@jsb188/app 1.1.11 → 1.1.12

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 (59) hide show
  1. package/package.json +7 -4
  2. package/src/constants/agent.ts +39 -62
  3. package/src/constants/app.ts +17 -0
  4. package/src/constants/wsActions.ts +7 -15
  5. package/src/i18n/account.ts +1 -1
  6. package/src/i18n/agent.ts +326 -88
  7. package/src/i18n/agentToolBusiness.ts +196 -0
  8. package/src/i18n/agentToolGrid.ts +137 -0
  9. package/src/i18n/agentToolWorkflow.ts +101 -0
  10. package/src/i18n/agent_note.ts +109 -0
  11. package/src/i18n/app.ts +23 -17
  12. package/src/i18n/auth.ts +28 -30
  13. package/src/i18n/billing.ts +3 -85
  14. package/src/i18n/c.ts +907 -0
  15. package/src/i18n/campaign.ts +842 -140
  16. package/src/i18n/datetime.ts +6 -0
  17. package/src/i18n/editor.ts +58 -0
  18. package/src/i18n/error.ts +307 -168
  19. package/src/i18n/field_doc_editor.ts +21 -0
  20. package/src/i18n/field_doc_programs.ts +52 -0
  21. package/src/i18n/field_docs.ts +170 -8
  22. package/src/i18n/index.ts +21 -5
  23. package/src/i18n/log.ts +232 -38
  24. package/src/i18n/memory.ts +18 -4
  25. package/src/i18n/note.ts +5 -3
  26. package/src/i18n/org.ts +93 -44
  27. package/src/i18n/schedule.ts +209 -0
  28. package/src/i18n/sheet.ts +102 -145
  29. package/src/i18n/sheet_formula.ts +165 -0
  30. package/src/i18n/workflow.ts +48 -9
  31. package/src/main.ts +2 -2
  32. package/src/platform.ts +89 -49
  33. package/src/types/ai.d.ts +19 -0
  34. package/src/types/app.d.ts +50 -57
  35. package/src/types/other.d.ts +8 -1
  36. package/src/utils/api.ts +46 -0
  37. package/src/utils/clientIP.ts +213 -0
  38. package/src/utils/color.ts +77 -0
  39. package/src/utils/csv.ts +19 -0
  40. package/src/utils/datetime.ts +207 -31
  41. package/src/utils/deferredSave.ts +89 -0
  42. package/src/utils/email.ts +50 -0
  43. package/src/utils/expression.helpers.ts +470 -0
  44. package/src/utils/expression.test.ts +793 -0
  45. package/src/utils/expression.ts +1633 -239
  46. package/src/utils/language.ts +9 -0
  47. package/src/utils/logic.ts +9 -162
  48. package/src/utils/number.ts +30 -11
  49. package/src/utils/object.ts +29 -0
  50. package/src/utils/promise.ts +78 -7
  51. package/src/utils/queryReset.ts +101 -14
  52. package/src/utils/string.test.ts +24 -39
  53. package/src/utils/string.ts +73 -143
  54. package/src/utils/url_client.ts +83 -14
  55. package/src/constants/billing.ts +0 -146
  56. package/src/i18n/agentDoc.ts +0 -110
  57. package/src/i18n/form.ts +0 -496
  58. package/src/types/form.d.ts +0 -101
  59. package/src/utils/billing.ts +0 -141
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsb188/app",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "Contains all the basic requirements for all @jsb188 apps.",
5
5
  "license": "ISC",
6
6
  "author": "jsb188",
@@ -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": {
@@ -1,63 +1,50 @@
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 Postmark
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 CAMPAIGN_REPLY_TO_AGENT_DOMAINS = [
42
+ ...new Set([...Object.values(OPERATION_INBOX_DOMAINS).flat(), ...DO_NOT_REPLY_EMAIL_DOMAINS]),
43
+ ];
34
44
 
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;
45
+ export const REQUEST_SOURCE_ENUMS = ['SMS', 'WEB', 'EMAIL', 'WORKFLOW'] as const;
40
46
 
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
- ];
47
+ export const WORKFLOW_RUN_STATUS_ENUMS = ['STARTED', 'COMPLETED', 'COMPLETED_PARTIAL', 'ERRORED', 'QUEUED', 'CANCELED'];
61
48
 
62
49
  export const WORKFLOW_KIND_ENUMS = ['WORKFLOW', 'REMINDER'];
63
50
 
@@ -65,18 +52,8 @@ export const WORKFLOW_TRIGGER_TYPE_ENUMS = ['LOG', 'SCHEDULE', 'ONCE'];
65
52
 
66
53
  export const WORKFLOW_WAIT_CHANNEL_ENUMS = ['SMS', 'EMAIL'];
67
54
 
68
- export const WORKFLOW_LIFECYCLE_STATUS_ENUMS = [
69
- 'INACTIVE',
70
- 'ACTIVE',
71
- 'SCHEDULED',
72
- 'IN_PROGRESS',
73
- 'COMPLETED',
74
- ];
55
+ export const WORKFLOW_LIFECYCLE_STATUS_ENUMS = ['INACTIVE', 'ACTIVE', 'SCHEDULED', 'IN_PROGRESS', 'COMPLETED'];
75
56
 
76
- export const WORKFLOW_SORT_ENUMS = [
77
- 'CREATED_DESC',
78
- 'LAST_RUN_DESC',
79
- 'TITLE_ASC',
80
- ];
57
+ export const WORKFLOW_SORT_ENUMS = ['CREATED_DESC', 'LAST_RUN_DESC', 'TITLE_ASC'];
81
58
 
82
59
  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
 
@@ -123,6 +129,17 @@ export const MAJOR_COLORS = [
123
129
 
124
130
  export const SUPPORTED_LANGUAGES = ['en', 'es'];
125
131
 
132
+ export const SUPPORTED_LOG_LANGUAGES = ['en', 'es', 'fr', 'pt', 'de', 'it', 'vi', 'zh-Hans'] as const;
133
+
134
+ export type SupportedLogLanguage = (typeof SUPPORTED_LOG_LANGUAGES)[number];
135
+
136
+ /*
137
+ * Return whether a value is one of the languages supported for log translation.
138
+ */
139
+ export function isSupportedLogLanguage(value: unknown): value is SupportedLogLanguage {
140
+ return typeof value === 'string' && (SUPPORTED_LOG_LANGUAGES as readonly string[]).includes(value);
141
+ }
142
+
126
143
  // Countries
127
144
 
128
145
  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,12 @@ 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',
41
+
42
+ // Account-owned Orchestrator artifact events. A socket joins its own
43
+ // authenticated account room only while that tab's orchestrator is open.
44
+ orchestrator: 'gcp:',
45
+ orchestrator_watch: 'gcp_w',
46
+ orchestrator_unwatch: 'gcp_uw',
55
47
  };
56
48
 
57
49
  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}',