@smart-factor/gem-ui-components 0.0.128 → 0.0.130
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/SignEditor.js +1 -1
- package/dist/components/SessionModal/SessionModal.d.ts +9 -0
- package/dist/components/SessionModal/SessionModal.stories.d.ts +6 -0
- package/dist/components/SessionModal/SessionModal.styled.d.ts +1 -0
- package/dist/components/SessionModal/SessionService.d.ts +32 -0
- package/dist/components/SessionModal/index.d.ts +4 -0
- package/dist/components/SessionModal/useSessionInit.d.ts +14 -0
- package/dist/components/SessionModal/useSessionModalOpen.d.ts +1 -0
- package/dist/hooks/useDidUpdate.d.ts +6 -0
- package/dist/{index-17nbsih3.js → index-CsH3Q6kI.js} +3833 -3679
- package/dist/main.d.ts +1 -0
- package/dist/main.js +17 -14
- package/dist/services/mutations/auth/loginWithPassword.d.ts +6 -0
- package/package.json +1 -1
- package/dist/services/mutations/auth/useLoginWithPassword.d.ts +0 -10
package/dist/SignEditor.js
CHANGED
|
@@ -2,7 +2,7 @@ import './assets/SignEditor.css';var N4 = Object.defineProperty;
|
|
|
2
2
|
var I4 = (o, e, t) => e in o ? N4(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
3
|
var Eu = (o, e, t) => I4(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { jsx as Vt, jsxs as ia, Fragment as o_ } from "react/jsx-runtime";
|
|
5
|
-
import { G as Ib, u as i_, a as rA, Q as uc, b as hs, c as Lp, D as KE, B as sp, d as ow, e as M4, z as Dc, f as a_, s as $E, I as Of, A as WE, F as O4, U as Ax, g as q4, h as R4, i as Q4, j as G4, T as V4, K as D4, k as H4 } from "./index-
|
|
5
|
+
import { G as Ib, u as i_, a as rA, Q as uc, b as hs, c as Lp, D as KE, B as sp, d as ow, e as M4, z as Dc, f as a_, s as $E, I as Of, A as WE, F as O4, U as Ax, g as q4, h as R4, i as Q4, j as G4, T as V4, K as D4, k as H4 } from "./index-CsH3Q6kI.js";
|
|
6
6
|
import { q as XE, s as Di, I as tu, J as r_, H as YE, S as lp } from "./Stack-Bsa5WF4E.js";
|
|
7
7
|
import { createContext as U4, useContext as z4, useState as vl, useCallback as zu, useEffect as oc, useMemo as cp, useRef as K4 } from "react";
|
|
8
8
|
import "react-dom";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type SessionModalProps = {
|
|
2
|
+
/** When false, the modal is never shown, regardless of session state. */
|
|
3
|
+
activated?: boolean;
|
|
4
|
+
onSessionRenewed?: () => void;
|
|
5
|
+
onSessionTerminated?: () => void;
|
|
6
|
+
onSessionRenewClick?: () => void;
|
|
7
|
+
whitelist?: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare const SessionModal: import('react').ComponentType<SessionModalProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ContentWrapper: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type SessionMessage = {
|
|
2
|
+
type: 'terminated';
|
|
3
|
+
} | {
|
|
4
|
+
type: 'initiated';
|
|
5
|
+
};
|
|
6
|
+
export declare class SessionService {
|
|
7
|
+
static channelName: string;
|
|
8
|
+
private static channel;
|
|
9
|
+
static readonly SESSION_TERMINATED_REASON = "session-terminated";
|
|
10
|
+
static readonly IS_AUTHENTICATED_KEY = "isAuthenticated";
|
|
11
|
+
static readonly X_AUTH_LOGIN_KEY = "x-auth-login";
|
|
12
|
+
static readonly X_AUTH_TOKEN_KEY = "x-auth-token";
|
|
13
|
+
/**
|
|
14
|
+
* Returns true if the current page was opened because of session termination
|
|
15
|
+
* (e.g. user clicked "Renew session" in the SessionModal).
|
|
16
|
+
*/
|
|
17
|
+
static wasOpenedDueToSessionTermination(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Marks the session as terminated (isAuthenticated = false), clears auth data,
|
|
20
|
+
* and broadcasts so the SessionModal opens.
|
|
21
|
+
*/
|
|
22
|
+
static terminate(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Initializes session: logs in with credentials (via auth API), then broadcasts renewed.
|
|
25
|
+
* Use this as the single entry point for "log in" so session is steered only from SessionService.
|
|
26
|
+
*/
|
|
27
|
+
static init(login: string, password: string): Promise<{
|
|
28
|
+
login: string;
|
|
29
|
+
token: string;
|
|
30
|
+
}>;
|
|
31
|
+
static isSessionTerminated(): boolean;
|
|
32
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MutationOptions, UseMutationResult } from '@tanstack/react-query';
|
|
2
|
+
export type SessionInitVariables = {
|
|
3
|
+
login: string;
|
|
4
|
+
password: string;
|
|
5
|
+
};
|
|
6
|
+
export type SessionInitResult = {
|
|
7
|
+
login: string;
|
|
8
|
+
token: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Hook to initialize session (log in) via SessionService.init.
|
|
12
|
+
* Use this so session is steered only from SessionService; no direct auth usage in UI.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useSessionInit(options?: MutationOptions<SessionInitResult, Error, SessionInitVariables, unknown>): UseMutationResult<SessionInitResult, Error, SessionInitVariables, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useSessionModalOpen: (initialValue: boolean, whitelist?: string[]) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs callback when `value` changes (skips initial mount).
|
|
3
|
+
* @param value - value to watch (can be primitive or object)
|
|
4
|
+
* @param onDidUpdate - called with previous and current value when value changes
|
|
5
|
+
*/
|
|
6
|
+
export default function useDidUpdate<T>(value: T, onDidUpdate: (prev: T, next: T) => void): void;
|