@jsb188/mday 1.1.8 → 1.1.11

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 (123) hide show
  1. package/package.json +105 -35
  2. package/src/constants/agentDoc.ts +12 -0
  3. package/src/constants/agentMemory.ts +154 -0
  4. package/src/constants/aiChat.ts +5 -0
  5. package/src/constants/campaign.ts +127 -0
  6. package/src/constants/dataTable.ts +48 -0
  7. package/src/constants/dataTableFieldTypes.generated.ts +63 -0
  8. package/src/constants/docAccess.ts +32 -0
  9. package/src/constants/email.ts +44 -0
  10. package/src/constants/fieldDoc.ts +34 -0
  11. package/src/constants/graphqlReactivity.ts +113 -0
  12. package/src/constants/inboundContact.ts +8 -0
  13. package/src/constants/integration.ts +13 -0
  14. package/src/constants/log.ts +7 -366
  15. package/src/constants/logActivityGroupColors.generated.ts +19 -0
  16. package/src/constants/logTaxonomy.generated.ts +1103 -0
  17. package/src/constants/noteDoc.ts +77 -0
  18. package/src/constants/organization.ts +18 -11
  19. package/src/constants/pageRoute.ts +23 -0
  20. package/src/constants/schedule.ts +220 -0
  21. package/src/constants/scheduleRuleTemplateSeed.ts +138 -0
  22. package/src/constants/scheduleRuleTemplates.generated.ts +145 -0
  23. package/src/constants/sheet.ts +168 -0
  24. package/src/constants/sheetRegionSources.generated.ts +578 -0
  25. package/src/constants/square.ts +16 -0
  26. package/src/constants/storage.ts +61 -0
  27. package/src/constants/usage.ts +79 -0
  28. package/src/schemas/editLogEntry.ts +1017 -738
  29. package/src/schemas/fieldDocsQuery.ts +12 -0
  30. package/src/schemas/inboundContact.ts +77 -0
  31. package/src/schemas/logsQuery.ts +57 -316
  32. package/src/schemas/organization.ts +53 -213
  33. package/src/types/account.d.ts +81 -0
  34. package/src/types/agentDoc.d.ts +64 -0
  35. package/src/types/agentMemory.d.ts +74 -0
  36. package/src/types/campaign.d.ts +683 -0
  37. package/src/types/dataTable.d.ts +366 -0
  38. package/src/types/docAccess.d.ts +96 -0
  39. package/src/types/email.d.ts +142 -0
  40. package/src/types/fieldDoc.d.ts +273 -0
  41. package/src/types/inboundContact.d.ts +57 -0
  42. package/src/types/integration.d.ts +42 -0
  43. package/src/types/log.d.ts +169 -190
  44. package/src/types/noteDoc.d.ts +86 -0
  45. package/src/types/organization.d.ts +175 -76
  46. package/src/types/pageRoute.d.ts +48 -0
  47. package/src/types/schedule.d.ts +391 -0
  48. package/src/types/sheet.d.ts +1130 -0
  49. package/src/types/storage.d.ts +242 -0
  50. package/src/types/usage.d.ts +106 -0
  51. package/src/types/workflow.d.ts +305 -0
  52. package/src/utils/agentDoc.ts +109 -0
  53. package/src/utils/aiChat.ts +26 -0
  54. package/src/utils/campaign.ts +741 -0
  55. package/src/utils/campaignFormEditor.ts +871 -0
  56. package/src/utils/dataTable.ts +849 -0
  57. package/src/utils/dataTableFieldTypeRegistry.ts +105 -0
  58. package/src/utils/dataTableRealtimeAuthority.ts +209 -0
  59. package/src/utils/dataTableRealtimeSelection.ts +134 -0
  60. package/src/utils/dataTableRowDocument.ts +508 -0
  61. package/src/utils/dataTableSource.ts +230 -0
  62. package/src/utils/docAccess.ts +383 -0
  63. package/src/utils/documentName.ts +53 -0
  64. package/src/utils/email.ts +172 -0
  65. package/src/utils/fieldDoc.ts +113 -0
  66. package/src/utils/log.ts +173 -778
  67. package/src/utils/logRegistryValue.ts +90 -0
  68. package/src/utils/logStoreRead.ts +266 -0
  69. package/src/utils/logTaxonomy.ts +76 -0
  70. package/src/utils/logTaxonomyDisplay.ts +439 -0
  71. package/src/utils/noteDoc.ts +827 -0
  72. package/src/utils/organization.ts +683 -81
  73. package/src/utils/pageRoute.ts +71 -0
  74. package/src/utils/schedule.ts +799 -0
  75. package/src/utils/scheduleEvaluation.ts +1994 -0
  76. package/src/utils/scheduleICS.ts +246 -0
  77. package/src/utils/scheduleRuleTemplates.ts +188 -0
  78. package/src/utils/sheet.ts +4973 -0
  79. package/src/utils/sheetAxisMove.ts +830 -0
  80. package/src/utils/sheetBootstrap.ts +1769 -0
  81. package/src/utils/sheetCommand.ts +423 -0
  82. package/src/utils/sheetExport.ts +238 -0
  83. package/src/utils/sheetFormulaEvaluation.ts +914 -0
  84. package/src/utils/sheetFormulaEvaluator.ts +852 -0
  85. package/src/utils/sheetJournal.ts +78 -0
  86. package/src/utils/sheetNumberFormat.ts +1211 -0
  87. package/src/utils/sheetRegion.ts +374 -0
  88. package/src/utils/sheetRegionFilter.ts +1259 -0
  89. package/src/utils/sheetRegionSourceRegistry.ts +594 -0
  90. package/src/utils/sheetSequence.ts +148 -0
  91. package/src/utils/sheetSnapshot.ts +992 -0
  92. package/src/utils/sheetStructureEdit.ts +1284 -0
  93. package/src/utils/square.ts +32 -0
  94. package/src/utils/storage.ts +152 -0
  95. package/src/utils/table-route.ts +262 -0
  96. package/src/utils/workflow.ts +380 -0
  97. package/tests/dataTableFieldTypeRegistry.test.ts +110 -0
  98. package/tests/docAccess.test.ts +525 -0
  99. package/tests/editLogEntry.test.ts +112 -0
  100. package/tests/noteDoc.test.ts +669 -0
  101. package/tests/schedule.test.ts +693 -0
  102. package/tests/scheduleEvaluation.test.ts +1970 -0
  103. package/tests/scheduleICS.test.ts +208 -0
  104. package/tests/scheduleRuleTemplates.test.ts +176 -0
  105. package/tests/scheduleSweepInvariants.test.ts +428 -0
  106. package/tests/sheetAxisMove.test.ts +343 -0
  107. package/tests/sheetFormulaEvaluator.test.ts +575 -0
  108. package/tests/sheetRegionFilter.test.ts +1135 -0
  109. package/tests/sheetSequence.test.ts +41 -0
  110. package/tests/sheetStructureEdit.test.ts +82 -0
  111. package/tsconfig.json +12 -0
  112. package/vitest.config.ts +8 -0
  113. package/src/constants/log-activityTexts.ts +0 -209
  114. package/src/constants/product.ts +0 -66
  115. package/src/constants/report.ts +0 -25
  116. package/src/schemas/childOrganizationsQuery.ts +0 -44
  117. package/src/schemas/productsQuery.ts +0 -145
  118. package/src/schemas/reportsQuery.ts +0 -107
  119. package/src/types/action.d.ts +0 -42
  120. package/src/types/product.d.ts +0 -173
  121. package/src/types/report.d.ts +0 -203
  122. package/src/utils/product-calEvent.ts +0 -508
  123. package/src/utils/route-helpers.ts +0 -583
@@ -0,0 +1,12 @@
1
+ import z from 'zod';
2
+
3
+ /**
4
+ * Zod schema for query params to filter
5
+ */
6
+
7
+ export const FieldDocsFilterSchema = z.object({
8
+ preset: z.string().optional().nullable(),
9
+ fieldDocGroupId: z.string().optional().nullable(),
10
+ startPeriod: z.string().optional().nullable(),
11
+ endPeriod: z.string().optional().nullable(),
12
+ });
@@ -0,0 +1,77 @@
1
+ import i18n from '@jsb188/app/i18n/index.ts';
2
+ import type { InboundContactGQL } from '../types/inboundContact.d.ts';
3
+
4
+ /**
5
+ * Length values for validation
6
+ */
7
+
8
+ const MIN_LEN_VALUES = {
9
+ email: 100,
10
+ memory: 750,
11
+ personName: 120,
12
+ phone: 40,
13
+ };
14
+
15
+ /**
16
+ * Schema; Edit inbound contact
17
+ */
18
+
19
+ export function makeEditInboundContactSchema(
20
+ formId: string,
21
+ focusedName: string,
22
+ formValues: Partial<InboundContactGQL>, // always append with "|| nodeData"
23
+ ) {
24
+ return {
25
+ listData: [
26
+ {
27
+ __type: 'input',
28
+ item: {
29
+ name: 'personName',
30
+ maxLength: MIN_LEN_VALUES.personName,
31
+ label: i18n.t('form.name'),
32
+ placeholder: formValues.personName || '',
33
+ autoComplete: 'off',
34
+ focused: focusedName === formId + '_personName',
35
+ },
36
+ },
37
+ {
38
+ __type: 'input',
39
+ item: {
40
+ name: 'email',
41
+ maxLength: MIN_LEN_VALUES.email,
42
+ label: i18n.t('form.email'),
43
+ placeholder: formValues.email || '',
44
+ autoComplete: 'off',
45
+ type: 'email',
46
+ focused: focusedName === formId + '_email',
47
+ },
48
+ },
49
+ {
50
+ __type: 'input',
51
+ item: {
52
+ name: 'phone',
53
+ maxLength: MIN_LEN_VALUES.phone,
54
+ label: i18n.t('form.phone'),
55
+ placeholder: formValues.phone || '',
56
+ autoComplete: 'off',
57
+ type: 'tel',
58
+ focused: focusedName === formId + '_phone',
59
+ },
60
+ },
61
+ {
62
+ __type: 'textarea',
63
+ item: {
64
+ name: 'memory',
65
+ maxLength: MIN_LEN_VALUES.memory,
66
+ label: i18n.t('form.memories'),
67
+ description: i18n.t('form.ai_memories_desc'),
68
+ placeholder: formValues.memory || '',
69
+ autoComplete: 'off',
70
+ minHeight: 80,
71
+ focused: focusedName === formId + '_memory',
72
+ },
73
+ },
74
+ ],
75
+ rules: [],
76
+ };
77
+ }
@@ -1,50 +1,54 @@
1
- import { isFutureCalDate, isValidCalDate } from '@jsb188/app/utils/datetime';
2
- import { indexToTimeZone, isValidTimeZone } from '@jsb188/app/utils/timeZone';
1
+ import { isFutureCalDate, isValidCalDate } from '@jsb188/app/utils/datetime.ts';
3
2
  import { z } from 'zod';
4
- import { LOG_ANY_ACTIVITY_ENUMS, LOG_ANY_TYPE_ENUMS, LOG_SORT_ENUMS, LOG_TYPES_BY_OPERATION } from '../constants/log';
5
- import { OPERATION_ENUMS } from '../constants/organization';
6
- import type { FilterLogEntriesArgs, LogSortEnum, LogTypeEnum } from '../types/log';
7
- import type { OrganizationOperationEnum } from '../types/organization';
3
+ import {
4
+ LOG_ANY_ACTIVITY_ENUMS,
5
+ LOG_ANY_TYPE_ENUMS,
6
+ LOG_SORT_ENUMS,
7
+ LOG_TYPES_BY_OPERATION,
8
+ } from '../constants/log.ts';
9
+ import type { FilterLogEntriesArgs, LogTypeEnum } from '../types/log.d.ts';
10
+ import type { OrganizationOperationEnum } from '../types/organization.d.ts';
8
11
 
9
12
  /**
10
13
  * Zod schema for query params to filter
11
14
  */
12
15
 
13
- export const FilterLogEntriesSchema = z.object({
14
- preset: z.string()
15
- .optional()
16
- .nullable(),
17
- types: z.array(z.enum(LOG_ANY_TYPE_ENUMS as [string]))
18
- .nullable(),
19
- activities: z.array(z.enum(LOG_ANY_ACTIVITY_ENUMS as [string]))
20
- .optional()
21
- .nullable(),
22
- startDate: z.string()
23
- .refine((sd) => isValidCalDate(sd), { message: 'START_DATE_INVALID' })
24
- .refine((sd) => !isFutureCalDate(sd, 1), { message: 'START_DATE_FUTURE_NOT_ALLOWED' })
25
- .nullable(),
26
- endDate: z.string()
27
- .refine((ed) => isValidCalDate(ed), { message: 'END_DATE_INVALID' })
28
- .nullable(),
29
- timeZone: z.string()
30
- .refine((tz) => isValidTimeZone(tz), { message: 'INVALID_TIMEZONE' })
31
- .nullable(),
32
- query: z.string()
33
- .nullable(),
34
- }).refine((data) => {
35
- if (!data.endDate) {
36
- // No need to validate if endDate is not provided
37
- return true;
38
- } else if (!data.startDate) {
39
- // If endDate is provided, startDate is required
40
- return false;
41
- }
42
- // End date must be after or equal to start date
43
- return data.endDate >= data.startDate;
44
- }, {
45
- message: 'END_DATE_MUST_BE_AFTER_START_DATE',
46
- path: ['endDate'], // where to attach the error
47
- });
16
+ export const FilterLogEntriesSchema = z
17
+ .object({
18
+ siteId: z.string().optional().nullable(),
19
+ preset: z.string().optional().nullable(),
20
+ types: z.array(z.enum(LOG_ANY_TYPE_ENUMS)).nullable(),
21
+ activities: z.array(z.enum(LOG_ANY_ACTIVITY_ENUMS)).optional().nullable(),
22
+ startDate: z
23
+ .string()
24
+ .refine((sd) => isValidCalDate(sd), { message: 'START_DATE_INVALID' })
25
+ .refine((sd) => !isFutureCalDate(sd, 1), {
26
+ message: 'START_DATE_FUTURE_NOT_ALLOWED',
27
+ })
28
+ .nullable(),
29
+ endDate: z
30
+ .string()
31
+ .refine((ed) => isValidCalDate(ed), { message: 'END_DATE_INVALID' })
32
+ .nullable(),
33
+ query: z.string().nullable(),
34
+ })
35
+ .refine(
36
+ (data) => {
37
+ if (!data.endDate) {
38
+ // No need to validate if endDate is not provided
39
+ return true;
40
+ } else if (!data.startDate) {
41
+ // If endDate is provided, startDate is required
42
+ return false;
43
+ }
44
+ // End date must be after or equal to start date
45
+ return data.endDate >= data.startDate;
46
+ },
47
+ {
48
+ message: 'END_DATE_MUST_BE_AFTER_START_DATE',
49
+ path: ['endDate'], // where to attach the error
50
+ },
51
+ );
48
52
 
49
53
  /**
50
54
  * Convert list of digits to log type enums
@@ -67,286 +71,23 @@ export function convertDigitsToLogTypes(
67
71
  return null;
68
72
  }
69
73
 
70
- return logTypes.map((type: LogTypeEnum, i: number) => {
71
- const value = typesStr.charAt(i);
72
- if (value === '1') {
73
- return type;
74
- }
75
- return null;
76
- }).filter(Boolean) as FilterLogEntriesArgs['types'];
77
- }
78
-
79
- /**
80
- * Convert list of log type enums to digits
81
- * @param operationType - The type of operation for organization
82
- * @param types - Array of log type enums
83
- * @returns String made of digits (indexes) representing log types
84
- */
85
-
86
- export function convertLogTypesToDigits(
87
- operationType: OrganizationOperationEnum | null,
88
- types: FilterLogEntriesArgs['types'],
89
- ): string | null {
90
- if (!operationType || !types) {
91
- return null;
92
- }
93
-
94
- const logTypes = LOG_TYPES_BY_OPERATION[operationType] as LogTypeEnum[];
95
- if (!logTypes) {
96
- console.warn(`No log types found for operation type: ${operationType}`);
97
- return null;
98
- }
99
-
100
- return logTypes.map((type: LogTypeEnum) => {
101
- return types.includes(type) ? '1' : '0';
102
- }).join('');
103
- }
104
-
105
- /**
106
- * Create a filter object for logEntries() query from the URL search query.
107
- * @param operation - The type of operation for organization
108
- * @param searchQuery - The search query string from the URL
109
- * @param otherFiltersObj - Additional filter properties to merge into the result
110
- * @returns FilterLogEntriesArgs - The filter object to be used in the logEntries() query
111
- */
112
-
113
- export function getLogFiltersFromURL(
114
- operation: OrganizationOperationEnum | null,
115
- searchQuery: string,
116
- otherFiltersObj?: {
117
- withoutPreset?: Partial<FilterLogEntriesArgs>,
118
- withPreset?: Partial<FilterLogEntriesArgs>
119
- }
120
- ) {
121
- if (!searchQuery && otherFiltersObj?.withPreset) {
122
- return {
123
- operation: operation!,
124
- ...otherFiltersObj.withPreset
125
- };
126
- } else if (searchQuery === '?preset=none' && otherFiltersObj?.withoutPreset) {
127
- return {
128
- operation: operation!,
129
- ...otherFiltersObj.withoutPreset
130
- };
131
- }
132
-
133
- const urlParams = new URLSearchParams(searchQuery);
134
-
135
- let startDate = urlParams.get('sd');
136
- let endDate = urlParams.get('ed');
137
- if (startDate && !endDate) {
138
- endDate = startDate;
139
- } else if (endDate && !startDate) {
140
- startDate = endDate;
141
- }
142
-
143
- const filter: FilterLogEntriesArgs = {
144
- operation: operation!,
145
- types: convertDigitsToLogTypes(operation, urlParams.get('t')), // (urlParams.get('t') || null) as FilterLogEntriesArgs['type'] | null,
146
- startDate,
147
- endDate,
148
- timeZone: indexToTimeZone(urlParams.get('z')),
149
- query: urlParams.get('q') || '',
150
- ...otherFiltersObj?.withoutPreset,
151
- };
152
-
153
- const validation = FilterLogEntriesSchema.safeParse(filter);
154
- if (!validation.success) {
155
- // console.log('validation error', validation.error);
156
- // Return null and force the client to go to a valid page
157
- return null;
158
- }
159
-
160
- return filter;
74
+ return logTypes
75
+ .map((type: LogTypeEnum, i: number) => {
76
+ const value = typesStr.charAt(i);
77
+ if (value === '1') {
78
+ return type;
79
+ }
80
+ return null;
81
+ })
82
+ .filter(Boolean) as FilterLogEntriesArgs['types'];
161
83
  }
162
84
 
163
85
  /**
164
86
  * Get Sort enum value from URL
165
87
  */
166
88
 
167
- export function getLogSorValueFromURL(
168
- searchQuery: string,
169
- ) {
170
- const urlParams = new URLSearchParams(searchQuery);
171
- const sortIndex = urlParams.get('s');
172
- return LOG_SORT_ENUMS[Number(sortIndex) - 1] || null;
173
- }
174
-
175
- /**
176
- * Test if URL search query is valid against actual filter object
177
- */
178
-
179
- export function logsSearchQueryIsValid(
180
- searchQuery: string,
181
- filter: FilterLogEntriesArgs | null
182
- ) {
183
- if (!filter) {
184
- return !searchQuery; // If no filter, searchQuery must be empty to be valid
185
- } else if (!searchQuery || searchQuery === '?preset=none') {
186
- return true; // If no searchQuery, any filter is valid
187
- }
188
-
189
- const urlParams = new URLSearchParams(searchQuery);
190
- // const operation = urlParams.get('o');
191
- // const types = urlParams.get('t');
192
- const accountId = urlParams.get('a');
193
- const startDate = urlParams.get('sd');
194
- const endDate = urlParams.get('ed');
195
- const timeZone = urlParams.get('z');
196
- const query = urlParams.get('q');
197
-
198
- // console.log(
199
- // 'a', !!filter.accountId === !!accountId,
200
- // 'sd', !!filter.startDate === !!startDate,
201
- // 'ed', !!filter.endDate === !!endDate,
202
- // 'z', !!filter.timeZone === !!timeZone,
203
- // 'q', !!filter.query === !!query
204
- // );
205
-
206
- return (
207
- // operation is allowed to pass through
208
- // !!filter.operation === !!operation &&
209
- // !!filter.types?.length === !!types && // Allow this to pass because of forced filters from page
210
- !!filter.accountId === !!accountId &&
211
- !!filter.startDate === !!startDate &&
212
- !!filter.endDate === !!endDate &&
213
- !!filter.timeZone === !!timeZone &&
214
- !!filter.query === !!query
215
- );
216
- }
217
-
218
- /**
219
- * Create URL from search query params.
220
- * This function assumes the query parameters are valid and well-formed.
221
- * @param operationType - Type of operation for organization
222
- * @param orgGenericId - Generic ID of the organization
223
- * @param searchQuery - Search query string from the URL
224
- * @param fileType - Type of file ('pdf' or 'csv')
225
- * @returns FilterLogEntriesArgs - The filter object to be used in the logEntries() query
226
- */
227
-
228
- export function createLogsFileNameFromURL(
229
- operationType: OrganizationOperationEnum | null,
230
- orgGenericId: string,
231
- searchQuery: string,
232
- fileType: string
233
- ) {
89
+ export function getLogSorValueFromURL(searchQuery: string) {
234
90
  const urlParams = new URLSearchParams(searchQuery);
235
- const o = urlParams.get('o');
236
- const t = urlParams.get('t');
237
- const a = urlParams.get('a');
238
- const sd = urlParams.get('sd');
239
- const ed = urlParams.get('ed');
240
- const z = urlParams.get('z');
241
- const q = urlParams.get('q');
242
-
243
- let checkStr = '';
244
- let paramStr = '';
245
-
246
- if (o) {
247
- checkStr += o;
248
- } else {
249
- const ix = OPERATION_ENUMS.indexOf(operationType || '');
250
- checkStr += String(ix + 1);
251
- }
252
-
253
- if (t?.split('')?.some(letter => letter !== '0')) {
254
- checkStr += '1';
255
- paramStr += `_${t}`;
256
- } else {
257
- checkStr += '0';
258
- }
259
-
260
- if (a) {
261
- checkStr += '1';
262
- paramStr += `_${a}`;
263
- } else {
264
- checkStr += '0';
265
- }
266
-
267
- if (sd) {
268
- checkStr += '1';
269
- paramStr += `_${sd}`;
270
- } else {
271
- checkStr += '0';
272
- }
273
-
274
- if (ed) {
275
- checkStr += '1';
276
- paramStr += `_${ed}`;
277
- } else {
278
- checkStr += '0';
279
- }
280
-
281
- if (z) {
282
- checkStr += '1';
283
- paramStr += `_${z}`;
284
- } else {
285
- checkStr += '0';
286
- }
287
-
288
- if (q) {
289
- checkStr += '1';
290
- paramStr += `_${q}`;
291
- } else {
292
- checkStr += '0';
293
- }
294
-
295
- if (checkStr.split('').every(digit => digit === '0')) {
296
- return `logs_${orgGenericId}_x${paramStr}.${fileType}`;
297
- }
298
-
299
- return `logs_${orgGenericId}_${checkStr}${paramStr}.${fileType}`;
300
- }
301
-
302
- /**
303
- * Create URL search params from a filter object
304
- * @param filter - The filter object to convert to URL search params
305
- * @param sort - Optional sort enum value
306
- * @param skipOperation - Whether to skip including the operation in the params
307
- * @returns URLSearchParams - The search params object
308
- */
309
-
310
- export function createSearchParamsFromFilter(
311
- filter: FilterLogEntriesArgs,
312
- sort?: LogSortEnum | null,
313
- skipOperation?: boolean,
314
- ): URLSearchParams {
315
- const params = new URLSearchParams();
316
- const { operation } = filter;
317
-
318
- if (operation && !skipOperation) {
319
- params.set('o', String(OPERATION_ENUMS.indexOf(operation) + 1));
320
- }
321
-
322
- if (filter.types && operation) {
323
- const typeDigits = convertLogTypesToDigits(operation, filter.types);
324
- if (typeDigits) {
325
- params.set('t', typeDigits);
326
- }
327
- }
328
-
329
- if (filter.accountId) {
330
- params.set('a', filter.accountId);
331
- }
332
- if (filter.startDate) {
333
- params.set('sd', filter.startDate);
334
- }
335
- if (filter.endDate) {
336
- params.set('ed', filter.endDate);
337
- }
338
- if (filter.timeZone) {
339
- params.set('z', filter.timeZone);
340
- }
341
- if (filter.query) {
342
- params.set('q', filter.query);
343
- }
344
- if (sort) {
345
- params.set('s', String(LOG_SORT_ENUMS.indexOf(sort) + 1));
346
- }
347
- if (!params.size && filter.preset === null) {
348
- params.set('preset', 'none');
349
- }
350
-
351
- return params;
91
+ const sortIndex = urlParams.get('s');
92
+ return LOG_SORT_ENUMS[Number(sortIndex) - 1] || null;
352
93
  }