@memobit/libs 3.11.2 → 3.12.0
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/components/Confetti/Confetti2.js +33 -33
- package/dist/components/ContextToast/ContextToast2.js +53 -57
- package/dist/components/ContextToast/useToast.js +12 -0
- package/dist/components/ControlPanel/ControlPanel2.js +41 -43
- package/dist/components/ControlPanel/ControlPanelContext.js +16 -21
- package/dist/components/ControlPanel/useControlPanel.js +11 -0
- package/dist/components/DataView/DataView.CardView.js +83 -109
- package/dist/components/DataView/DataView.MiniSort.js +1 -1
- package/dist/components/DataView/DataView.helpers.js +34 -0
- package/dist/components/DataView/DataView2.js +111 -108
- package/dist/components/Dropdown/Dropdown2.js +108 -106
- package/dist/components/InputEmail/InputEmail2.js +43 -43
- package/dist/components/InputEmail/validateEmail.js +7 -0
- package/dist/components/InputMask/InputMask2.js +40 -54
- package/dist/components/InputMask/InputMaskPresets.js +18 -0
- package/dist/components/Pagination/Pagination2.js +4 -4
- package/dist/components/QuickOptionUpdate/QuickOptionUpdate2.js +29 -28
- package/dist/components/Sidebar/Sidebar2.js +1 -1
- package/dist/components/Sidebar/SidebarContext.js +18 -23
- package/dist/components/Sidebar/useSidebar.js +11 -0
- package/dist/components/SuggestionsList/SuggestionsList2.js +27 -27
- package/dist/components/TimelineMarkers/TimelineMarkers2.js +31 -49
- package/dist/components/TimelineMarkers/calculateTimelineMarkers.js +28 -0
- package/dist/components/Toolbar/Toolbar2.js +6 -6
- package/dist/components/Tooltip/Tooltip2.js +35 -35
- package/dist/contexts/AuthContext/AuthContext.context.js +5 -0
- package/dist/contexts/AuthContext/AuthContext.js +59 -63
- package/dist/helpers/AppPersistenceStorage.js +25 -15
- package/dist/helpers/Http.js +76 -48
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/hooks/useAppPersistence.js +20 -20
- package/dist/hooks/useAuth/useAuth.js +1 -1
- package/dist/http.d.ts +4 -0
- package/dist/index.d.ts +13 -1
- package/dist/index.js +270 -262
- package/dist/version.js +2 -2
- package/dist/version.json +4 -4
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AppPersistenceStorage as
|
|
2
|
-
import { useCallback as
|
|
1
|
+
import { AppPersistenceStorage as r } from "../helpers/AppPersistenceStorage.js";
|
|
2
|
+
import { useCallback as c, useState as u } from "react";
|
|
3
3
|
function S(e, g) {
|
|
4
|
-
const
|
|
4
|
+
const [o] = u(() => ({
|
|
5
5
|
pages: g.pages ?? {},
|
|
6
6
|
theme: g.theme
|
|
7
|
-
}, [l,
|
|
8
|
-
|
|
7
|
+
})), [l, a] = u(() => r.load(e, o)), h = c((s, n) => {
|
|
8
|
+
a((t) => {
|
|
9
9
|
const m = {
|
|
10
10
|
...t,
|
|
11
11
|
pages: {
|
|
@@ -13,37 +13,37 @@ function S(e, g) {
|
|
|
13
13
|
[s]: n
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
return
|
|
16
|
+
return r.save(e, m), m;
|
|
17
17
|
});
|
|
18
|
-
}, [e]),
|
|
19
|
-
|
|
18
|
+
}, [e]), i = c((s) => {
|
|
19
|
+
a((n) => {
|
|
20
20
|
const t = {
|
|
21
21
|
...n,
|
|
22
22
|
theme: s
|
|
23
23
|
};
|
|
24
|
-
return
|
|
24
|
+
return r.save(e, t), t;
|
|
25
25
|
});
|
|
26
|
-
}, [e]),
|
|
27
|
-
|
|
26
|
+
}, [e]), x = c((s) => {
|
|
27
|
+
a((n) => {
|
|
28
28
|
const t = {
|
|
29
29
|
...n,
|
|
30
30
|
pages: {
|
|
31
31
|
...n.pages,
|
|
32
|
-
[s]:
|
|
32
|
+
[s]: o.pages[s]
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
return
|
|
35
|
+
return r.save(e, t), t;
|
|
36
36
|
});
|
|
37
|
-
}, [e]),
|
|
38
|
-
|
|
39
|
-
}, [e]);
|
|
37
|
+
}, [e, o]), A = c(() => {
|
|
38
|
+
a(o), r.clearAll(e);
|
|
39
|
+
}, [e, o]);
|
|
40
40
|
return {
|
|
41
41
|
pages: l.pages,
|
|
42
42
|
theme: l.theme,
|
|
43
|
-
setPage:
|
|
44
|
-
setTheme:
|
|
45
|
-
clearPage:
|
|
46
|
-
clearAll:
|
|
43
|
+
setPage: h,
|
|
44
|
+
setTheme: i,
|
|
45
|
+
clearPage: x,
|
|
46
|
+
clearAll: A
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
export {
|
package/dist/http.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare interface ApiClientConfig {
|
|
|
12
12
|
loginPath?: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/** A failed API request. `status` is the HTTP status, or 0 when the server could not be reached. */
|
|
15
16
|
export declare class ApiError extends Error {
|
|
16
17
|
readonly status: number;
|
|
17
18
|
constructor(message: string, status: number);
|
|
@@ -24,6 +25,9 @@ export declare const buildRequestHeaders: (method: HttpMethod, json?: boolean) =
|
|
|
24
25
|
* header on mutating requests, surfaces the server's `error` message, and on 401 navigates
|
|
25
26
|
* to the login page. The 401 path returns a promise that never settles so callers don't
|
|
26
27
|
* flash an error toast while the browser is already leaving the page.
|
|
28
|
+
*
|
|
29
|
+
* It reports unreachable-server, gateway and invalid-JSON failures to the hub, so callers
|
|
30
|
+
* only show a toast for API errors and don't log them again.
|
|
27
31
|
*/
|
|
28
32
|
export declare const createApiClient: ({ baseUrl, loginPath }: ApiClientConfig) => ApiClient;
|
|
29
33
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Context } from 'react';
|
|
|
4
4
|
import { CSSProperties } from 'react';
|
|
5
5
|
import { default as default_2 } from 'react';
|
|
6
6
|
import { ErrorInfo } from 'react';
|
|
7
|
+
import { ErrorReportContext } from '@memobit/core';
|
|
7
8
|
import { FC } from 'react';
|
|
8
9
|
import { FocusEvent as FocusEvent_2 } from 'react';
|
|
9
10
|
import { ForwardRefExoticComponent } from 'react';
|
|
@@ -125,6 +126,7 @@ export declare interface ApiClientConfig {
|
|
|
125
126
|
loginPath?: string;
|
|
126
127
|
}
|
|
127
128
|
|
|
129
|
+
/** A failed API request. `status` is the HTTP status, or 0 when the server could not be reached. */
|
|
128
130
|
export declare class ApiError extends Error {
|
|
129
131
|
readonly status: number;
|
|
130
132
|
constructor(message: string, status: number);
|
|
@@ -176,7 +178,7 @@ export declare interface AuthConfig {
|
|
|
176
178
|
appName?: string;
|
|
177
179
|
}
|
|
178
180
|
|
|
179
|
-
export declare const AuthContext:
|
|
181
|
+
export declare const AuthContext: Context<AuthContextValue | undefined>;
|
|
180
182
|
|
|
181
183
|
export declare interface AuthContextValue {
|
|
182
184
|
user: User | null;
|
|
@@ -1027,6 +1029,9 @@ declare interface CountryWithFlagProps {
|
|
|
1027
1029
|
* header on mutating requests, surfaces the server's `error` message, and on 401 navigates
|
|
1028
1030
|
* to the login page. The 401 path returns a promise that never settles so callers don't
|
|
1029
1031
|
* flash an error toast while the browser is already leaving the page.
|
|
1032
|
+
*
|
|
1033
|
+
* It reports unreachable-server, gateway and invalid-JSON failures to the hub, so callers
|
|
1034
|
+
* only show a toast for API errors and don't log them again.
|
|
1030
1035
|
*/
|
|
1031
1036
|
export declare const createApiClient: ({ baseUrl, loginPath }: ApiClientConfig) => ApiClient;
|
|
1032
1037
|
|
|
@@ -2387,6 +2392,13 @@ export declare interface LoginResponse {
|
|
|
2387
2392
|
method?: MfaMethod;
|
|
2388
2393
|
}
|
|
2389
2394
|
|
|
2395
|
+
/**
|
|
2396
|
+
* For the catch around an API call: reports `error` unless it is an `ApiError` (the client and
|
|
2397
|
+
* the backend already report those that matter) or an aborted request. What is left is a bug in
|
|
2398
|
+
* the code around the call, e.g. mapping the response.
|
|
2399
|
+
*/
|
|
2400
|
+
export declare const logUnexpectedError: (message: string, error: unknown, context?: ErrorReportContext) => void;
|
|
2401
|
+
|
|
2390
2402
|
export declare const matchStringsByLogicalOperator: (searchItems: string[], targetString: string, operator: LogicalOperator) => boolean;
|
|
2391
2403
|
|
|
2392
2404
|
export declare const MenuHamburger: FC<MenuHamburgerProps>;
|