Skip to content

Commit 8d9941f

Browse files
add deprecation alerts for lead capture livechat features
1 parent 2103a7a commit 8d9941f

5 files changed

Lines changed: 35 additions & 16 deletions

File tree

.changeset/old-bottles-shave.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@rocket.chat/models': patch
3+
'@rocket.chat/i18n': patch
4+
'@rocket.chat/meteor': patch
5+
---
6+
7+
Deprecates `Lead capture email regex` and `Lead capture phone regex` features.

apps/meteor/app/livechat/server/hooks/leadCapture.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ function validateMessage(message: IMessage, room: IOmnichannelRoom) {
3030
return true;
3131
}
3232

33+
// TODO: Remove Livechat lead capture features in version 9.0.0
3334
callbacks.add(
3435
'afterOmnichannelSaveMessage',
3536
async (message, { room }) => {

apps/meteor/server/settings/omnichannel.ts

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { SettingEditor } from '@rocket.chat/core-typings';
22

33
import { settingsRegistry } from '../../app/settings/server';
4+
import { shouldBreakInVersion } from '../lib/shouldBreakInVersion';
45

56
const omnichannelEnabledQuery = { _id: 'Livechat_enabled', value: true };
67

@@ -336,25 +337,32 @@ export const createOmniSettings = () =>
336337
enableQuery: omnichannelEnabledQuery,
337338
});
338339

339-
await this.add('Livechat_lead_email_regex', '\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,4}\\b', {
340-
type: 'string',
341-
group: 'Omnichannel',
342-
section: 'CRM_Integration',
343-
i18nLabel: 'Lead_capture_email_regex',
344-
enableQuery: omnichannelEnabledQuery,
345-
});
346-
347-
await this.add(
348-
'Livechat_lead_phone_regex',
349-
'((?:\\([0-9]{1,3}\\)|[0-9]{2})[ \\-]*?[0-9]{4,5}(?:[\\-\\s\\_]{1,2})?[0-9]{4}(?:(?=[^0-9])|$)|[0-9]{4,5}(?:[\\-\\s\\_]{1,2})?[0-9]{4}(?:(?=[^0-9])|$))',
350-
{
340+
if (!shouldBreakInVersion('9.0.0')) {
341+
// TODO: Remove Livechat lead capture features in version 9.0.0
342+
await this.add('Livechat_lead_email_regex', '\\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,4}\\b', {
351343
type: 'string',
352344
group: 'Omnichannel',
353345
section: 'CRM_Integration',
354-
i18nLabel: 'Lead_capture_phone_regex',
346+
i18nLabel: 'Lead_capture_email_regex',
355347
enableQuery: omnichannelEnabledQuery,
356-
},
357-
);
348+
alert: 'Lead_capture_email_regex_deprecation_alert',
349+
});
350+
351+
await this.add(
352+
'Livechat_lead_phone_regex',
353+
'((?:\\([0-9]{1,3}\\)|[0-9]{2})[ \\-]*?[0-9]{4,5}(?:[\\-\\s\\_]{1,2})?[0-9]{4}(?:(?=[^0-9])|$)|[0-9]{4,5}(?:[\\-\\s\\_]{1,2})?[0-9]{4}(?:(?=[^0-9])|$))',
354+
{
355+
type: 'string',
356+
group: 'Omnichannel',
357+
section: 'CRM_Integration',
358+
i18nLabel: 'Lead_capture_phone_regex',
359+
enableQuery: omnichannelEnabledQuery,
360+
alert: 'Lead_capture_phone_regex_deprecation_alert',
361+
},
362+
);
363+
} else {
364+
throw new Error('Omnichannel: Livechat lead capture features should be removed from the codebase in version 9.0.0');
365+
}
358366

359367
await this.add('Livechat_history_monitor_type', 'url', {
360368
type: 'select',

packages/i18n/src/locales/en.i18n.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3075,7 +3075,9 @@
30753075
"Layout_Sidenav_Footer_description": "Footer size is 260 x 70px",
30763076
"Layout_Terms_of_Service": "Terms of Service",
30773077
"Lead_capture_email_regex": "Lead capture email regex",
3078+
"Lead_capture_email_regex_deprecation_alert": "This feature is deprecated and will be removed in version 9.0.0.",
30783079
"Lead_capture_phone_regex": "Lead capture phone regex",
3080+
"Lead_capture_phone_regex_deprecation_alert": "This feature is deprecated and will be removed in version 9.0.0.",
30793081
"Leaders": "Leaders",
30803082
"Learn_how_to_unlock_the_myriad_possibilities_of_rocket_chat": "Learn how to unlock the myriad possibilities of Rocket.Chat.",
30813083
"Learn_more": "Learn more",
@@ -7161,4 +7163,4 @@
71617163
"message_attachment": "message attachment",
71627164
"system_message_body": "system message body",
71637165
"No_changes_to_save": "No changes to save"
7164-
}
7166+
}

packages/models/src/models/LivechatVisitors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ export class LivechatVisitorsRaw extends BaseRaw<ILivechatVisitor> implements IL
369369
return this.deleteOne({ _id });
370370
}
371371

372+
// TODO: Remove Livechat lead capture features in version 9.0.0
372373
saveGuestEmailPhoneById(_id: string, emails: string[], phones: string[]): Promise<UpdateResult | Document | void> {
373374
const saveEmail = ([] as string[])
374375
.concat(emails)

0 commit comments

Comments
 (0)