@jsb188/app 1.1.10 → 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/utils/url_client.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type LinkType =
|
|
2
|
+
| 'USER'
|
|
3
|
+
| 'KAJI'
|
|
4
|
+
| 'DATASET'
|
|
5
|
+
| 'VOICE'
|
|
6
|
+
| 'FEED'
|
|
7
|
+
| 'ROOM'
|
|
8
|
+
| 'THREAD'
|
|
9
|
+
| 'OTHER';
|
|
3
10
|
|
|
4
11
|
// links to consider for User cards
|
|
5
12
|
// instagram
|
|
@@ -16,25 +23,25 @@ type LinkType = 'USER' | 'KAJI' | 'DATASET' | 'VOICE' | 'FEED' | 'ROOM' | 'THREA
|
|
|
16
23
|
*/
|
|
17
24
|
|
|
18
25
|
export function makeUploadsUrl(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
urlPath?: string | null,
|
|
27
|
+
size?: 'small' | 'medium' | 'original',
|
|
28
|
+
download?: boolean,
|
|
22
29
|
): string {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
if (!urlPath) {
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
const searchParams: string[] = [];
|
|
35
|
+
if (size) {
|
|
36
|
+
searchParams.push(`size=${encodeURIComponent(size)}`);
|
|
37
|
+
}
|
|
38
|
+
if (download) {
|
|
39
|
+
searchParams.push('download=1');
|
|
40
|
+
}
|
|
34
41
|
|
|
35
|
-
|
|
42
|
+
const searchPath = searchParams.length ? `?${searchParams.join('&')}` : '';
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
return 'https://assets.chiefhappiness.co/marketday/' + urlPath + searchPath;
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
/**
|
|
@@ -42,7 +49,7 @@ export function makeUploadsUrl(
|
|
|
42
49
|
*/
|
|
43
50
|
|
|
44
51
|
export function makeStaticAssetUrl(urlPath?: string | null): string {
|
|
45
|
-
|
|
52
|
+
return 'https://assets.chiefhappiness.co/marketday/static/' + urlPath;
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
/**
|
|
@@ -50,28 +57,25 @@ export function makeStaticAssetUrl(urlPath?: string | null): string {
|
|
|
50
57
|
*/
|
|
51
58
|
|
|
52
59
|
export function makeChatUrl(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
firstChatId?: string | null,
|
|
61
|
+
secondChatId?: string | null,
|
|
62
|
+
nextFirstChatId?: string | null,
|
|
63
|
+
nextSecondChatId?: string | null,
|
|
57
64
|
) {
|
|
58
|
-
|
|
65
|
+
const path = 'chat';
|
|
59
66
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
) {
|
|
64
|
-
return `/${path}/${firstChatId}/${secondChatId}`;
|
|
65
|
-
}
|
|
67
|
+
if (nextFirstChatId && nextFirstChatId === secondChatId) {
|
|
68
|
+
return `/${path}/${firstChatId}/${secondChatId}`;
|
|
69
|
+
}
|
|
66
70
|
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
const first = nextFirstChatId || firstChatId || 'none';
|
|
72
|
+
const second = nextSecondChatId || secondChatId;
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
if (first === second) {
|
|
75
|
+
return `/${path}/${first}`;
|
|
76
|
+
}
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
return `/${path}/${first}${second ? `/${second}` : ''}`;
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
/**
|
|
@@ -79,24 +83,24 @@ export function makeChatUrl(
|
|
|
79
83
|
*/
|
|
80
84
|
|
|
81
85
|
export function getUrlType(type: LinkType) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
86
|
+
switch (type) {
|
|
87
|
+
case 'USER':
|
|
88
|
+
return 'User';
|
|
89
|
+
case 'KAJI':
|
|
90
|
+
return 'AI';
|
|
91
|
+
case 'DATASET':
|
|
92
|
+
return 'Dataset';
|
|
93
|
+
case 'VOICE':
|
|
94
|
+
return 'Voice';
|
|
95
|
+
case 'FEED':
|
|
96
|
+
return 'Feed post';
|
|
97
|
+
case 'ROOM':
|
|
98
|
+
return 'Room';
|
|
99
|
+
case 'THREAD':
|
|
100
|
+
return 'Forum thread';
|
|
101
|
+
default:
|
|
102
|
+
return 'Link';
|
|
103
|
+
}
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
/**
|
|
@@ -104,20 +108,20 @@ export function getUrlType(type: LinkType) {
|
|
|
104
108
|
*/
|
|
105
109
|
|
|
106
110
|
export function locationSearchToObject(searchParams?: string) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
if (!searchParams) {
|
|
112
|
+
return {};
|
|
113
|
+
}
|
|
110
114
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
const search = searchParams.substring(1);
|
|
116
|
+
const searchParamsArray = search.split('&');
|
|
117
|
+
const searchParamsObject: Record<string, string> = {};
|
|
114
118
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
searchParamsArray.forEach((param) => {
|
|
120
|
+
const [key, value] = param.split('=');
|
|
121
|
+
searchParamsObject[key] = value;
|
|
122
|
+
});
|
|
119
123
|
|
|
120
|
-
|
|
124
|
+
return searchParamsObject;
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
/**
|
|
@@ -125,9 +129,9 @@ export function locationSearchToObject(searchParams?: string) {
|
|
|
125
129
|
*/
|
|
126
130
|
|
|
127
131
|
export function isChatPage() {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
const pathname = globalThis?.location?.pathname?.toLowerCase();
|
|
133
|
+
if (pathname) {
|
|
134
|
+
return /^\/(?:chat|dm)\//i.test(pathname);
|
|
135
|
+
}
|
|
136
|
+
return false;
|
|
133
137
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"allowImportingTsExtensions": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true
|
|
10
|
+
},
|
|
11
|
+
"include": ["src/**/*"]
|
|
12
12
|
}
|
package/src/i18n/product.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
en: {
|
|
3
|
-
animal_id: 'Animal ID',
|
|
4
|
-
dam_id: 'Dam ID',
|
|
5
|
-
breed: 'Breed',
|
|
6
|
-
|
|
7
|
-
upcoming_markets: 'Upcoming markets',
|
|
8
|
-
markets_empty_msg: 'Talk to your AI to create farmers market events.',
|
|
9
|
-
event_not_scheduled_msg: 'This event is not scheduled for this date.',
|
|
10
|
-
attendance_list_empty_msg: 'Attendance list is empty for this date.',
|
|
11
|
-
workflow: 'Workflow',
|
|
12
|
-
|
|
13
|
-
// Report
|
|
14
|
-
collected_total_ct_evidences: 'Collected a total of %{smart_count} evidence.||||Collected a total of %{smart_count} evidences.',
|
|
15
|
-
reporting_year: 'Reporting year',
|
|
16
|
-
not_answered_msg: 'This question hasn\'t been answered yet.',
|
|
17
|
-
report_summary_not_done: 'AI is still generating the report summary.',
|
|
18
|
-
|
|
19
|
-
// Content names
|
|
20
|
-
view_document: 'View document',
|
|
21
|
-
view_event: 'View event',
|
|
22
|
-
view_market: 'View market',
|
|
23
|
-
|
|
24
|
-
edit_document: 'Edit document',
|
|
25
|
-
edit_event: 'Edit event',
|
|
26
|
-
edit_market: 'Edit market',
|
|
27
|
-
|
|
28
|
-
delete_document: 'Delete document',
|
|
29
|
-
delete_event: 'Delete event',
|
|
30
|
-
delete_market: 'Delete market',
|
|
31
|
-
|
|
32
|
-
// Enums
|
|
33
|
-
status: {
|
|
34
|
-
ALIVE: 'Alive',
|
|
35
|
-
SICK: 'Sick',
|
|
36
|
-
SOLD: 'Sold',
|
|
37
|
-
DECEASED: 'Deceased',
|
|
38
|
-
PASS: 'Pass',
|
|
39
|
-
WARNING: 'Warning',
|
|
40
|
-
FAIL: 'Fail',
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
event_frequency_msg: {
|
|
44
|
-
ONCE: 'This event does not repeat.',
|
|
45
|
-
WEEKLY: 'This event repeats weekly.',
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
contentName_plural: {
|
|
49
|
-
market: 'Markets',
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
feature_short: {
|
|
53
|
-
NORMAL_LOGGING: 'Logs',
|
|
54
|
-
SITE_INSPECTION: 'Site inspection',
|
|
55
|
-
FOOD_SAFETY: 'Food safety',
|
|
56
|
-
GLOBAL_GAP: 'GLOBALG.A.P.',
|
|
57
|
-
LIVESTOCK_MANAGEMENT: 'Livestock',
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
feature_title: {
|
|
61
|
-
NORMAL_LOGGING: 'Logs',
|
|
62
|
-
SITE_INSPECTION: 'Site inspection',
|
|
63
|
-
FOOD_SAFETY: 'Food safety',
|
|
64
|
-
GLOBAL_GAP: 'GLOBALG.A.P.',
|
|
65
|
-
LIVESTOCK_MANAGEMENT: 'Livestock management',
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
// Reports
|
|
69
|
-
|
|
70
|
-
report: {
|
|
71
|
-
GLOBAL_GAP: 'GLOBALG.A.P.',
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
back_to_globalgap: 'Back to GLOBALG.A.P.',
|
|
75
|
-
},
|
|
76
|
-
};
|