@jsb188/app 1.1.9 → 1.1.11
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/package.json +54 -45
- package/src/constants/agent.ts +58 -25
- package/src/constants/app.ts +18 -14
- package/src/constants/billing.ts +92 -92
- package/src/constants/emoji.ts +9144 -8936
- package/src/constants/other.ts +1 -5
- package/src/constants/user.ts +16 -25
- package/src/constants/wsActions.ts +35 -0
- package/src/i18n/account.ts +129 -107
- package/src/i18n/agent.ts +63 -43
- package/src/i18n/agentDoc.ts +110 -0
- package/src/i18n/app.ts +101 -91
- package/src/i18n/auth.ts +119 -102
- package/src/i18n/billing.ts +73 -78
- package/src/i18n/campaign.ts +217 -0
- package/src/i18n/country.ts +248 -248
- package/src/i18n/datetime.ts +26 -26
- package/src/i18n/error.ts +428 -182
- package/src/i18n/field_docs.ts +28 -0
- package/src/i18n/form.ts +464 -344
- package/src/i18n/index.ts +25 -18
- package/src/i18n/log.ts +53 -213
- package/src/i18n/memory.ts +39 -0
- package/src/i18n/message.ts +3 -4
- package/src/i18n/note.ts +17 -0
- package/src/i18n/org.ts +115 -109
- package/src/i18n/sheet.ts +376 -4
- package/src/i18n/workflow.ts +70 -23
- package/src/main.ts +66 -62
- package/src/platform.ts +25 -24
- package/src/types/ai.d.ts +33 -23
- package/src/types/app.d.ts +95 -37
- package/src/types/auth.d.ts +66 -40
- package/src/types/console.d.ts +3 -0
- package/src/types/form.d.ts +65 -61
- package/src/types/other.d.ts +6 -6
- package/src/types.d.ts +12 -14
- package/src/utils/account.ts +64 -58
- package/src/utils/api.ts +280 -77
- package/src/utils/authSession.ts +24 -0
- package/src/utils/billing.ts +110 -103
- package/src/utils/color.ts +202 -0
- package/src/utils/cron.ts +49 -18
- package/src/utils/datetime.ts +255 -103
- package/src/utils/emoji.ts +107 -84
- package/src/utils/expression.ts +867 -0
- package/src/utils/interval.ts +80 -0
- package/src/utils/logic.ts +209 -36
- package/src/utils/managedSession.ts +34 -0
- package/src/utils/managedSessionBff.test.ts +60 -0
- package/src/utils/managedSessionBff.ts +117 -0
- package/src/utils/number.ts +60 -32
- package/src/utils/object.ts +198 -30
- package/src/utils/promise.ts +27 -0
- package/src/utils/queryReset.ts +179 -0
- package/src/utils/recurringTask.ts +60 -0
- package/src/utils/schema.ts +293 -0
- package/src/utils/string.test.ts +220 -208
- package/src/utils/string.ts +471 -438
- package/src/utils/timeZone.ts +309 -851
- package/src/utils/url_client.ts +73 -69
- package/tsconfig.json +10 -10
- package/src/i18n/product.ts +0 -76
package/src/platform.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
const PLATFORM_HANDLERS: Record<string, any> = {};
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -6,7 +5,7 @@ const PLATFORM_HANDLERS: Record<string, any> = {};
|
|
|
6
5
|
*/
|
|
7
6
|
|
|
8
7
|
export function getPlatform(): 'WEB' | 'MOBILE' | 'UNKNOWN' {
|
|
9
|
-
|
|
8
|
+
return PLATFORM_HANDLERS?.getPlatform?.() || 'UNKNOWN';
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -14,7 +13,7 @@ export function getPlatform(): 'WEB' | 'MOBILE' | 'UNKNOWN' {
|
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
export const fetchAuthToken = (cb: (token: string | null) => void): void => {
|
|
17
|
-
|
|
16
|
+
return PLATFORM_HANDLERS?.fetchAuthToken?.(cb) || cb(null);
|
|
18
17
|
};
|
|
19
18
|
|
|
20
19
|
/**
|
|
@@ -22,7 +21,7 @@ export const fetchAuthToken = (cb: (token: string | null) => void): void => {
|
|
|
22
21
|
*/
|
|
23
22
|
|
|
24
23
|
export const deleteAuthToken = (): void => {
|
|
25
|
-
|
|
24
|
+
return PLATFORM_HANDLERS?.deleteAuthToken?.();
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
/**
|
|
@@ -30,7 +29,7 @@ export const deleteAuthToken = (): void => {
|
|
|
30
29
|
*/
|
|
31
30
|
|
|
32
31
|
export function saveAuthTokenToPlatform(token: string, cb: () => void) {
|
|
33
|
-
|
|
32
|
+
return PLATFORM_HANDLERS?.saveAuthTokenToPlatform?.(token, cb) || cb();
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
/**
|
|
@@ -39,7 +38,7 @@ export function saveAuthTokenToPlatform(token: string, cb: () => void) {
|
|
|
39
38
|
*/
|
|
40
39
|
|
|
41
40
|
export function clearAppCache() {
|
|
42
|
-
|
|
41
|
+
return PLATFORM_HANDLERS?.clearAppCache?.();
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
/**
|
|
@@ -47,10 +46,12 @@ export function clearAppCache() {
|
|
|
47
46
|
*/
|
|
48
47
|
|
|
49
48
|
export const fetchLightModeSetting = (
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
accountId: number | null,
|
|
50
|
+
cb: (lightMode: string) => void,
|
|
52
51
|
): void => {
|
|
53
|
-
|
|
52
|
+
return (
|
|
53
|
+
PLATFORM_HANDLERS?.fetchLightModeSetting?.(accountId, cb) || cb('SYSTEM')
|
|
54
|
+
);
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
/**
|
|
@@ -58,7 +59,7 @@ export const fetchLightModeSetting = (
|
|
|
58
59
|
*/
|
|
59
60
|
|
|
60
61
|
export function getOS() {
|
|
61
|
-
|
|
62
|
+
return PLATFORM_HANDLERS?.getOS?.();
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
/**
|
|
@@ -66,7 +67,7 @@ export function getOS() {
|
|
|
66
67
|
*/
|
|
67
68
|
|
|
68
69
|
export function updateAppTheme(lightMode: string, theme: string) {
|
|
69
|
-
|
|
70
|
+
return PLATFORM_HANDLERS?.updateAppTheme?.(lightMode, theme);
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
/**
|
|
@@ -74,7 +75,7 @@ export function updateAppTheme(lightMode: string, theme: string) {
|
|
|
74
75
|
*/
|
|
75
76
|
|
|
76
77
|
export function getLocalLastVersion(accountId: string) {
|
|
77
|
-
|
|
78
|
+
return PLATFORM_HANDLERS?.getLocalLastVersion?.(accountId);
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
/**
|
|
@@ -82,7 +83,7 @@ export function getLocalLastVersion(accountId: string) {
|
|
|
82
83
|
*/
|
|
83
84
|
|
|
84
85
|
export function saveLocalLastVersion(accountId: string, version: string) {
|
|
85
|
-
|
|
86
|
+
return PLATFORM_HANDLERS?.saveLocalLastVersion?.(accountId, version);
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
/**
|
|
@@ -90,7 +91,7 @@ export function saveLocalLastVersion(accountId: string, version: string) {
|
|
|
90
91
|
*/
|
|
91
92
|
|
|
92
93
|
export function getFileInputObject(fileInput: File) {
|
|
93
|
-
|
|
94
|
+
return PLATFORM_HANDLERS?.getFileInputObject?.(fileInput) || fileInput;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
/**
|
|
@@ -98,7 +99,7 @@ export function getFileInputObject(fileInput: File) {
|
|
|
98
99
|
*/
|
|
99
100
|
|
|
100
101
|
export function getBufferDataFromFile(file: any) {
|
|
101
|
-
|
|
102
|
+
return PLATFORM_HANDLERS?.getBufferDataFromFile?.(file) || file;
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
/**
|
|
@@ -106,7 +107,7 @@ export function getBufferDataFromFile(file: any) {
|
|
|
106
107
|
*/
|
|
107
108
|
|
|
108
109
|
export function isSystemDarkMode() {
|
|
109
|
-
|
|
110
|
+
return PLATFORM_HANDLERS?.isSystemDarkMode?.();
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
/**
|
|
@@ -114,12 +115,12 @@ export function isSystemDarkMode() {
|
|
|
114
115
|
*/
|
|
115
116
|
|
|
116
117
|
export function registerPlatformHandlers(handlers: Record<string, any>) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
for (const key in handlers) {
|
|
119
|
+
if (
|
|
120
|
+
Object.prototype.hasOwnProperty.call(handlers, key) &&
|
|
121
|
+
typeof handlers[key] === 'function'
|
|
122
|
+
) {
|
|
123
|
+
PLATFORM_HANDLERS[key] = handlers[key];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
125
126
|
}
|
package/src/types/ai.d.ts
CHANGED
|
@@ -1,34 +1,44 @@
|
|
|
1
|
-
|
|
2
1
|
// AI chat types
|
|
3
2
|
|
|
4
|
-
export type AIChatMessageType =
|
|
3
|
+
export type AIChatMessageType =
|
|
4
|
+
| 'MESSAGE'
|
|
5
|
+
| 'SMS'
|
|
6
|
+
| 'IMAGE'
|
|
7
|
+
| 'FILE'
|
|
8
|
+
| 'SMS_IMAGE'
|
|
9
|
+
| 'SMS_FILE'
|
|
10
|
+
| 'TRANSCRIBED_MESSAGE'
|
|
11
|
+
| 'FUNCTION_CALL'
|
|
12
|
+
| 'FUNCTION_CALL_OUTPUT';
|
|
5
13
|
|
|
6
14
|
// AI events
|
|
7
15
|
|
|
8
16
|
export type AIEventErrorName =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
| 'AI_EVENT_UNKNOWN_ERR'
|
|
18
|
+
| 'AI_EVENT_DEVELOPER_ERR'
|
|
19
|
+
| 'AI_EVENT_NO_ACCESS'
|
|
20
|
+
| 'AI_COULD_NOT_RESOLVE'
|
|
21
|
+
| 'AI_CONTEXT_ERR'
|
|
22
|
+
| 'AI_ORG_ACL_FAILED'
|
|
23
|
+
| 'SETUP_INCOMPLETE_ORG'
|
|
24
|
+
| 'MISSING_API_KEY'
|
|
25
|
+
| 'LLM_PROVIDER_NOT_FOUND'
|
|
26
|
+
| 'LLM_SERVICE_ERR'
|
|
27
|
+
| 'MODERATION_MISSING'
|
|
28
|
+
| 'MODERATION_SERVICE_ERR'
|
|
29
|
+
| 'UNKNOWN_LLM_ERR'
|
|
30
|
+
| 'TWILIO_API_ERR'
|
|
31
|
+
| 'UNFINISHED_LOGIC';
|
|
24
32
|
|
|
25
33
|
// AI chat
|
|
26
34
|
|
|
27
35
|
export interface AIChatData {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
id: string;
|
|
37
|
+
organizationId: string | null;
|
|
38
|
+
calDate: string | null;
|
|
39
|
+
summary: string;
|
|
40
|
+
userManagedSummary: boolean;
|
|
41
|
+
archivedAt: string | null;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
updatedAt: string;
|
|
34
44
|
}
|
package/src/types/app.d.ts
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { COLORS } from '../constants/app.ts';
|
|
2
|
+
import type { QueryResetTarget } from '../utils/queryReset.ts';
|
|
2
3
|
|
|
3
4
|
// Modal; App settings
|
|
4
5
|
|
|
5
6
|
export interface EditIfaceModalProps {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
containerClassName: string;
|
|
8
|
+
saveCounter: number;
|
|
9
|
+
saving: boolean;
|
|
10
|
+
hasChanges: boolean;
|
|
11
|
+
openModalPopUp: (opts: any) => void;
|
|
12
|
+
onChangeDiff: (diff: boolean) => void;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export interface EditUserModalProps extends EditIfaceModalProps {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
user: any;
|
|
17
|
+
editUser: (obj: object) => void;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export interface EditUserPlusModalProps extends EditIfaceModalProps {
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
user: any;
|
|
22
|
+
editUserPlus: (obj: object) => void;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
// App types
|
|
25
26
|
|
|
26
27
|
export type DarkOrLightEnum = 'light' | 'dark';
|
|
27
28
|
|
|
28
|
-
export type ColorEnum = typeof COLORS[number];
|
|
29
|
+
export type ColorEnum = (typeof COLORS)[number];
|
|
29
30
|
|
|
30
31
|
// Stripe types
|
|
31
32
|
|
|
@@ -34,43 +35,100 @@ export type PlatformProductGroupEnum = 'PERKS' | 'PLUS' | 'PRO' | 'COINS';
|
|
|
34
35
|
// Server/API related types
|
|
35
36
|
|
|
36
37
|
export interface ServerErrorObj {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
statusCode: number;
|
|
39
|
+
errorCode: string;
|
|
40
|
+
errorValue?: string;
|
|
41
|
+
iconName?: string;
|
|
42
|
+
title: string;
|
|
43
|
+
message: string;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
export interface SimpleErrorType {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
iconName?: string;
|
|
48
|
+
title?: string;
|
|
49
|
+
message: string;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
// Web Socket events
|
|
52
53
|
|
|
53
|
-
export type ResetQueryRuleEnum =
|
|
54
|
+
export type ResetQueryRuleEnum =
|
|
55
|
+
| 'ALWAYS'
|
|
56
|
+
| 'IF_FRAGMENT_NOT_FOUND'
|
|
57
|
+
| 'IF_FRAGMENT_FOUND'
|
|
58
|
+
| 'NEVER'
|
|
59
|
+
| 'RESET_ONLY';
|
|
54
60
|
export type AppendRuleEnum = 'APPEND_NEW' | 'APPEND_AT_END' | 'APPEND_AT_FRONT';
|
|
55
61
|
|
|
62
|
+
export interface DataTableChangeWSMeta {
|
|
63
|
+
batchId: string;
|
|
64
|
+
organizationId: string;
|
|
65
|
+
dataTableId: string;
|
|
66
|
+
fromSeq: string;
|
|
67
|
+
toSeq: string;
|
|
68
|
+
chunkIndex: number;
|
|
69
|
+
chunkCount: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type DataTableWriteOrderWS =
|
|
73
|
+
| {
|
|
74
|
+
kind: 'CELL';
|
|
75
|
+
dataTableRowId: string;
|
|
76
|
+
cellKey: string;
|
|
77
|
+
serverSeq: string;
|
|
78
|
+
tombstone: boolean;
|
|
79
|
+
}
|
|
80
|
+
| {
|
|
81
|
+
kind: 'DESIGN';
|
|
82
|
+
property:
|
|
83
|
+
| 'CELLS_ORDER'
|
|
84
|
+
| 'FORMAT'
|
|
85
|
+
| 'HUMAN_LABEL'
|
|
86
|
+
| 'ROW_IDENTIFIER'
|
|
87
|
+
| 'WIDTH';
|
|
88
|
+
targetKey: string;
|
|
89
|
+
targetType: 'CELL' | 'TABLE';
|
|
90
|
+
serverSeq: string;
|
|
91
|
+
tombstone: boolean;
|
|
92
|
+
}
|
|
93
|
+
| {
|
|
94
|
+
kind: 'ROW';
|
|
95
|
+
dataTableRowId: string;
|
|
96
|
+
serverSeq: string;
|
|
97
|
+
tombstone: boolean;
|
|
98
|
+
};
|
|
99
|
+
|
|
56
100
|
export interface WSDataUpdateObj {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
101
|
+
id: string;
|
|
102
|
+
route: string[]; // First items in the array have priority (Different org operations may not allow the actions handled by other org operations)
|
|
103
|
+
message?: string | null; // If null, nothing will be visible to the client.
|
|
104
|
+
messageType: 'NORMAL' | 'SUCCESS' | 'ERROR';
|
|
105
|
+
resetQueries?: QueryResetTarget[]; // Structured query reset targets
|
|
106
|
+
resetQueryRule?: ResetQueryRuleEnum; // Defaults to "IF_FRAGMENT_FOUND"
|
|
107
|
+
reactiveFragmentKeys?: string[]; // Fragment keys that are used to trigger reactivity
|
|
108
|
+
dataTableChange?: DataTableChangeWSMeta; // Exact journal range/chunk contract
|
|
109
|
+
dataTableSnapshotRequired?: boolean; // Full snapshot must be awaited before this range is considered converged
|
|
110
|
+
dataTableWriteOrders?: DataTableWriteOrderWS[]; // Committed per-target realtime authority
|
|
111
|
+
// Committed DataTable authority delivered to a Sheet data room so bridged
|
|
112
|
+
// region previews settle without the client joining the DataTable's room
|
|
113
|
+
sheetDataTableWriteOrders?: {
|
|
114
|
+
dataTableId: string;
|
|
115
|
+
organizationId: string;
|
|
116
|
+
orders: DataTableWriteOrderWS[];
|
|
117
|
+
};
|
|
118
|
+
authorizationContextChanged?: boolean; // Private memory/disk cache must be discarded and auth reloaded
|
|
119
|
+
fragments?:
|
|
120
|
+
| null
|
|
121
|
+
| ({
|
|
122
|
+
name: string;
|
|
123
|
+
dataId: string;
|
|
124
|
+
sequence?: string;
|
|
125
|
+
replaceId?: string; // Use this where client has a temporary ID that will be replaced by the server-side ID later
|
|
126
|
+
appendRule?: AppendRuleEnum | null;
|
|
127
|
+
data: any;
|
|
128
|
+
} | null)[];
|
|
71
129
|
}
|
|
72
130
|
|
|
73
131
|
export interface WSAppContextUpdateObj {
|
|
74
|
-
|
|
75
|
-
|
|
132
|
+
accountId: string;
|
|
133
|
+
updates: [any, any][];
|
|
76
134
|
}
|
package/src/types/auth.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { OrganizationShortData } from './organization.d.ts';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Auth enums
|
|
5
3
|
*/
|
|
@@ -12,42 +10,68 @@ export type LightModeEnum = 'LIGHT' | 'DARK' | 'SYSTEM';
|
|
|
12
10
|
*/
|
|
13
11
|
|
|
14
12
|
export interface AccountData {
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
id: string;
|
|
14
|
+
deleted: boolean;
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
plus: any; // placeholder for later
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
settings: AccountSettings;
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
profile: {
|
|
21
|
+
id: string;
|
|
22
|
+
firstName: string;
|
|
23
|
+
lastName: string;
|
|
24
|
+
photoId: string;
|
|
25
|
+
photoUri: string;
|
|
26
|
+
};
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
email: {
|
|
29
|
+
id: string;
|
|
30
|
+
address: string;
|
|
31
|
+
verified: boolean;
|
|
32
|
+
};
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
phone: {
|
|
35
|
+
id: string;
|
|
36
|
+
number: string;
|
|
37
|
+
verified: boolean;
|
|
38
|
+
};
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
export interface AccountSettings {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
theme: string | null;
|
|
43
|
+
language: string;
|
|
44
|
+
lightMode: LightModeEnum;
|
|
45
|
+
timeZone: string | null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface AccountSessionOrganizationAuthorizationData {
|
|
49
|
+
id: string;
|
|
50
|
+
organizationId: string;
|
|
51
|
+
ssoConnectionId?: string | null;
|
|
52
|
+
authorizationMethod: string;
|
|
53
|
+
authorizedAt: string;
|
|
54
|
+
lastActivityAt?: string | null;
|
|
55
|
+
revokedAt?: string | null;
|
|
56
|
+
revokeReason?: string | null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface AccountSessionData {
|
|
60
|
+
id: string;
|
|
61
|
+
accountId: string;
|
|
62
|
+
authMethod: string;
|
|
63
|
+
deviceName?: string | null;
|
|
64
|
+
userAgent?: string | null;
|
|
65
|
+
createdIpAddress?: string | null;
|
|
66
|
+
lastIpAddress?: string | null;
|
|
67
|
+
createdAt: string;
|
|
68
|
+
lastActivityAt: string;
|
|
69
|
+
idleExpiresAt: string;
|
|
70
|
+
absoluteExpiresAt: string;
|
|
71
|
+
revokedAt?: string | null;
|
|
72
|
+
revokeReason?: string | null;
|
|
73
|
+
current: boolean;
|
|
74
|
+
organizationAuthorizations: AccountSessionOrganizationAuthorizationData[];
|
|
51
75
|
}
|
|
52
76
|
|
|
53
77
|
/**
|
|
@@ -55,14 +79,16 @@ export interface AccountSettings {
|
|
|
55
79
|
*/
|
|
56
80
|
|
|
57
81
|
export interface AuthenticationData {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
82
|
+
token: string | null;
|
|
83
|
+
sessionBootstrapToken?: string | null;
|
|
84
|
+
cacheAuthorizationEpoch?: string | null;
|
|
85
|
+
timeZone: string | null;
|
|
86
|
+
account: AccountData | null;
|
|
87
|
+
settings: AccountSettings | null;
|
|
88
|
+
primaryOrganizationId: string | null;
|
|
89
|
+
activated: boolean;
|
|
90
|
+
hasPassword: boolean;
|
|
91
|
+
webVersion: string;
|
|
92
|
+
mobileVersion: string;
|
|
93
|
+
alertUpdatesOnMount: boolean;
|
|
68
94
|
}
|
package/src/types/form.d.ts
CHANGED
|
@@ -1,63 +1,64 @@
|
|
|
1
|
+
import type { ChangeEvent, FormEvent, KeyboardEvent, MouseEvent } from 'react';
|
|
1
2
|
|
|
2
3
|
/**
|
|
3
4
|
* Types; form schema
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
export type FormValuesObj = {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
__errorFields?: string[];
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export type FormValueSetter<TFormValues extends FormValuesObj = any> = (
|
|
12
|
-
|
|
13
|
+
values: TFormValues | ((prev: TFormValues) => TFormValues),
|
|
13
14
|
) => void;
|
|
14
15
|
|
|
15
16
|
export type FormItemType =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
| 'subtitle'
|
|
18
|
+
| 'break'
|
|
19
|
+
| 'group'
|
|
20
|
+
| 'input'
|
|
21
|
+
| 'section_title'
|
|
22
|
+
| 'input_click'
|
|
23
|
+
| 'input_w_button'
|
|
24
|
+
| 'input_time_from_date'
|
|
25
|
+
| 'password'
|
|
26
|
+
| 'textarea'
|
|
27
|
+
| 'none'
|
|
28
|
+
| (string & {});
|
|
28
29
|
|
|
29
30
|
interface SchemaItemAny<TCurrentData = any, TDataForSchema = any> {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
__typename?: string;
|
|
33
|
+
setter?: (currentData?: TCurrentData, dataForSchema?: TDataForSchema) => any;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export interface FormItemSchemaObj<TCurrentData = any, TDataForSchema = any> {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
__type: FormItemType;
|
|
38
|
+
autoFocus?: boolean;
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
hidden?: boolean | ((dataForSchema: TDataForSchema) => boolean);
|
|
41
|
+
locked?: boolean | ((dataForSchema: TDataForSchema) => boolean);
|
|
42
|
+
labelClassName?: string;
|
|
43
|
+
listenToInput?: boolean;
|
|
44
|
+
value?: any;
|
|
45
|
+
item: SchemaItemAny<TCurrentData, TDataForSchema>;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
interface SchemaRule<TFormValues extends FormValuesObj = any> {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
49
|
+
for: string;
|
|
50
|
+
rule: (value: any, formValues: TFormValues) => boolean;
|
|
51
|
+
error: any;
|
|
52
|
+
}
|
|
52
53
|
|
|
53
54
|
export interface FormSchemaObj<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
TFormValues extends FormValuesObj = any,
|
|
56
|
+
TCurrentData = any,
|
|
57
|
+
TDataForSchema = any,
|
|
57
58
|
> {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
listData: FormItemSchemaObj<TCurrentData, TDataForSchema>[];
|
|
60
|
+
rules?: SchemaRule<TFormValues>[];
|
|
61
|
+
isButtonDisabled?: (formValues: TFormValues) => boolean;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
/**
|
|
@@ -65,33 +66,36 @@ export interface FormSchemaObj<
|
|
|
65
66
|
*/
|
|
66
67
|
|
|
67
68
|
interface FormGroupType<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
TFormValues extends FormValuesObj = any,
|
|
70
|
+
TCurrentData = any,
|
|
71
|
+
TDataForSchema = any,
|
|
71
72
|
> {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
id?: string;
|
|
74
|
+
name: string;
|
|
75
|
+
label?: string;
|
|
76
|
+
value: string | number | null;
|
|
77
|
+
items: Array<FormItemIfaceObj<TFormValues, TCurrentData, TDataForSchema>>;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
export interface FormItemIfaceObj<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
TFormValues extends FormValuesObj = any,
|
|
82
|
+
TCurrentData = any,
|
|
83
|
+
TDataForSchema = any,
|
|
83
84
|
> extends FormItemSchemaObj<TCurrentData, TDataForSchema> {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
85
|
+
name: string;
|
|
86
|
+
preset?: string;
|
|
87
|
+
className?: string;
|
|
88
|
+
inputClassName?: string;
|
|
89
|
+
focusStyle?: string;
|
|
90
|
+
hidden?: boolean | ((dataForSchema: TDataForSchema) => boolean);
|
|
91
|
+
locked?: boolean | ((dataForSchema: TDataForSchema) => boolean);
|
|
92
|
+
formValues: TFormValues;
|
|
93
|
+
setFormValues: FormValueSetter<TFormValues>;
|
|
94
|
+
onInput?: (e: FormEvent, name: string) => void;
|
|
95
|
+
onKeyDown?: (e: KeyboardEvent, name: string) => void;
|
|
96
|
+
onSubmit?: (e: MouseEvent, name: string) => void;
|
|
97
|
+
onChange?: (
|
|
98
|
+
e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
|
|
99
|
+
name: string,
|
|
100
|
+
) => void;
|
|
97
101
|
}
|