|
1 | 1 | import { SettingEditor } from '@rocket.chat/core-typings'; |
2 | 2 |
|
3 | 3 | import { settingsRegistry } from '../../app/settings/server'; |
| 4 | +import { shouldBreakInVersion } from '../lib/shouldBreakInVersion'; |
4 | 5 |
|
5 | 6 | const omnichannelEnabledQuery = { _id: 'Livechat_enabled', value: true }; |
6 | 7 |
|
@@ -336,25 +337,32 @@ export const createOmniSettings = () => |
336 | 337 | enableQuery: omnichannelEnabledQuery, |
337 | 338 | }); |
338 | 339 |
|
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', { |
351 | 343 | type: 'string', |
352 | 344 | group: 'Omnichannel', |
353 | 345 | section: 'CRM_Integration', |
354 | | - i18nLabel: 'Lead_capture_phone_regex', |
| 346 | + i18nLabel: 'Lead_capture_email_regex', |
355 | 347 | 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 | + } |
358 | 366 |
|
359 | 367 | await this.add('Livechat_history_monitor_type', 'url', { |
360 | 368 | type: 'select', |
|
0 commit comments