@jsb188/app 1.1.10 → 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 (79) hide show
  1. package/package.json +57 -45
  2. package/src/constants/agent.ts +51 -41
  3. package/src/constants/app.ts +34 -13
  4. package/src/constants/emoji.ts +9144 -8936
  5. package/src/constants/other.ts +1 -5
  6. package/src/constants/user.ts +16 -25
  7. package/src/constants/wsActions.ts +27 -0
  8. package/src/i18n/account.ts +129 -107
  9. package/src/i18n/agent.ts +331 -73
  10. package/src/i18n/agentToolBusiness.ts +196 -0
  11. package/src/i18n/agentToolGrid.ts +137 -0
  12. package/src/i18n/agentToolWorkflow.ts +101 -0
  13. package/src/i18n/agent_note.ts +109 -0
  14. package/src/i18n/app.ts +107 -91
  15. package/src/i18n/auth.ts +117 -102
  16. package/src/i18n/billing.ts +5 -92
  17. package/src/i18n/c.ts +907 -0
  18. package/src/i18n/campaign.ts +919 -0
  19. package/src/i18n/country.ts +248 -248
  20. package/src/i18n/datetime.ts +32 -26
  21. package/src/i18n/editor.ts +58 -0
  22. package/src/i18n/error.ts +577 -192
  23. package/src/i18n/field_doc_editor.ts +21 -0
  24. package/src/i18n/field_doc_programs.ts +52 -0
  25. package/src/i18n/field_docs.ts +190 -0
  26. package/src/i18n/index.ts +42 -19
  27. package/src/i18n/log.ts +272 -238
  28. package/src/i18n/memory.ts +53 -0
  29. package/src/i18n/message.ts +3 -4
  30. package/src/i18n/note.ts +19 -0
  31. package/src/i18n/org.ts +164 -109
  32. package/src/i18n/schedule.ts +209 -0
  33. package/src/i18n/sheet.ts +333 -4
  34. package/src/i18n/sheet_formula.ts +165 -0
  35. package/src/i18n/workflow.ts +109 -23
  36. package/src/main.ts +68 -64
  37. package/src/platform.ts +90 -49
  38. package/src/types/ai.d.ts +52 -23
  39. package/src/types/app.d.ts +95 -44
  40. package/src/types/auth.d.ts +66 -40
  41. package/src/types/console.d.ts +3 -0
  42. package/src/types/other.d.ts +13 -6
  43. package/src/types.d.ts +12 -14
  44. package/src/utils/account.ts +64 -58
  45. package/src/utils/api.ts +326 -77
  46. package/src/utils/authSession.ts +24 -0
  47. package/src/utils/clientIP.ts +213 -0
  48. package/src/utils/color.ts +279 -0
  49. package/src/utils/cron.ts +49 -18
  50. package/src/utils/csv.ts +19 -0
  51. package/src/utils/datetime.ts +445 -117
  52. package/src/utils/deferredSave.ts +89 -0
  53. package/src/utils/email.ts +50 -0
  54. package/src/utils/emoji.ts +107 -84
  55. package/src/utils/expression.helpers.ts +470 -0
  56. package/src/utils/expression.test.ts +793 -0
  57. package/src/utils/expression.ts +2261 -0
  58. package/src/utils/interval.ts +80 -0
  59. package/src/utils/language.ts +9 -0
  60. package/src/utils/logic.ts +141 -121
  61. package/src/utils/managedSession.ts +34 -0
  62. package/src/utils/managedSessionBff.test.ts +60 -0
  63. package/src/utils/managedSessionBff.ts +117 -0
  64. package/src/utils/number.ts +85 -38
  65. package/src/utils/object.ts +227 -30
  66. package/src/utils/promise.ts +98 -0
  67. package/src/utils/queryReset.ts +266 -0
  68. package/src/utils/recurringTask.ts +60 -0
  69. package/src/utils/schema.ts +293 -0
  70. package/src/utils/string.test.ts +205 -208
  71. package/src/utils/string.ts +426 -463
  72. package/src/utils/timeZone.ts +309 -851
  73. package/src/utils/url_client.ts +145 -72
  74. package/tsconfig.json +10 -10
  75. package/src/constants/billing.ts +0 -146
  76. package/src/i18n/form.ts +0 -376
  77. package/src/i18n/product.ts +0 -76
  78. package/src/types/form.d.ts +0 -97
  79. package/src/utils/billing.ts +0 -134
package/package.json CHANGED
@@ -1,47 +1,59 @@
1
1
  {
2
- "name": "@jsb188/app",
3
- "version": "1.1.10",
4
- "description": "Contains all the basic requirements for all @jsb188 apps.",
5
- "license": "ISC",
6
- "author": "jsb188",
7
- "type": "module",
8
- "main": "src/main.ts",
9
- "types": "src/types.d.ts",
10
- "exports": {
11
- ".": "./src/main.ts",
12
- "./platform.ts": "./src/platform.ts",
13
- "./i18n/index.ts": "./src/i18n/index.ts",
14
- "./constants/agent.ts": "./src/constants/agent.ts",
15
- "./constants/app.ts": "./src/constants/app.ts",
16
- "./constants/billing.ts": "./src/constants/billing.ts",
17
- "./constants/emoji.ts": "./src/constants/emoji.ts",
18
- "./constants/other.ts": "./src/constants/other.ts",
19
- "./constants/user.ts": "./src/constants/user.ts",
20
- "./constants/wsActions.ts": "./src/constants/wsActions.ts",
21
- "./utils/account.ts": "./src/utils/account.ts",
22
- "./utils/api.ts": "./src/utils/api.ts",
23
- "./utils/billing.ts": "./src/utils/billing.ts",
24
- "./utils/datetime.ts": "./src/utils/datetime.ts",
25
- "./utils/emoji.ts": "./src/utils/emoji.ts",
26
- "./utils/cron.ts": "./src/utils/cron.ts",
27
- "./utils/logic.ts": "./src/utils/logic.ts",
28
- "./utils/number.ts": "./src/utils/number.ts",
29
- "./utils/object.ts": "./src/utils/object.ts",
30
- "./utils/string.ts": "./src/utils/string.ts",
31
- "./utils/timeZone.ts": "./src/utils/timeZone.ts",
32
- "./utils/url_client.ts": "./src/utils/url_client.ts",
33
- "./types/ai.d.ts": "./src/types/ai.d.ts",
34
- "./types/app.d.ts": "./src/types/app.d.ts",
35
- "./types/auth.d.ts": "./src/types/auth.d.ts",
36
- "./types/form.d.ts": "./src/types/form.d.ts",
37
- "./types/other.d.ts": "./src/types/other.d.ts"
38
- },
39
- "dependencies": {
40
- "node-polyglot": "^2.6.0",
41
- "luxon": "^3.6.1",
42
- "cron-parser": "^5.5.0"
43
- },
44
- "scripts": {
45
- "test": "echo \"Error: no test specified\" && exit 1"
46
- }
2
+ "name": "@jsb188/app",
3
+ "version": "1.1.12",
4
+ "description": "Contains all the basic requirements for all @jsb188 apps.",
5
+ "license": "ISC",
6
+ "author": "jsb188",
7
+ "type": "module",
8
+ "main": "src/main.ts",
9
+ "types": "src/types.d.ts",
10
+ "exports": {
11
+ ".": "./src/main.ts",
12
+ "./platform.ts": "./src/platform.ts",
13
+ "./i18n/index.ts": "./src/i18n/index.ts",
14
+ "./constants/agent.ts": "./src/constants/agent.ts",
15
+ "./constants/app.ts": "./src/constants/app.ts",
16
+ "./constants/emoji.ts": "./src/constants/emoji.ts",
17
+ "./constants/other.ts": "./src/constants/other.ts",
18
+ "./constants/user.ts": "./src/constants/user.ts",
19
+ "./constants/wsActions.ts": "./src/constants/wsActions.ts",
20
+ "./utils/account.ts": "./src/utils/account.ts",
21
+ "./utils/api.ts": "./src/utils/api.ts",
22
+ "./utils/authSession.ts": "./src/utils/authSession.ts",
23
+ "./utils/clientIP.ts": "./src/utils/clientIP.ts",
24
+ "./utils/managedSession.ts": "./src/utils/managedSession.ts",
25
+ "./utils/managedSessionBff.ts": "./src/utils/managedSessionBff.ts",
26
+ "./utils/color.ts": "./src/utils/color.ts",
27
+ "./utils/csv.ts": "./src/utils/csv.ts",
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",
32
+ "./utils/emoji.ts": "./src/utils/emoji.ts",
33
+ "./utils/cron.ts": "./src/utils/cron.ts",
34
+ "./utils/interval.ts": "./src/utils/interval.ts",
35
+ "./utils/language.ts": "./src/utils/language.ts",
36
+ "./utils/logic.ts": "./src/utils/logic.ts",
37
+ "./utils/number.ts": "./src/utils/number.ts",
38
+ "./utils/object.ts": "./src/utils/object.ts",
39
+ "./utils/promise.ts": "./src/utils/promise.ts",
40
+ "./utils/queryReset.ts": "./src/utils/queryReset.ts",
41
+ "./utils/recurringTask.ts": "./src/utils/recurringTask.ts",
42
+ "./utils/schema.ts": "./src/utils/schema.ts",
43
+ "./utils/string.ts": "./src/utils/string.ts",
44
+ "./utils/timeZone.ts": "./src/utils/timeZone.ts",
45
+ "./utils/url_client.ts": "./src/utils/url_client.ts",
46
+ "./types/ai.d.ts": "./src/types/ai.d.ts",
47
+ "./types/app.d.ts": "./src/types/app.d.ts",
48
+ "./types/auth.d.ts": "./src/types/auth.d.ts",
49
+ "./types/other.d.ts": "./src/types/other.d.ts"
50
+ },
51
+ "dependencies": {
52
+ "node-polyglot": "^2.6.0",
53
+ "luxon": "^3.7.2",
54
+ "cron-parser": "^5.6.2"
55
+ },
56
+ "scripts": {
57
+ "test": "echo \"Error: no test specified\" && exit 1"
58
+ }
47
59
  }
@@ -1,49 +1,59 @@
1
-
2
1
  // AI agent inboxes
3
2
 
4
- const GROUP_TO_INBOX_DOMAINS = {
5
- vendor: [
6
- 'orders.marketday.ai',
7
- // 'agent.marketday.ai', // enable when ready
8
- ],
9
- default: [
10
- // 'agent.marketday.ai', // enable when ready
11
- ]
12
- };
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];
13
26
 
14
27
  export const OPERATION_INBOX_DOMAINS = {
15
- ARABLE: GROUP_TO_INBOX_DOMAINS.vendor,
16
- RESTAURANT: GROUP_TO_INBOX_DOMAINS.vendor,
17
- DEFAULT: GROUP_TO_INBOX_DOMAINS.default,
28
+ DEFAULT: AGENT_EMAIL_DOMAINS,
18
29
  };
19
30
 
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
+ >;
36
+
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'> = [];
20
40
 
21
- export const DOMAIN_TO_INBOX = {
22
- // Assistant
23
- 'agent.marketday.ai': 'ASSISTANT',
24
- 'assistant.marketday.ai': 'ASSISTANT',
25
-
26
- // General inquiry
27
- 'general.marketday.ai': 'GENERAL_INQUIRY',
28
- 'info.marketday.ai': 'GENERAL_INQUIRY',
29
- 'inquiry.marketday.ai': 'GENERAL_INQUIRY',
30
-
31
- // Orders
32
- 'orders.marketday.ai': 'ORDERS',
33
- } as const;
34
-
35
- export const REQUEST_SOURCE_ENUMS = [
36
- 'SMS',
37
- 'WEB',
38
- 'EMAIL',
39
- 'WORKFLOW'
40
- ] as const;
41
-
42
- export const WORKFLOW_RUN_STATUS_ENUMS = [
43
- 'STARTED',
44
- 'COMPLETED',
45
- 'COMPLETED_PARTIAL',
46
- 'ERRORED',
47
- 'QUEUED',
48
- 'CANCELED',
41
+ export const CAMPAIGN_REPLY_TO_AGENT_DOMAINS = [
42
+ ...new Set([...Object.values(OPERATION_INBOX_DOMAINS).flat(), ...DO_NOT_REPLY_EMAIL_DOMAINS]),
49
43
  ];
44
+
45
+ export const REQUEST_SOURCE_ENUMS = ['SMS', 'WEB', 'EMAIL', 'WORKFLOW'] as const;
46
+
47
+ export const WORKFLOW_RUN_STATUS_ENUMS = ['STARTED', 'COMPLETED', 'COMPLETED_PARTIAL', 'ERRORED', 'QUEUED', 'CANCELED'];
48
+
49
+ export const WORKFLOW_KIND_ENUMS = ['WORKFLOW', 'REMINDER'];
50
+
51
+ export const WORKFLOW_TRIGGER_TYPE_ENUMS = ['LOG', 'SCHEDULE', 'ONCE'];
52
+
53
+ export const WORKFLOW_WAIT_CHANNEL_ENUMS = ['SMS', 'EMAIL'];
54
+
55
+ export const WORKFLOW_LIFECYCLE_STATUS_ENUMS = ['INACTIVE', 'ACTIVE', 'SCHEDULED', 'IN_PROGRESS', 'COMPLETED'];
56
+
57
+ export const WORKFLOW_SORT_ENUMS = ['CREATED_DESC', 'LAST_RUN_DESC', 'TITLE_ASC'];
58
+
59
+ export const WORKFLOW_RUN_SORT_ENUMS = ['LATEST_ACTIVITY_DESC'];
@@ -1,3 +1,4 @@
1
+ export const APP_NAME = 'Marketday';
1
2
 
2
3
  // Max file size (client)
3
4
 
@@ -16,6 +17,7 @@ export const DOM_IDS = {
16
17
 
17
18
  export const END_BUTTON_WIDTH = '40px';
18
19
  export const DATE_WIDTH = '100px';
20
+ export const DATE_AND_TIME_WIDTH = '180px';
19
21
  export const DATE_AND_BUTTON_WIDTH = DATE_WIDTH + ' ' + END_BUTTON_WIDTH;
20
22
 
21
23
  // Common, repeatable classnames
@@ -27,10 +29,14 @@ export const COMMON_CLASSNAMES = {
27
29
  modalScreenSplitContent: 'h_top px_md pb_md gap_lg',
28
30
  modalScreenHeading: 'pt_lg pb_df ft_normal ft_xs cl_darker_2 ls_2',
29
31
 
30
- // These are x-paddings used for consistency around content
31
- tableRowXPadding: 'px_20',
32
- contentXPadding: 'px_28',
33
- contentXMargin: 'mx_28',
32
+ // These are x-paddings used for consistency around content
33
+ tableRowXPadding: 'px_20',
34
+ contentXPadding: 'px_28',
35
+ contentPadding_shadow_offset: 'p_27',
36
+ contentXPadding_shadow_offset: 'px_27',
37
+ contentLeftPadding: 'pl_28',
38
+ contentSidebarClosedPadding: 'pl_8',
39
+ contentXMargin: 'mx_28',
34
40
  };
35
41
 
36
42
  // Local storage
@@ -41,6 +47,9 @@ export const STORAGE_KEYS = {
41
47
  LAST_VERSION: 'LV:', // ":" at end means it's a prefix
42
48
  CURRENT_ACCOUNT_ID: 'CU:',
43
49
 
50
+ // Personalization
51
+ TABLE_COLUMNS_WIDTH: 'TC:',
52
+
44
53
  // Settings
45
54
  LIGHT_MODE: 'LM:',
46
55
  } as Record<string, string>;
@@ -59,6 +68,7 @@ export const COMPANY_ADDRESS = {
59
68
  // Support emails
60
69
 
61
70
  export const APP_EMAILS = {
71
+ assistant: 'assistant@marketday.ai',
62
72
  support: 'hello@marketday.ai',
63
73
  } as Record<string, string>;
64
74
 
@@ -69,10 +79,13 @@ export const SOCIAL_URLS = {
69
79
  x: 'https://x.com/?',
70
80
  x_username: '?',
71
81
  },
72
- } as Record<string, {
73
- x: string;
74
- x_username: string;
75
- }>;
82
+ } as Record<
83
+ string,
84
+ {
85
+ x: string;
86
+ x_username: string;
87
+ }
88
+ >;
76
89
 
77
90
  // Colors
78
91
 
@@ -104,7 +117,7 @@ export const COLORS = [
104
117
 
105
118
  export const MAJOR_COLORS = [
106
119
  'red',
107
- 'amber',
120
+ 'amber',
108
121
  'yellow',
109
122
  'emerald', // Using "emerald" instead of "green" because its closer to brand color
110
123
  'blue',
@@ -114,10 +127,18 @@ export const MAJOR_COLORS = [
114
127
 
115
128
  // Languages
116
129
 
117
- export const SUPPORTED_LANGUAGES = [
118
- 'en',
119
- 'es',
120
- ];
130
+ export const SUPPORTED_LANGUAGES = ['en', 'es'];
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
+ }
121
142
 
122
143
  // Countries
123
144