@jsb188/app 1.1.4 → 1.1.6
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/constants/app.ts +340 -24
- package/constants/other.ts +17 -0
- package/constants/wsActions.ts +21 -0
- package/i18n/{user.ts → account.ts} +21 -38
- package/i18n/app.ts +4 -18
- package/i18n/auth.ts +33 -9
- package/i18n/billing.ts +1 -1
- package/i18n/datetime.ts +57 -18
- package/i18n/error.ts +32 -18
- package/i18n/form.ts +192 -3
- package/main.ts +2 -2
- package/package.json +6 -4
- package/types/account.d.ts +63 -0
- package/types/ai.d.ts +3 -0
- package/types/app.d.ts +26 -1
- package/types/auth.d.ts +6 -1
- package/types/form.d.ts +9 -3
- package/types/other.d.ts +61 -0
- package/utils/action.ts +28 -0
- package/utils/api.ts +1 -1
- package/utils/datetime.ts +417 -56
- package/utils/logic.ts +60 -9
- package/utils/number.ts +160 -8
- package/utils/object.ts +291 -71
- package/utils/string.ts +183 -21
- package/utils/timeZone.ts +612 -436
- package/utils/url_client.ts +17 -22
- package/utils/user.ts +1 -126
- package/constants/organization.ts +0 -8
- package/constants/ws.ts +0 -47
- package/types/organization.d.ts +0 -40
- package/types/user.d.ts +0 -52
package/types/form.d.ts
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
* Types; form schema
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
interface
|
|
6
|
+
interface SchemaItemAny {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
__typename?: string;
|
|
7
9
|
setter?: (currentData?: any, dataForSchema?: any) => any;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export interface FormItemSchemaObj {
|
|
11
|
-
__type: 'group' | 'input' | 'password' | 'textarea' | '
|
|
13
|
+
__type: 'subtitle' | 'group' | 'input' | 'section_title' | 'input_click' | 'input_w_button' | 'input_time_from_date' | 'password' | 'textarea' | 'none' | string;
|
|
12
14
|
autoFocus?: boolean;
|
|
13
15
|
disabled?: boolean;
|
|
14
16
|
hidden?: boolean | ((dataForSchema: any) => boolean);
|
|
@@ -16,7 +18,7 @@ export interface FormItemSchemaObj {
|
|
|
16
18
|
labelClassName?: string;
|
|
17
19
|
listenToInput?: boolean;
|
|
18
20
|
value?: any;
|
|
19
|
-
item:
|
|
21
|
+
item: SchemaItemAny;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
interface SchemaRule {
|
|
@@ -45,6 +47,10 @@ interface FormGroupType {
|
|
|
45
47
|
|
|
46
48
|
export interface FormItemIfaceObj extends FormItemSchemaObj {
|
|
47
49
|
name: string;
|
|
50
|
+
preset?: string;
|
|
51
|
+
className?: string;
|
|
52
|
+
inputClassName?: string;
|
|
53
|
+
focusStyle?: string;
|
|
48
54
|
hidden?: boolean | ((dataForSchema: any) => boolean);
|
|
49
55
|
locked?: boolean | ((dataForSchema: any) => boolean);
|
|
50
56
|
formValues: any;
|
package/types/other.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DAY_OF_WEEK, SCHEDULE_FREQUENCY } from '../constants/other.ts';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enums
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type DayOfWeekEnum = typeof DAY_OF_WEEK[number];
|
|
8
|
+
export type ScheduleFrequencyEnum = typeof SCHEDULE_FREQUENCY[number];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Storage
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export interface StorageData {
|
|
15
|
+
__table: 'storage';
|
|
16
|
+
id: number;
|
|
17
|
+
organizationId: number | null;
|
|
18
|
+
accountId: number | null;
|
|
19
|
+
uri: string;
|
|
20
|
+
size: number;
|
|
21
|
+
checked: boolean;
|
|
22
|
+
at: Date;
|
|
23
|
+
contentType: string;
|
|
24
|
+
values: string[] | null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Address
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
export interface AddressObj {
|
|
32
|
+
line1: string;
|
|
33
|
+
line2?: string | null;
|
|
34
|
+
city: string;
|
|
35
|
+
state: string;
|
|
36
|
+
postalCode: string;
|
|
37
|
+
country: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Schedule
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
export interface ScheduleObj {
|
|
45
|
+
frequency: ScheduleFrequencyEnum;
|
|
46
|
+
weeksOfMonth?: number[];
|
|
47
|
+
daysOfWeek?: (0 | 1 | 2 | 3 | 4 | 5 | 6)[];
|
|
48
|
+
time?: [
|
|
49
|
+
string?, // Star time "hhmm" format
|
|
50
|
+
string?, // End time "hhmm" format (optional)
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* File object
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
export interface FileObj {
|
|
59
|
+
buffer: Uint8Array;
|
|
60
|
+
contentType: string;
|
|
61
|
+
}
|
package/utils/action.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ActionCategoryEnum } from '@jsb188/mday/types/action.d';
|
|
2
|
+
import type { LogActivityEnum } from '@jsb188/mday/types/log.d';
|
|
3
|
+
import type { OrganizationOperationEnum } from '../types/organization.d.ts';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Enums
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const ACTION_STATUS_ENUMS = [
|
|
10
|
+
'SCHEDULED',
|
|
11
|
+
'STARTED',
|
|
12
|
+
'COMPLETED',
|
|
13
|
+
'ERRORED',
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get aggregated action types to log activities
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export function getAggregatedActivities(
|
|
21
|
+
operation: OrganizationOperationEnum,
|
|
22
|
+
actionCategory: ActionCategoryEnum,
|
|
23
|
+
): LogActivityEnum[] {
|
|
24
|
+
|
|
25
|
+
return [
|
|
26
|
+
'MARKET_CREDIT_RECEIPT',
|
|
27
|
+
];
|
|
28
|
+
}
|
package/utils/api.ts
CHANGED
|
@@ -72,7 +72,7 @@ export function normalizeServerError(error?: any): ServerErrorObj {
|
|
|
72
72
|
|
|
73
73
|
if (!message) {
|
|
74
74
|
if (i18nErrCodeExists(errorCode)) {
|
|
75
|
-
message = i18n.t(`error.${errorCode}`, { value: errorValue });
|
|
75
|
+
message = i18n.t(`error.${errorCode}`, { value: errorValue, smart_count: Number(errorValue) });
|
|
76
76
|
} else {
|
|
77
77
|
message = i18n.t('error.unknown_error');
|
|
78
78
|
}
|