@jsb188/app 1.1.5 → 1.1.6

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/i18n/error.ts CHANGED
@@ -12,8 +12,9 @@ export default {
12
12
  not_allowed_perms: 'You do not have permission to do that.',
13
13
  login_changed: 'Login changed',
14
14
  link_expired: 'Link expired',
15
- link_expired_msg: 'This link expired. Please try again by requesting another link.',
16
- invalid_link_msg: 'This link is invalid. Please try again by requesting another link.',
15
+ invalid_link: 'Invalid link',
16
+ link_expired_msg: 'This link expired. Please try again by\n requesting another link.',
17
+ invalid_link_msg: 'This link is invalid. Please try again by\n requesting another link.',
17
18
 
18
19
  // 1x
19
20
  '10000_title': 'App updated!',
@@ -30,6 +31,7 @@ export default {
30
31
  10010: 'Your Apple login token was invalid.',
31
32
  10011: 'Apple API failed to respond.',
32
33
  10012: 'This browser tab will reload because you changed your login.',
34
+ 10013: 'Our e-mail service is experiencing an outage. Please try again in a moment.',
33
35
 
34
36
  // 2x
35
37
 
@@ -43,7 +45,7 @@ export default {
43
45
  20005: 'Could not find the account with that username (@%{value})',
44
46
  20006: 'Could not find the account with that e-mail. (%{value})',
45
47
  20007: 'Could not find the account with that ID. (%{value})',
46
- 20008: 'Your password is incorrect. You have %{value} try(s) remaining.',
48
+ 20008: 'Your password is incorrect. You have %{value} try remaining.||||Your password is incorrect. You have %{value} tries remaining.',
47
49
  20009: 'Please wait 10 minutes before trying to log in again.',
48
50
  20010: 'This account could not be found.',
49
51
  20011: 'Your token expired, please request a new link.',
@@ -54,7 +56,8 @@ export default {
54
56
  20016: 'You are being rate limited. Please try again in a moment.',
55
57
  20017: 'Please check your-email before requesting another verification link or wait few more seconds.',
56
58
  20018: "Your e-mail is already verified. There's no need to verify your e-mail again.",
57
- 20019: 'You are not logged in. Please log in and try again.',
59
+ '20019_title': 'Login expired',
60
+ 20019: 'Your login token expired. Please log in again.',
58
61
  20020: 'You do not have access to this chat.',
59
62
  '20021_title': 'Slow down!',
60
63
  20021: 'You are sending messages too fast.',
@@ -97,6 +100,9 @@ export default {
97
100
  20058: 'You do not have permissions to edit this log. Please contact your administrator.',
98
101
  20059: 'This log was not found.\nIt may have been deleted.',
99
102
  20060: 'You do not have permissions to delete this log. Please contact your administrator.',
103
+ 20061: 'You do not have permissions to perform this action. Please contact your administrator.',
104
+ 20062: '"%{value}" is not a valid e-mail address.',
105
+ 20063: 'You cannot change your e-mail to the same e-mail address.',
100
106
 
101
107
  '29999_title': 'Not ready',
102
108
  29999: 'AI chat is not ready right now.',
@@ -104,6 +110,7 @@ export default {
104
110
  // 3x
105
111
 
106
112
  30000: 'An unknown error occured.',
113
+ 30002: 'We made an error in our code. We will fix this soon.',
107
114
  30003: "We're having trouble accessing the server.",
108
115
  30004: 'We made a mistake in our code. We will fix this soon.',
109
116
  30010: 'Google servers are not responding right now.',
package/i18n/form.ts CHANGED
@@ -5,26 +5,73 @@ export default {
5
5
  no_nevermind: 'No, nevermind',
6
6
  ok: 'OK',
7
7
  or: 'or',
8
+ n_a: 'N/A',
9
+ unknown: 'Unknown',
10
+ void: 'Void', // Use uppercase if needed
11
+ location: 'Location',
8
12
  warning: 'Warning',
9
13
  cancel: 'Cancel',
10
14
  continue: 'Continue',
11
15
  continue_editing: 'Continue editing',
16
+ class: 'Class',
17
+ classification: 'Classification',
18
+ overview: 'Overview',
19
+ latest: 'Latest',
20
+ latest_activity: 'Latest Activity',
21
+ dob: 'DOB',
22
+ date_of_birth: 'Date of birth',
23
+ deceased: 'Deceased',
24
+ confirmation: 'Confirmation',
25
+ primary: 'Primary',
26
+ id: 'ID',
27
+ for: 'For',
28
+ sort_by: 'Sort by',
29
+ sort_list: 'Sort list',
12
30
  apply: 'Apply',
13
31
  apply_filters: 'Apply filters',
32
+ content_missing: 'Content missing',
33
+ content_not_found_msg: 'The content you are looking for could not be found.',
34
+ reports: 'Reports',
35
+ section: 'Section',
36
+ title: 'Title',
14
37
  hide: 'Hide',
15
38
  show: 'Show',
16
39
  deleted: 'Deleted',
17
40
  delete: 'Delete',
41
+ balance: 'Balance',
42
+ number: 'Number',
43
+ livestock: 'Livestock',
44
+ frequency: 'Frequency',
45
+ expiration: 'Expiration',
46
+ expiration_date: 'Expiration date',
47
+ document: 'Document',
48
+ documents: 'Documents',
49
+ document_type: 'Document type',
50
+ untitled_document: 'Untitled document',
18
51
  try_again: 'Try again',
19
52
  refresh_page: 'Refresh page',
53
+ authenticate: 'Authenticate',
54
+ please_verify: 'Please verify',
55
+ check_email: 'Check your e-mail',
56
+ request_will_complete_once_verified_msg: 'Your request will be completed once the verification is complete.',
57
+ your_request_is_completed_msg: 'Your request is completed.',
58
+ page_of: 'Page %{number} of %{total}',
59
+ subtotal: 'Subtotal',
60
+ total: 'Total',
61
+ receipts: 'Receipts',
62
+ market_receipts: 'Market receipts',
20
63
  search: 'Search',
64
+ submitted: 'Submitted',
21
65
  no_results: 'No results',
22
66
  change: 'Change',
67
+ loading_: 'Loading...',
23
68
  save: 'Save',
24
69
  saving_: 'Saving...',
25
70
  undo_changes: 'Undo changes',
26
71
  save_changes: 'Save changes',
27
72
  unsaved_changes_msg: 'You have unsaved changes.',
73
+ table_of_contents: 'Table of contents',
74
+ copy_to_clipboard: 'Copy to clipboard',
28
75
  ai: 'AI',
29
76
  you: 'You',
30
77
  copied_: 'Copied!',
@@ -36,15 +83,60 @@ export default {
36
83
  join: 'Join',
37
84
  change_img: 'Change image',
38
85
  upload_img: 'Upload image',
86
+ upload_files: 'Upload files',
39
87
  keep_current_img: 'Keep current image',
40
88
  select_file: 'Select file',
89
+ task_: 'Task – %{text}',
90
+ tasks: 'Tasks',
91
+ latest_update: 'Latest update',
41
92
  name: 'Name',
93
+ item: 'Item',
94
+ items: 'Items',
95
+ tax: 'Tax',
96
+ price: 'Price',
97
+ unit: 'Unit',
98
+ unit_price: 'Unit Price',
99
+ price_ph: '1000.50',
100
+ tax_ph: '78.20',
101
+ purchase_summary: 'Purchase summary',
102
+ amount: 'Amount',
103
+ address: 'Address',
104
+ unknown_address: 'Unknown address',
105
+ line1: 'Line 1',
106
+ line1_ph: '1234 Main St.',
107
+ line2_optional: 'Line 2 (optional)',
108
+ line2_ph: 'Apartment, suite, unit, building, floor, etc.',
109
+ city: 'City',
110
+ city_ph: 'Some City',
111
+ state: 'State',
112
+ state_ph: 'CA',
113
+ country: 'Country',
114
+ country_ph: 'United States, Canada, etc.',
115
+ postalCode: 'Zip code', // USA uses zip code
116
+ postalCode_ph: '12345',
117
+ workflows: 'Workflows',
118
+ information: 'Information',
119
+ instructions: 'Instructions',
120
+ metadata: 'Metadata',
121
+ summary: 'Summary',
122
+ instructions_summary: 'Instructions summary',
123
+ status: 'Status',
124
+ orders: 'Orders',
125
+ 'order_#': 'Order #',
126
+ order_details: 'Order details',
127
+ type: 'Type',
42
128
  pin_to_top: 'Pin to top',
43
129
  create_new: 'Create new',
44
130
  upload: 'Upload',
45
131
  create: 'Create',
46
132
  invite: 'Invite',
47
133
  invited: 'Invited',
134
+ invoice_date: 'Invoice date',
135
+ sales: 'Sales',
136
+ sales_orders: 'Sales & orders',
137
+ actions: 'Actions',
138
+ ai_tasks: 'AI tasks',
139
+ ai_workflows: 'AI workflows',
48
140
  add: 'Add',
49
141
  remove: 'Remove',
50
142
  removed: 'Removed',
@@ -56,30 +148,86 @@ export default {
56
148
  dismiss: 'Dismiss',
57
149
  description: 'Description',
58
150
  no_desc: 'No description.',
151
+ no_additional_notes: 'No additional notes.',
59
152
  use_default: 'Use default',
60
153
  use_personal: 'Use personal',
61
154
  learn_more: 'Learn more',
155
+ department: 'Department',
62
156
  email: 'E-mail',
157
+ phone: 'Phone',
158
+ phone_number: 'Phone number',
159
+ partners: 'Partners',
160
+ partner: 'Partner',
161
+ contact_person: 'Contact person',
162
+ farms: 'Farms',
163
+ region: 'Region',
164
+ commodities: 'Commodities',
165
+ fsvp: 'FSVP',
166
+ risk: 'Risk',
167
+ operation: 'Operation',
168
+ grower: 'Grower',
169
+ growers: 'Growers',
170
+ domestic_growers: 'Domestic growers',
171
+ foreign_growers: 'Foreign growers',
172
+ vendors: 'Vendors',
173
+ 'vendors_#': 'Vendors #',
174
+ vendor: 'Vendor',
175
+ vendor_info: 'Vendor information',
176
+ vendor_name: 'Vendor name',
177
+ markets: 'Markets',
178
+ market: 'Market',
179
+ organization: 'Organization',
180
+ coordinator: 'Co-ordinator',
181
+ contact: 'Contact',
182
+ profile: 'Profile',
183
+ compliance: 'Compliance',
184
+ requirement: 'Requirement',
185
+ person_name: 'Person name',
186
+ primary_contact: 'Primary contact',
63
187
  thank_you: 'Thank you',
64
188
  click_here: 'Click here',
65
189
  success: 'Success',
66
190
  success_: 'Success!',
67
191
  help: 'Help',
192
+ advanced: 'Advanced',
68
193
  start: 'Start',
194
+ started: 'Started',
69
195
  end: 'End',
70
196
  time: 'Time',
197
+ start_time: 'Start time',
198
+ end_time: 'End time',
71
199
  time_with_zone: 'Time (%{timeZone})',
200
+ time_zone_: 'Time zone: %{timeZone}',
201
+ not_specified: 'Not specified',
202
+ attendance: 'Attendance',
203
+ attended_: 'Attended?',
204
+ ct_attending: '%{count} / %{total} attending',
205
+ ct_attended: '%{count} / %{total} attended',
206
+ day: 'Day',
207
+ all_day: 'All day',
72
208
  date: 'Date',
209
+ daily: 'Daily',
210
+ weekly: 'Weekly',
211
+ monthly: 'Monthly',
212
+ schedule: 'Schedule',
213
+ scheduled: 'Scheduled',
214
+ created_by: 'Created by',
215
+ tasked_by: 'Tasked by',
216
+ updated: 'Updated',
217
+ next_due: 'Next due',
218
+ recurring: 'Recurring',
73
219
  start_date: 'Start date',
74
220
  end_date: 'End date',
221
+ event: 'Event',
75
222
  esc: 'ESC',
76
223
  settings: 'Settings',
77
224
  note: 'Note',
225
+ notes: 'Notes',
78
226
  details: 'Details',
227
+ temperature: 'Temperature',
228
+ water: 'Water',
79
229
  quantity: 'Quantity',
80
230
  quantity_ph: '7.5',
81
- unit: 'Unit',
82
- price: 'Price',
83
231
  cropId: 'Crop',
84
232
  logged_edited_at: 'Logged %{logDate}. Updated %{editDate}.',
85
233
  logged_at: 'Logged %{logDate}.',
@@ -96,6 +244,9 @@ export default {
96
244
  water_unit: 'Unit (water)',
97
245
  water_unit_ph: 'gallons, litres',
98
246
 
247
+ // File Browser Plus module
248
+ fbp_upload_instructions: 'Click here to upload files, or drag and drop\n your files anywhere on the screen.',
249
+
99
250
  // Day periods
100
251
  greet_MORNING: 'Good morning, %{name}.',
101
252
  greet_AFTERNOON: 'Good afternoon, %{name}.',
@@ -108,8 +259,8 @@ export default {
108
259
 
109
260
  // Languages
110
261
  lang: {
111
- ENGLISH: 'English',
112
- SPANISH: 'Spanish',
113
- },
262
+ en: 'English',
263
+ es: 'Spanish',
264
+ }
114
265
  },
115
266
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsb188/app",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Contains all the basic requirements for all @jsb188 apps.",
5
5
  "license": "ISC",
6
6
  "author": "jsb188",
@@ -14,9 +14,9 @@
14
14
  "./constants/app": "./constants/app.ts",
15
15
  "./constants/billing": "./constants/billing.ts",
16
16
  "./constants/emoji": "./constants/emoji.ts",
17
- "./constants/organization": "./constants/organization.ts",
17
+ "./constants/other": "./constants/other.ts",
18
18
  "./constants/user": "./constants/user.ts",
19
- "./constants/ws": "./constants/ws.ts",
19
+ "./constants/wsActions": "./constants/wsActions.ts",
20
20
  "./utils/api": "./utils/api.ts",
21
21
  "./utils/billing": "./utils/billing.ts",
22
22
  "./utils/datetime": "./utils/datetime.ts",
@@ -24,7 +24,6 @@
24
24
  "./utils/logic": "./utils/logic.ts",
25
25
  "./utils/number": "./utils/number.ts",
26
26
  "./utils/object": "./utils/object.ts",
27
- "./utils/organization": "./utils/organization.ts",
28
27
  "./utils/string": "./utils/string.ts",
29
28
  "./utils/timeZone": "./utils/timeZone.ts",
30
29
  "./utils/url_client": "./utils/url_client.ts",
@@ -34,7 +33,7 @@
34
33
  "./types/app.d": "./types/app.d.ts",
35
34
  "./types/auth.d": "./types/auth.d.ts",
36
35
  "./types/form.d": "./types/form.d.ts",
37
- "./types/organization.d": "./types/organization.d.ts"
36
+ "./types/other.d": "./types/other.d.ts"
38
37
  },
39
38
  "dependencies": {
40
39
  "node-polyglot": "^2.6.0",
@@ -7,8 +7,7 @@ import type { OrganizationACL, OrganizationRoleEnum } from './organization.d.ts'
7
7
  export interface AccountPhoneObj {
8
8
  id: number;
9
9
  number: string;
10
- primary: boolean;
11
- // verified: boolean; // Assume verified when data is fetched
10
+ verified: boolean;
12
11
  }
13
12
 
14
13
  /**
@@ -17,32 +16,33 @@ export interface AccountPhoneObj {
17
16
 
18
17
  export interface AccountObj {
19
18
  id: number;
20
- profile: {
21
- id: number;
19
+ settings: Record<string, any>;
20
+ profile: Partial<{
22
21
  firstName: string;
23
22
  lastName: string;
24
23
  storageId: number | null;
25
24
  // phone: AccountPhoneObj | null; // ?? This is a coding mistake, I think
26
- };
25
+ }>;
27
26
  }
28
27
 
29
28
  export interface AccountData extends AccountObj {
29
+ __table: 'accounts';
30
30
  phone: {
31
31
  id: number;
32
32
  number: string;
33
- primary: boolean;
34
33
  verified: boolean;
35
34
  banned: boolean;
36
35
  editAt: Date;
37
36
  };
38
37
  email: {
39
38
  id: number;
40
- email: string;
41
- primary: boolean;
39
+ address: string;
42
40
  verified: boolean;
43
41
  banned: boolean;
44
42
  editAt: Date;
45
43
  };
44
+ createdAt: Date;
45
+ updatedAt: Date;
46
46
  }
47
47
 
48
48
  /**
@@ -55,6 +55,7 @@ export interface AccountMembershipData {
55
55
  organizationId: number;
56
56
  role: OrganizationRoleEnum;
57
57
  acl: OrganizationACL;
58
+ notes?: string;
58
59
  primary: boolean;
59
60
  createdAt: Date;
60
61
  updatedAt: Date;
package/types/app.d.ts CHANGED
@@ -47,3 +47,27 @@ export interface SimpleErrorType {
47
47
  title?: string;
48
48
  message: string;
49
49
  }
50
+
51
+ // Web Socket events
52
+
53
+ type ResetQueryRuleEnum = 'ALWAYS' | 'IF_FRAGMENT_NOT_FOUND' | 'IF_FRAGMENT_FOUND' | 'NEVER';
54
+
55
+ export interface WSDataUpdateObj {
56
+ id: string;
57
+ route: string[]; // First items in the array have priority (Different org operations may not allow the actions handled by other org operations)
58
+ message?: string | null; // If null, nothing will be visible to the client.
59
+ messageType: 'NORMAL' | 'SUCCESS' | 'ERROR';
60
+ resetQueryKeys?: string[]; // List of query keys including {variablesKey}
61
+ resetQueryRule?: ResetQueryRuleEnum; // Defaults to "IF_FRAGMENT_FOUND"
62
+ reactiveFragmentKeys?: string[]; // Fragment keys that are used to trigger reactivity
63
+ fragments?: null | ({
64
+ name: string;
65
+ dataId: string;
66
+ data: any;
67
+ } | null)[];
68
+ }
69
+
70
+ export interface WSAppContextUpdateObj {
71
+ accountId: string;
72
+ updates: [any, any][];
73
+ }
package/types/auth.d.ts CHANGED
@@ -14,7 +14,6 @@ export type LightModeEnum = 'LIGHT' | 'DARK' | 'SYSTEM';
14
14
  export interface AccountData {
15
15
  id: string;
16
16
  deleted: boolean;
17
- color: string;
18
17
 
19
18
  plus: any; // placeholder for later
20
19
 
package/types/form.d.ts CHANGED
@@ -10,7 +10,7 @@ interface SchemaItemAny {
10
10
  }
11
11
 
12
12
  export interface FormItemSchemaObj {
13
- __type: 'subtitle' | 'group' | 'input' | 'input_click' | 'input_w_button' | 'input_time_from_date' | 'password' | 'textarea' | 'none' | string;
13
+ __type: 'subtitle' | 'group' | 'input' | 'section_title' | 'input_click' | 'input_w_button' | 'input_time_from_date' | 'password' | 'textarea' | 'none' | string;
14
14
  autoFocus?: boolean;
15
15
  disabled?: boolean;
16
16
  hidden?: boolean | ((dataForSchema: any) => boolean);
@@ -0,0 +1,61 @@
1
+ import { DAY_OF_WEEK, SCHEDULE_FREQUENCY } from '../constants/other.ts';
2
+
3
+ /**
4
+ * Enums
5
+ */
6
+
7
+ export type DayOfWeekEnum = typeof DAY_OF_WEEK[number];
8
+ export type ScheduleFrequencyEnum = typeof SCHEDULE_FREQUENCY[number];
9
+
10
+ /**
11
+ * Storage
12
+ */
13
+
14
+ export interface StorageData {
15
+ __table: 'storage';
16
+ id: number;
17
+ organizationId: number | null;
18
+ accountId: number | null;
19
+ uri: string;
20
+ size: number;
21
+ checked: boolean;
22
+ at: Date;
23
+ contentType: string;
24
+ values: string[] | null;
25
+ }
26
+
27
+ /**
28
+ * Address
29
+ */
30
+
31
+ export interface AddressObj {
32
+ line1: string;
33
+ line2?: string | null;
34
+ city: string;
35
+ state: string;
36
+ postalCode: string;
37
+ country: string;
38
+ }
39
+
40
+ /**
41
+ * Schedule
42
+ */
43
+
44
+ export interface ScheduleObj {
45
+ frequency: ScheduleFrequencyEnum;
46
+ weeksOfMonth?: number[];
47
+ daysOfWeek?: (0 | 1 | 2 | 3 | 4 | 5 | 6)[];
48
+ time?: [
49
+ string?, // Star time "hhmm" format
50
+ string?, // End time "hhmm" format (optional)
51
+ ];
52
+ }
53
+
54
+ /**
55
+ * File object
56
+ */
57
+
58
+ export interface FileObj {
59
+ buffer: Uint8Array;
60
+ contentType: string;
61
+ }
@@ -0,0 +1,28 @@
1
+ import type { ActionCategoryEnum } from '@jsb188/mday/types/action.d';
2
+ import type { LogActivityEnum } from '@jsb188/mday/types/log.d';
3
+ import type { OrganizationOperationEnum } from '../types/organization.d.ts';
4
+
5
+ /**
6
+ * Enums
7
+ */
8
+
9
+ export const ACTION_STATUS_ENUMS = [
10
+ 'SCHEDULED',
11
+ 'STARTED',
12
+ 'COMPLETED',
13
+ 'ERRORED',
14
+ ];
15
+
16
+ /**
17
+ * Get aggregated action types to log activities
18
+ */
19
+
20
+ export function getAggregatedActivities(
21
+ operation: OrganizationOperationEnum,
22
+ actionCategory: ActionCategoryEnum,
23
+ ): LogActivityEnum[] {
24
+
25
+ return [
26
+ 'MARKET_CREDIT_RECEIPT',
27
+ ];
28
+ }
package/utils/api.ts CHANGED
@@ -72,7 +72,7 @@ export function normalizeServerError(error?: any): ServerErrorObj {
72
72
 
73
73
  if (!message) {
74
74
  if (i18nErrCodeExists(errorCode)) {
75
- message = i18n.t(`error.${errorCode}`, { value: errorValue });
75
+ message = i18n.t(`error.${errorCode}`, { value: errorValue, smart_count: Number(errorValue) });
76
76
  } else {
77
77
  message = i18n.t('error.unknown_error');
78
78
  }