@capxul/sdk-react 0.1.0-alpha.9 → 0.2.0-alpha.3
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 +98 -0
- package/README.md +1 -1
- package/dist/index.cjs +449 -71
- package/dist/index.d.cts +143 -41
- package/dist/index.d.ts +143 -41
- package/dist/index.js +444 -74
- package/dist/proof/index.cjs +21 -13
- package/dist/proof/index.js +18 -10
- package/package.json +4 -4
package/dist/proof/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var React4 = require('react');
|
|
5
5
|
var sdk = require('@capxul/sdk');
|
|
6
6
|
var reactQuery = require('@tanstack/react-query');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -29,7 +29,7 @@ function _interopNamespace(e) {
|
|
|
29
29
|
return Object.freeze(n);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
|
|
33
33
|
var DeprecatedReactTestUtils__namespace = /*#__PURE__*/_interopNamespace(DeprecatedReactTestUtils);
|
|
34
34
|
var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
|
|
35
35
|
var ReactDOMClient__namespace = /*#__PURE__*/_interopNamespace(ReactDOMClient);
|
|
@@ -9065,7 +9065,14 @@ var require_lz_string = __commonJS({
|
|
|
9065
9065
|
}
|
|
9066
9066
|
}
|
|
9067
9067
|
});
|
|
9068
|
-
var
|
|
9068
|
+
var AuthServiceContext = React4.createContext(null);
|
|
9069
|
+
function AuthServiceProvider({
|
|
9070
|
+
authService,
|
|
9071
|
+
children
|
|
9072
|
+
}) {
|
|
9073
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AuthServiceContext.Provider, { value: authService, children });
|
|
9074
|
+
}
|
|
9075
|
+
var CapxulClientContext = React4.createContext(null);
|
|
9069
9076
|
function CapxulClientProvider({
|
|
9070
9077
|
client,
|
|
9071
9078
|
children
|
|
@@ -9077,15 +9084,16 @@ function CapxulTestProvider({
|
|
|
9077
9084
|
queryClient,
|
|
9078
9085
|
children
|
|
9079
9086
|
}) {
|
|
9080
|
-
const client =
|
|
9081
|
-
const
|
|
9087
|
+
const client = React4.useMemo(() => sdk.createCapxulClient(config2), [config2]);
|
|
9088
|
+
const authService = React4.useMemo(() => new sdk.AuthService(config2), [config2]);
|
|
9089
|
+
const defaultClient = React4.useMemo(
|
|
9082
9090
|
() => new reactQuery.QueryClient({
|
|
9083
9091
|
defaultOptions: { queries: { staleTime: 3e4 } }
|
|
9084
9092
|
}),
|
|
9085
9093
|
[]
|
|
9086
9094
|
);
|
|
9087
9095
|
const effectiveClient = queryClient ?? defaultClient;
|
|
9088
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: effectiveClient, children: /* @__PURE__ */ jsxRuntime.jsx(CapxulClientProvider, { client, children }) });
|
|
9096
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: effectiveClient, children: /* @__PURE__ */ jsxRuntime.jsx(CapxulClientProvider, { client, children: /* @__PURE__ */ jsxRuntime.jsx(AuthServiceProvider, { authService, children }) }) });
|
|
9089
9097
|
}
|
|
9090
9098
|
|
|
9091
9099
|
// ../../node_modules/.pnpm/@testing-library+dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js
|
|
@@ -12385,7 +12393,7 @@ typeof document !== "undefined" && document.body ? getQueriesForElement(document
|
|
|
12385
12393
|
}, initialValue);
|
|
12386
12394
|
|
|
12387
12395
|
// ../../node_modules/.pnpm/@testing-library+react@16.3.2_@testing-library+dom@10.4.0_@types+react-dom@19.2.3_@types+reac_7xeq5cee7rpipmcytuzilkbgi4/node_modules/@testing-library/react/dist/@testing-library/react.esm.js
|
|
12388
|
-
var reactAct = typeof
|
|
12396
|
+
var reactAct = typeof React4__namespace.act === "function" ? React4__namespace.act : DeprecatedReactTestUtils__namespace.act;
|
|
12389
12397
|
function getGlobalThis() {
|
|
12390
12398
|
if (typeof globalThis !== "undefined") {
|
|
12391
12399
|
return globalThis;
|
|
@@ -12502,10 +12510,10 @@ configure({
|
|
|
12502
12510
|
var mountedContainers = /* @__PURE__ */ new Set();
|
|
12503
12511
|
var mountedRootEntries = [];
|
|
12504
12512
|
function strictModeIfNeeded(innerElement, reactStrictMode) {
|
|
12505
|
-
return reactStrictMode ?? getConfig2().reactStrictMode ? /* @__PURE__ */
|
|
12513
|
+
return reactStrictMode ?? getConfig2().reactStrictMode ? /* @__PURE__ */ React4__namespace.createElement(React4__namespace.StrictMode, null, innerElement) : innerElement;
|
|
12506
12514
|
}
|
|
12507
12515
|
function wrapUiIfNeeded(innerElement, wrapperComponent) {
|
|
12508
|
-
return wrapperComponent ? /* @__PURE__ */
|
|
12516
|
+
return wrapperComponent ? /* @__PURE__ */ React4__namespace.createElement(wrapperComponent, null, innerElement) : innerElement;
|
|
12509
12517
|
}
|
|
12510
12518
|
function createConcurrentRoot(container, {
|
|
12511
12519
|
hydrate,
|
|
@@ -12692,12 +12700,12 @@ function renderHook(renderCallback, options = {}) {
|
|
|
12692
12700
|
Error.captureStackTrace(error, renderHook);
|
|
12693
12701
|
throw error;
|
|
12694
12702
|
}
|
|
12695
|
-
const result = /* @__PURE__ */
|
|
12703
|
+
const result = /* @__PURE__ */ React4__namespace.createRef();
|
|
12696
12704
|
function TestComponent({
|
|
12697
12705
|
renderCallbackProps
|
|
12698
12706
|
}) {
|
|
12699
12707
|
const pendingResult = renderCallback(renderCallbackProps);
|
|
12700
|
-
|
|
12708
|
+
React4__namespace.useEffect(() => {
|
|
12701
12709
|
result.current = pendingResult;
|
|
12702
12710
|
});
|
|
12703
12711
|
return null;
|
|
@@ -12705,11 +12713,11 @@ function renderHook(renderCallback, options = {}) {
|
|
|
12705
12713
|
const {
|
|
12706
12714
|
rerender: baseRerender,
|
|
12707
12715
|
unmount
|
|
12708
|
-
} = render(/* @__PURE__ */
|
|
12716
|
+
} = render(/* @__PURE__ */ React4__namespace.createElement(TestComponent, {
|
|
12709
12717
|
renderCallbackProps: initialProps
|
|
12710
12718
|
}), renderOptions);
|
|
12711
12719
|
function rerender(rerenderCallbackProps) {
|
|
12712
|
-
return baseRerender(/* @__PURE__ */
|
|
12720
|
+
return baseRerender(/* @__PURE__ */ React4__namespace.createElement(TestComponent, {
|
|
12713
12721
|
renderCallbackProps: rerenderCallbackProps
|
|
12714
12722
|
}));
|
|
12715
12723
|
}
|
package/dist/proof/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
2
|
+
import * as React4 from 'react';
|
|
3
3
|
import { createContext, useMemo } from 'react';
|
|
4
|
-
import { createCapxulClient } from '@capxul/sdk';
|
|
4
|
+
import { createCapxulClient, AuthService } from '@capxul/sdk';
|
|
5
5
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
import * as DeprecatedReactTestUtils from 'react-dom/test-utils';
|
|
@@ -9039,6 +9039,13 @@ var require_lz_string = __commonJS({
|
|
|
9039
9039
|
}
|
|
9040
9040
|
}
|
|
9041
9041
|
});
|
|
9042
|
+
var AuthServiceContext = createContext(null);
|
|
9043
|
+
function AuthServiceProvider({
|
|
9044
|
+
authService,
|
|
9045
|
+
children
|
|
9046
|
+
}) {
|
|
9047
|
+
return /* @__PURE__ */ jsx(AuthServiceContext.Provider, { value: authService, children });
|
|
9048
|
+
}
|
|
9042
9049
|
var CapxulClientContext = createContext(null);
|
|
9043
9050
|
function CapxulClientProvider({
|
|
9044
9051
|
client,
|
|
@@ -9052,6 +9059,7 @@ function CapxulTestProvider({
|
|
|
9052
9059
|
children
|
|
9053
9060
|
}) {
|
|
9054
9061
|
const client = useMemo(() => createCapxulClient(config2), [config2]);
|
|
9062
|
+
const authService = useMemo(() => new AuthService(config2), [config2]);
|
|
9055
9063
|
const defaultClient = useMemo(
|
|
9056
9064
|
() => new QueryClient({
|
|
9057
9065
|
defaultOptions: { queries: { staleTime: 3e4 } }
|
|
@@ -9059,7 +9067,7 @@ function CapxulTestProvider({
|
|
|
9059
9067
|
[]
|
|
9060
9068
|
);
|
|
9061
9069
|
const effectiveClient = queryClient ?? defaultClient;
|
|
9062
|
-
return /* @__PURE__ */ jsx(QueryClientProvider, { client: effectiveClient, children: /* @__PURE__ */ jsx(CapxulClientProvider, { client, children }) });
|
|
9070
|
+
return /* @__PURE__ */ jsx(QueryClientProvider, { client: effectiveClient, children: /* @__PURE__ */ jsx(CapxulClientProvider, { client, children: /* @__PURE__ */ jsx(AuthServiceProvider, { authService, children }) }) });
|
|
9063
9071
|
}
|
|
9064
9072
|
|
|
9065
9073
|
// ../../node_modules/.pnpm/@testing-library+dom@10.4.0/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js
|
|
@@ -12359,7 +12367,7 @@ typeof document !== "undefined" && document.body ? getQueriesForElement(document
|
|
|
12359
12367
|
}, initialValue);
|
|
12360
12368
|
|
|
12361
12369
|
// ../../node_modules/.pnpm/@testing-library+react@16.3.2_@testing-library+dom@10.4.0_@types+react-dom@19.2.3_@types+reac_7xeq5cee7rpipmcytuzilkbgi4/node_modules/@testing-library/react/dist/@testing-library/react.esm.js
|
|
12362
|
-
var reactAct = typeof
|
|
12370
|
+
var reactAct = typeof React4.act === "function" ? React4.act : DeprecatedReactTestUtils.act;
|
|
12363
12371
|
function getGlobalThis() {
|
|
12364
12372
|
if (typeof globalThis !== "undefined") {
|
|
12365
12373
|
return globalThis;
|
|
@@ -12476,10 +12484,10 @@ configure({
|
|
|
12476
12484
|
var mountedContainers = /* @__PURE__ */ new Set();
|
|
12477
12485
|
var mountedRootEntries = [];
|
|
12478
12486
|
function strictModeIfNeeded(innerElement, reactStrictMode) {
|
|
12479
|
-
return reactStrictMode ?? getConfig2().reactStrictMode ? /* @__PURE__ */
|
|
12487
|
+
return reactStrictMode ?? getConfig2().reactStrictMode ? /* @__PURE__ */ React4.createElement(React4.StrictMode, null, innerElement) : innerElement;
|
|
12480
12488
|
}
|
|
12481
12489
|
function wrapUiIfNeeded(innerElement, wrapperComponent) {
|
|
12482
|
-
return wrapperComponent ? /* @__PURE__ */
|
|
12490
|
+
return wrapperComponent ? /* @__PURE__ */ React4.createElement(wrapperComponent, null, innerElement) : innerElement;
|
|
12483
12491
|
}
|
|
12484
12492
|
function createConcurrentRoot(container, {
|
|
12485
12493
|
hydrate,
|
|
@@ -12666,12 +12674,12 @@ function renderHook(renderCallback, options = {}) {
|
|
|
12666
12674
|
Error.captureStackTrace(error, renderHook);
|
|
12667
12675
|
throw error;
|
|
12668
12676
|
}
|
|
12669
|
-
const result = /* @__PURE__ */
|
|
12677
|
+
const result = /* @__PURE__ */ React4.createRef();
|
|
12670
12678
|
function TestComponent({
|
|
12671
12679
|
renderCallbackProps
|
|
12672
12680
|
}) {
|
|
12673
12681
|
const pendingResult = renderCallback(renderCallbackProps);
|
|
12674
|
-
|
|
12682
|
+
React4.useEffect(() => {
|
|
12675
12683
|
result.current = pendingResult;
|
|
12676
12684
|
});
|
|
12677
12685
|
return null;
|
|
@@ -12679,11 +12687,11 @@ function renderHook(renderCallback, options = {}) {
|
|
|
12679
12687
|
const {
|
|
12680
12688
|
rerender: baseRerender,
|
|
12681
12689
|
unmount
|
|
12682
|
-
} = render(/* @__PURE__ */
|
|
12690
|
+
} = render(/* @__PURE__ */ React4.createElement(TestComponent, {
|
|
12683
12691
|
renderCallbackProps: initialProps
|
|
12684
12692
|
}), renderOptions);
|
|
12685
12693
|
function rerender(rerenderCallbackProps) {
|
|
12686
|
-
return baseRerender(/* @__PURE__ */
|
|
12694
|
+
return baseRerender(/* @__PURE__ */ React4.createElement(TestComponent, {
|
|
12687
12695
|
renderCallbackProps: rerenderCallbackProps
|
|
12688
12696
|
}));
|
|
12689
12697
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capxul/sdk-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-alpha.3",
|
|
4
4
|
"description": "React provider + hooks for the @capxul/sdk headless client.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@capxul/sdk": "0.
|
|
49
|
+
"@capxul/sdk": "0.2.0-alpha.3"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@tanstack/react-query": "^5",
|
|
53
53
|
"@xstate/react": "^5",
|
|
54
54
|
"convex": ">=1.0.0",
|
|
55
|
-
"react": ">=
|
|
55
|
+
"react": ">=18.2.0 <20",
|
|
56
56
|
"viem": ">=2.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"typescript": "5.9.2",
|
|
71
71
|
"viem": "2.47.10",
|
|
72
72
|
"vitest": "^4.1.2",
|
|
73
|
-
"@repo/observability": "0.0.0",
|
|
74
73
|
"@repo/config": "0.0.0",
|
|
74
|
+
"@repo/observability": "0.0.0",
|
|
75
75
|
"@repo/platform-kernel": "0.0.0",
|
|
76
76
|
"@repo/typescript-config": "0.0.0"
|
|
77
77
|
},
|