@m5kdev/frontend 0.20.51 → 0.21.1
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/src/index.d.mts +25 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/src/index.js +83 -0
- package/dist/src/index.mjs +25 -0
- package/dist/src/modules/auth/auth.client.d.mts +708 -0
- package/dist/src/modules/auth/auth.client.d.mts.map +1 -0
- package/dist/src/modules/auth/auth.client.d.ts +708 -0
- package/dist/src/modules/auth/auth.client.d.ts.map +1 -0
- package/dist/src/modules/auth/auth.client.js +72 -0
- package/dist/src/modules/auth/auth.client.js.map +1 -0
- package/dist/src/modules/auth/auth.client.mjs +71 -0
- package/dist/src/modules/auth/auth.client.mjs.map +1 -0
- package/dist/src/modules/auth/auth.context.d.mts +15 -0
- package/dist/src/modules/auth/auth.context.d.mts.map +1 -0
- package/dist/src/modules/auth/auth.context.d.ts +15 -0
- package/dist/src/modules/auth/auth.context.d.ts.map +1 -0
- package/dist/src/modules/auth/auth.context.js +13 -0
- package/dist/src/modules/auth/auth.context.js.map +1 -0
- package/dist/src/modules/auth/auth.context.mjs +13 -0
- package/dist/src/modules/auth/auth.context.mjs.map +1 -0
- package/dist/src/modules/auth/auth.lib.d.mts +1251 -1380
- package/dist/src/modules/auth/auth.lib.d.mts.map +1 -1
- package/dist/src/modules/auth/auth.lib.d.ts +1251 -1380
- package/dist/src/modules/auth/auth.lib.d.ts.map +1 -1
- package/dist/src/modules/auth/auth.lib.js +18 -63
- package/dist/src/modules/auth/auth.lib.js.map +1 -1
- package/dist/src/modules/auth/auth.lib.mjs +10 -64
- package/dist/src/modules/auth/auth.lib.mjs.map +1 -1
- package/dist/src/modules/auth/components/AuthProvider.d.mts +9 -10
- package/dist/src/modules/auth/components/AuthProvider.d.mts.map +1 -1
- package/dist/src/modules/auth/components/AuthProvider.d.ts +9 -10
- package/dist/src/modules/auth/components/AuthProvider.d.ts.map +1 -1
- package/dist/src/modules/auth/components/AuthProvider.js +20 -42
- package/dist/src/modules/auth/components/AuthProvider.js.map +1 -1
- package/dist/src/modules/auth/components/AuthProvider.mjs +22 -43
- package/dist/src/modules/auth/components/AuthProvider.mjs.map +1 -1
- package/dist/src/modules/auth/hooks/useAuth.d.mts.map +1 -1
- package/dist/src/modules/auth/hooks/useAuth.d.ts.map +1 -1
- package/dist/src/modules/auth/hooks/useAuth.js +5 -3
- package/dist/src/modules/auth/hooks/useAuth.js.map +1 -1
- package/dist/src/modules/auth/hooks/useAuth.mjs +3 -1
- package/dist/src/modules/auth/hooks/useAuth.mjs.map +1 -1
- package/dist/src/modules/auth/hooks/useAuthAdmin.d.mts +10 -19
- package/dist/src/modules/auth/hooks/useAuthAdmin.d.mts.map +1 -1
- package/dist/src/modules/auth/hooks/useAuthAdmin.d.ts +10 -19
- package/dist/src/modules/auth/hooks/useAuthAdmin.d.ts.map +1 -1
- package/dist/src/modules/auth/hooks/useAuthAdmin.js +20 -12
- package/dist/src/modules/auth/hooks/useAuthAdmin.js.map +1 -1
- package/dist/src/modules/auth/hooks/useAuthAdmin.mjs +14 -6
- package/dist/src/modules/auth/hooks/useAuthAdmin.mjs.map +1 -1
- package/dist/src/modules/auth/hooks/useAuthClient.d.mts +707 -0
- package/dist/src/modules/auth/hooks/useAuthClient.d.mts.map +1 -0
- package/dist/src/modules/auth/hooks/useAuthClient.d.ts +707 -0
- package/dist/src/modules/auth/hooks/useAuthClient.d.ts.map +1 -0
- package/dist/src/modules/auth/hooks/useAuthClient.js +12 -0
- package/dist/src/modules/auth/hooks/useAuthClient.js.map +1 -0
- package/dist/src/modules/auth/hooks/useAuthClient.mjs +11 -0
- package/dist/src/modules/auth/hooks/useAuthClient.mjs.map +1 -0
- package/dist/src/modules/auth/hooks/useMemberInvite.js +3 -2
- package/dist/src/modules/auth/hooks/useMemberInvite.js.map +1 -1
- package/dist/src/modules/auth/hooks/useMemberInvite.mjs +2 -1
- package/dist/src/modules/auth/hooks/useMemberInvite.mjs.map +1 -1
- package/dist/src/modules/auth/hooks/useOrganizationAccess.d.mts +1 -1
- package/dist/src/modules/auth/hooks/useOrganizationAccess.d.ts +1 -1
- package/dist/src/modules/auth/hooks/useSession.d.mts +4 -37
- package/dist/src/modules/auth/hooks/useSession.d.mts.map +1 -1
- package/dist/src/modules/auth/hooks/useSession.d.ts +4 -37
- package/dist/src/modules/auth/hooks/useSession.d.ts.map +1 -1
- package/dist/src/modules/auth/hooks/useSession.js +3 -2
- package/dist/src/modules/auth/hooks/useSession.js.map +1 -1
- package/dist/src/modules/auth/hooks/useSession.mjs +3 -2
- package/dist/src/modules/auth/hooks/useSession.mjs.map +1 -1
- package/dist/src/modules/billing/components/BillingProvider.d.mts +1 -1
- package/dist/src/modules/billing/components/BillingProvider.d.mts.map +1 -1
- package/dist/src/modules/billing/components/BillingProvider.d.ts +1 -1
- package/dist/src/modules/billing/components/BillingProvider.d.ts.map +1 -1
- package/dist/src/modules/file/hooks/useS3Upload.d.mts +15 -2
- package/dist/src/modules/file/hooks/useS3Upload.d.mts.map +1 -1
- package/dist/src/modules/file/hooks/useS3Upload.d.ts +15 -2
- package/dist/src/modules/file/hooks/useS3Upload.d.ts.map +1 -1
- package/dist/src/modules/file/hooks/useS3Upload.js +29 -4
- package/dist/src/modules/file/hooks/useS3Upload.js.map +1 -1
- package/dist/src/modules/file/hooks/useS3Upload.mjs +29 -5
- package/dist/src/modules/file/hooks/useS3Upload.mjs.map +1 -1
- package/dist/src/modules/file/hooks/useUpload.d.mts +6 -4
- package/dist/src/modules/file/hooks/useUpload.d.mts.map +1 -1
- package/dist/src/modules/file/hooks/useUpload.d.ts +6 -4
- package/dist/src/modules/file/hooks/useUpload.d.ts.map +1 -1
- package/dist/src/modules/file/hooks/useUpload.js +10 -7
- package/dist/src/modules/file/hooks/useUpload.js.map +1 -1
- package/dist/src/modules/file/hooks/useUpload.mjs +10 -7
- package/dist/src/modules/file/hooks/useUpload.mjs.map +1 -1
- package/dist/src/modules/table/hooks/useQueryWithParams.d.mts +2 -2
- package/dist/src/modules/table/hooks/useQueryWithParams.d.mts.map +1 -1
- package/dist/src/modules/table/hooks/useQueryWithParams.d.ts +2 -2
- package/dist/src/modules/table/hooks/useQueryWithParams.d.ts.map +1 -1
- package/dist/src/modules/table/hooks/useQueryWithParams.js.map +1 -1
- package/dist/src/modules/table/hooks/useQueryWithParams.mjs.map +1 -1
- package/dist/src/modules/table/hooks/useTableQueryParams.d.mts +7 -0
- package/dist/src/modules/table/hooks/useTableQueryParams.d.mts.map +1 -0
- package/dist/src/modules/table/hooks/useTableQueryParams.d.ts +7 -0
- package/dist/src/modules/table/hooks/useTableQueryParams.d.ts.map +1 -0
- package/dist/src/modules/table/hooks/useTableQueryParams.js +95 -0
- package/dist/src/modules/table/hooks/useTableQueryParams.js.map +1 -0
- package/dist/src/modules/table/hooks/useTableQueryParams.mjs +94 -0
- package/dist/src/modules/table/hooks/useTableQueryParams.mjs.map +1 -0
- package/dist/src/modules/table/queryParams.d.mts +34 -0
- package/dist/src/modules/table/queryParams.d.mts.map +1 -0
- package/dist/src/modules/table/queryParams.d.ts +34 -0
- package/dist/src/modules/table/queryParams.d.ts.map +1 -0
- package/dist/src/modules/table/{hooks/useNuqsQueryParams.js → queryParams.js} +14 -130
- package/dist/src/modules/table/queryParams.js.map +1 -0
- package/dist/src/modules/table/{hooks/useNuqsQueryParams.mjs → queryParams.mjs} +10 -130
- package/dist/src/modules/table/queryParams.mjs.map +1 -0
- package/dist/src/utils/date.d.mts +1 -1
- package/package.json +24 -6
- package/dist/src/modules/table/hooks/useDateRangeFilter.d.mts +0 -34
- package/dist/src/modules/table/hooks/useDateRangeFilter.d.mts.map +0 -1
- package/dist/src/modules/table/hooks/useDateRangeFilter.d.ts +0 -34
- package/dist/src/modules/table/hooks/useDateRangeFilter.d.ts.map +0 -1
- package/dist/src/modules/table/hooks/useDateRangeFilter.js +0 -30
- package/dist/src/modules/table/hooks/useDateRangeFilter.js.map +0 -1
- package/dist/src/modules/table/hooks/useDateRangeFilter.mjs +0 -29
- package/dist/src/modules/table/hooks/useDateRangeFilter.mjs.map +0 -1
- package/dist/src/modules/table/hooks/useNuqsQueryParams.d.mts +0 -34
- package/dist/src/modules/table/hooks/useNuqsQueryParams.d.mts.map +0 -1
- package/dist/src/modules/table/hooks/useNuqsQueryParams.d.ts +0 -34
- package/dist/src/modules/table/hooks/useNuqsQueryParams.d.ts.map +0 -1
- package/dist/src/modules/table/hooks/useNuqsQueryParams.js.map +0 -1
- package/dist/src/modules/table/hooks/useNuqsQueryParams.mjs.map +0 -1
- package/dist/src/modules/table/hooks/useNuqsTable.d.mts +0 -46
- package/dist/src/modules/table/hooks/useNuqsTable.d.mts.map +0 -1
- package/dist/src/modules/table/hooks/useNuqsTable.d.ts +0 -46
- package/dist/src/modules/table/hooks/useNuqsTable.d.ts.map +0 -1
- package/dist/src/modules/table/hooks/useNuqsTable.js +0 -58
- package/dist/src/modules/table/hooks/useNuqsTable.js.map +0 -1
- package/dist/src/modules/table/hooks/useNuqsTable.mjs +0 -58
- package/dist/src/modules/table/hooks/useNuqsTable.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.lib.d.ts","names":[],"sources":["../../../../src/modules/auth/auth.lib.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"auth.lib.d.ts","names":[],"sources":["../../../../src/modules/auth/auth.lib.ts"],"mappings":"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"}
|
|
@@ -1,68 +1,23 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
const require_src_modules_auth_auth_client = require("./auth.client.js");
|
|
3
3
|
//#region src/modules/auth/auth.lib.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(0, better_auth_client_plugins.adminClient)(),
|
|
13
|
-
(0, better_auth_client_plugins.inferAdditionalFields)({
|
|
14
|
-
session: {
|
|
15
|
-
activeOrganizationId: {
|
|
16
|
-
type: "string",
|
|
17
|
-
required: false
|
|
18
|
-
},
|
|
19
|
-
activeTeamId: {
|
|
20
|
-
type: "string",
|
|
21
|
-
required: false
|
|
22
|
-
},
|
|
23
|
-
activeTeamRole: {
|
|
24
|
-
type: "string",
|
|
25
|
-
required: false
|
|
26
|
-
},
|
|
27
|
-
activeOrganizationRole: {
|
|
28
|
-
type: "string",
|
|
29
|
-
required: false
|
|
30
|
-
},
|
|
31
|
-
activeOrganizationType: {
|
|
32
|
-
type: "string",
|
|
33
|
-
required: false
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
user: {
|
|
37
|
-
onboarding: {
|
|
38
|
-
type: "number",
|
|
39
|
-
required: false
|
|
40
|
-
},
|
|
41
|
-
preferences: {
|
|
42
|
-
type: "string",
|
|
43
|
-
required: false
|
|
44
|
-
},
|
|
45
|
-
metadata: {
|
|
46
|
-
type: "string",
|
|
47
|
-
required: false
|
|
48
|
-
},
|
|
49
|
-
flags: {
|
|
50
|
-
type: "string",
|
|
51
|
-
required: false
|
|
52
|
-
},
|
|
53
|
-
stripeCustomerId: {
|
|
54
|
-
type: "string",
|
|
55
|
-
required: false
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
teamMembers: { role: {
|
|
59
|
-
type: "string",
|
|
60
|
-
required: true
|
|
61
|
-
} }
|
|
62
|
-
})
|
|
63
|
-
]
|
|
64
|
-
});
|
|
4
|
+
let authClient = require_src_modules_auth_auth_client.createM5KAuthClient();
|
|
5
|
+
function configureAuthClient({ baseURL, client } = {}) {
|
|
6
|
+
authClient = client ?? require_src_modules_auth_auth_client.createM5KAuthClient(baseURL);
|
|
7
|
+
return authClient;
|
|
8
|
+
}
|
|
9
|
+
function getAuthClient() {
|
|
10
|
+
return authClient;
|
|
11
|
+
}
|
|
65
12
|
//#endregion
|
|
66
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "authClient", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function() {
|
|
16
|
+
return authClient;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
exports.configureAuthClient = configureAuthClient;
|
|
20
|
+
exports.createM5KAuthClient = require_src_modules_auth_auth_client.createM5KAuthClient;
|
|
21
|
+
exports.getAuthClient = getAuthClient;
|
|
67
22
|
|
|
68
23
|
//# sourceMappingURL=auth.lib.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.lib.js","names":[],"sources":["../../../../src/modules/auth/auth.lib.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"auth.lib.js","names":["createM5KAuthClient"],"sources":["../../../../src/modules/auth/auth.lib.ts"],"sourcesContent":["import { createM5KAuthClient } from \"./auth.client\";\r\n\r\nexport { createM5KAuthClient };\r\nexport type { M5KAuthClient as AuthClient } from \"./auth.client\";\r\n\r\nexport let authClient = createM5KAuthClient();\r\n\r\nexport function configureAuthClient({\r\n baseURL,\r\n client,\r\n}: {\r\n baseURL?: string;\r\n client?: typeof authClient;\r\n} = {}) {\r\n authClient = client ?? createM5KAuthClient(baseURL);\r\n return authClient;\r\n}\r\n\r\nexport function getAuthClient() {\r\n return authClient;\r\n}\r\n"],"mappings":";;;AAKA,IAAW,aAAaA,qCAAAA,qBAAqB;AAE7C,SAAgB,oBAAoB,EAClC,SACA,WAIE,EAAE,EAAE;AACN,cAAa,UAAUA,qCAAAA,oBAAoB,QAAQ;AACnD,QAAO;;AAGT,SAAgB,gBAAgB;AAC9B,QAAO"}
|
|
@@ -1,68 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createAuthClient } from "better-auth/react";
|
|
1
|
+
import { createM5KAuthClient } from "./auth.client.mjs";
|
|
3
2
|
//#region src/modules/auth/auth.lib.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
adminClient(),
|
|
13
|
-
inferAdditionalFields({
|
|
14
|
-
session: {
|
|
15
|
-
activeOrganizationId: {
|
|
16
|
-
type: "string",
|
|
17
|
-
required: false
|
|
18
|
-
},
|
|
19
|
-
activeTeamId: {
|
|
20
|
-
type: "string",
|
|
21
|
-
required: false
|
|
22
|
-
},
|
|
23
|
-
activeTeamRole: {
|
|
24
|
-
type: "string",
|
|
25
|
-
required: false
|
|
26
|
-
},
|
|
27
|
-
activeOrganizationRole: {
|
|
28
|
-
type: "string",
|
|
29
|
-
required: false
|
|
30
|
-
},
|
|
31
|
-
activeOrganizationType: {
|
|
32
|
-
type: "string",
|
|
33
|
-
required: false
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
user: {
|
|
37
|
-
onboarding: {
|
|
38
|
-
type: "number",
|
|
39
|
-
required: false
|
|
40
|
-
},
|
|
41
|
-
preferences: {
|
|
42
|
-
type: "string",
|
|
43
|
-
required: false
|
|
44
|
-
},
|
|
45
|
-
metadata: {
|
|
46
|
-
type: "string",
|
|
47
|
-
required: false
|
|
48
|
-
},
|
|
49
|
-
flags: {
|
|
50
|
-
type: "string",
|
|
51
|
-
required: false
|
|
52
|
-
},
|
|
53
|
-
stripeCustomerId: {
|
|
54
|
-
type: "string",
|
|
55
|
-
required: false
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
teamMembers: { role: {
|
|
59
|
-
type: "string",
|
|
60
|
-
required: true
|
|
61
|
-
} }
|
|
62
|
-
})
|
|
63
|
-
]
|
|
64
|
-
});
|
|
3
|
+
let authClient = createM5KAuthClient();
|
|
4
|
+
function configureAuthClient({ baseURL, client } = {}) {
|
|
5
|
+
authClient = client ?? createM5KAuthClient(baseURL);
|
|
6
|
+
return authClient;
|
|
7
|
+
}
|
|
8
|
+
function getAuthClient() {
|
|
9
|
+
return authClient;
|
|
10
|
+
}
|
|
65
11
|
//#endregion
|
|
66
|
-
export { authClient };
|
|
12
|
+
export { authClient, configureAuthClient, createM5KAuthClient, getAuthClient };
|
|
67
13
|
|
|
68
14
|
//# sourceMappingURL=auth.lib.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.lib.mjs","names":[],"sources":["../../../../src/modules/auth/auth.lib.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"auth.lib.mjs","names":[],"sources":["../../../../src/modules/auth/auth.lib.ts"],"sourcesContent":["import { createM5KAuthClient } from \"./auth.client\";\r\n\r\nexport { createM5KAuthClient };\r\nexport type { M5KAuthClient as AuthClient } from \"./auth.client\";\r\n\r\nexport let authClient = createM5KAuthClient();\r\n\r\nexport function configureAuthClient({\r\n baseURL,\r\n client,\r\n}: {\r\n baseURL?: string;\r\n client?: typeof authClient;\r\n} = {}) {\r\n authClient = client ?? createM5KAuthClient(baseURL);\r\n return authClient;\r\n}\r\n\r\nexport function getAuthClient() {\r\n return authClient;\r\n}\r\n"],"mappings":";;AAKA,IAAW,aAAa,qBAAqB;AAE7C,SAAgB,oBAAoB,EAClC,SACA,WAIE,EAAE,EAAE;AACN,cAAa,UAAU,oBAAoB,QAAQ;AACnD,QAAO;;AAGT,SAAgB,gBAAgB;AAC9B,QAAO"}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M5KAuthClient } from "../auth.client.mjs";
|
|
2
|
+
import { AuthSession } from "../auth.context.mjs";
|
|
2
3
|
import * as _$react from "react";
|
|
3
4
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
5
|
|
|
5
6
|
//#region src/modules/auth/components/AuthProvider.d.ts
|
|
6
|
-
type Session =
|
|
7
|
-
declare const authProviderContext: _$react.Context<{
|
|
8
|
-
isLoading: boolean;
|
|
9
|
-
data: Session | null;
|
|
10
|
-
signOut: () => void;
|
|
11
|
-
registerSession: (onSuccess: () => void) => void;
|
|
12
|
-
}>;
|
|
7
|
+
type Session = AuthSession;
|
|
13
8
|
declare function AuthProvider({
|
|
9
|
+
authClient,
|
|
10
|
+
baseURL,
|
|
14
11
|
children,
|
|
15
12
|
loader,
|
|
16
13
|
onSession
|
|
17
14
|
}: {
|
|
15
|
+
authClient?: M5KAuthClient;
|
|
16
|
+
baseURL?: string;
|
|
18
17
|
children: React.ReactNode;
|
|
19
18
|
loader?: React.ReactNode;
|
|
20
19
|
onSession?: (session: Session | null) => void;
|
|
21
|
-
}): string | number | bigint | true |
|
|
20
|
+
}): string | number | bigint | true | Iterable<_$react.ReactNode> | Promise<string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | null | undefined> | _$react_jsx_runtime0.JSX.Element | null;
|
|
22
21
|
//#endregion
|
|
23
|
-
export { AuthProvider
|
|
22
|
+
export { AuthProvider };
|
|
24
23
|
//# sourceMappingURL=AuthProvider.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthProvider.d.mts","names":[],"sources":["../../../../../src/modules/auth/components/AuthProvider.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthProvider.d.mts","names":[],"sources":["../../../../../src/modules/auth/components/AuthProvider.tsx"],"mappings":";;;;;;KAKK,OAAA,GAAU,WAAA;AAAA,iBAEC,YAAA,CAAA;EACd,UAAA;EACA,OAAA;EACA,QAAA;EACA,MAAA;EACA;AAAA;EAEA,UAAA,GAAa,aAAA;EACb,OAAA;EACA,QAAA,EAAU,KAAA,CAAM,SAAA;EAChB,MAAA,GAAS,KAAA,CAAM,SAAA;EACf,SAAA,IAAa,OAAA,EAAS,OAAA;AAAA,sCACvB,QAAA,CAD8B,OAAA,CAC9B,SAAA,IAAA,OAAA,sCAAA,OAAA,CAAA,WAAA,GAAA,OAAA,CAAA,YAAA,mBAAA,OAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,OAAA,CAAA,SAAA,wBAAA,oBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M5KAuthClient } from "../auth.client.js";
|
|
2
|
+
import { AuthSession } from "../auth.context.js";
|
|
2
3
|
import * as _$react from "react";
|
|
3
4
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
5
|
|
|
5
6
|
//#region src/modules/auth/components/AuthProvider.d.ts
|
|
6
|
-
type Session =
|
|
7
|
-
declare const authProviderContext: _$react.Context<{
|
|
8
|
-
isLoading: boolean;
|
|
9
|
-
data: Session | null;
|
|
10
|
-
signOut: () => void;
|
|
11
|
-
registerSession: (onSuccess: () => void) => void;
|
|
12
|
-
}>;
|
|
7
|
+
type Session = AuthSession;
|
|
13
8
|
declare function AuthProvider({
|
|
9
|
+
authClient,
|
|
10
|
+
baseURL,
|
|
14
11
|
children,
|
|
15
12
|
loader,
|
|
16
13
|
onSession
|
|
17
14
|
}: {
|
|
15
|
+
authClient?: M5KAuthClient;
|
|
16
|
+
baseURL?: string;
|
|
18
17
|
children: React.ReactNode;
|
|
19
18
|
loader?: React.ReactNode;
|
|
20
19
|
onSession?: (session: Session | null) => void;
|
|
21
|
-
}): string | number | bigint | true |
|
|
20
|
+
}): string | number | bigint | true | Iterable<_$react.ReactNode> | Promise<string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | null | undefined> | _$react_jsx_runtime0.JSX.Element | null;
|
|
22
21
|
//#endregion
|
|
23
|
-
export { AuthProvider
|
|
22
|
+
export { AuthProvider };
|
|
24
23
|
//# sourceMappingURL=AuthProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthProvider.d.ts","names":[],"sources":["../../../../../src/modules/auth/components/AuthProvider.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthProvider.d.ts","names":[],"sources":["../../../../../src/modules/auth/components/AuthProvider.tsx"],"mappings":";;;;;;KAKK,OAAA,GAAU,WAAA;AAAA,iBAEC,YAAA,CAAA;EACd,UAAA;EACA,OAAA;EACA,QAAA;EACA,MAAA;EACA;AAAA;EAEA,UAAA,GAAa,aAAA;EACb,OAAA;EACA,QAAA,EAAU,KAAA,CAAM,SAAA;EAChB,MAAA,GAAS,KAAA,CAAM,SAAA;EACf,SAAA,IAAa,OAAA,EAAS,OAAA;AAAA,sCACvB,QAAA,CAD8B,OAAA,CAC9B,SAAA,IAAA,OAAA,sCAAA,OAAA,CAAA,WAAA,GAAA,OAAA,CAAA,YAAA,mBAAA,OAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,OAAA,CAAA,SAAA,wBAAA,oBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,67 +1,46 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src_modules_app_components_AppConfigProvider = require("../../app/components/AppConfigProvider.js");
|
|
2
3
|
const require_src_modules_auth_auth_lib = require("../auth.lib.js");
|
|
4
|
+
const require_src_modules_auth_auth_context = require("../auth.context.js");
|
|
3
5
|
let react = require("react");
|
|
4
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
-
let posthog_js_react_dist_umd_index_js = require("posthog-js/react/dist/umd/index.js");
|
|
6
7
|
//#region src/modules/auth/components/AuthProvider.tsx
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function AuthProvider({ children, loader, onSession }) {
|
|
18
|
-
const posthog = (0, posthog_js_react_dist_umd_index_js.usePostHog)();
|
|
8
|
+
function AuthProvider({ authClient, baseURL, children, loader, onSession }) {
|
|
9
|
+
const appConfig = (0, react.useContext)(require_src_modules_app_components_AppConfigProvider.AppConfigContext);
|
|
10
|
+
const resolvedAuthClient = (0, react.useMemo)(() => require_src_modules_auth_auth_lib.configureAuthClient({
|
|
11
|
+
baseURL: baseURL ?? appConfig?.serverUrl,
|
|
12
|
+
client: authClient
|
|
13
|
+
}), [
|
|
14
|
+
authClient,
|
|
15
|
+
appConfig?.serverUrl,
|
|
16
|
+
baseURL
|
|
17
|
+
]);
|
|
19
18
|
const [isLoading, setIsLoading] = (0, react.useState)(true);
|
|
20
19
|
const [session, setSession] = (0, react.useState)(null);
|
|
21
20
|
const registerSession = (0, react.useCallback)((onSuccess) => {
|
|
22
|
-
|
|
21
|
+
resolvedAuthClient.getSession().then(({ data: nextSession }) => {
|
|
23
22
|
setIsLoading(false);
|
|
24
23
|
setSession(nextSession);
|
|
25
24
|
onSession?.(nextSession);
|
|
26
|
-
if (isImpersonatedSession(nextSession)) {
|
|
27
|
-
posthog.opt_out_capturing();
|
|
28
|
-
posthog.reset();
|
|
29
|
-
onSuccess?.();
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
posthog.opt_in_capturing();
|
|
33
|
-
if (nextSession?.user) posthog.identify(nextSession.user.id, {
|
|
34
|
-
email: nextSession.user.email,
|
|
35
|
-
name: nextSession.user.name,
|
|
36
|
-
createdAt: nextSession.user.createdAt,
|
|
37
|
-
updatedAt: nextSession.user.updatedAt,
|
|
38
|
-
role: nextSession.user.role,
|
|
39
|
-
image: nextSession.user.image,
|
|
40
|
-
preferences: nextSession.user.preferences,
|
|
41
|
-
onboarding: nextSession.user.onboarding,
|
|
42
|
-
flags: nextSession.user.flags
|
|
43
|
-
});
|
|
44
|
-
else posthog.reset();
|
|
45
25
|
onSuccess?.();
|
|
46
26
|
}).catch((error) => {
|
|
47
27
|
console.error("Failed to get session:", error);
|
|
48
28
|
setIsLoading(false);
|
|
49
29
|
setSession(null);
|
|
50
30
|
});
|
|
51
|
-
}, [onSession,
|
|
31
|
+
}, [onSession, resolvedAuthClient]);
|
|
52
32
|
(0, react.useEffect)(() => {
|
|
53
33
|
registerSession();
|
|
54
|
-
}, []);
|
|
34
|
+
}, [registerSession]);
|
|
55
35
|
const signOut = (0, react.useCallback)(() => {
|
|
56
|
-
|
|
57
|
-
posthog.reset();
|
|
58
|
-
posthog.opt_in_capturing();
|
|
36
|
+
resolvedAuthClient.signOut().then(() => {
|
|
59
37
|
setSession(null);
|
|
60
38
|
});
|
|
61
|
-
}, [
|
|
62
|
-
if (isLoading) return loader ? loader :
|
|
63
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(authProviderContext.Provider, {
|
|
39
|
+
}, [resolvedAuthClient]);
|
|
40
|
+
if (isLoading) return loader ? loader : null;
|
|
41
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src_modules_auth_auth_context.authProviderContext.Provider, {
|
|
64
42
|
value: {
|
|
43
|
+
authClient: resolvedAuthClient,
|
|
65
44
|
isLoading,
|
|
66
45
|
data: session,
|
|
67
46
|
signOut,
|
|
@@ -72,6 +51,5 @@ function AuthProvider({ children, loader, onSession }) {
|
|
|
72
51
|
}
|
|
73
52
|
//#endregion
|
|
74
53
|
exports.AuthProvider = AuthProvider;
|
|
75
|
-
exports.authProviderContext = authProviderContext;
|
|
76
54
|
|
|
77
55
|
//# sourceMappingURL=AuthProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthProvider.js","names":[],"sources":["../../../../../src/modules/auth/components/AuthProvider.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"AuthProvider.js","names":["AppConfigContext","configureAuthClient","authProviderContext"],"sources":["../../../../../src/modules/auth/components/AuthProvider.tsx"],"sourcesContent":["import { useCallback, useContext, useEffect, useMemo, useState } from \"react\";\r\nimport { AppConfigContext } from \"../../app/components/AppConfigProvider\";\r\nimport { type AuthSession, authProviderContext } from \"../auth.context\";\r\nimport { type AuthClient, configureAuthClient } from \"../auth.lib\";\r\n\r\ntype Session = AuthSession;\r\n\r\nexport function AuthProvider({\r\n authClient,\r\n baseURL,\r\n children,\r\n loader,\r\n onSession,\r\n}: {\r\n authClient?: AuthClient;\r\n baseURL?: string;\r\n children: React.ReactNode;\r\n loader?: React.ReactNode;\r\n onSession?: (session: Session | null) => void;\r\n}) {\r\n const appConfig = useContext(AppConfigContext);\r\n const resolvedAuthClient = useMemo(\r\n () => configureAuthClient({ baseURL: baseURL ?? appConfig?.serverUrl, client: authClient }),\r\n [authClient, appConfig?.serverUrl, baseURL]\r\n );\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [session, setSession] = useState<Session | null>(null);\r\n\r\n const registerSession = useCallback(\r\n (onSuccess?: () => void) => {\r\n resolvedAuthClient\r\n .getSession()\r\n .then(({ data: nextSession }) => {\r\n setIsLoading(false);\r\n setSession(nextSession);\r\n onSession?.(nextSession);\r\n onSuccess?.();\r\n })\r\n .catch((error) => {\r\n console.error(\"Failed to get session:\", error);\r\n setIsLoading(false);\r\n setSession(null);\r\n });\r\n },\r\n [onSession, resolvedAuthClient]\r\n );\r\n\r\n useEffect(() => {\r\n registerSession();\r\n }, [registerSession]);\r\n\r\n const signOut = useCallback(() => {\r\n resolvedAuthClient.signOut().then(() => {\r\n setSession(null);\r\n });\r\n }, [resolvedAuthClient]);\r\n\r\n // Show loading screen while checking authentication status\r\n if (isLoading) {\r\n return loader ? loader : null;\r\n }\r\n\r\n return (\r\n <authProviderContext.Provider\r\n value={{ authClient: resolvedAuthClient, isLoading, data: session, signOut, registerSession }}\r\n >\r\n {children}\r\n </authProviderContext.Provider>\r\n );\r\n}\r\n"],"mappings":";;;;;;;AAOA,SAAgB,aAAa,EAC3B,YACA,SACA,UACA,QACA,aAOC;CACD,MAAM,aAAA,GAAA,MAAA,YAAuBA,qDAAAA,iBAAiB;CAC9C,MAAM,sBAAA,GAAA,MAAA,eACEC,kCAAAA,oBAAoB;EAAE,SAAS,WAAW,WAAW;EAAW,QAAQ;EAAY,CAAC,EAC3F;EAAC;EAAY,WAAW;EAAW;EAAQ,CAC5C;CACD,MAAM,CAAC,WAAW,iBAAA,GAAA,MAAA,UAAyB,KAAK;CAChD,MAAM,CAAC,SAAS,eAAA,GAAA,MAAA,UAAuC,KAAK;CAE5D,MAAM,mBAAA,GAAA,MAAA,cACH,cAA2B;AAC1B,qBACG,YAAY,CACZ,MAAM,EAAE,MAAM,kBAAkB;AAC/B,gBAAa,MAAM;AACnB,cAAW,YAAY;AACvB,eAAY,YAAY;AACxB,gBAAa;IACb,CACD,OAAO,UAAU;AAChB,WAAQ,MAAM,0BAA0B,MAAM;AAC9C,gBAAa,MAAM;AACnB,cAAW,KAAK;IAChB;IAEN,CAAC,WAAW,mBAAmB,CAChC;AAED,EAAA,GAAA,MAAA,iBAAgB;AACd,mBAAiB;IAChB,CAAC,gBAAgB,CAAC;CAErB,MAAM,WAAA,GAAA,MAAA,mBAA4B;AAChC,qBAAmB,SAAS,CAAC,WAAW;AACtC,cAAW,KAAK;IAChB;IACD,CAAC,mBAAmB,CAAC;AAGxB,KAAI,UACF,QAAO,SAAS,SAAS;AAG3B,QACE,iBAAA,GAAA,kBAAA,KAACC,sCAAAA,oBAAoB,UAArB;EACE,OAAO;GAAE,YAAY;GAAoB;GAAW,MAAM;GAAS;GAAS;GAAiB;EAE5F;EAC4B,CAAA"}
|
|
@@ -1,66 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AppConfigContext } from "../../app/components/AppConfigProvider.mjs";
|
|
2
|
+
import { configureAuthClient } from "../auth.lib.mjs";
|
|
3
|
+
import { authProviderContext } from "../auth.context.mjs";
|
|
4
|
+
import { useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
3
5
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { usePostHog } from "posthog-js/react/dist/esm/index.js";
|
|
5
6
|
//#region src/modules/auth/components/AuthProvider.tsx
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function AuthProvider({ children, loader, onSession }) {
|
|
17
|
-
const posthog = usePostHog();
|
|
7
|
+
function AuthProvider({ authClient, baseURL, children, loader, onSession }) {
|
|
8
|
+
const appConfig = useContext(AppConfigContext);
|
|
9
|
+
const resolvedAuthClient = useMemo(() => configureAuthClient({
|
|
10
|
+
baseURL: baseURL ?? appConfig?.serverUrl,
|
|
11
|
+
client: authClient
|
|
12
|
+
}), [
|
|
13
|
+
authClient,
|
|
14
|
+
appConfig?.serverUrl,
|
|
15
|
+
baseURL
|
|
16
|
+
]);
|
|
18
17
|
const [isLoading, setIsLoading] = useState(true);
|
|
19
18
|
const [session, setSession] = useState(null);
|
|
20
19
|
const registerSession = useCallback((onSuccess) => {
|
|
21
|
-
|
|
20
|
+
resolvedAuthClient.getSession().then(({ data: nextSession }) => {
|
|
22
21
|
setIsLoading(false);
|
|
23
22
|
setSession(nextSession);
|
|
24
23
|
onSession?.(nextSession);
|
|
25
|
-
if (isImpersonatedSession(nextSession)) {
|
|
26
|
-
posthog.opt_out_capturing();
|
|
27
|
-
posthog.reset();
|
|
28
|
-
onSuccess?.();
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
posthog.opt_in_capturing();
|
|
32
|
-
if (nextSession?.user) posthog.identify(nextSession.user.id, {
|
|
33
|
-
email: nextSession.user.email,
|
|
34
|
-
name: nextSession.user.name,
|
|
35
|
-
createdAt: nextSession.user.createdAt,
|
|
36
|
-
updatedAt: nextSession.user.updatedAt,
|
|
37
|
-
role: nextSession.user.role,
|
|
38
|
-
image: nextSession.user.image,
|
|
39
|
-
preferences: nextSession.user.preferences,
|
|
40
|
-
onboarding: nextSession.user.onboarding,
|
|
41
|
-
flags: nextSession.user.flags
|
|
42
|
-
});
|
|
43
|
-
else posthog.reset();
|
|
44
24
|
onSuccess?.();
|
|
45
25
|
}).catch((error) => {
|
|
46
26
|
console.error("Failed to get session:", error);
|
|
47
27
|
setIsLoading(false);
|
|
48
28
|
setSession(null);
|
|
49
29
|
});
|
|
50
|
-
}, [onSession,
|
|
30
|
+
}, [onSession, resolvedAuthClient]);
|
|
51
31
|
useEffect(() => {
|
|
52
32
|
registerSession();
|
|
53
|
-
}, []);
|
|
33
|
+
}, [registerSession]);
|
|
54
34
|
const signOut = useCallback(() => {
|
|
55
|
-
|
|
56
|
-
posthog.reset();
|
|
57
|
-
posthog.opt_in_capturing();
|
|
35
|
+
resolvedAuthClient.signOut().then(() => {
|
|
58
36
|
setSession(null);
|
|
59
37
|
});
|
|
60
|
-
}, [
|
|
61
|
-
if (isLoading) return loader ? loader :
|
|
38
|
+
}, [resolvedAuthClient]);
|
|
39
|
+
if (isLoading) return loader ? loader : null;
|
|
62
40
|
return /* @__PURE__ */ jsx(authProviderContext.Provider, {
|
|
63
41
|
value: {
|
|
42
|
+
authClient: resolvedAuthClient,
|
|
64
43
|
isLoading,
|
|
65
44
|
data: session,
|
|
66
45
|
signOut,
|
|
@@ -70,6 +49,6 @@ function AuthProvider({ children, loader, onSession }) {
|
|
|
70
49
|
});
|
|
71
50
|
}
|
|
72
51
|
//#endregion
|
|
73
|
-
export { AuthProvider
|
|
52
|
+
export { AuthProvider };
|
|
74
53
|
|
|
75
54
|
//# sourceMappingURL=AuthProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthProvider.mjs","names":[],"sources":["../../../../../src/modules/auth/components/AuthProvider.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"AuthProvider.mjs","names":[],"sources":["../../../../../src/modules/auth/components/AuthProvider.tsx"],"sourcesContent":["import { useCallback, useContext, useEffect, useMemo, useState } from \"react\";\r\nimport { AppConfigContext } from \"../../app/components/AppConfigProvider\";\r\nimport { type AuthSession, authProviderContext } from \"../auth.context\";\r\nimport { type AuthClient, configureAuthClient } from \"../auth.lib\";\r\n\r\ntype Session = AuthSession;\r\n\r\nexport function AuthProvider({\r\n authClient,\r\n baseURL,\r\n children,\r\n loader,\r\n onSession,\r\n}: {\r\n authClient?: AuthClient;\r\n baseURL?: string;\r\n children: React.ReactNode;\r\n loader?: React.ReactNode;\r\n onSession?: (session: Session | null) => void;\r\n}) {\r\n const appConfig = useContext(AppConfigContext);\r\n const resolvedAuthClient = useMemo(\r\n () => configureAuthClient({ baseURL: baseURL ?? appConfig?.serverUrl, client: authClient }),\r\n [authClient, appConfig?.serverUrl, baseURL]\r\n );\r\n const [isLoading, setIsLoading] = useState(true);\r\n const [session, setSession] = useState<Session | null>(null);\r\n\r\n const registerSession = useCallback(\r\n (onSuccess?: () => void) => {\r\n resolvedAuthClient\r\n .getSession()\r\n .then(({ data: nextSession }) => {\r\n setIsLoading(false);\r\n setSession(nextSession);\r\n onSession?.(nextSession);\r\n onSuccess?.();\r\n })\r\n .catch((error) => {\r\n console.error(\"Failed to get session:\", error);\r\n setIsLoading(false);\r\n setSession(null);\r\n });\r\n },\r\n [onSession, resolvedAuthClient]\r\n );\r\n\r\n useEffect(() => {\r\n registerSession();\r\n }, [registerSession]);\r\n\r\n const signOut = useCallback(() => {\r\n resolvedAuthClient.signOut().then(() => {\r\n setSession(null);\r\n });\r\n }, [resolvedAuthClient]);\r\n\r\n // Show loading screen while checking authentication status\r\n if (isLoading) {\r\n return loader ? loader : null;\r\n }\r\n\r\n return (\r\n <authProviderContext.Provider\r\n value={{ authClient: resolvedAuthClient, isLoading, data: session, signOut, registerSession }}\r\n >\r\n {children}\r\n </authProviderContext.Provider>\r\n );\r\n}\r\n"],"mappings":";;;;;;AAOA,SAAgB,aAAa,EAC3B,YACA,SACA,UACA,QACA,aAOC;CACD,MAAM,YAAY,WAAW,iBAAiB;CAC9C,MAAM,qBAAqB,cACnB,oBAAoB;EAAE,SAAS,WAAW,WAAW;EAAW,QAAQ;EAAY,CAAC,EAC3F;EAAC;EAAY,WAAW;EAAW;EAAQ,CAC5C;CACD,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;CAChD,MAAM,CAAC,SAAS,cAAc,SAAyB,KAAK;CAE5D,MAAM,kBAAkB,aACrB,cAA2B;AAC1B,qBACG,YAAY,CACZ,MAAM,EAAE,MAAM,kBAAkB;AAC/B,gBAAa,MAAM;AACnB,cAAW,YAAY;AACvB,eAAY,YAAY;AACxB,gBAAa;IACb,CACD,OAAO,UAAU;AAChB,WAAQ,MAAM,0BAA0B,MAAM;AAC9C,gBAAa,MAAM;AACnB,cAAW,KAAK;IAChB;IAEN,CAAC,WAAW,mBAAmB,CAChC;AAED,iBAAgB;AACd,mBAAiB;IAChB,CAAC,gBAAgB,CAAC;CAErB,MAAM,UAAU,kBAAkB;AAChC,qBAAmB,SAAS,CAAC,WAAW;AACtC,cAAW,KAAK;IAChB;IACD,CAAC,mBAAmB,CAAC;AAGxB,KAAI,UACF,QAAO,SAAS,SAAS;AAG3B,QACE,oBAAC,oBAAoB,UAArB;EACE,OAAO;GAAE,YAAY;GAAoB;GAAW,MAAM;GAAS;GAAS;GAAiB;EAE5F;EAC4B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.d.mts","names":[],"sources":["../../../../../src/modules/auth/hooks/useAuth.ts"],"mappings":";;;;iBAGgB,aAAA,CAAc,OAAA,EAAS,qBAAA,GAAqB,wBAAA,CAAA,iBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"useAuth.d.mts","names":[],"sources":["../../../../../src/modules/auth/hooks/useAuth.ts"],"mappings":";;;;iBAGgB,aAAA,CAAc,OAAA,EAAS,qBAAA,GAAqB,wBAAA,CAAA,iBAAA;AAAA,iBAS5C,wBAAA,WAAmC,MAAA,cAAA,CACjD,OAAA,EAAS,qBAAA,GAAqB,wBAAA,CAAA,iBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.d.ts","names":[],"sources":["../../../../../src/modules/auth/hooks/useAuth.ts"],"mappings":";;;;iBAGgB,aAAA,CAAc,OAAA,EAAS,qBAAA,GAAqB,wBAAA,CAAA,iBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"useAuth.d.ts","names":[],"sources":["../../../../../src/modules/auth/hooks/useAuth.ts"],"mappings":";;;;iBAGgB,aAAA,CAAc,OAAA,EAAS,qBAAA,GAAqB,wBAAA,CAAA,iBAAA;AAAA,iBAS5C,wBAAA,WAAmC,MAAA,cAAA,CACjD,OAAA,EAAS,qBAAA,GAAqB,wBAAA,CAAA,iBAAA"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_src_modules_auth_hooks_useAuthClient = require("./useAuthClient.js");
|
|
3
3
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
4
4
|
//#region src/modules/auth/hooks/useAuth.ts
|
|
5
5
|
function useUpdateUser(options) {
|
|
6
|
+
const authClient = require_src_modules_auth_hooks_useAuthClient.useAuthClient();
|
|
6
7
|
return (0, _tanstack_react_query.useMutation)({
|
|
7
|
-
mutationFn: (...args) =>
|
|
8
|
+
mutationFn: (...args) => authClient.updateUser(...args),
|
|
8
9
|
...options
|
|
9
10
|
});
|
|
10
11
|
}
|
|
11
12
|
function useUpdateUserPreferences(options) {
|
|
13
|
+
const authClient = require_src_modules_auth_hooks_useAuthClient.useAuthClient();
|
|
12
14
|
return (0, _tanstack_react_query.useMutation)({
|
|
13
|
-
mutationFn: (preferences) =>
|
|
15
|
+
mutationFn: (preferences) => authClient.updateUser({ preferences: JSON.stringify(preferences) }),
|
|
14
16
|
...options
|
|
15
17
|
});
|
|
16
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.js","names":["
|
|
1
|
+
{"version":3,"file":"useAuth.js","names":["useAuthClient"],"sources":["../../../../../src/modules/auth/hooks/useAuth.ts"],"sourcesContent":["import { type AnyUseMutationOptions, useMutation } from \"@tanstack/react-query\";\r\nimport { useAuthClient } from \"./useAuthClient\";\r\n\r\nexport function useUpdateUser(options: AnyUseMutationOptions) {\r\n const authClient = useAuthClient();\r\n return useMutation({\r\n mutationFn: (...args: Parameters<typeof authClient.updateUser>) =>\r\n authClient.updateUser(...args),\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useUpdateUserPreferences<T extends Record<string, any>>(\r\n options: AnyUseMutationOptions\r\n) {\r\n const authClient = useAuthClient();\r\n return useMutation({\r\n mutationFn: (preferences: T) =>\r\n authClient.updateUser({ preferences: JSON.stringify(preferences) as string }),\r\n ...options,\r\n });\r\n}\r\n"],"mappings":";;;;AAGA,SAAgB,cAAc,SAAgC;CAC5D,MAAM,aAAaA,6CAAAA,eAAe;AAClC,SAAA,GAAA,sBAAA,aAAmB;EACjB,aAAa,GAAG,SACd,WAAW,WAAW,GAAG,KAAK;EAChC,GAAG;EACJ,CAAC;;AAGJ,SAAgB,yBACd,SACA;CACA,MAAM,aAAaA,6CAAAA,eAAe;AAClC,SAAA,GAAA,sBAAA,aAAmB;EACjB,aAAa,gBACX,WAAW,WAAW,EAAE,aAAa,KAAK,UAAU,YAAY,EAAY,CAAC;EAC/E,GAAG;EACJ,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useAuthClient } from "./useAuthClient.mjs";
|
|
2
2
|
import { useMutation } from "@tanstack/react-query";
|
|
3
3
|
//#region src/modules/auth/hooks/useAuth.ts
|
|
4
4
|
function useUpdateUser(options) {
|
|
5
|
+
const authClient = useAuthClient();
|
|
5
6
|
return useMutation({
|
|
6
7
|
mutationFn: (...args) => authClient.updateUser(...args),
|
|
7
8
|
...options
|
|
8
9
|
});
|
|
9
10
|
}
|
|
10
11
|
function useUpdateUserPreferences(options) {
|
|
12
|
+
const authClient = useAuthClient();
|
|
11
13
|
return useMutation({
|
|
12
14
|
mutationFn: (preferences) => authClient.updateUser({ preferences: JSON.stringify(preferences) }),
|
|
13
15
|
...options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.mjs","names":[],"sources":["../../../../../src/modules/auth/hooks/useAuth.ts"],"sourcesContent":["import { type AnyUseMutationOptions, useMutation } from \"@tanstack/react-query\";\r\nimport {
|
|
1
|
+
{"version":3,"file":"useAuth.mjs","names":[],"sources":["../../../../../src/modules/auth/hooks/useAuth.ts"],"sourcesContent":["import { type AnyUseMutationOptions, useMutation } from \"@tanstack/react-query\";\r\nimport { useAuthClient } from \"./useAuthClient\";\r\n\r\nexport function useUpdateUser(options: AnyUseMutationOptions) {\r\n const authClient = useAuthClient();\r\n return useMutation({\r\n mutationFn: (...args: Parameters<typeof authClient.updateUser>) =>\r\n authClient.updateUser(...args),\r\n ...options,\r\n });\r\n}\r\n\r\nexport function useUpdateUserPreferences<T extends Record<string, any>>(\r\n options: AnyUseMutationOptions\r\n) {\r\n const authClient = useAuthClient();\r\n return useMutation({\r\n mutationFn: (preferences: T) =>\r\n authClient.updateUser({ preferences: JSON.stringify(preferences) as string }),\r\n ...options,\r\n });\r\n}\r\n"],"mappings":";;;AAGA,SAAgB,cAAc,SAAgC;CAC5D,MAAM,aAAa,eAAe;AAClC,QAAO,YAAY;EACjB,aAAa,GAAG,SACd,WAAW,WAAW,GAAG,KAAK;EAChC,GAAG;EACJ,CAAC;;AAGJ,SAAgB,yBACd,SACA;CACA,MAAM,aAAa,eAAe;AAClC,QAAO,YAAY;EACjB,aAAa,gBACX,WAAW,WAAW,EAAE,aAAa,KAAK,UAAU,YAAY,EAAY,CAAC;EAC/E,GAAG;EACJ,CAAC"}
|