@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.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +17 -6
  3. package/src/constants/agent.ts +44 -57
  4. package/src/constants/app.ts +43 -0
  5. package/src/constants/wsActions.ts +1 -15
  6. package/src/i18n/account.ts +1 -1
  7. package/src/i18n/agent.ts +321 -96
  8. package/src/i18n/agentToolBusiness.ts +340 -0
  9. package/src/i18n/agentToolGrid.ts +121 -0
  10. package/src/i18n/agentToolWorkflow.ts +101 -0
  11. package/src/i18n/agent_note.ts +110 -0
  12. package/src/i18n/app.ts +23 -17
  13. package/src/i18n/auth.ts +25 -30
  14. package/src/i18n/billing.ts +3 -85
  15. package/src/i18n/c.ts +953 -0
  16. package/src/i18n/campaign.ts +164 -211
  17. package/src/i18n/datetime.ts +6 -0
  18. package/src/i18n/editor.ts +56 -0
  19. package/src/i18n/email_outreach_editor.ts +526 -0
  20. package/src/i18n/error.ts +430 -202
  21. package/src/i18n/field_doc_editor.ts +21 -0
  22. package/src/i18n/field_doc_programs.ts +51 -0
  23. package/src/i18n/field_docs.ts +171 -8
  24. package/src/i18n/form.ts +7 -491
  25. package/src/i18n/index.ts +23 -3
  26. package/src/i18n/log.ts +234 -39
  27. package/src/i18n/memory.ts +18 -5
  28. package/src/i18n/message.ts +1 -0
  29. package/src/i18n/note.ts +5 -3
  30. package/src/i18n/org.ts +97 -45
  31. package/src/i18n/schedule.ts +133 -0
  32. package/src/i18n/sheet.ts +105 -161
  33. package/src/i18n/sheet_formula.ts +165 -0
  34. package/src/i18n/workflow.ts +112 -11
  35. package/src/main.ts +2 -2
  36. package/src/platform.ts +89 -49
  37. package/src/types/ai.d.ts +16 -1
  38. package/src/types/app.d.ts +29 -73
  39. package/src/types/auth.d.ts +1 -1
  40. package/src/types/other.d.ts +8 -1
  41. package/src/utils/api.ts +60 -10
  42. package/src/utils/clientIP.ts +213 -0
  43. package/src/utils/color.ts +95 -0
  44. package/src/utils/csv.ts +19 -0
  45. package/src/utils/datetime.ts +207 -31
  46. package/src/utils/deferredSave.ts +89 -0
  47. package/src/utils/email.ts +50 -0
  48. package/src/utils/expression.helpers.ts +470 -0
  49. package/src/utils/expression.ts +1633 -239
  50. package/src/utils/language.ts +9 -0
  51. package/src/utils/logic.ts +9 -162
  52. package/src/utils/number.ts +30 -11
  53. package/src/utils/object.ts +69 -127
  54. package/src/utils/promise.ts +78 -7
  55. package/src/utils/queryReset.ts +110 -61
  56. package/src/utils/string.ts +80 -143
  57. package/src/utils/url_client.ts +115 -15
  58. package/src/constants/billing.ts +0 -146
  59. package/src/i18n/agentDoc.ts +0 -110
  60. package/src/types/form.d.ts +0 -101
  61. package/src/utils/billing.ts +0 -141
  62. package/src/utils/managedSessionBff.test.ts +0 -60
  63. package/src/utils/string.test.ts +0 -293
  64. package/tsconfig.json +0 -12
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 jsb188
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@jsb188/app",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "description": "Contains all the basic requirements for all @jsb188 apps.",
5
- "license": "ISC",
5
+ "license": "MIT",
6
6
  "author": "jsb188",
7
7
  "type": "module",
8
8
  "main": "src/main.ts",
@@ -13,7 +13,6 @@
13
13
  "./i18n/index.ts": "./src/i18n/index.ts",
14
14
  "./constants/agent.ts": "./src/constants/agent.ts",
15
15
  "./constants/app.ts": "./src/constants/app.ts",
16
- "./constants/billing.ts": "./src/constants/billing.ts",
17
16
  "./constants/emoji.ts": "./src/constants/emoji.ts",
18
17
  "./constants/other.ts": "./src/constants/other.ts",
19
18
  "./constants/user.ts": "./src/constants/user.ts",
@@ -21,14 +20,19 @@
21
20
  "./utils/account.ts": "./src/utils/account.ts",
22
21
  "./utils/api.ts": "./src/utils/api.ts",
23
22
  "./utils/authSession.ts": "./src/utils/authSession.ts",
23
+ "./utils/clientIP.ts": "./src/utils/clientIP.ts",
24
24
  "./utils/managedSession.ts": "./src/utils/managedSession.ts",
25
25
  "./utils/managedSessionBff.ts": "./src/utils/managedSessionBff.ts",
26
- "./utils/billing.ts": "./src/utils/billing.ts",
27
26
  "./utils/color.ts": "./src/utils/color.ts",
27
+ "./utils/csv.ts": "./src/utils/csv.ts",
28
28
  "./utils/datetime.ts": "./src/utils/datetime.ts",
29
+ "./utils/deferredSave.ts": "./src/utils/deferredSave.ts",
30
+ "./utils/email.ts": "./src/utils/email.ts",
31
+ "./utils/expression.helpers.ts": "./src/utils/expression.helpers.ts",
29
32
  "./utils/emoji.ts": "./src/utils/emoji.ts",
30
33
  "./utils/cron.ts": "./src/utils/cron.ts",
31
34
  "./utils/interval.ts": "./src/utils/interval.ts",
35
+ "./utils/language.ts": "./src/utils/language.ts",
32
36
  "./utils/logic.ts": "./src/utils/logic.ts",
33
37
  "./utils/number.ts": "./src/utils/number.ts",
34
38
  "./utils/object.ts": "./src/utils/object.ts",
@@ -42,7 +46,6 @@
42
46
  "./types/ai.d.ts": "./src/types/ai.d.ts",
43
47
  "./types/app.d.ts": "./src/types/app.d.ts",
44
48
  "./types/auth.d.ts": "./src/types/auth.d.ts",
45
- "./types/form.d.ts": "./src/types/form.d.ts",
46
49
  "./types/other.d.ts": "./src/types/other.d.ts"
47
50
  },
48
51
  "dependencies": {
@@ -52,5 +55,13 @@
52
55
  },
53
56
  "scripts": {
54
57
  "test": "echo \"Error: no test specified\" && exit 1"
55
- }
58
+ },
59
+ "files": [
60
+ "src/**/*.{ts,tsx,css,svg}",
61
+ "!**/*.test.*",
62
+ "!**/*.spec.*",
63
+ "!**/tests/**",
64
+ "!**/*.md",
65
+ "!**/.DS_Store"
66
+ ]
56
67
  }
@@ -1,82 +1,69 @@
1
1
  // AI agent inboxes
2
2
 
3
- const GROUP_TO_INBOX_DOMAINS = {
4
- vendor: [
5
- 'orders.marketday.ai',
6
- 'assistant.marketday.ai',
7
- // 'agent.marketday.ai', // enable when ready
8
- ],
9
- default: [
10
- 'assistant.marketday.ai',
11
- // 'agent.marketday.ai', // enable when ready
12
- ],
13
- };
3
+ export const EMAIL_BASE_DOMAINS = ['marketday.ai'] as const;
4
+ export const ALLOWED_EMAIL_SUBDOMAINS = ['agent', 'outbound', 'do-not-reply'] as const;
5
+ // Organization handles belong only on these purpose-specific domains; the root is reserved for platform addresses.
6
+ export const ALLOWED_EMAIL_DOMAINS = ALLOWED_EMAIL_SUBDOMAINS.flatMap(getEmailDomains);
7
+ export const ALLOWED_EMAIL_SENDER_DOMAINS = [...EMAIL_BASE_DOMAINS, ...ALLOWED_EMAIL_DOMAINS];
8
+
9
+ /*
10
+ * Return every full email domain for one hard-coded inbox prefix.
11
+ */
12
+ function getEmailDomains(prefix: (typeof ALLOWED_EMAIL_SUBDOMAINS)[number]): string[] {
13
+ return EMAIL_BASE_DOMAINS.map((baseDomain) => `${prefix}.${baseDomain}`);
14
+ }
15
+
16
+ // Domain used as the per-org broadcast/outbound From address:
17
+ // <org emailHandle>@outbound.<primary base domain>. Verified once in Mailgun
18
+ // at the domain level, so every org handle sends as an authenticated sender.
19
+ export const OUTBOUND_EMAIL_DOMAINS = getEmailDomains('outbound');
20
+ export const OUTBOUND_EMAIL_DOMAIN = OUTBOUND_EMAIL_DOMAINS[0];
21
+ export const DO_NOT_REPLY_EMAIL_DOMAINS = getEmailDomains('do-not-reply');
22
+ export const DO_NOT_REPLY_EMAIL_DOMAIN = DO_NOT_REPLY_EMAIL_DOMAINS[0];
23
+
24
+ export const AGENT_EMAIL_DOMAINS = getEmailDomains('agent');
25
+ export const AGENT_EMAIL_DOMAIN = AGENT_EMAIL_DOMAINS[0];
14
26
 
15
27
  export const OPERATION_INBOX_DOMAINS = {
16
- ARABLE: GROUP_TO_INBOX_DOMAINS.vendor,
17
- RESTAURANT: GROUP_TO_INBOX_DOMAINS.vendor,
18
- DEFAULT: GROUP_TO_INBOX_DOMAINS.default,
28
+ DEFAULT: AGENT_EMAIL_DOMAINS,
19
29
  };
20
30
 
21
- export const DOMAIN_TO_INBOX = {
22
- // Assistant
23
- 'agent.marketday.ai': 'ASSISTANT',
24
- 'assistant.marketday.ai': 'ASSISTANT',
31
+ // ASSISTANT remains the internal capability and memory key for the unified Agent inbox.
32
+ export const DOMAIN_TO_INBOX = Object.fromEntries(AGENT_EMAIL_DOMAINS.map((domain) => [domain, 'ASSISTANT'] as const)) as Record<
33
+ string,
34
+ 'ASSISTANT'
35
+ >;
25
36
 
26
- // General inquiry
27
- 'general.marketday.ai': 'GENERAL_INQUIRY',
28
- 'info.marketday.ai': 'GENERAL_INQUIRY',
29
- 'inquiry.marketday.ai': 'GENERAL_INQUIRY',
37
+ // Inboxes that are NOT ready for production yet. Inbound mail to them is rejected, and campaigns show their
38
+ // addresses as disabled From options. Remove an inbox here to enable it everywhere.
39
+ export const DISABLED_INBOXES: ReadonlyArray<'ASSISTANT'> = [];
30
40
 
31
- // Orders
32
- 'orders.marketday.ai': 'ORDERS',
33
- } as const;
41
+ export const REQUEST_SOURCE_ENUMS = ['SMS', 'WEB', 'EMAIL', 'WORKFLOW'] as const;
34
42
 
35
- // Agent inbox domains that are fully wired for field-doc email replies.
36
- // Add future domains here only after their inbound agent implementation is ready.
37
- export const FIELD_DOC_REPLY_TO_AGENT_DOMAINS = [
38
- 'orders.marketday.ai',
39
- ] as const;
40
-
41
- // Domain used as the per-org broadcast/outbound From address:
42
- // <org emailHandle>@outbound.marketday.ai. Verified once in Postmark at the
43
- // domain level, so every org handle sends as an authenticated sender.
44
- export const OUTBOUND_EMAIL_DOMAIN = 'outbound.marketday.ai';
45
-
46
- export const REQUEST_SOURCE_ENUMS = [
47
- 'SMS',
48
- 'WEB',
49
- 'EMAIL',
50
- 'WORKFLOW',
51
- ] as const;
52
-
53
- export const WORKFLOW_RUN_STATUS_ENUMS = [
54
- 'STARTED',
55
- 'COMPLETED',
56
- 'COMPLETED_PARTIAL',
57
- 'ERRORED',
58
- 'QUEUED',
59
- 'CANCELED',
60
- ];
43
+ export const WORKFLOW_RUN_STATUS_ENUMS = ['STARTED', 'COMPLETED', 'COMPLETED_PARTIAL', 'ERRORED', 'QUEUED', 'CANCELED'];
61
44
 
62
45
  export const WORKFLOW_KIND_ENUMS = ['WORKFLOW', 'REMINDER'];
63
46
 
64
- export const WORKFLOW_TRIGGER_TYPE_ENUMS = ['LOG', 'SCHEDULE', 'ONCE'];
47
+ // FINISHED: a workflow (kind WORKFLOW) started each time a kind of work finishes; LOG covers log and form workflows
48
+ export const WORKFLOW_TRIGGER_TYPE_ENUMS = ['LOG', 'SCHEDULE', 'ONCE', 'FINISHED'];
65
49
 
66
50
  export const WORKFLOW_WAIT_CHANNEL_ENUMS = ['SMS', 'EMAIL'];
67
51
 
52
+ // WAITING: a scheduled task waiting for other work to finish; BLOCKED: one that ended because that work cannot finish
68
53
  export const WORKFLOW_LIFECYCLE_STATUS_ENUMS = [
69
54
  'INACTIVE',
70
55
  'ACTIVE',
71
56
  'SCHEDULED',
72
57
  'IN_PROGRESS',
73
58
  'COMPLETED',
59
+ 'DRAFT',
60
+ 'WAITING',
61
+ 'BLOCKED',
74
62
  ];
75
63
 
76
- export const WORKFLOW_SORT_ENUMS = [
77
- 'CREATED_DESC',
78
- 'LAST_RUN_DESC',
79
- 'TITLE_ASC',
80
- ];
64
+ // workflow_versions.state: a draft being written, the published version runs use, or a version a later publish replaced
65
+ export const WORKFLOW_VERSION_STATE_ENUMS = ['DRAFT', 'PUBLISHED', 'RETIRED'];
66
+
67
+ export const WORKFLOW_SORT_ENUMS = ['CREATED_DESC', 'LAST_RUN_DESC', 'TITLE_ASC'];
81
68
 
82
69
  export const WORKFLOW_RUN_SORT_ENUMS = ['LATEST_ACTIVITY_DESC'];
@@ -1,3 +1,5 @@
1
+ export const APP_NAME = 'Marketday';
2
+
1
3
  // Max file size (client)
2
4
 
3
5
  export const MAX_FILE_SIZE_CLIENT = 20 * 1024 * 1024; // 20 MB
@@ -15,6 +17,7 @@ export const DOM_IDS = {
15
17
 
16
18
  export const END_BUTTON_WIDTH = '40px';
17
19
  export const DATE_WIDTH = '100px';
20
+ export const DATE_AND_TIME_WIDTH = '180px';
18
21
  export const DATE_AND_BUTTON_WIDTH = DATE_WIDTH + ' ' + END_BUTTON_WIDTH;
19
22
 
20
23
  // Common, repeatable classnames
@@ -29,6 +32,8 @@ export const COMMON_CLASSNAMES = {
29
32
  // These are x-paddings used for consistency around content
30
33
  tableRowXPadding: 'px_20',
31
34
  contentXPadding: 'px_28',
35
+ contentPadding_shadow_offset: 'p_27',
36
+ contentXPadding_shadow_offset: 'px_27',
32
37
  contentLeftPadding: 'pl_28',
33
38
  contentSidebarClosedPadding: 'pl_8',
34
39
  contentXMargin: 'mx_28',
@@ -63,6 +68,7 @@ export const COMPANY_ADDRESS = {
63
68
  // Support emails
64
69
 
65
70
  export const APP_EMAILS = {
71
+ assistant: 'assistant@marketday.ai',
66
72
  support: 'hello@marketday.ai',
67
73
  } as Record<string, string>;
68
74
 
@@ -107,6 +113,32 @@ export const COLORS = [
107
113
  'stone',
108
114
  ];
109
115
 
116
+ // Preferred colors
117
+
118
+ export const PREFERRED_COLORS = [
119
+ 'emerald',
120
+ 'sky',
121
+ 'violet',
122
+ 'rose',
123
+ 'amber',
124
+
125
+ 'lime',
126
+ 'green',
127
+ 'blue',
128
+ 'indigo',
129
+ 'red',
130
+
131
+ 'teal',
132
+ 'cyan',
133
+ 'purple',
134
+ 'fuchsia',
135
+ 'orange',
136
+
137
+ 'brown',
138
+ 'yellow',
139
+ 'pink',
140
+ ];
141
+
110
142
  // Major colors where limited color options are preferred
111
143
 
112
144
  export const MAJOR_COLORS = [
@@ -123,6 +155,17 @@ export const MAJOR_COLORS = [
123
155
 
124
156
  export const SUPPORTED_LANGUAGES = ['en', 'es'];
125
157
 
158
+ export const SUPPORTED_LOG_LANGUAGES = ['en', 'es', 'fr', 'pt', 'de', 'it', 'vi', 'zh-Hans'] as const;
159
+
160
+ export type SupportedLogLanguage = (typeof SUPPORTED_LOG_LANGUAGES)[number];
161
+
162
+ /*
163
+ * Return whether a value is one of the languages supported for log translation.
164
+ */
165
+ export function isSupportedLogLanguage(value: unknown): value is SupportedLogLanguage {
166
+ return typeof value === 'string' && (SUPPORTED_LOG_LANGUAGES as readonly string[]).includes(value);
167
+ }
168
+
126
169
  // Countries
127
170
 
128
171
  export const SUPPORTED_COUNTRIES = [
@@ -22,24 +22,13 @@ const WS_ACTIONS = {
22
22
  session: 'session:',
23
23
  organization: 'org:',
24
24
 
25
- // Server-authorized per-DataTable data delivery
26
- data_table: 'data_table:',
27
- data_table_watch: 'dt_w',
28
- data_table_watch_ack: 'dt_wa',
29
- data_table_change: 'dt_c',
30
- data_table_change_ack: 'dt_ca',
31
- data_table_preview_replay_request: 'dt_pr',
32
- data_table_selection: 'dt_s',
33
- data_table_unwatch: 'dt_u',
34
-
35
25
  // Sheet collaboration
36
26
  sheet: 'sheet:',
37
27
  sheet_join: 'sh_j',
38
28
  sheet_leave: 'sh_l',
39
29
  sheet_presence: 'sh_p',
40
30
  sheet_selection: 'sh_s',
41
- sheet_change: 'sh_c',
42
- sheet_change_ack: 'sh_ca',
31
+ sheet_draft: 'sh_d',
43
32
 
44
33
  // Authorization-only Sheet access watcher (no workbook/collab payloads)
45
34
  sheet_access: 'sheet_access:',
@@ -49,9 +38,6 @@ const WS_ACTIONS = {
49
38
 
50
39
  // Server-managed, signed-capability Sheet data delivery room
51
40
  sheet_data: 'sheet_data:',
52
- // DataTable edit previews bridged into a Sheet's stable data room, so a Sheet
53
- // viewer sees generated region cells change without joining DataTable rooms
54
- sheet_data_table_change: 'sh_dtc',
55
41
  };
56
42
 
57
43
  export default WS_ACTIONS;
@@ -47,7 +47,7 @@ export default {
47
47
  ai_language: 'Preferred language for AI',
48
48
  timeZone: 'Time zone',
49
49
  your_account: 'Your account',
50
- sessions: 'Devices and sessions',
50
+ sessions: 'Sessions',
51
51
  sessions_desc: 'Review the devices currently signed in to your account.',
52
52
  session_current: 'Current session',
53
53
  session_last_active: 'Last active %{date}',