@krak-stack/auth 0.2.15 → 0.2.16
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/api.d.ts +1364 -1364
- package/dist/components/auth-provider.d.ts +2 -2
- package/dist/components/auth-provider.js +4 -1
- package/package.json +5 -2
|
@@ -13,7 +13,6 @@ export declare class KrakstackAuthUnavailableError extends KrakstackAuthUnavaila
|
|
|
13
13
|
}
|
|
14
14
|
export type KrakstackAuthProviderProps = {
|
|
15
15
|
children: ReactNode;
|
|
16
|
-
locale?: KrakstackAuthLocale | undefined;
|
|
17
16
|
baseUrl?: string | undefined;
|
|
18
17
|
projectId?: string | null | undefined;
|
|
19
18
|
access?: ProjectAccessCatalog | undefined;
|
|
@@ -35,7 +34,8 @@ type ProjectConfigState = {
|
|
|
35
34
|
projectConfig: ExtraProjectPublicConfig | null;
|
|
36
35
|
};
|
|
37
36
|
export declare const resolveProjectConfigState: (result: AsyncResult.AsyncResult<ExtraProjectPublicConfig | null, unknown>) => ProjectConfigState;
|
|
38
|
-
export declare
|
|
37
|
+
export declare const resolveKrakstackAuthLocale: (locale: string) => KrakstackAuthLocale;
|
|
38
|
+
export declare function KrakstackAuthProvider({ children, baseUrl, projectId, access, accessLabels, }: KrakstackAuthProviderProps): import("react").JSX.Element;
|
|
39
39
|
export declare const useKrakstackAuth: () => KrakstackAuthContextValue | null;
|
|
40
40
|
export declare const useKrakstackAuthProjectConfig: () => {
|
|
41
41
|
readonly projectKey: string;
|
|
@@ -4,6 +4,7 @@ import { useRouterState } from "@tanstack/react-router";
|
|
|
4
4
|
import { Cause, Option, Schema } from "effect";
|
|
5
5
|
import { HttpApiError } from "effect/unstable/httpapi";
|
|
6
6
|
import { AsyncResult, Atom } from "effect/unstable/reactivity";
|
|
7
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
7
8
|
import { createContext, useContext, useEffect, useMemo, useRef, } from "react";
|
|
8
9
|
import { activeAuthOrganizationAtom, authSessionAtom } from "./auth-atoms.js";
|
|
9
10
|
import { authClientApi } from "./auth-client-api.js";
|
|
@@ -70,6 +71,7 @@ export const resolveProjectConfigState = (result) => {
|
|
|
70
71
|
}
|
|
71
72
|
return { status: "loading", error: null, projectConfig: null };
|
|
72
73
|
};
|
|
74
|
+
export const resolveKrakstackAuthLocale = (locale) => (locale.startsWith("fr") ? "fr" : "en");
|
|
73
75
|
const useProjectConfigState = (baseUrl, providedProjectId) => {
|
|
74
76
|
const searchString = useRouterState({
|
|
75
77
|
select: (state) => state.location.searchStr,
|
|
@@ -104,7 +106,8 @@ const useProjectConfigState = (baseUrl, providedProjectId) => {
|
|
|
104
106
|
const result = useAtomValue(projectConfigAtom);
|
|
105
107
|
return useMemo(() => resolveProjectConfigState(result), [result]);
|
|
106
108
|
};
|
|
107
|
-
export function KrakstackAuthProvider({ children,
|
|
109
|
+
export function KrakstackAuthProvider({ children, baseUrl, projectId, access, accessLabels, }) {
|
|
110
|
+
const locale = resolveKrakstackAuthLocale(useKrakstackLocale());
|
|
108
111
|
const searchString = useRouterState({
|
|
109
112
|
select: (state) => state.location.searchStr,
|
|
110
113
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krak-stack/auth",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"description": "Effect HttpApi clients and schemas for KrakStack Auth.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -76,11 +76,14 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@effect/atom-react": "4.0.0-rc.112",
|
|
79
|
-
"@krak-stack/registry": "^0.1.33",
|
|
80
79
|
"@lucas-barake/effect-form-react": "0.26.0-beta.5",
|
|
81
80
|
"react-qr-code": "^2.2.0"
|
|
82
81
|
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@krak-stack/registry": "0.1.34"
|
|
84
|
+
},
|
|
83
85
|
"peerDependencies": {
|
|
86
|
+
"@krak-stack/registry": "^0.1.34",
|
|
84
87
|
"@tanstack/react-router": "^1.170.15",
|
|
85
88
|
"effect": "4.0.0-rc.112",
|
|
86
89
|
"input-otp": "^1.5.0",
|