@jsb188/mday-web 1.1.2
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/package.json +38 -0
- package/src/libs/route-metadata.server.ts +67 -0
- package/src/modules/Grids.filters.ts +36 -0
- package/src/modules/Grids.tsx +610 -0
- package/src/modules/RouteShell.tsx +76 -0
- package/src/schemas/organization.ts +128 -0
- package/src/types/css.d.ts +1 -0
- package/src/utils/email.ts +117 -0
- package/src/utils/list-web.ts +17 -0
- package/src/utils/log-web.helpers.ts +99 -0
- package/src/utils/log-web.icons.ts +184 -0
- package/src/utils/log-web.ts +150 -0
- package/src/utils/operation-pages.ts +154 -0
- package/src/utils/org-web.ts +67 -0
- package/src/utils/route-helpers.ts +950 -0
- package/src/utils/workflow-web.ts +72 -0
- package/tests/log-web.test.ts +134 -0
- package/tests/route-helpers.test.ts +17 -0
- package/tsconfig.json +13 -0
- package/vitest.config.ts +11 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { SUPPORTED_LOG_LANGUAGES } from '@jsb188/app/constants/app.ts';
|
|
2
|
+
import i18n from '@jsb188/app/i18n/index.ts';
|
|
3
|
+
import { makeAddressSchema } from '@jsb188/auth-web/schemas/address';
|
|
4
|
+
import { defineForm } from '@jsb188/form/libs/defineForm';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import type { OrganizationGQL, OrganizationSettingsObj } from '@jsb188/mday/types/organization.d.ts';
|
|
7
|
+
import { getOrganizationDisplayTranslatedLogsSetting, getOrganizationLogLanguageSetting } from '@jsb188/mday/utils/organization.ts';
|
|
8
|
+
|
|
9
|
+
/* Keep the existing organization settings popovers consistent across selectors. */
|
|
10
|
+
function settingsPopover(name: string, options: object[], designClassName?: string, className?: string) {
|
|
11
|
+
return {
|
|
12
|
+
id: `edit_org_${name}`,
|
|
13
|
+
zClassName: 'z9',
|
|
14
|
+
position: 'bottom_left' as const,
|
|
15
|
+
offsetX: 0,
|
|
16
|
+
offsetY: 7,
|
|
17
|
+
iface: {
|
|
18
|
+
name: 'PO_LIST',
|
|
19
|
+
variables: { designClassName, className, options },
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Define organization information, language preferences, and address in display order. */
|
|
25
|
+
export function makeEditOrganizationSchema(
|
|
26
|
+
organization: OrganizationGQL,
|
|
27
|
+
settings: Pick<OrganizationSettingsObj, 'displayTranslatedLogs' | 'translateLanguage'>,
|
|
28
|
+
) {
|
|
29
|
+
const address = makeAddressSchema(organization.address);
|
|
30
|
+
const disabledLanguageText = i18n.t('org.translate_language_disabled');
|
|
31
|
+
|
|
32
|
+
return defineForm({
|
|
33
|
+
schema: address.schema.extend({
|
|
34
|
+
name: z.string(),
|
|
35
|
+
operation: z.string(),
|
|
36
|
+
translateLanguage: z.string().nullable(),
|
|
37
|
+
displayTranslatedLogs: z.boolean(),
|
|
38
|
+
}),
|
|
39
|
+
defaults: {
|
|
40
|
+
...address.defaults,
|
|
41
|
+
name: organization.name || '',
|
|
42
|
+
operation: organization.operation,
|
|
43
|
+
translateLanguage: getOrganizationLogLanguageSetting(settings, 'translateLanguage'),
|
|
44
|
+
displayTranslatedLogs: getOrganizationDisplayTranslatedLogsSetting(settings),
|
|
45
|
+
},
|
|
46
|
+
fields: {
|
|
47
|
+
name: {
|
|
48
|
+
kind: 'input',
|
|
49
|
+
maxLength: 40,
|
|
50
|
+
label: i18n.t('org.name_of'),
|
|
51
|
+
placeholder: organization.name,
|
|
52
|
+
autoComplete: 'off',
|
|
53
|
+
},
|
|
54
|
+
operation: {
|
|
55
|
+
kind: 'input',
|
|
56
|
+
locked: true,
|
|
57
|
+
label: i18n.t('org.type_of'),
|
|
58
|
+
placeholder: i18n.t(`org.type.${organization.operation}`),
|
|
59
|
+
getter: (value: string) => i18n.t(`org.type.${value}`),
|
|
60
|
+
autoComplete: 'off',
|
|
61
|
+
info: i18n.t('org.contact_to_change'),
|
|
62
|
+
},
|
|
63
|
+
translateLanguage: {
|
|
64
|
+
kind: 'click',
|
|
65
|
+
label: i18n.t('org.translate_language'),
|
|
66
|
+
info: i18n.t('org.translate_language_description'),
|
|
67
|
+
placeholder: disabledLanguageText,
|
|
68
|
+
getter: (value: string | null) => (value === null ? disabledLanguageText : i18n.t(`c.lang.${value || 'en'}`)),
|
|
69
|
+
resolve: ({ values }) => ({
|
|
70
|
+
inputClassName: values.translateLanguage === null ? 'cl_md' : undefined,
|
|
71
|
+
popOverProps: settingsPopover(
|
|
72
|
+
'translateLanguage',
|
|
73
|
+
[
|
|
74
|
+
{
|
|
75
|
+
__type: 'LIST_ITEM',
|
|
76
|
+
text: disabledLanguageText,
|
|
77
|
+
textClassName: 'cl_md',
|
|
78
|
+
name: 'translateLanguage',
|
|
79
|
+
value: null,
|
|
80
|
+
selected: values.translateLanguage === null,
|
|
81
|
+
},
|
|
82
|
+
...SUPPORTED_LOG_LANGUAGES.map((language) => ({
|
|
83
|
+
__type: 'LIST_ITEM',
|
|
84
|
+
text: i18n.t(`c.lang.${language}`),
|
|
85
|
+
name: 'translateLanguage',
|
|
86
|
+
value: language,
|
|
87
|
+
selected: values.translateLanguage === language,
|
|
88
|
+
})).sort((a, b) => a.text.localeCompare(b.text)),
|
|
89
|
+
],
|
|
90
|
+
'w_400',
|
|
91
|
+
'max_h_40vh',
|
|
92
|
+
),
|
|
93
|
+
}),
|
|
94
|
+
},
|
|
95
|
+
displayTranslatedLogs: {
|
|
96
|
+
kind: 'click',
|
|
97
|
+
label: i18n.t('org.log_language_preference'),
|
|
98
|
+
info: i18n.t('org.log_language_preference_description'),
|
|
99
|
+
getter: (value: boolean) =>
|
|
100
|
+
i18n.t(value === false ? 'org.always_show_original_log_texts' : 'org.display_translated_logs_if_available'),
|
|
101
|
+
resolve: ({ values }) => ({
|
|
102
|
+
popOverProps: settingsPopover(
|
|
103
|
+
'displayTranslatedLogs',
|
|
104
|
+
[true, false].map((value) => ({
|
|
105
|
+
__type: 'LIST_ITEM',
|
|
106
|
+
text: i18n.t(value ? 'org.display_translated_logs_if_available' : 'org.always_show_original_log_texts'),
|
|
107
|
+
name: 'displayTranslatedLogs',
|
|
108
|
+
value,
|
|
109
|
+
selected: values.displayTranslatedLogs === value,
|
|
110
|
+
})),
|
|
111
|
+
'w_400',
|
|
112
|
+
),
|
|
113
|
+
}),
|
|
114
|
+
},
|
|
115
|
+
...address.fields,
|
|
116
|
+
},
|
|
117
|
+
layout: [
|
|
118
|
+
{ kind: 'section', id: 'information', title: i18n.t('c.information') },
|
|
119
|
+
'name',
|
|
120
|
+
'operation',
|
|
121
|
+
{ kind: 'section', id: 'language', title: i18n.t('account.language') },
|
|
122
|
+
'translateLanguage',
|
|
123
|
+
'displayTranslatedLogs',
|
|
124
|
+
{ kind: 'section', id: 'address', title: i18n.t('c.address'), description: i18n.t('org.address_notice_msg') },
|
|
125
|
+
...(address.layout || []),
|
|
126
|
+
],
|
|
127
|
+
});
|
|
128
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module '*.css';
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import i18n from '@jsb188/app/i18n/index.ts';
|
|
2
|
+
import { getFullDate, getFullDateTime } from '@jsb188/app/utils/datetime.ts';
|
|
3
|
+
import { ucFirst } from '@jsb188/app/utils/string.ts';
|
|
4
|
+
import type { EmailMessageGQL, EmailMessageStatusEnum } from '@jsb188/mday/types/email.d.ts';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Describe one email event with its recorded local time and a capitalized sentence.
|
|
8
|
+
*/
|
|
9
|
+
function getEmailEventHeading(event: string, name: string, timeZone: string | null, timestamp?: string | null): string {
|
|
10
|
+
const dateTime =
|
|
11
|
+
timestamp && Number.isFinite(Date.parse(timestamp))
|
|
12
|
+
? `${getFullDate(timestamp, 'DATE_TEXT', timeZone)}, ${getFullDateTime(timestamp, { timeZone, hideDate: true })}`
|
|
13
|
+
: null;
|
|
14
|
+
return ucFirst(i18n.t(`agent.email_message_heading.${event}${dateTime ? '_at' : ''}`, { name, dateTime }));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* Share outbound delivery headings between campaign recipients and email message details.
|
|
19
|
+
*/
|
|
20
|
+
export function getOutboundEmailHeading(
|
|
21
|
+
email: {
|
|
22
|
+
name: string;
|
|
23
|
+
status?: EmailMessageStatusEnum | null;
|
|
24
|
+
sentAt?: string | null;
|
|
25
|
+
deliveredAt?: string | null;
|
|
26
|
+
openedAt?: string | null;
|
|
27
|
+
respondedAt?: string | null;
|
|
28
|
+
bouncedAt?: string | null;
|
|
29
|
+
spamComplaintAt?: string | null;
|
|
30
|
+
},
|
|
31
|
+
timeZone: string | null,
|
|
32
|
+
): string {
|
|
33
|
+
const { name } = email;
|
|
34
|
+
switch (email.status) {
|
|
35
|
+
case 'SENT':
|
|
36
|
+
if (email.spamComplaintAt) return getEmailEventHeading('spam', name, timeZone, email.spamComplaintAt);
|
|
37
|
+
if (email.respondedAt) return getEmailEventHeading('responded', name, timeZone, email.respondedAt);
|
|
38
|
+
if (email.openedAt) return getEmailEventHeading('opened', name, timeZone, email.openedAt);
|
|
39
|
+
if (email.deliveredAt) return getEmailEventHeading('delivered', name, timeZone, email.deliveredAt);
|
|
40
|
+
return getEmailEventHeading('sent', name, timeZone, email.sentAt);
|
|
41
|
+
case 'BOUNCED':
|
|
42
|
+
return getEmailEventHeading('bounced', name, timeZone, email.bouncedAt);
|
|
43
|
+
case 'QUEUED':
|
|
44
|
+
return getEmailEventHeading('queued', name, timeZone);
|
|
45
|
+
case 'PROCESSING':
|
|
46
|
+
return getEmailEventHeading('sending', name, timeZone);
|
|
47
|
+
case 'DELIVERY_UNKNOWN':
|
|
48
|
+
return getEmailEventHeading('unknown_delivery', name, timeZone);
|
|
49
|
+
case 'ERRORED':
|
|
50
|
+
return getEmailEventHeading('failed', name, timeZone);
|
|
51
|
+
case 'SUPPRESSED':
|
|
52
|
+
return getEmailEventHeading('skipped', name, timeZone);
|
|
53
|
+
default:
|
|
54
|
+
return getEmailEventHeading('unavailable', name, timeZone);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
* Describe outbound delivery or inbound AI processing using the appropriate person and event time.
|
|
60
|
+
*/
|
|
61
|
+
export function getEmailMessageHeading(email: EmailMessageGQL, timeZone: string | null): string {
|
|
62
|
+
if (email.direction === 'OUTBOUND') {
|
|
63
|
+
return getOutboundEmailHeading(
|
|
64
|
+
{
|
|
65
|
+
name: email.toName?.trim() || email.toEmail || i18n.t('c.unknown'),
|
|
66
|
+
status: email.status,
|
|
67
|
+
sentAt: email.sentAt,
|
|
68
|
+
deliveredAt: email.deliveredAt,
|
|
69
|
+
openedAt: email.firstOpenedAt,
|
|
70
|
+
bouncedAt: email.bouncedAt,
|
|
71
|
+
spamComplaintAt: email.spamComplaintAt,
|
|
72
|
+
},
|
|
73
|
+
timeZone,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
const name = email.fromName?.trim() || email.fromEmail || i18n.t('c.unknown');
|
|
77
|
+
switch (email.status) {
|
|
78
|
+
case 'RECEIVED':
|
|
79
|
+
return getEmailEventHeading('received', name, timeZone, email.occurredAt);
|
|
80
|
+
case 'QUEUED':
|
|
81
|
+
return getEmailEventHeading('inbound_queued', name, timeZone);
|
|
82
|
+
case 'PROCESSING':
|
|
83
|
+
return getEmailEventHeading('inbound_processing', name, timeZone, email.processingStartedAt);
|
|
84
|
+
case 'COMPLETED':
|
|
85
|
+
return getEmailEventHeading('inbound_completed', name, timeZone, email.processingCompletedAt);
|
|
86
|
+
case 'ERRORED':
|
|
87
|
+
return getEmailEventHeading('inbound_failed', name, timeZone, email.processingCompletedAt);
|
|
88
|
+
case 'IGNORED':
|
|
89
|
+
return getEmailEventHeading('inbound_ignored', name, timeZone);
|
|
90
|
+
case 'SUPERSEDED':
|
|
91
|
+
return getEmailEventHeading('inbound_superseded', name, timeZone);
|
|
92
|
+
default:
|
|
93
|
+
return getEmailEventHeading('inbound_unavailable', name, timeZone);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/*
|
|
98
|
+
* Explain one campaign delivery suppression without exposing internal codes.
|
|
99
|
+
*/
|
|
100
|
+
export function getOutboundEmailSuppressionReasonText(reason: string | null | undefined): string {
|
|
101
|
+
switch (reason) {
|
|
102
|
+
case 'ORGANIZATION_OPT_OUT':
|
|
103
|
+
return i18n.t('campaign.email_suppression_organization_opt_out');
|
|
104
|
+
case 'CLEANED':
|
|
105
|
+
return i18n.t('campaign.email_suppression_cleaned');
|
|
106
|
+
case 'SPAM_COMPLAINT':
|
|
107
|
+
return i18n.t('campaign.email_suppression_spam_complaint');
|
|
108
|
+
case 'MANUAL_SUPPRESSION':
|
|
109
|
+
return i18n.t('campaign.email_suppression_manual');
|
|
110
|
+
case 'AUDIENCE_INELIGIBLE':
|
|
111
|
+
return i18n.t('campaign.email_suppression_audience_ineligible');
|
|
112
|
+
case 'CAMPAIGN_UNAVAILABLE':
|
|
113
|
+
return i18n.t('campaign.email_suppression_campaign_unavailable');
|
|
114
|
+
default:
|
|
115
|
+
return i18n.t('campaign.email_suppression_unknown');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Map nullable list records into renderable list items in one pass.
|
|
3
|
+
*/
|
|
4
|
+
export function mapRenderableItems<T, R>(
|
|
5
|
+
items: T[] | null | undefined,
|
|
6
|
+
mapItem: (item: T) => R | null | undefined,
|
|
7
|
+
) {
|
|
8
|
+
return (items ?? []).reduce<NonNullable<R>[]>((acc, item) => {
|
|
9
|
+
const mappedItem = mapItem(item);
|
|
10
|
+
|
|
11
|
+
if (mappedItem != null) {
|
|
12
|
+
acc.push(mappedItem);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return acc;
|
|
16
|
+
}, []);
|
|
17
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export type IconMatchRule = {
|
|
2
|
+
icon: string;
|
|
3
|
+
tier: 'specific' | 'activity' | 'fallback';
|
|
4
|
+
words?: readonly string[];
|
|
5
|
+
phrases?: readonly string[];
|
|
6
|
+
prefixes?: readonly string[];
|
|
7
|
+
patterns?: readonly string[];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type CompiledIconMatcher = {
|
|
11
|
+
icon: string;
|
|
12
|
+
priority: number;
|
|
13
|
+
regex: RegExp;
|
|
14
|
+
key: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const FILE_CONSTANTS = {
|
|
18
|
+
tierPriority: { specific: 3, activity: 2, fallback: 1 },
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* Normalize case, Unicode compatibility forms, separators, and whitespace once per input.
|
|
23
|
+
*/
|
|
24
|
+
function normalizeIconText(text: string): string {
|
|
25
|
+
return text
|
|
26
|
+
.normalize('NFKC')
|
|
27
|
+
.toLowerCase()
|
|
28
|
+
.replace(/[\p{Dash_Punctuation}_\s]+/gu, ' ')
|
|
29
|
+
.trim();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* Escape literal aliases so punctuation cannot accidentally introduce regex syntax.
|
|
34
|
+
*/
|
|
35
|
+
function escapeIconAlias(text: string): string {
|
|
36
|
+
return normalizeIconText(text).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* Precompile each rule once, sorting literal alternatives longest-first to retain overlapping phrases.
|
|
41
|
+
* Only patterns contain regex syntax; words and phrases match complete tokens, while prefixes consume word endings.
|
|
42
|
+
*/
|
|
43
|
+
export function compileIconMatchRules(rules: readonly IconMatchRule[]): readonly CompiledIconMatcher[] {
|
|
44
|
+
return rules
|
|
45
|
+
.flatMap((rule) => {
|
|
46
|
+
const literals = [...(rule.words || []), ...(rule.phrases || [])].map(escapeIconAlias);
|
|
47
|
+
// Literal alternatives can be safely ordered by length; variable-length regexes must compete independently.
|
|
48
|
+
literals.sort((a, b) => b.length - a.length || (a < b ? -1 : a > b ? 1 : 0));
|
|
49
|
+
const patterns = [
|
|
50
|
+
...(literals.length ? [literals.join('|')] : []),
|
|
51
|
+
...(rule.prefixes || []).map((prefix) => `${escapeIconAlias(prefix)}[\\p{L}\\p{M}]*`),
|
|
52
|
+
...(rule.patterns || []),
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
return patterns.map((source) => ({
|
|
56
|
+
icon: rule.icon,
|
|
57
|
+
priority: FILE_CONSTANTS.tierPriority[rule.tier],
|
|
58
|
+
regex: new RegExp(`(^|[^\\p{L}\\p{M}\\p{N}])(${source})(?![\\p{L}\\p{M}\\p{N}])`, 'u'),
|
|
59
|
+
key: `${rule.icon}:${rule.tier}:${source}`,
|
|
60
|
+
}));
|
|
61
|
+
})
|
|
62
|
+
.sort((a, b) => b.priority - a.priority);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* Choose the strongest tier, then the first mention. At the same start, prefer the longer matching phrase.
|
|
67
|
+
* Containing phrases start before their inner words; stable keys resolve identical spans without list-order priority.
|
|
68
|
+
* Regexes are non-global, so repeated calls and repeated words cannot retain mutable lastIndex state.
|
|
69
|
+
*/
|
|
70
|
+
export function matchIconName(matchers: readonly CompiledIconMatcher[], text?: string | null): string | null {
|
|
71
|
+
if (!text?.trim()) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const normalizedText = normalizeIconText(text);
|
|
76
|
+
let best: { matcher: CompiledIconMatcher; index: number; length: number } | null = null;
|
|
77
|
+
|
|
78
|
+
for (const matcher of matchers) {
|
|
79
|
+
// Compiled rules are sorted by tier, so lower tiers cannot displace an existing match.
|
|
80
|
+
if (best && matcher.priority < best.matcher.priority) {
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
const match = matcher.regex.exec(normalizedText);
|
|
84
|
+
if (!match) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const index = match.index + match[1].length;
|
|
88
|
+
const length = match[2].length;
|
|
89
|
+
if (
|
|
90
|
+
!best ||
|
|
91
|
+
index < best.index ||
|
|
92
|
+
(index === best.index && (length > best.length || (length === best.length && matcher.key < best.matcher.key)))
|
|
93
|
+
) {
|
|
94
|
+
best = { matcher, index, length };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return best?.matcher.icon || null;
|
|
99
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { compileIconMatchRules } from './log-web.helpers.ts';
|
|
2
|
+
|
|
3
|
+
// Definition order does not control priority. Tiers, match position, overlapping specificity, and stable keys do.
|
|
4
|
+
// Keep each alias beside its icon; use prefixes only for intentional stems, and generic terms as fallbacks.
|
|
5
|
+
export const ARABLE_ICON_MATCHERS = compileIconMatchRules([
|
|
6
|
+
{
|
|
7
|
+
icon: 'vegetable-lettuce-top',
|
|
8
|
+
tier: 'specific',
|
|
9
|
+
words: ['marciano', 'spretnak', 'newham', 'bokchoy'],
|
|
10
|
+
phrases: ['little gem', 'lil gem', 'red butter', 'green gem', 'red gem', 'bok choy'],
|
|
11
|
+
},
|
|
12
|
+
{ icon: 'vegetable-lettuce-top', tier: 'fallback', words: ['gems'] },
|
|
13
|
+
{
|
|
14
|
+
icon: 'vegetable-lettuce',
|
|
15
|
+
tier: 'specific',
|
|
16
|
+
words: ['lettuce', 'lettuces', 'romaine', 'radicchio', 'treviso', 'thaddeus', 'cruced'],
|
|
17
|
+
phrases: ['red oak', 'braci ardenti', 'braci adenti', 'di lusia', 'di lusio'],
|
|
18
|
+
prefixes: ['escarol'],
|
|
19
|
+
},
|
|
20
|
+
{ icon: 'vegetable-lavender', tier: 'specific', words: ['lavendar', 'lavender', 'alyssum'], phrases: ['anise hyssop'] },
|
|
21
|
+
{ icon: 'vegetable-basil', tier: 'specific', words: ['basil'] },
|
|
22
|
+
{ icon: 'vegetable-beet', tier: 'specific', words: ['chioggia', 'beet', 'beets', 'beetroot'], phrases: ['yellow tooth'] },
|
|
23
|
+
{ icon: 'vegetable-broccoli', tier: 'specific', words: ['broccoli'], prefixes: ['cauliflow', 'piracicab'] },
|
|
24
|
+
{
|
|
25
|
+
icon: 'vegetable-pumpkin',
|
|
26
|
+
tier: 'specific',
|
|
27
|
+
words: ['pumpkin', 'pumpkins', 'benning'],
|
|
28
|
+
phrases: ['cargo pump', 'bennings green'],
|
|
29
|
+
},
|
|
30
|
+
{ icon: 'vegetable-pumpkin', tier: 'fallback', words: ['pump'] },
|
|
31
|
+
{
|
|
32
|
+
icon: 'vegetable-spinach',
|
|
33
|
+
tier: 'specific',
|
|
34
|
+
words: ['mesclun', 'spinach', 'chard'],
|
|
35
|
+
phrases: ['mustard green', 'mustard greens'],
|
|
36
|
+
},
|
|
37
|
+
{ icon: 'vegetable-spinach', tier: 'fallback', words: ['mix', 'mixes'] },
|
|
38
|
+
{ icon: 'vegetable-tomato', tier: 'specific', words: ['tomato', 'tomatoes'] },
|
|
39
|
+
{ icon: 'fruit-grapes', tier: 'specific', words: ['grape', 'grapes'] },
|
|
40
|
+
{ icon: 'fruit-apricot', tier: 'specific', words: ['apricot', 'apricots', 'peach', 'peaches', 'plum', 'plums'] },
|
|
41
|
+
{ icon: 'raspberry', tier: 'specific', prefixes: ['raspberr'] },
|
|
42
|
+
{ icon: 'fruit-cloud-berry', tier: 'specific', prefixes: ['blackberr', 'cloudberr', 'cloud berr'] },
|
|
43
|
+
{ icon: 'fruit-billberry-blackberry-blueberry', tier: 'specific', prefixes: ['blueberr', 'billberr', 'bilberr'] },
|
|
44
|
+
{ icon: 'fruit-billberry-blackberry-blueberry', tier: 'fallback', patterns: ['\\p{L}*berr(?:y|ies)'] },
|
|
45
|
+
{ icon: 'vegetable-asparagus', tier: 'specific', words: ['asparagus'] },
|
|
46
|
+
{
|
|
47
|
+
icon: 'vegetable-acornsquash',
|
|
48
|
+
tier: 'specific',
|
|
49
|
+
words: ['acornsquash'],
|
|
50
|
+
phrases: ['sunshine kabocha', 'acorn squash', 'yellow star patty', 'sweet pepper', 'sweet peppers', 'bell pepper', 'bell peppers'],
|
|
51
|
+
},
|
|
52
|
+
{ icon: 'fruit-strawberry', tier: 'specific', prefixes: ['strawberr'] },
|
|
53
|
+
{ icon: 'seasoning-chilli', tier: 'specific', words: ['chilli', 'chillies'] },
|
|
54
|
+
{ icon: 'seasoning-chilli', tier: 'fallback', words: ['pepper', 'peppers'] },
|
|
55
|
+
{ icon: 'vegetable-delicata-squash', tier: 'specific', words: ['delicata'], phrases: ['delicata squash'] },
|
|
56
|
+
{ icon: 'vegetable-hubbard-squash', tier: 'specific', words: ['hubbard'], phrases: ['hubbard squash', 'red kuri'] },
|
|
57
|
+
{ icon: 'vegetable-cucumber', tier: 'specific', words: ['shinto', 'cucumber', 'cucumbers', 'pickle', 'pickles'] },
|
|
58
|
+
{
|
|
59
|
+
icon: 'vegetable-butternutsquash',
|
|
60
|
+
tier: 'specific',
|
|
61
|
+
words: ['butternutsquash', 'butternut'],
|
|
62
|
+
phrases: ['butternut squash', 'starry night'],
|
|
63
|
+
},
|
|
64
|
+
{ icon: 'vegetable-butternutsquash', tier: 'fallback', words: ['squash', 'squashes'] },
|
|
65
|
+
{
|
|
66
|
+
icon: 'vegetable-thyme',
|
|
67
|
+
tier: 'specific',
|
|
68
|
+
words: ['thyme', 'rosemary', 'savory'],
|
|
69
|
+
prefixes: ['summar savor', 'summer savor', 'summery savor', 'summary savor'],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
icon: 'vegetable-arugula',
|
|
73
|
+
tier: 'specific',
|
|
74
|
+
words: ['arugula', 'chicory', 'puntarelle', 'frisee', 'kale'],
|
|
75
|
+
phrases: ['green curl'],
|
|
76
|
+
},
|
|
77
|
+
{ icon: 'vegetable-arugula', tier: 'fallback', words: ['dino'] },
|
|
78
|
+
{ icon: 'vegetable-parsley', tier: 'specific', words: ['parsley', 'wasabina', 'chervil'], phrases: ['beoc raab'] },
|
|
79
|
+
{ icon: 'vegetable-carrot', tier: 'specific', words: ['carrot', 'carrots'] },
|
|
80
|
+
{ icon: 'vegetable-artichoke', tier: 'specific', words: ['artichoke', 'artichokes', 'romanesco'] },
|
|
81
|
+
{ icon: 'vegetable-artichoke', tier: 'fallback', words: ['star', 'stars'] },
|
|
82
|
+
{ icon: 'vegetable-cabbage', tier: 'specific', prefixes: ['cabbag'] },
|
|
83
|
+
{ icon: 'vegetable-kohlrabi', tier: 'specific', prefixes: ['kohlrab'] },
|
|
84
|
+
{ icon: 'vegetable-zucchini', tier: 'specific', words: ['zucchini', 'zucchinis', 'zuchini'], phrases: ['midnight light'] },
|
|
85
|
+
{ icon: 'vegetable-potato', tier: 'specific', words: ['potato', 'potatoes'] },
|
|
86
|
+
{ icon: 'vegetable-eggplant', tier: 'specific', words: ['eggplant', 'eggplants'] },
|
|
87
|
+
{ icon: 'vegetable-jalapeno', tier: 'specific', words: ['jalapeno', 'jalapenos', 'jalapeño', 'jalapeños'] },
|
|
88
|
+
{
|
|
89
|
+
icon: 'vegetable-stinging-kettle',
|
|
90
|
+
tier: 'specific',
|
|
91
|
+
words: ['nettle', 'nettles', 'cardoon', 'cardunculus', 'cresta', 'shiso'],
|
|
92
|
+
phrases: ['stinging kettle', 'cynara cardunculus'],
|
|
93
|
+
},
|
|
94
|
+
{ icon: 'vegetable-okra', tier: 'specific', words: ['okra'] },
|
|
95
|
+
{ icon: 'plant-1', tier: 'specific', words: ['sage', 'sages', 'marjoram', 'sorrel', 'mint'] },
|
|
96
|
+
{
|
|
97
|
+
icon: 'vegetable-scallion',
|
|
98
|
+
tier: 'specific',
|
|
99
|
+
words: ['scallion', 'scallions', 'scalion', 'springonion', 'springonions'],
|
|
100
|
+
phrases: ['spring onion', 'spring onions'],
|
|
101
|
+
},
|
|
102
|
+
{ icon: 'gardening-seed-bag', tier: 'fallback', words: ['seed', 'seeds', 'seeding', 'seedling', 'seedlings'] },
|
|
103
|
+
{ icon: 'vegetable-onion', tier: 'specific', words: ['onion', 'onions', 'shallot', 'shallots', 'matador'] },
|
|
104
|
+
{ icon: 'vegetable-black-bean', tier: 'specific', prefixes: ['oliv'] },
|
|
105
|
+
{ icon: 'vegetable-stringbean-1', tier: 'specific', words: ['bean', 'beans', 'stringbean', 'stringbeans'] },
|
|
106
|
+
{ icon: 'vegetable-cilantro', tier: 'specific', words: ['cilantro'] },
|
|
107
|
+
{ icon: 'vegetable-cilantro', tier: 'fallback', words: ['flor'] },
|
|
108
|
+
{ icon: 'vegetable-radish', tier: 'specific', words: ['raddish', 'raddishes', 'radish', 'radishes'] },
|
|
109
|
+
{ icon: 'vegetable-wasabi', tier: 'specific', words: ['wasabi'] },
|
|
110
|
+
{ icon: 'flower', tier: 'fallback', words: ['flower', 'flowers'] },
|
|
111
|
+
// Activity aliases follow display text; update these if the corresponding i18n labels change.
|
|
112
|
+
{ icon: 'product-growth-tree-box', tier: 'activity', words: ['soil'] },
|
|
113
|
+
{ icon: 'gardening-sprinkler', tier: 'activity', words: ['irrigation'] },
|
|
114
|
+
{ icon: 'agriculture-machine-seeder', tier: 'activity', phrases: ['direct seed', 'direct seeding'] },
|
|
115
|
+
{ icon: 'organic-bag-leaf', tier: 'activity', words: ['fertilization'] },
|
|
116
|
+
{ icon: 'gardening-tools-1', tier: 'activity', phrases: ['crop protection'] },
|
|
117
|
+
{ icon: 'farming-barn-sun', tier: 'activity', phrases: ['crop monitoring'] },
|
|
118
|
+
{ icon: 'farming-barn-sun', tier: 'fallback', words: ['field', 'fields'] },
|
|
119
|
+
{ icon: 'gardening-scissors', tier: 'activity', words: ['pruning'] },
|
|
120
|
+
{ icon: 'barbed-wire-fence', tier: 'activity', words: ['trellising'] },
|
|
121
|
+
{ icon: 'protein-gluten-wheat', tier: 'activity', phrases: ['preparing crops'] },
|
|
122
|
+
{ icon: 'harvest-product', tier: 'activity', phrases: ['grading produce', 'moving produce'] },
|
|
123
|
+
{ icon: 'harvest-product', tier: 'fallback', words: ['crop', 'crops'] },
|
|
124
|
+
{ icon: 'crop-info-biotech-1', tier: 'activity', phrases: ['estimating yield', 'other harvest'] },
|
|
125
|
+
{ icon: 'warehouse-storage', tier: 'activity', phrases: ['post harvest'] },
|
|
126
|
+
{ icon: 'temperature-control-warehouse-1', tier: 'activity', phrases: ['cold storage temperature'] },
|
|
127
|
+
{ icon: 'receipt-dollar', tier: 'activity', words: ['sale', 'sales'] },
|
|
128
|
+
{ icon: 'organic-flask', tier: 'activity', phrases: ['water testing', 'chlorine level'] },
|
|
129
|
+
]);
|
|
130
|
+
|
|
131
|
+
export const FARMERS_MARKET_ICON_MATCHERS = compileIconMatchRules([{ icon: 'farming-hay', tier: 'specific', words: ['hay'] }]);
|
|
132
|
+
|
|
133
|
+
export const FOOD_MANUFACTURING_DEFAULT_ICON = 'meal-can';
|
|
134
|
+
|
|
135
|
+
export const FOOD_MANUFACTURING_ICON_MATCHERS = compileIconMatchRules([
|
|
136
|
+
{
|
|
137
|
+
icon: FOOD_MANUFACTURING_DEFAULT_ICON,
|
|
138
|
+
tier: 'fallback',
|
|
139
|
+
words: ['can', 'cans', 'canned', 'canning', 'tin', 'tins', 'tinned'],
|
|
140
|
+
phrases: ['canned goods', 'canned food', 'canned foods', 'tin can', 'tin cans'],
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
icon: 'exotic-food-rolls',
|
|
144
|
+
tier: 'specific',
|
|
145
|
+
words: ['lumpia'],
|
|
146
|
+
phrases: ['spring roll', 'spring rolls', 'egg roll', 'egg rolls', 'fried roll', 'fried rolls'],
|
|
147
|
+
},
|
|
148
|
+
{ icon: 'pasta-cavatappi', tier: 'specific', prefixes: ['cavatap'] },
|
|
149
|
+
// A named pasta type wins over the generic pasta fallback, regardless of its position in the text.
|
|
150
|
+
{ icon: 'pasta-cavatappi', tier: 'fallback', words: ['pasta', 'pastas'] },
|
|
151
|
+
{ icon: 'pasta-farfalle', tier: 'specific', prefixes: ['farfal'] },
|
|
152
|
+
{ icon: 'pasta-fusili', tier: 'specific', prefixes: ['fusil', 'fussil'] },
|
|
153
|
+
{ icon: 'pasta-lasagne', tier: 'specific', prefixes: ['lasagn', 'lasang'] },
|
|
154
|
+
{ icon: 'pasta-penne', tier: 'specific', words: ['penne', 'pene', 'penni'] },
|
|
155
|
+
{ icon: 'pasta-ravioli', tier: 'specific', prefixes: ['raviol'] },
|
|
156
|
+
{ icon: 'pasta-rigatoni', tier: 'specific', prefixes: ['rigaton'] },
|
|
157
|
+
{
|
|
158
|
+
icon: 'salami',
|
|
159
|
+
tier: 'specific',
|
|
160
|
+
// Match word-start stems and common spelling variants, allowing incomplete or misspelled endings.
|
|
161
|
+
prefixes: [
|
|
162
|
+
'salam',
|
|
163
|
+
'choriz',
|
|
164
|
+
'choris',
|
|
165
|
+
'soppres',
|
|
166
|
+
'sopres',
|
|
167
|
+
'capicol',
|
|
168
|
+
'cappicol',
|
|
169
|
+
'capocol',
|
|
170
|
+
'bologn',
|
|
171
|
+
'balogn',
|
|
172
|
+
'bolon',
|
|
173
|
+
'balon',
|
|
174
|
+
'pepperon',
|
|
175
|
+
'peperon',
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
icon: 'wood-material-1',
|
|
180
|
+
tier: 'specific',
|
|
181
|
+
words: ['meatloaf', 'meatloaves'],
|
|
182
|
+
phrases: ['meat loaf', 'meat loaves'],
|
|
183
|
+
},
|
|
184
|
+
]);
|