@vuer-ai/vuer-uikit 0.0.103 → 0.0.104
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/dist/auth/context/auth-context.d.cts +3 -5
- package/dist/auth/context/auth-context.d.ts +3 -5
- package/dist/auth/handler/get-session.cjs +11 -0
- package/dist/auth/handler/get-session.d.cts +19 -0
- package/dist/auth/handler/get-session.d.ts +19 -0
- package/dist/auth/handler/get-session.mjs +2 -0
- package/dist/auth/handler/sign-in-handler.cjs +3 -3
- package/dist/auth/handler/sign-in-handler.d.cts +0 -1
- package/dist/auth/handler/sign-in-handler.d.ts +0 -1
- package/dist/auth/handler/sign-in-handler.mjs +2 -2
- package/dist/auth/handler/sign-out-handler.cjs +11 -0
- package/dist/auth/handler/sign-out-handler.d.cts +5 -0
- package/dist/auth/handler/sign-out-handler.d.ts +5 -0
- package/dist/auth/handler/sign-out-handler.mjs +2 -0
- package/dist/auth/hooks/use-vuer-auth.d.cts +0 -1
- package/dist/auth/hooks/use-vuer-auth.d.ts +0 -1
- package/dist/auth/hooks/use-vuer-method.cjs +5 -4
- package/dist/auth/hooks/use-vuer-method.d.cts +2 -3
- package/dist/auth/hooks/use-vuer-method.d.ts +2 -3
- package/dist/auth/hooks/use-vuer-method.mjs +4 -3
- package/dist/auth/index.cjs +9 -13
- package/dist/auth/index.d.cts +1 -2
- package/dist/auth/index.d.ts +1 -2
- package/dist/auth/index.mjs +6 -6
- package/dist/auth/localstorage-key.cjs +2 -6
- package/dist/auth/localstorage-key.d.cts +1 -2
- package/dist/auth/localstorage-key.d.ts +1 -2
- package/dist/auth/localstorage-key.mjs +1 -1
- package/dist/auth/types.cjs +0 -12
- package/dist/auth/types.d.cts +10 -3466
- package/dist/auth/types.d.ts +10 -3466
- package/dist/auth/types.mjs +1 -1
- package/dist/auth/vuer-auth-provider.cjs +4 -5
- package/dist/auth/vuer-auth-provider.mjs +3 -4
- package/dist/{chunk-WGVKFNG6.mjs → chunk-276VJZCV.mjs} +1 -2
- package/dist/chunk-4CPB3XHE.cjs +18 -0
- package/dist/chunk-5HS4PMUR.mjs +45 -0
- package/dist/{chunk-SHHQDSSI.cjs → chunk-7WA7ZFVS.cjs} +2 -2
- package/dist/{chunk-FBAOEFDU.mjs → chunk-AKVHFPXH.mjs} +7 -5
- package/dist/chunk-CGODCUQ5.mjs +16 -0
- package/dist/{chunk-JWUIZX35.mjs → chunk-LDFGQSE4.mjs} +2 -2
- package/dist/{chunk-LSKJOUAE.cjs → chunk-PB4UO2NR.cjs} +3 -4
- package/dist/{chunk-6BD5MQ5R.cjs → chunk-SVWS4AL6.cjs} +0 -2
- package/dist/chunk-T2D6PSA6.cjs +47 -0
- package/dist/chunk-T57VFBIC.mjs +17 -0
- package/dist/chunk-WTYBTOLO.cjs +19 -0
- package/dist/{chunk-JLWAIMUZ.cjs → chunk-XFTKHT2M.cjs} +8 -6
- package/dist/{chunk-7KQXX7QB.mjs → chunk-XGM57WPN.mjs} +2 -3
- package/dist/dial/DialPanel.cjs +17 -17
- package/dist/dial/DialPanel.mjs +16 -16
- package/dist/dial/index.cjs +33 -33
- package/dist/dial/index.mjs +16 -16
- package/dist/dial/wrapped-inputs/ControlledInputs.cjs +21 -21
- package/dist/dial/wrapped-inputs/ControlledInputs.mjs +16 -16
- package/dist/dial/wrapped-inputs/DialInputs.cjs +30 -30
- package/dist/dial/wrapped-inputs/DialInputs.mjs +16 -16
- package/dist/dial/wrapped-inputs/DialPresetsInput.cjs +17 -17
- package/dist/dial/wrapped-inputs/DialPresetsInput.mjs +16 -16
- package/dist/dial/wrapped-inputs/DialVectorInput.cjs +17 -17
- package/dist/dial/wrapped-inputs/DialVectorInput.mjs +16 -16
- package/dist/dial/wrapped-inputs/index.cjs +37 -37
- package/dist/dial/wrapped-inputs/index.mjs +16 -16
- package/dist/index.cjs +88 -88
- package/dist/index.mjs +16 -16
- package/dist/ui/UIKitBadge.cjs +5 -5
- package/dist/ui/UIKitBadge.mjs +1 -1
- package/dist/ui/badge.d.cts +1 -1
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/index.cjs +61 -61
- package/dist/ui/index.mjs +14 -14
- package/dist/ui/inputs/index.cjs +10 -10
- package/dist/ui/inputs/index.mjs +2 -2
- package/dist/ui/inputs/input.d.cts +1 -1
- package/dist/ui/inputs/input.d.ts +1 -1
- package/dist/ui/inputs/number-inputs/index.cjs +5 -5
- package/dist/ui/inputs/number-inputs/index.mjs +1 -1
- package/dist/ui/layouts/index.cjs +7 -7
- package/dist/ui/layouts/index.mjs +3 -3
- package/dist/ui/select.d.cts +1 -1
- package/dist/ui/select.d.ts +1 -1
- package/dist/ui/textarea.d.cts +1 -1
- package/dist/ui/textarea.d.ts +1 -1
- package/dist/ui/tree-view/index.cjs +9 -9
- package/dist/ui/tree-view/index.mjs +1 -1
- package/dist/ui/waterfall/index.cjs +4 -4
- package/dist/ui/waterfall/index.mjs +3 -3
- package/package.json +1 -1
- package/src/auth/context/auth-context.ts +3 -4
- package/src/auth/handler/get-session.ts +17 -0
- package/src/auth/handler/sign-in-handler.ts +1 -2
- package/src/auth/handler/sign-out-handler.ts +13 -0
- package/src/auth/hooks/use-vuer-method.ts +8 -6
- package/src/auth/localstorage-key.ts +0 -2
- package/src/auth/types.ts +9 -27
- package/src/auth/vuer-auth-provider.tsx +25 -8
- package/dist/auth/handler/create-client.cjs +0 -12
- package/dist/auth/handler/create-client.d.cts +0 -7
- package/dist/auth/handler/create-client.d.ts +0 -7
- package/dist/auth/handler/create-client.mjs +0 -3
- package/dist/chunk-ACYOVCGH.mjs +0 -30
- package/dist/chunk-CHYXRETV.cjs +0 -23
- package/dist/chunk-G6U2K2GR.cjs +0 -32
- package/dist/chunk-HPK4YEVK.cjs +0 -27
- package/dist/chunk-PKSIXQJX.mjs +0 -20
- package/dist/chunk-PZMA33PL.mjs +0 -25
- package/src/auth/handler/create-client.ts +0 -23
- package/dist/{chunk-I2BVWNRP.cjs → chunk-5QDNFK4H.cjs} +3 -3
- package/dist/{chunk-YLDDI6SZ.mjs → chunk-77FMULFB.mjs} +3 -3
- package/dist/{chunk-5SP25SO3.cjs → chunk-7RHQ6DVU.cjs} +2 -2
- package/dist/{chunk-YHY6SXVJ.mjs → chunk-K2OC2HWQ.mjs} +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('../../chunk-E6G4MTX3.cjs');
|
|
4
|
-
require('../../chunk-4AE2TOOL.cjs');
|
|
5
4
|
require('../../chunk-WX7SLJUA.cjs');
|
|
6
|
-
|
|
7
|
-
var chunkUULSGVNF_cjs = require('../../chunk-UULSGVNF.cjs');
|
|
5
|
+
require('../../chunk-4AE2TOOL.cjs');
|
|
8
6
|
var chunkH6MFBIRB_cjs = require('../../chunk-H6MFBIRB.cjs');
|
|
9
7
|
require('../../chunk-SPRBKXGP.cjs');
|
|
8
|
+
var chunkLBGZKACW_cjs = require('../../chunk-LBGZKACW.cjs');
|
|
9
|
+
var chunkUULSGVNF_cjs = require('../../chunk-UULSGVNF.cjs');
|
|
10
10
|
require('../../chunk-QN4N4I3Z.cjs');
|
|
11
11
|
require('../../chunk-Q7E73DVJ.cjs');
|
|
12
12
|
require('../../chunk-JR4TVE43.cjs');
|
|
@@ -20,6 +20,10 @@ require('../../chunk-OHIB3TEN.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
Object.defineProperty(exports, "LiquidLayoutView", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkH6MFBIRB_cjs.LiquidLayoutView; }
|
|
26
|
+
});
|
|
23
27
|
Object.defineProperty(exports, "DockLayoutView", {
|
|
24
28
|
enumerable: true,
|
|
25
29
|
get: function () { return chunkLBGZKACW_cjs.DockLayoutView; }
|
|
@@ -48,7 +52,3 @@ Object.defineProperty(exports, "DockLayoutTop", {
|
|
|
48
52
|
enumerable: true,
|
|
49
53
|
get: function () { return chunkUULSGVNF_cjs.DockLayoutTop; }
|
|
50
54
|
});
|
|
51
|
-
Object.defineProperty(exports, "LiquidLayoutView", {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
get: function () { return chunkH6MFBIRB_cjs.LiquidLayoutView; }
|
|
54
|
-
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import '../../chunk-IGTUE4NW.mjs';
|
|
2
|
-
import '../../chunk-EPRRJR2S.mjs';
|
|
3
2
|
import '../../chunk-4QFWMPJZ.mjs';
|
|
4
|
-
|
|
5
|
-
export { DockLayout, DockLayoutBottom, DockLayoutContent, DockLayoutLeft, DockLayoutRight, DockLayoutTop } from '../../chunk-3LO3AM25.mjs';
|
|
3
|
+
import '../../chunk-EPRRJR2S.mjs';
|
|
6
4
|
export { LiquidLayoutView } from '../../chunk-THMYDDZF.mjs';
|
|
7
5
|
import '../../chunk-PIC2EJWA.mjs';
|
|
6
|
+
export { DockLayoutView } from '../../chunk-M6JLGVJ7.mjs';
|
|
7
|
+
export { DockLayout, DockLayoutBottom, DockLayoutContent, DockLayoutLeft, DockLayoutRight, DockLayoutTop } from '../../chunk-3LO3AM25.mjs';
|
|
8
8
|
import '../../chunk-F7ZHPSLA.mjs';
|
|
9
9
|
import '../../chunk-3QT5VABC.mjs';
|
|
10
10
|
import '../../chunk-XHJDRQD7.mjs';
|
package/dist/ui/select.d.cts
CHANGED
|
@@ -21,7 +21,7 @@ declare function SelectGroup({ className, ...props }: ComponentProps<typeof Sele
|
|
|
21
21
|
*/
|
|
22
22
|
declare function SelectValue({ ...props }: ComponentProps<typeof SelectPrimitive.Value>): react_jsx_runtime.JSX.Element;
|
|
23
23
|
declare const selectTriggerVariants: (props?: ({
|
|
24
|
-
state?: "
|
|
24
|
+
state?: "default" | "disabled" | "error" | null | undefined;
|
|
25
25
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
26
26
|
font?: "standard" | "mono" | null | undefined;
|
|
27
27
|
align?: "left" | "right" | "center" | null | undefined;
|
package/dist/ui/select.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ declare function SelectGroup({ className, ...props }: ComponentProps<typeof Sele
|
|
|
21
21
|
*/
|
|
22
22
|
declare function SelectValue({ ...props }: ComponentProps<typeof SelectPrimitive.Value>): react_jsx_runtime.JSX.Element;
|
|
23
23
|
declare const selectTriggerVariants: (props?: ({
|
|
24
|
-
state?: "
|
|
24
|
+
state?: "default" | "disabled" | "error" | null | undefined;
|
|
25
25
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
26
26
|
font?: "standard" | "mono" | null | undefined;
|
|
27
27
|
align?: "left" | "right" | "center" | null | undefined;
|
package/dist/ui/textarea.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
4
4
|
import { ComponentProps } from 'react';
|
|
5
5
|
|
|
6
6
|
declare const textareaVariants: (props?: ({
|
|
7
|
-
state?: "
|
|
7
|
+
state?: "default" | "error" | null | undefined;
|
|
8
8
|
size?: "base" | "sm" | "lg" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
interface TextareaProps extends ComponentProps<"textarea">, VariantProps<typeof textareaVariants> {
|
package/dist/ui/textarea.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
4
4
|
import { ComponentProps } from 'react';
|
|
5
5
|
|
|
6
6
|
declare const textareaVariants: (props?: ({
|
|
7
|
-
state?: "
|
|
7
|
+
state?: "default" | "error" | null | undefined;
|
|
8
8
|
size?: "base" | "sm" | "lg" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
interface TextareaProps extends ComponentProps<"textarea">, VariantProps<typeof textareaVariants> {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('../../chunk-G5NT42YF.cjs');
|
|
4
|
+
var chunkEEGQLTSQ_cjs = require('../../chunk-EEGQLTSQ.cjs');
|
|
4
5
|
require('../../chunk-VOTZLQ6J.cjs');
|
|
5
6
|
var chunk5JPYU5A6_cjs = require('../../chunk-5JPYU5A6.cjs');
|
|
6
7
|
var chunkHAVTMZR3_cjs = require('../../chunk-HAVTMZR3.cjs');
|
|
7
|
-
var chunkEEGQLTSQ_cjs = require('../../chunk-EEGQLTSQ.cjs');
|
|
8
8
|
require('../../chunk-LFSCJLL2.cjs');
|
|
9
9
|
require('../../chunk-LQGXG373.cjs');
|
|
10
10
|
require('../../chunk-QN4N4I3Z.cjs');
|
|
@@ -20,6 +20,14 @@ require('../../chunk-OHIB3TEN.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
Object.defineProperty(exports, "useTreeSearch", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkEEGQLTSQ_cjs.useTreeSearch; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "useTreeState", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkEEGQLTSQ_cjs.useTreeState; }
|
|
30
|
+
});
|
|
23
31
|
Object.defineProperty(exports, "TreeSearchBar", {
|
|
24
32
|
enumerable: true,
|
|
25
33
|
get: function () { return chunk5JPYU5A6_cjs.TreeSearchBar; }
|
|
@@ -32,11 +40,3 @@ Object.defineProperty(exports, "TreeView", {
|
|
|
32
40
|
enumerable: true,
|
|
33
41
|
get: function () { return chunkHAVTMZR3_cjs.TreeView; }
|
|
34
42
|
});
|
|
35
|
-
Object.defineProperty(exports, "useTreeSearch", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
get: function () { return chunkEEGQLTSQ_cjs.useTreeSearch; }
|
|
38
|
-
});
|
|
39
|
-
Object.defineProperty(exports, "useTreeState", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
get: function () { return chunkEEGQLTSQ_cjs.useTreeState; }
|
|
42
|
-
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../../chunk-HVVT3D2T.mjs';
|
|
2
|
+
export { useTreeSearch, useTreeState } from '../../chunk-PC5DHSC4.mjs';
|
|
2
3
|
import '../../chunk-HTAFERCZ.mjs';
|
|
3
4
|
export { TreeSearchBar } from '../../chunk-SUEFWFPX.mjs';
|
|
4
5
|
export { TreeEntryItem, TreeView } from '../../chunk-VQPJ7TLB.mjs';
|
|
5
|
-
export { useTreeSearch, useTreeState } from '../../chunk-PC5DHSC4.mjs';
|
|
6
6
|
import '../../chunk-5MBEK77I.mjs';
|
|
7
7
|
import '../../chunk-LRSDE62T.mjs';
|
|
8
8
|
import '../../chunk-F7ZHPSLA.mjs';
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7RHQ6DVU_cjs = require('../../chunk-7RHQ6DVU.cjs');
|
|
4
4
|
require('../../chunk-WJL5HMO6.cjs');
|
|
5
5
|
require('../../chunk-RJ7I6ZQK.cjs');
|
|
6
|
+
require('../../chunk-YXFHJKNW.cjs');
|
|
6
7
|
require('../../chunk-5MNZYCN2.cjs');
|
|
7
8
|
require('../../chunk-Z6UDRPC2.cjs');
|
|
8
9
|
require('../../chunk-YJ6X6T5K.cjs');
|
|
9
10
|
require('../../chunk-G5NT42YF.cjs');
|
|
11
|
+
require('../../chunk-EEGQLTSQ.cjs');
|
|
10
12
|
require('../../chunk-VOTZLQ6J.cjs');
|
|
11
13
|
require('../../chunk-2J75MYQA.cjs');
|
|
12
14
|
require('../../chunk-UTS56UA5.cjs');
|
|
13
15
|
require('../../chunk-JWVH6R35.cjs');
|
|
14
16
|
require('../../chunk-MVAFOQ67.cjs');
|
|
15
17
|
require('../../chunk-TUYG6BYZ.cjs');
|
|
16
|
-
require('../../chunk-YXFHJKNW.cjs');
|
|
17
18
|
var chunkG2ZYONQO_cjs = require('../../chunk-G2ZYONQO.cjs');
|
|
18
19
|
require('../../chunk-5JPYU5A6.cjs');
|
|
19
20
|
require('../../chunk-HAVTMZR3.cjs');
|
|
20
|
-
require('../../chunk-EEGQLTSQ.cjs');
|
|
21
21
|
require('../../chunk-LFSCJLL2.cjs');
|
|
22
22
|
require('../../chunk-LQGXG373.cjs');
|
|
23
23
|
require('../../chunk-JMCH2AFN.cjs');
|
|
@@ -38,7 +38,7 @@ require('../../chunk-G4FJGNY5.cjs');
|
|
|
38
38
|
|
|
39
39
|
Object.defineProperty(exports, "Waterfall", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunk7RHQ6DVU_cjs.Waterfall; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "TOTAL_DURATION", {
|
|
44
44
|
enumerable: true,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export { Waterfall } from '../../chunk-
|
|
1
|
+
export { Waterfall } from '../../chunk-K2OC2HWQ.mjs';
|
|
2
2
|
import '../../chunk-JWKOW2OV.mjs';
|
|
3
3
|
import '../../chunk-VPQ5SSY3.mjs';
|
|
4
|
+
import '../../chunk-CO6EASQO.mjs';
|
|
4
5
|
import '../../chunk-IR334P7F.mjs';
|
|
5
6
|
import '../../chunk-CIPI2V54.mjs';
|
|
6
7
|
import '../../chunk-WPDU2YYR.mjs';
|
|
7
8
|
import '../../chunk-HVVT3D2T.mjs';
|
|
9
|
+
import '../../chunk-PC5DHSC4.mjs';
|
|
8
10
|
import '../../chunk-HTAFERCZ.mjs';
|
|
9
11
|
import '../../chunk-SA5WKLYB.mjs';
|
|
10
12
|
import '../../chunk-D5H4XX6Q.mjs';
|
|
11
13
|
import '../../chunk-JVV7W3TP.mjs';
|
|
12
14
|
import '../../chunk-OC4HRPZU.mjs';
|
|
13
15
|
import '../../chunk-N6DSPSMM.mjs';
|
|
14
|
-
import '../../chunk-CO6EASQO.mjs';
|
|
15
16
|
export { TOTAL_DURATION, borderColorClasses, colorClasses, formatDuration, leftWedgeClasses, rightWedgeClasses } from '../../chunk-4U232QAX.mjs';
|
|
16
17
|
import '../../chunk-SUEFWFPX.mjs';
|
|
17
18
|
import '../../chunk-VQPJ7TLB.mjs';
|
|
18
|
-
import '../../chunk-PC5DHSC4.mjs';
|
|
19
19
|
import '../../chunk-5MBEK77I.mjs';
|
|
20
20
|
import '../../chunk-LRSDE62T.mjs';
|
|
21
21
|
import '../../chunk-BNDRHLLZ.mjs';
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Refetch, UserSession } from "../types";
|
|
4
4
|
|
|
5
5
|
interface IAuthContext {
|
|
6
6
|
baseURL: string;
|
|
7
|
-
data:
|
|
7
|
+
data: UserSession | null;
|
|
8
8
|
isPending: boolean;
|
|
9
|
-
|
|
10
|
-
refetch: () => void;
|
|
9
|
+
refetch: Refetch;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
const AuthContext = createContext<IAuthContext>(null!);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { bearerToken } from "../localstorage-key";
|
|
2
|
+
import { UserSession } from "../types";
|
|
3
|
+
|
|
4
|
+
const getSession = async (baseURL: string) => {
|
|
5
|
+
const token = localStorage.getItem(bearerToken) || "";
|
|
6
|
+
const res = await fetch(`${baseURL}/api/auth/get-session`, {
|
|
7
|
+
headers: {
|
|
8
|
+
Authorization: `Bearer ${token}`,
|
|
9
|
+
},
|
|
10
|
+
credentials: "include",
|
|
11
|
+
});
|
|
12
|
+
const authJWT = res.headers.get("set-auth-jwt");
|
|
13
|
+
const data = (await res.json()) as UserSession;
|
|
14
|
+
return { ...data, session: { ...data.session, jwt: authJWT ?? "" } };
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { getSession };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { bearerToken } from "../localstorage-key";
|
|
2
|
+
|
|
3
|
+
export const signOutHandler = async (baseURL: string) => {
|
|
4
|
+
const token = localStorage.getItem(bearerToken) || "";
|
|
5
|
+
const res = await fetch(`${baseURL}/api/auth/sign-out`, {
|
|
6
|
+
method: "POST",
|
|
7
|
+
headers: {
|
|
8
|
+
Authorization: `Bearer ${token}`,
|
|
9
|
+
},
|
|
10
|
+
credentials: "include",
|
|
11
|
+
});
|
|
12
|
+
return (await res.json()) as { success: boolean };
|
|
13
|
+
};
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { useCallback, useMemo } from "react";
|
|
2
2
|
|
|
3
3
|
import { signInHandler } from "../handler/sign-in-handler";
|
|
4
|
-
import {
|
|
4
|
+
import { SignInWithOutBaseURLParams, SignOut } from "../types";
|
|
5
5
|
import { useVuerAuth } from "./use-vuer-auth";
|
|
6
|
+
import { signOutHandler } from "../handler/sign-out-handler";
|
|
6
7
|
|
|
7
8
|
interface UseVuerAuth {
|
|
8
9
|
signIn: (p?: SignInWithOutBaseURLParams) => Promise<string> | void;
|
|
9
|
-
signOut:
|
|
10
|
+
signOut: SignOut;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const useVuerMethod = (): UseVuerAuth => {
|
|
13
|
-
const { refetch,
|
|
14
|
+
const { refetch, baseURL } = useVuerAuth();
|
|
14
15
|
|
|
15
|
-
const signOutHandle = useCallback(() => {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const signOutHandle = useCallback(async () => {
|
|
17
|
+
await signOutHandler(baseURL);
|
|
18
|
+
await refetch();
|
|
19
|
+
}, [baseURL, refetch]);
|
|
18
20
|
|
|
19
21
|
const signInHandle = useCallback(
|
|
20
22
|
(props?: SignInWithOutBaseURLParams) => {
|
package/src/auth/types.ts
CHANGED
|
@@ -1,26 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { customSessionClient } from "better-auth/client/plugins";
|
|
3
|
-
import { customSession } from "better-auth/plugins";
|
|
4
|
-
import { createAuthClient } from "better-auth/react";
|
|
5
|
-
|
|
6
|
-
export const auth = betterAuth({
|
|
7
|
-
plugins: [
|
|
8
|
-
customSession(async (session) => {
|
|
9
|
-
return {
|
|
10
|
-
...session,
|
|
11
|
-
session: { ...session.session, sessionToken: "" },
|
|
12
|
-
};
|
|
13
|
-
}),
|
|
14
|
-
],
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export const options = {
|
|
18
|
-
plugins: [customSessionClient<typeof auth>()],
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
type BetterAuth = ReturnType<typeof createAuthClient<typeof options>>;
|
|
1
|
+
import { Session, User } from "better-auth";
|
|
22
2
|
|
|
23
|
-
|
|
3
|
+
interface UserSession {
|
|
4
|
+
user: User;
|
|
5
|
+
session: Session & { sessionToken: string; jwt: string };
|
|
6
|
+
}
|
|
24
7
|
|
|
25
8
|
interface SignInWithPopup {
|
|
26
9
|
baseURL: string;
|
|
@@ -34,9 +17,9 @@ interface SignInWithRedirect {
|
|
|
34
17
|
callbackURL: string;
|
|
35
18
|
}
|
|
36
19
|
|
|
37
|
-
type Refetch =
|
|
20
|
+
type Refetch = () => Promise<UserSession | null>;
|
|
38
21
|
|
|
39
|
-
type SignOut =
|
|
22
|
+
type SignOut = () => Promise<void>;
|
|
40
23
|
|
|
41
24
|
type SignInParams = SignInWithPopup | SignInWithRedirect;
|
|
42
25
|
|
|
@@ -45,10 +28,9 @@ type SignInWithOutBaseURLParams =
|
|
|
45
28
|
| Omit<SignInWithRedirect, "baseURL">;
|
|
46
29
|
|
|
47
30
|
export type {
|
|
48
|
-
SignOut,
|
|
49
31
|
Refetch,
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
SignOut,
|
|
33
|
+
UserSession,
|
|
52
34
|
SignInParams,
|
|
53
35
|
SignInWithOutBaseURLParams,
|
|
54
36
|
SignInWithPopup,
|
|
@@ -1,33 +1,50 @@
|
|
|
1
|
-
import { PropsWithChildren, useEffect, useMemo,
|
|
1
|
+
import { PropsWithChildren, useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
|
|
3
3
|
import { AuthContext } from "./context/auth-context";
|
|
4
|
-
import {
|
|
4
|
+
import { getSession } from "./handler/get-session";
|
|
5
5
|
import { bearerToken } from "./localstorage-key";
|
|
6
|
+
import { UserSession } from "./types";
|
|
6
7
|
|
|
7
8
|
interface Props {
|
|
8
9
|
baseURL: string;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export function VuerAuthProvider({ children, baseURL }: PropsWithChildren<Props>) {
|
|
12
|
-
const
|
|
13
|
+
const [isPending, setIsPending] = useState<boolean>(true);
|
|
14
|
+
const [session, setSession] = useState<UserSession | null>(null);
|
|
13
15
|
|
|
14
|
-
const
|
|
16
|
+
const refetchHandle = useCallback(async () => {
|
|
17
|
+
setIsPending(true);
|
|
18
|
+
const data = await getSession(baseURL);
|
|
19
|
+
setSession(data);
|
|
20
|
+
setIsPending(false);
|
|
21
|
+
return data;
|
|
22
|
+
}, [baseURL]);
|
|
15
23
|
|
|
16
24
|
useEffect(() => {
|
|
17
25
|
const searchParams = new URLSearchParams(window.location.search);
|
|
18
26
|
const session = searchParams.get("token");
|
|
19
27
|
if (session) {
|
|
20
28
|
localStorage.setItem(bearerToken, encodeURIComponent(session));
|
|
21
|
-
|
|
29
|
+
refetchHandle().then(() => console.log("Sign in session"));
|
|
22
30
|
window.history.replaceState({}, "", window.location.pathname);
|
|
23
31
|
}
|
|
24
|
-
}, [
|
|
32
|
+
}, [refetchHandle]);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
refetchHandle().then(() => console.log("Init session"));
|
|
36
|
+
}, [refetchHandle]);
|
|
25
37
|
|
|
26
38
|
return (
|
|
27
39
|
<AuthContext.Provider
|
|
28
40
|
value={useMemo(() => {
|
|
29
|
-
return {
|
|
30
|
-
|
|
41
|
+
return {
|
|
42
|
+
baseURL,
|
|
43
|
+
isPending,
|
|
44
|
+
data: session,
|
|
45
|
+
refetch: refetchHandle,
|
|
46
|
+
};
|
|
47
|
+
}, [baseURL, session, isPending, refetchHandle])}
|
|
31
48
|
>
|
|
32
49
|
{children}
|
|
33
50
|
</AuthContext.Provider>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkHPK4YEVK_cjs = require('../../chunk-HPK4YEVK.cjs');
|
|
4
|
-
require('../../chunk-6BD5MQ5R.cjs');
|
|
5
|
-
require('../../chunk-CHYXRETV.cjs');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "createClient", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () { return chunkHPK4YEVK_cjs.createClient; }
|
|
12
|
-
});
|
package/dist/chunk-ACYOVCGH.mjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { createClient } from './chunk-PZMA33PL.mjs';
|
|
2
|
-
import { AuthContext } from './chunk-TC3W4VRO.mjs';
|
|
3
|
-
import { bearerToken } from './chunk-WGVKFNG6.mjs';
|
|
4
|
-
import { useRef, useEffect, useMemo } from 'react';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
function VuerAuthProvider({ children, baseURL }) {
|
|
8
|
-
const authClient = useRef(createClient(baseURL));
|
|
9
|
-
const { data, isPending, refetch } = authClient.current.useSession();
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
12
|
-
const session = searchParams.get("token");
|
|
13
|
-
if (session) {
|
|
14
|
-
localStorage.setItem(bearerToken, encodeURIComponent(session));
|
|
15
|
-
refetch();
|
|
16
|
-
window.history.replaceState({}, "", window.location.pathname);
|
|
17
|
-
}
|
|
18
|
-
}, [refetch]);
|
|
19
|
-
return /* @__PURE__ */ jsx(
|
|
20
|
-
AuthContext.Provider,
|
|
21
|
-
{
|
|
22
|
-
value: useMemo(() => {
|
|
23
|
-
return { data, isPending, refetch, authClient: authClient.current, baseURL };
|
|
24
|
-
}, [baseURL, data, isPending, refetch]),
|
|
25
|
-
children
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { VuerAuthProvider };
|
package/dist/chunk-CHYXRETV.cjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var betterAuth = require('better-auth');
|
|
4
|
-
var plugins$1 = require('better-auth/client/plugins');
|
|
5
|
-
var plugins = require('better-auth/plugins');
|
|
6
|
-
|
|
7
|
-
// src/auth/types.ts
|
|
8
|
-
var auth = betterAuth.betterAuth({
|
|
9
|
-
plugins: [
|
|
10
|
-
plugins.customSession(async (session) => {
|
|
11
|
-
return {
|
|
12
|
-
...session,
|
|
13
|
-
session: { ...session.session, sessionToken: "" }
|
|
14
|
-
};
|
|
15
|
-
})
|
|
16
|
-
]
|
|
17
|
-
});
|
|
18
|
-
var options = {
|
|
19
|
-
plugins: [plugins$1.customSessionClient()]
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
exports.auth = auth;
|
|
23
|
-
exports.options = options;
|
package/dist/chunk-G6U2K2GR.cjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkHPK4YEVK_cjs = require('./chunk-HPK4YEVK.cjs');
|
|
4
|
-
var chunkZULCZ5L6_cjs = require('./chunk-ZULCZ5L6.cjs');
|
|
5
|
-
var chunk6BD5MQ5R_cjs = require('./chunk-6BD5MQ5R.cjs');
|
|
6
|
-
var react = require('react');
|
|
7
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
-
|
|
9
|
-
function VuerAuthProvider({ children, baseURL }) {
|
|
10
|
-
const authClient = react.useRef(chunkHPK4YEVK_cjs.createClient(baseURL));
|
|
11
|
-
const { data, isPending, refetch } = authClient.current.useSession();
|
|
12
|
-
react.useEffect(() => {
|
|
13
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
14
|
-
const session = searchParams.get("token");
|
|
15
|
-
if (session) {
|
|
16
|
-
localStorage.setItem(chunk6BD5MQ5R_cjs.bearerToken, encodeURIComponent(session));
|
|
17
|
-
refetch();
|
|
18
|
-
window.history.replaceState({}, "", window.location.pathname);
|
|
19
|
-
}
|
|
20
|
-
}, [refetch]);
|
|
21
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
|
-
chunkZULCZ5L6_cjs.AuthContext.Provider,
|
|
23
|
-
{
|
|
24
|
-
value: react.useMemo(() => {
|
|
25
|
-
return { data, isPending, refetch, authClient: authClient.current, baseURL };
|
|
26
|
-
}, [baseURL, data, isPending, refetch]),
|
|
27
|
-
children
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
exports.VuerAuthProvider = VuerAuthProvider;
|
package/dist/chunk-HPK4YEVK.cjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk6BD5MQ5R_cjs = require('./chunk-6BD5MQ5R.cjs');
|
|
4
|
-
var chunkCHYXRETV_cjs = require('./chunk-CHYXRETV.cjs');
|
|
5
|
-
var react = require('better-auth/react');
|
|
6
|
-
|
|
7
|
-
var createClient = (baseURL) => {
|
|
8
|
-
return react.createAuthClient({
|
|
9
|
-
...chunkCHYXRETV_cjs.options,
|
|
10
|
-
baseURL,
|
|
11
|
-
fetchOptions: {
|
|
12
|
-
auth: {
|
|
13
|
-
type: "Bearer",
|
|
14
|
-
token: () => localStorage.getItem(chunk6BD5MQ5R_cjs.bearerToken) || ""
|
|
15
|
-
// get the token from localStorage
|
|
16
|
-
},
|
|
17
|
-
onSuccess: (ctx) => {
|
|
18
|
-
const jwt = ctx.response.headers.get("set-auth-jwt");
|
|
19
|
-
if (jwt) {
|
|
20
|
-
localStorage.setItem(chunk6BD5MQ5R_cjs.jwtToken, jwt);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
exports.createClient = createClient;
|
package/dist/chunk-PKSIXQJX.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { betterAuth } from 'better-auth';
|
|
2
|
-
import { customSessionClient } from 'better-auth/client/plugins';
|
|
3
|
-
import { customSession } from 'better-auth/plugins';
|
|
4
|
-
|
|
5
|
-
// src/auth/types.ts
|
|
6
|
-
var auth = betterAuth({
|
|
7
|
-
plugins: [
|
|
8
|
-
customSession(async (session) => {
|
|
9
|
-
return {
|
|
10
|
-
...session,
|
|
11
|
-
session: { ...session.session, sessionToken: "" }
|
|
12
|
-
};
|
|
13
|
-
})
|
|
14
|
-
]
|
|
15
|
-
});
|
|
16
|
-
var options = {
|
|
17
|
-
plugins: [customSessionClient()]
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { auth, options };
|
package/dist/chunk-PZMA33PL.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jwtToken, bearerToken } from './chunk-WGVKFNG6.mjs';
|
|
2
|
-
import { options } from './chunk-PKSIXQJX.mjs';
|
|
3
|
-
import { createAuthClient } from 'better-auth/react';
|
|
4
|
-
|
|
5
|
-
var createClient = (baseURL) => {
|
|
6
|
-
return createAuthClient({
|
|
7
|
-
...options,
|
|
8
|
-
baseURL,
|
|
9
|
-
fetchOptions: {
|
|
10
|
-
auth: {
|
|
11
|
-
type: "Bearer",
|
|
12
|
-
token: () => localStorage.getItem(bearerToken) || ""
|
|
13
|
-
// get the token from localStorage
|
|
14
|
-
},
|
|
15
|
-
onSuccess: (ctx) => {
|
|
16
|
-
const jwt = ctx.response.headers.get("set-auth-jwt");
|
|
17
|
-
if (jwt) {
|
|
18
|
-
localStorage.setItem(jwtToken, jwt);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export { createClient };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createAuthClient } from "better-auth/react";
|
|
2
|
-
|
|
3
|
-
import { bearerToken, jwtToken } from "../localstorage-key";
|
|
4
|
-
import { BetterAuth, options } from "../types";
|
|
5
|
-
|
|
6
|
-
export const createClient = (baseURL: string): BetterAuth => {
|
|
7
|
-
return createAuthClient({
|
|
8
|
-
...options,
|
|
9
|
-
baseURL: baseURL,
|
|
10
|
-
fetchOptions: {
|
|
11
|
-
auth: {
|
|
12
|
-
type: "Bearer",
|
|
13
|
-
token: () => localStorage.getItem(bearerToken) || "", // get the token from localStorage
|
|
14
|
-
},
|
|
15
|
-
onSuccess: (ctx) => {
|
|
16
|
-
const jwt = ctx.response.headers.get("set-auth-jwt");
|
|
17
|
-
if (jwt) {
|
|
18
|
-
localStorage.setItem(jwtToken, jwt);
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
};
|