@jsb188/app 1.1.11 → 1.1.13
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/LICENSE +21 -0
- package/package.json +17 -6
- package/src/constants/agent.ts +44 -57
- package/src/constants/app.ts +43 -0
- package/src/constants/wsActions.ts +1 -15
- package/src/i18n/account.ts +1 -1
- package/src/i18n/agent.ts +321 -96
- package/src/i18n/agentToolBusiness.ts +340 -0
- package/src/i18n/agentToolGrid.ts +121 -0
- package/src/i18n/agentToolWorkflow.ts +101 -0
- package/src/i18n/agent_note.ts +110 -0
- package/src/i18n/app.ts +23 -17
- package/src/i18n/auth.ts +25 -30
- package/src/i18n/billing.ts +3 -85
- package/src/i18n/c.ts +953 -0
- package/src/i18n/campaign.ts +164 -211
- package/src/i18n/datetime.ts +6 -0
- package/src/i18n/editor.ts +56 -0
- package/src/i18n/email_outreach_editor.ts +526 -0
- package/src/i18n/error.ts +430 -202
- package/src/i18n/field_doc_editor.ts +21 -0
- package/src/i18n/field_doc_programs.ts +51 -0
- package/src/i18n/field_docs.ts +171 -8
- package/src/i18n/form.ts +7 -491
- package/src/i18n/index.ts +23 -3
- package/src/i18n/log.ts +234 -39
- package/src/i18n/memory.ts +18 -5
- package/src/i18n/message.ts +1 -0
- package/src/i18n/note.ts +5 -3
- package/src/i18n/org.ts +97 -45
- package/src/i18n/schedule.ts +133 -0
- package/src/i18n/sheet.ts +105 -161
- package/src/i18n/sheet_formula.ts +165 -0
- package/src/i18n/workflow.ts +112 -11
- package/src/main.ts +2 -2
- package/src/platform.ts +89 -49
- package/src/types/ai.d.ts +16 -1
- package/src/types/app.d.ts +29 -73
- package/src/types/auth.d.ts +1 -1
- package/src/types/other.d.ts +8 -1
- package/src/utils/api.ts +60 -10
- package/src/utils/clientIP.ts +213 -0
- package/src/utils/color.ts +95 -0
- package/src/utils/csv.ts +19 -0
- package/src/utils/datetime.ts +207 -31
- package/src/utils/deferredSave.ts +89 -0
- package/src/utils/email.ts +50 -0
- package/src/utils/expression.helpers.ts +470 -0
- package/src/utils/expression.ts +1633 -239
- package/src/utils/language.ts +9 -0
- package/src/utils/logic.ts +9 -162
- package/src/utils/number.ts +30 -11
- package/src/utils/object.ts +69 -127
- package/src/utils/promise.ts +78 -7
- package/src/utils/queryReset.ts +110 -61
- package/src/utils/string.ts +80 -143
- package/src/utils/url_client.ts +115 -15
- package/src/constants/billing.ts +0 -146
- package/src/i18n/agentDoc.ts +0 -110
- package/src/types/form.d.ts +0 -101
- package/src/utils/billing.ts +0 -141
- package/src/utils/managedSessionBff.test.ts +0 -60
- package/src/utils/string.test.ts +0 -293
- package/tsconfig.json +0 -12
package/src/i18n/workflow.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
en: {
|
|
3
|
+
active_only: 'Active only',
|
|
4
|
+
operation_workflows: 'Operation workflows',
|
|
3
5
|
workflow_missing: 'Workflow is missing',
|
|
4
6
|
workflow_missing_msg: "The workflow you're looking for could not be found.",
|
|
5
|
-
not_active_msg: 'Not active – no upcoming jobs',
|
|
6
|
-
active_msg: 'Active – waiting for %{logType} logs',
|
|
7
7
|
|
|
8
8
|
// Reminders
|
|
9
|
-
reminders: '
|
|
9
|
+
reminders: 'Scheduled',
|
|
10
10
|
reminder_missing: 'Reminder is missing',
|
|
11
11
|
reminder_missing_msg: "The reminder you're looking for could not be found.",
|
|
12
12
|
one_time: 'One-time',
|
|
@@ -14,8 +14,9 @@ export default {
|
|
|
14
14
|
completed_msg: 'Completed – no further follow-ups',
|
|
15
15
|
completed: 'Completed',
|
|
16
16
|
cancel_reminder: 'Cancel reminder',
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
delete_scheduled_task: 'Delete scheduled task',
|
|
18
|
+
delete_scheduled_task_failed: 'The scheduled task could not be deleted. Try again.',
|
|
19
|
+
cancel_reminder_confirm_msg: 'This reminder will not be delivered and any in-progress runs will be stopped. Cancel this reminder?',
|
|
19
20
|
canceled: 'Canceled',
|
|
20
21
|
run_history: 'Run history',
|
|
21
22
|
progress_report: 'Progress report',
|
|
@@ -25,11 +26,18 @@ export default {
|
|
|
25
26
|
follow_up_at_msg: 'Next follow-up: %{followUpAt}',
|
|
26
27
|
created_by: 'Created by %{name}',
|
|
27
28
|
recipients: 'Recipients',
|
|
29
|
+
// Scheduled tasks that start after other work finishes
|
|
30
|
+
waiting: 'Waiting',
|
|
31
|
+
blocked: 'Did not run',
|
|
32
|
+
waiting_for_label: 'Waiting for:',
|
|
33
|
+
waiting_msg: 'Waiting for other work to finish',
|
|
34
|
+
on_hold_msg: 'On hold: %{title} failed',
|
|
35
|
+
blocked_msg: 'Did not run: %{reason}',
|
|
28
36
|
|
|
29
37
|
run_status: {
|
|
30
38
|
STARTED: 'In progress',
|
|
31
39
|
COMPLETED: 'Completed',
|
|
32
|
-
COMPLETED_PARTIAL: '
|
|
40
|
+
COMPLETED_PARTIAL: 'Partial',
|
|
33
41
|
ERRORED: 'Failed',
|
|
34
42
|
QUEUED: 'Queued',
|
|
35
43
|
CANCELED: 'Canceled',
|
|
@@ -37,6 +45,15 @@ export default {
|
|
|
37
45
|
|
|
38
46
|
// Workflow runs page
|
|
39
47
|
workflow_runs: 'Workflow runs',
|
|
48
|
+
workflows_end:
|
|
49
|
+
'There is %{smart_count} workflow for this organization.||||' + 'There are %{smart_count} workflows for this organization.',
|
|
50
|
+
workflows_empty: "There aren't any workflows for this organization.",
|
|
51
|
+
workflow_runs_end:
|
|
52
|
+
'There is %{smart_count} workflow run for this organization.||||' +
|
|
53
|
+
'There are %{smart_count} workflow runs for this organization.',
|
|
54
|
+
workflow_runs_empty: "There aren't any workflow runs for this organization.",
|
|
55
|
+
runs_end: 'There is %{smart_count} run for this workflow.||||' + 'There are %{smart_count} runs for this workflow.',
|
|
56
|
+
runs_empty: "There aren't any runs for this workflow.",
|
|
40
57
|
view_runs: 'View workflow runs',
|
|
41
58
|
run_missing: 'Run is missing',
|
|
42
59
|
run_missing_msg: "The workflow run you're looking for could not be found.",
|
|
@@ -44,15 +61,98 @@ export default {
|
|
|
44
61
|
|
|
45
62
|
// Workflow kind filter
|
|
46
63
|
filter_by_kind: 'Filter by type',
|
|
47
|
-
all_kinds: 'Workflows +
|
|
64
|
+
all_kinds: 'Workflows + Scheduled',
|
|
48
65
|
workflows_only: 'Workflows only',
|
|
49
|
-
reminders_only: '
|
|
66
|
+
reminders_only: 'Scheduled only',
|
|
50
67
|
|
|
51
68
|
kind: {
|
|
52
69
|
WORKFLOW: 'Workflow',
|
|
53
|
-
REMINDER: '
|
|
70
|
+
REMINDER: 'Scheduled',
|
|
54
71
|
},
|
|
55
72
|
|
|
73
|
+
// Program-managed workflows
|
|
74
|
+
program_managed: 'Managed by %{program}',
|
|
75
|
+
program_managed_msg:
|
|
76
|
+
'This workflow comes with the %{program} program and stays up to date with it. You can pause it or add your own instructions.',
|
|
77
|
+
program_workflow: 'Program workflow',
|
|
78
|
+
program_unenrolled_msg:
|
|
79
|
+
"This workflow's program was removed from your organization. Restore the program in App Settings → Programs to resume it.",
|
|
80
|
+
program_restore_expired_msg:
|
|
81
|
+
"This workflow's program was removed from your organization more than 90 days ago and can no longer be restored, so this workflow can't be resumed. It will be deleted soon.",
|
|
82
|
+
program_removed_paused_msg:
|
|
83
|
+
'Paused when the %{program} program was removed. Restore the program in App Settings → Programs to resume this workflow.',
|
|
84
|
+
pause_workflow: 'Pause workflow',
|
|
85
|
+
resume_workflow: 'Resume workflow',
|
|
86
|
+
user_instructions: 'User instructions',
|
|
87
|
+
user_instructions_ph: 'Instructions for your organization (optional)',
|
|
88
|
+
user_instructions_empty: 'No user instructions yet.',
|
|
89
|
+
edit_user_instructions: 'Edit instructions',
|
|
90
|
+
user_instructions_msg: 'Your instructions are added after the program instructions each time this workflow runs.',
|
|
91
|
+
user_instructions_max: 'Use at most %{smart_count} character.||||Use at most %{smart_count} characters.',
|
|
92
|
+
catalog_instructions: 'Program instructions',
|
|
93
|
+
composed_instructions: 'What AI reads',
|
|
94
|
+
save_user_instructions: 'Save instructions',
|
|
95
|
+
user_instructions_saved: 'User instructions saved.',
|
|
96
|
+
|
|
97
|
+
// AI workflow definitions (the workflow modal)
|
|
98
|
+
step_type: {
|
|
99
|
+
CHECK: 'Check',
|
|
100
|
+
SEND_EMAIL: 'Email',
|
|
101
|
+
SEND_TEXT: 'Text',
|
|
102
|
+
WAIT: 'Wait',
|
|
103
|
+
CREATE_TASK: 'Create scheduled task',
|
|
104
|
+
},
|
|
105
|
+
runs_when: 'Runs when',
|
|
106
|
+
// A FINISHED trigger that names one scheduled task or workflow
|
|
107
|
+
trigger_source_runs: 'View runs of %{title}',
|
|
108
|
+
trigger_source_missing: 'What this trigger names no longer exists, so it will not run.',
|
|
109
|
+
steps: 'Steps',
|
|
110
|
+
steps_then: 'Then',
|
|
111
|
+
rules: 'Rules',
|
|
112
|
+
on_edit: 'When the log is edited',
|
|
113
|
+
remembers: 'Remembers',
|
|
114
|
+
problems: 'Problems',
|
|
115
|
+
last_dry_run: 'Last dry run',
|
|
116
|
+
// Keyed by Workflow.status; the sidebar derives the same three from workflowPublished and workflowActive
|
|
117
|
+
definition_status: {
|
|
118
|
+
DRAFT: 'Draft',
|
|
119
|
+
ACTIVE: 'On',
|
|
120
|
+
INACTIVE: 'Paused',
|
|
121
|
+
},
|
|
122
|
+
version_number: 'Version %{version}',
|
|
123
|
+
switch_on: 'Switch on',
|
|
124
|
+
apply_changes: 'Apply changes',
|
|
125
|
+
pause: 'Pause',
|
|
126
|
+
resume: 'Resume',
|
|
127
|
+
discard_draft: 'Discard draft',
|
|
128
|
+
remove_added: 'Remove what was added',
|
|
129
|
+
arrow_finish: 'Finish',
|
|
130
|
+
arrow_otherwise: 'otherwise',
|
|
131
|
+
to_label: 'To:',
|
|
132
|
+
reply_to_label: 'Reply-to:',
|
|
133
|
+
// The Draft/Live switch, shown when a workflow has both a live version and a draft
|
|
134
|
+
version_view: {
|
|
135
|
+
DRAFT: 'Draft',
|
|
136
|
+
LIVE: 'Live',
|
|
137
|
+
},
|
|
138
|
+
draft_not_live_msg: 'Changes in this draft are not live yet. The live version keeps running.',
|
|
139
|
+
switch_on_title: 'Switch on this workflow?',
|
|
140
|
+
switch_on_confirm_msg: 'From now on, when %{trigger}, this workflow will act without review.',
|
|
141
|
+
apply_changes_title: 'Apply these changes?',
|
|
142
|
+
apply_changes_confirm_msg: 'This draft will replace the live version. From now on, when %{trigger}, it will act without review.',
|
|
143
|
+
pause_form_title: "Pause this form's workflow?",
|
|
144
|
+
pause_form_confirm_msg: 'Nothing will fill this form while its workflow is paused, and its answers cannot be typed in.',
|
|
145
|
+
discard_draft_title: 'Discard this draft?',
|
|
146
|
+
discard_draft_confirm_msg: 'The changes in this draft will be deleted. The live version keeps running.',
|
|
147
|
+
discard_unpublished_confirm_msg: 'This workflow was never switched on, so discarding its draft deletes the workflow.',
|
|
148
|
+
remove_added_title: 'Remove what was added?',
|
|
149
|
+
remove_added_confirm_msg:
|
|
150
|
+
"The steps and rules added to this form's workflow will be deleted, with any draft. The form keeps filling from its logs, and its runs stay.",
|
|
151
|
+
fill_title: 'Fills the form from its logs',
|
|
152
|
+
fill_msg: 'Saves the answers the logs support and texts the person who logged what changed and what is missing. Always on.',
|
|
153
|
+
nothing_added: 'Nothing added',
|
|
154
|
+
form_paused_msg: 'Paused: nothing is filling this form.',
|
|
155
|
+
|
|
56
156
|
// Below is old but some may be useful
|
|
57
157
|
|
|
58
158
|
// Actions related
|
|
@@ -61,8 +161,9 @@ export default {
|
|
|
61
161
|
waiting_for_tasks_to_be_created: 'Waiting for tasks to be created...',
|
|
62
162
|
view_workflow: 'View workflow',
|
|
63
163
|
delete_workflow: 'Delete workflow',
|
|
64
|
-
|
|
65
|
-
|
|
164
|
+
yes_delete_workflow: 'Yes, delete workflow',
|
|
165
|
+
delete_workflow_failed: 'The workflow could not be deleted. Try again.',
|
|
166
|
+
workflows_empty_msg: 'Please email us at hello@marketday.ai to create workflows for your %{orgType}.',
|
|
66
167
|
|
|
67
168
|
for_operation: {
|
|
68
169
|
FARMERS_MARKET: 'Vendor',
|
package/src/main.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import i18n, { i18nTranslations } from './i18n/index.ts';
|
|
4
4
|
|
|
5
5
|
// Get the correct type for ENV
|
|
6
|
-
|
|
6
|
+
const ENV = new Map<string, string | boolean | number>();
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Extend i18n with app specific texts
|
|
@@ -41,7 +41,7 @@ export function configI18n(texts?: Record<string, any>) {
|
|
|
41
41
|
* Register environment variables so the package may use it
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
|
-
export function registerENV(env: Record<string, string>) {
|
|
44
|
+
export function registerENV(env: Record<string, string | boolean | number>) {
|
|
45
45
|
// Do not use process.env; because this package is used in client + server
|
|
46
46
|
|
|
47
47
|
for (const key in env) {
|
package/src/platform.ts
CHANGED
|
@@ -1,65 +1,102 @@
|
|
|
1
|
-
|
|
1
|
+
import { STORAGE_KEYS } from './constants/app.ts';
|
|
2
|
+
|
|
3
|
+
interface PlatformOptions {
|
|
4
|
+
defaultTheme: string;
|
|
5
|
+
clearAppCache?: () => void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let platformOptions: PlatformOptions = { defaultTheme: '' };
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Configure app-owned theme and cache behavior without replacing browser defaults.
|
|
12
|
+
*/
|
|
13
|
+
export function configurePlatform(options: PlatformOptions): void {
|
|
14
|
+
platformOptions = { ...options };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* Read the system dark-mode preference when the runtime supports it.
|
|
19
|
+
*/
|
|
20
|
+
export function isSystemDarkMode(): boolean {
|
|
21
|
+
return !!globalThis.matchMedia?.('(prefers-color-scheme: dark)').matches;
|
|
22
|
+
}
|
|
2
23
|
|
|
3
24
|
/**
|
|
4
25
|
* Get current platform
|
|
5
26
|
*/
|
|
6
27
|
|
|
7
28
|
export function getPlatform(): 'WEB' | 'MOBILE' | 'UNKNOWN' {
|
|
8
|
-
return
|
|
29
|
+
return 'WEB';
|
|
9
30
|
}
|
|
10
31
|
|
|
11
32
|
/**
|
|
12
33
|
* Fetch last used login token
|
|
13
34
|
*/
|
|
14
35
|
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
36
|
+
export function fetchAuthToken(cb: (token: string | null) => void): void {
|
|
37
|
+
if (typeof document !== 'undefined') {
|
|
38
|
+
const authToken: string =
|
|
39
|
+
localStorage.getItem(STORAGE_KEYS.AUTH_TOKEN) ?? '';
|
|
40
|
+
cb(authToken);
|
|
41
|
+
} else {
|
|
42
|
+
cb(null);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
18
45
|
|
|
19
46
|
/**
|
|
20
47
|
* Delete auth token
|
|
21
48
|
*/
|
|
22
49
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
50
|
+
export function deleteAuthToken(): void {
|
|
51
|
+
if (typeof document !== 'undefined') {
|
|
52
|
+
localStorage.removeItem(STORAGE_KEYS.AUTH_TOKEN);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
26
55
|
|
|
27
56
|
/**
|
|
28
57
|
* Save token after login
|
|
29
58
|
*/
|
|
30
59
|
|
|
31
|
-
export function saveAuthTokenToPlatform(
|
|
32
|
-
|
|
60
|
+
export function saveAuthTokenToPlatform(_token: string, cb: () => void) {
|
|
61
|
+
// In Web, there is nothing saved to local storage because we use SSR
|
|
62
|
+
cb();
|
|
33
63
|
}
|
|
34
64
|
|
|
35
65
|
/**
|
|
36
|
-
* Clear
|
|
37
|
-
* Change this based on what the app uses
|
|
66
|
+
* Clear app-owned caches using the callback configured at startup.
|
|
38
67
|
*/
|
|
39
68
|
|
|
40
69
|
export function clearAppCache() {
|
|
41
|
-
|
|
70
|
+
platformOptions.clearAppCache?.();
|
|
42
71
|
}
|
|
43
72
|
|
|
44
73
|
/**
|
|
45
74
|
* Fetch last used light mode setting
|
|
46
75
|
*/
|
|
47
76
|
|
|
48
|
-
export
|
|
77
|
+
export function fetchLightModeSetting(
|
|
49
78
|
accountId: number | null,
|
|
50
79
|
cb: (lightMode: string) => void,
|
|
51
|
-
): void
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
80
|
+
): void {
|
|
81
|
+
if (typeof document === 'undefined') {
|
|
82
|
+
cb('');
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const key = `${STORAGE_KEYS.LIGHT_MODE}${accountId || 'guest'}`;
|
|
87
|
+
const lightModeSetting = localStorage.getItem(key) || '';
|
|
88
|
+
cb(lightModeSetting);
|
|
89
|
+
}
|
|
56
90
|
|
|
57
91
|
/**
|
|
58
92
|
* Get correct platform
|
|
59
93
|
*/
|
|
60
94
|
|
|
61
95
|
export function getOS() {
|
|
62
|
-
|
|
96
|
+
const isApple = /(Mac|iPhone|iPod|iPad)/i.test(
|
|
97
|
+
globalThis.navigator?.platform || '',
|
|
98
|
+
);
|
|
99
|
+
return isApple ? 'mac_os' : 'windows';
|
|
63
100
|
}
|
|
64
101
|
|
|
65
102
|
/**
|
|
@@ -67,7 +104,23 @@ export function getOS() {
|
|
|
67
104
|
*/
|
|
68
105
|
|
|
69
106
|
export function updateAppTheme(lightMode: string, theme: string) {
|
|
70
|
-
|
|
107
|
+
if (typeof document === 'undefined') {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const lightModeVal =
|
|
112
|
+
lightMode === 'SYSTEM'
|
|
113
|
+
? isSystemDarkMode()
|
|
114
|
+
? 'dark'
|
|
115
|
+
: 'light'
|
|
116
|
+
: lightMode === 'DARK'
|
|
117
|
+
? 'dark'
|
|
118
|
+
: 'light';
|
|
119
|
+
|
|
120
|
+
const fullThemeName = `${theme || platformOptions.defaultTheme}_${lightModeVal}`;
|
|
121
|
+
|
|
122
|
+
document.body.setAttribute('data-mode', lightModeVal);
|
|
123
|
+
document.body.setAttribute('data-theme', fullThemeName);
|
|
71
124
|
}
|
|
72
125
|
|
|
73
126
|
/**
|
|
@@ -75,7 +128,13 @@ export function updateAppTheme(lightMode: string, theme: string) {
|
|
|
75
128
|
*/
|
|
76
129
|
|
|
77
130
|
export function getLocalLastVersion(accountId: string) {
|
|
78
|
-
|
|
131
|
+
if (typeof document === 'undefined') {
|
|
132
|
+
return '';
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const lastVersion: string =
|
|
136
|
+
localStorage.getItem(STORAGE_KEYS.LAST_VERSION + accountId) ?? '';
|
|
137
|
+
return lastVersion;
|
|
79
138
|
}
|
|
80
139
|
|
|
81
140
|
/**
|
|
@@ -83,7 +142,11 @@ export function getLocalLastVersion(accountId: string) {
|
|
|
83
142
|
*/
|
|
84
143
|
|
|
85
144
|
export function saveLocalLastVersion(accountId: string, version: string) {
|
|
86
|
-
|
|
145
|
+
if (typeof document === 'undefined') {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
localStorage.setItem(STORAGE_KEYS.LAST_VERSION + accountId, version);
|
|
87
150
|
}
|
|
88
151
|
|
|
89
152
|
/**
|
|
@@ -91,36 +154,13 @@ export function saveLocalLastVersion(accountId: string, version: string) {
|
|
|
91
154
|
*/
|
|
92
155
|
|
|
93
156
|
export function getFileInputObject(fileInput: File) {
|
|
94
|
-
return
|
|
157
|
+
return fileInput;
|
|
95
158
|
}
|
|
96
159
|
|
|
97
160
|
/**
|
|
98
161
|
* Get buffer data from file
|
|
99
162
|
*/
|
|
100
163
|
|
|
101
|
-
export function getBufferDataFromFile(file:
|
|
102
|
-
return
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Check if system is dark mode
|
|
107
|
-
*/
|
|
108
|
-
|
|
109
|
-
export function isSystemDarkMode() {
|
|
110
|
-
return PLATFORM_HANDLERS?.isSystemDarkMode?.();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Register platform specific handlers
|
|
115
|
-
*/
|
|
116
|
-
|
|
117
|
-
export function registerPlatformHandlers(handlers: Record<string, any>) {
|
|
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
|
-
}
|
|
164
|
+
export function getBufferDataFromFile<T>(file: T) {
|
|
165
|
+
return file;
|
|
126
166
|
}
|
package/src/types/ai.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export type AIEventErrorName =
|
|
|
19
19
|
| 'AI_EVENT_NO_ACCESS'
|
|
20
20
|
| 'AI_COULD_NOT_RESOLVE'
|
|
21
21
|
| 'AI_CONTEXT_ERR'
|
|
22
|
+
| 'AI_CONTEXT_MANAGEMENT_ERR'
|
|
23
|
+
| 'AI_TOOL_EXECUTION_ERR'
|
|
22
24
|
| 'AI_ORG_ACL_FAILED'
|
|
23
25
|
| 'SETUP_INCOMPLETE_ORG'
|
|
24
26
|
| 'MISSING_API_KEY'
|
|
@@ -33,12 +35,25 @@ export type AIEventErrorName =
|
|
|
33
35
|
// AI chat
|
|
34
36
|
|
|
35
37
|
export interface AIChatData {
|
|
38
|
+
activityOrder?: string;
|
|
36
39
|
id: string;
|
|
37
40
|
organizationId: string | null;
|
|
41
|
+
agentNoteId?: string | null;
|
|
38
42
|
calDate: string | null;
|
|
39
43
|
summary: string;
|
|
40
|
-
userManagedSummary: boolean;
|
|
41
44
|
archivedAt: string | null;
|
|
42
45
|
createdAt: string;
|
|
43
46
|
updatedAt: string;
|
|
44
47
|
}
|
|
48
|
+
|
|
49
|
+
// Public execution metadata shared by GraphQL responses and CHAT_RUN_UPDATE SSE events.
|
|
50
|
+
export interface AIChatRunData {
|
|
51
|
+
id: string;
|
|
52
|
+
sourceMessageIds: string[];
|
|
53
|
+
status: 'QUEUED' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED' | 'DELIVERY_UNKNOWN';
|
|
54
|
+
inProgress: boolean;
|
|
55
|
+
createdAt: string | null;
|
|
56
|
+
claimedAt: string | null;
|
|
57
|
+
finishedAt: string | null;
|
|
58
|
+
updatedAt: string | null;
|
|
59
|
+
}
|
package/src/types/app.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { AIChatLinkEvent } from '@jsb188/mday/types/linkedEntity.d.ts';
|
|
1
2
|
import { COLORS } from '../constants/app.ts';
|
|
2
|
-
import type { QueryResetTarget } from '../utils/queryReset.ts';
|
|
3
3
|
|
|
4
4
|
// Modal; App settings
|
|
5
5
|
|
|
@@ -17,21 +17,12 @@ export interface EditUserModalProps extends EditIfaceModalProps {
|
|
|
17
17
|
editUser: (obj: object) => void;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export interface EditUserPlusModalProps extends EditIfaceModalProps {
|
|
21
|
-
user: any;
|
|
22
|
-
editUserPlus: (obj: object) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
20
|
// App types
|
|
26
21
|
|
|
27
22
|
export type DarkOrLightEnum = 'light' | 'dark';
|
|
28
23
|
|
|
29
24
|
export type ColorEnum = (typeof COLORS)[number];
|
|
30
25
|
|
|
31
|
-
// Stripe types
|
|
32
|
-
|
|
33
|
-
export type PlatformProductGroupEnum = 'PERKS' | 'PLUS' | 'PRO' | 'COINS';
|
|
34
|
-
|
|
35
26
|
// Server/API related types
|
|
36
27
|
|
|
37
28
|
export interface ServerErrorObj {
|
|
@@ -51,83 +42,48 @@ export interface SimpleErrorType {
|
|
|
51
42
|
|
|
52
43
|
// Web Socket events
|
|
53
44
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
chunkIndex: number;
|
|
69
|
-
chunkCount: number;
|
|
45
|
+
/* What happened to a record (or, for 'touched', to some records of a type in a scope). */
|
|
46
|
+
export type DataChangeKind = 'updated' | 'added' | 'moved' | 'deleted' | 'touched';
|
|
47
|
+
|
|
48
|
+
/* One record change in a data update packet. */
|
|
49
|
+
export interface WSDataChange {
|
|
50
|
+
type: string; // DATA_TYPES key; narrowed to DataTypeKey by the server builders and the client dispatcher
|
|
51
|
+
kind: DataChangeKind;
|
|
52
|
+
id?: string; // Serialized record id; absent only for 'touched'
|
|
53
|
+
scope?: Record<string, string>; // Serialized parent ids named by DATA_TYPES[type].scope
|
|
54
|
+
data?: Record<string, unknown>; // Fields to merge into the cached record
|
|
55
|
+
partial?: true; // The record changed in ways `data` does not carry
|
|
56
|
+
rev?: string; // Decimal revision of this record; an older one is ignored
|
|
57
|
+
revKey?: string; // Revision fence shared by several records
|
|
58
|
+
append?: 'start' | 'end'; // Arrays in `data` are added to the cached arrays, not replaced
|
|
70
59
|
}
|
|
71
60
|
|
|
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
|
-
|
|
100
61
|
export interface WSDataUpdateObj {
|
|
101
62
|
id: string;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
};
|
|
63
|
+
origin?: true; // This socket's own request caused these changes
|
|
64
|
+
changes?: WSDataChange[];
|
|
65
|
+
aiChatSubmission?: AIChatSubmissionWSObj;
|
|
66
|
+
aiChatLinkEvent?: AIChatLinkEvent;
|
|
118
67
|
authorizationContextChanged?: boolean; // Private memory/disk cache must be discarded and auth reloaded
|
|
68
|
+
// Sheet journal packets only (Sheet, SheetTab, SheetManifest and SheetView fragments); every other record travels in `changes`
|
|
69
|
+
reactiveFragmentKeys?: string[]; // Sheet journal: further fragment keys whose observers are notified
|
|
119
70
|
fragments?:
|
|
120
71
|
| null
|
|
121
72
|
| ({
|
|
122
73
|
name: string;
|
|
123
74
|
dataId: string;
|
|
124
|
-
sequence?: string;
|
|
125
|
-
|
|
126
|
-
appendRule?: AppendRuleEnum | null;
|
|
75
|
+
sequence?: string; // Sheet journal: decimal revision; an older one is ignored
|
|
76
|
+
sequenceKey?: string; // Sheet journal: revision fence shared by several fragments
|
|
127
77
|
data: any;
|
|
128
78
|
} | null)[];
|
|
129
79
|
}
|
|
130
80
|
|
|
81
|
+
export interface AIChatSubmissionWSObj {
|
|
82
|
+
aiChatId: string;
|
|
83
|
+
clientRequestId: string;
|
|
84
|
+
phase: 'RECEIVED';
|
|
85
|
+
}
|
|
86
|
+
|
|
131
87
|
export interface WSAppContextUpdateObj {
|
|
132
88
|
accountId: string;
|
|
133
89
|
updates: [any, any][];
|
package/src/types/auth.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ export interface AccountSessionData {
|
|
|
79
79
|
*/
|
|
80
80
|
|
|
81
81
|
export interface AuthenticationData {
|
|
82
|
+
storageToken?: string | null;
|
|
82
83
|
token: string | null;
|
|
83
84
|
sessionBootstrapToken?: string | null;
|
|
84
85
|
cacheAuthorizationEpoch?: string | null;
|
|
@@ -90,5 +91,4 @@ export interface AuthenticationData {
|
|
|
90
91
|
hasPassword: boolean;
|
|
91
92
|
webVersion: string;
|
|
92
93
|
mobileVersion: string;
|
|
93
|
-
alertUpdatesOnMount: boolean;
|
|
94
94
|
}
|
package/src/types/other.d.ts
CHANGED
|
@@ -7,6 +7,13 @@ import { DAY_OF_WEEK, SCHEDULE_FREQUENCY } from '../constants/other.ts';
|
|
|
7
7
|
export type DayOfWeekEnum = (typeof DAY_OF_WEEK)[number];
|
|
8
8
|
export type ScheduleFrequencyEnum = (typeof SCHEDULE_FREQUENCY)[number];
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Shared acknowledgment returned by optimistic editor mutations.
|
|
12
|
+
*/
|
|
13
|
+
export interface EditVersionPayloadGQL {
|
|
14
|
+
editVersion: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
/**
|
|
11
18
|
* Address
|
|
12
19
|
*/
|
|
@@ -39,7 +46,7 @@ export interface ScheduleObj {
|
|
|
39
46
|
*/
|
|
40
47
|
|
|
41
48
|
export interface LabelAndValue {
|
|
42
|
-
iconName?:
|
|
49
|
+
iconName?: string;
|
|
43
50
|
label: string;
|
|
44
51
|
value: string;
|
|
45
52
|
quantity?: number;
|