@capillarytech/creatives-library 9.2.1 → 9.2.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.
Files changed (45) hide show
  1. package/constants/unified.js +0 -3
  2. package/package.json +1 -1
  3. package/translations/en.json +0 -1
  4. package/translations/ja-JP.json +0 -1
  5. package/translations/zh.json +0 -1
  6. package/utils/tagValidations.js +4 -35
  7. package/utils/tests/tagValidations.test.js +0 -48
  8. package/v2Components/CapTagList/index.js +7 -46
  9. package/v2Components/CapTagList/messages.js +0 -44
  10. package/v2Components/CapTagList/style.scss +1 -113
  11. package/v2Components/FormBuilder/Classic.js +14 -24
  12. package/v2Components/FormBuilder/Functional/channels/mobilepush/config.js +0 -1
  13. package/v2Components/FormBuilder/Functional/channels/mobilepush/getEditorErrorDescriptor.js +1 -1
  14. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/validate.test.js +0 -57
  15. package/v2Components/FormBuilder/Functional/channels/mobilepush/validate.js +4 -4
  16. package/v2Components/FormBuilder/Functional/channels/sms/getEditorErrorDescriptor.js +0 -3
  17. package/v2Components/FormBuilder/Functional/channels/sms/tests/getEditorErrorDescriptor.test.js +0 -5
  18. package/v2Components/FormBuilder/Functional/channels/sms/tests/validate.test.js +0 -6
  19. package/v2Components/FormBuilder/Functional/channels/sms/validate.js +1 -3
  20. package/v2Components/FormBuilder/Functional/renderers/mpushRenderers.js +0 -3
  21. package/v2Components/FormBuilder/Functional/tests/mpushRenderers.test.js +0 -22
  22. package/v2Containers/Cap/messages.js +0 -4
  23. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
  24. package/v2Containers/InApp/index.js +1 -4
  25. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +0 -3
  26. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +0 -2
  27. package/v2Containers/Line/Container/Text/index.js +1 -3
  28. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +0 -16
  29. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +0 -18
  30. package/v2Containers/MobilePushNew/index.js +1 -4
  31. package/v2Containers/Rcs/index.js +1 -8
  32. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -59
  33. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
  34. package/v2Containers/SmsTrai/Edit/index.js +5 -13
  35. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +0 -15
  36. package/v2Containers/Viber/index.js +1 -3
  37. package/v2Containers/WebPush/Create/utils/validation.js +0 -6
  38. package/v2Containers/WebPush/Create/utils/validation.test.js +0 -50
  39. package/v2Containers/Whatsapp/index.js +5 -9
  40. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +2 -2
  41. package/v2Containers/Zalo/index.js +1 -4
  42. package/v2Components/CapTagList/TagFallbackPanel.js +0 -124
  43. package/v2Components/CapTagList/constants.js +0 -5
  44. package/v2Components/CapTagList/tests/TagFallback.test.js +0 -222
  45. package/v2Components/CapTagList/utils.js +0 -17
@@ -161,9 +161,6 @@ export const UNSUBSCRIBE_TAG = 'unsubscribe';
161
161
  export const UNSUBSCRIBE_TAG_REGEX = new RegExp(`\\{\\{\\s*${UNSUBSCRIBE_TAG}\\s*\\}\\}`);
162
162
  /** Matches {{ ... }} and captures the inner tag content (for scanning content for tags). */
163
163
  export const TAG_CONTENT_REGEX = /{{([^}]+)}}/g;
164
- // `default:` filter inside a tag, and the same filter with a quoted value e.g. default: 'x'
165
- export const DEFAULT_FILTER_REGEX = /^\s*default\s*:/;
166
- export const QUOTED_DEFAULT_REGEX = /^\s*default\s*:\s*('[^']*'|"[^"]*")\s*$/;
167
164
  export const ENTRY_TRIGGER_TAG_REGEX = /\bentryTrigger\.\w+(?:\.\w+)?(?:\(\w+\))?/g;
168
165
  /** Strips characters not allowed in a downloaded file name, keeping alphanumerics, `-`, `_` and spaces. */
169
166
  export const SAFE_FILE_NAME_REGEX = /[^a-zA-Z0-9-_ ]/g;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "9.2.1",
4
+ "version": "9.2.2",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -317,7 +317,6 @@
317
317
  "creatives.componentsV2.TopBar.profile": "Profile",
318
318
  "creatives.componentsV2.TopBar.settings": "Settings",
319
319
  "creatives.componentsV2.unbalanacedCurlyBraces": "Invalid label, please close all curly braces",
320
- "creatives.componentsV2.unquotedTagDefaultValue": "Invalid label, default value must be within quotes",
321
320
  "creatives.componentsv2.MobilePushPreviewV2.header": "This is the MobilePushPreviewV2 component !",
322
321
  "creatives.containers.Assets.Gallery.alphabetically": "Alphabetically",
323
322
  "creatives.containers.Assets.Gallery.assetDeleteFailed": "Image deletion failed.",
@@ -316,7 +316,6 @@
316
316
  "creatives.componentsV2.TopBar.profile": "",
317
317
  "creatives.componentsV2.TopBar.settings": "",
318
318
  "creatives.componentsV2.unbalanacedCurlyBraces": "",
319
- "creatives.componentsV2.unquotedTagDefaultValue": "",
320
319
  "creatives.componentsv2.MobilePushPreviewV2.header": "",
321
320
  "creatives.containers.Assets.Gallery.alphabetically": "",
322
321
  "creatives.containers.Assets.Gallery.assetDeleteFailed": "",
@@ -316,7 +316,6 @@
316
316
  "creatives.componentsV2.TopBar.profile": "",
317
317
  "creatives.componentsV2.TopBar.settings": "",
318
318
  "creatives.componentsV2.unbalanacedCurlyBraces": "",
319
- "creatives.componentsV2.unquotedTagDefaultValue": "",
320
319
  "creatives.componentsv2.MobilePushPreviewV2.header": "",
321
320
  "creatives.containers.Assets.Gallery.alphabetically": "",
322
321
  "creatives.containers.Assets.Gallery.assetDeleteFailed": "",
@@ -8,15 +8,7 @@
8
8
 
9
9
  import lodashForEach from 'lodash/forEach';
10
10
  import lodashCloneDeep from 'lodash/cloneDeep';
11
- import {
12
- ENTRY_TRIGGER_TAG_REGEX,
13
- SKIP_TAGS_REGEX_GROUPS,
14
- TAG_CONTENT_REGEX,
15
- UNSUBSCRIBE_TAG,
16
- UNSUBSCRIBE_TAG_REGEX,
17
- DEFAULT_FILTER_REGEX,
18
- QUOTED_DEFAULT_REGEX,
19
- } from '../constants/unified';
11
+ import { ENTRY_TRIGGER_TAG_REGEX, SKIP_TAGS_REGEX_GROUPS, TAG_CONTENT_REGEX, UNSUBSCRIBE_TAG, UNSUBSCRIBE_TAG_REGEX } from '../constants/unified';
20
12
 
21
13
  const DEFAULT = 'default';
22
14
  const SUBTAGS = 'subtags';
@@ -97,8 +89,9 @@ export const validateTagsCore = ({
97
89
  }
98
90
 
99
91
  response.isBraceError = !validateIfTagClosed(contentForBraceCheck);
100
- response.isDefaultQuoteError = !response.isBraceError && hasUnquotedTagDefault(contentForBraceCheck);
101
- if (response.isBraceError || response.isDefaultQuoteError || response?.missingTags?.length > 0) {
92
+ if (response.isBraceError) {
93
+ response.valid = false;
94
+ } else if (response?.missingTags?.length > 0) {
102
95
  response.valid = false;
103
96
  }
104
97
  return response;
@@ -210,30 +203,6 @@ export const validateIfTagClosed = (value) => {
210
203
  return (l1 == l2 && l2 == l3 && l1 == l3);
211
204
  };
212
205
 
213
- // Splits a tag body into filters on `|` outside quotes (Liquid has no escaped quotes).
214
- const splitTagFilters = (body) => {
215
- const filters = [''];
216
- let quote = null;
217
- [...body].forEach((char) => {
218
- if (quote) {
219
- if (char === quote) quote = null;
220
- } else if (char === "'" || char === '"') {
221
- quote = char;
222
- } else if (char === '|') {
223
- filters.push('');
224
- return;
225
- }
226
- filters[filters.length - 1] += char;
227
- });
228
- return filters;
229
- };
230
-
231
- // `default:` inside a {{ }} tag must be followed by a quoted value, e.g. {{tag | default: 'x'}}
232
- export const hasUnquotedTagDefault = (value = '') =>
233
- (String(value).match(/{{.*?}}/g) || []).some((tag) => splitTagFilters(tag.slice(2, -2))
234
- .slice(1)
235
- .some((filter) => DEFAULT_FILTER_REGEX.test(filter) && !QUOTED_DEFAULT_REGEX.test(filter)));
236
-
237
206
  //replaces encoded string with their respective characters
238
207
  export const preprocessHtml = (content) => {
239
208
  const replacements = {
@@ -11,7 +11,6 @@ import {
11
11
  skipTags,
12
12
  checkIfSupportedTag,
13
13
  transformInjectedTags,
14
- hasUnquotedTagDefault,
15
14
  } from '../tagValidations';
16
15
  import { containsBase64Images } from '../content';
17
16
 
@@ -194,53 +193,6 @@ describe("check if curly brackets are balanced", () => {
194
193
  })
195
194
  })
196
195
 
197
- describe('hasUnquotedTagDefault', () => {
198
- it('allows tags without default and defaults within quotes', () => {
199
- expect(hasUnquotedTagDefault('{{badge_description}}')).toBe(false);
200
- expect(hasUnquotedTagDefault("{{badge_description | default: ''}}")).toBe(false);
201
- expect(hasUnquotedTagDefault("{{badge_description | default: 'Rafeeq'}}")).toBe(false);
202
- expect(hasUnquotedTagDefault('{{badge_description | default: "Rafeeq\'s"}}')).toBe(false);
203
- expect(hasUnquotedTagDefault("Hi {{a|default:' '}} {{b}} plain text")).toBe(false);
204
- });
205
-
206
- it('flags default with missing or unquoted value', () => {
207
- expect(hasUnquotedTagDefault('{{badge_description | default: }}')).toBe(true);
208
- expect(hasUnquotedTagDefault('{{badge_description | default: Rafeeq}}')).toBe(true);
209
- expect(hasUnquotedTagDefault("{{badge_description | default: 'Rafeeq}}")).toBe(true);
210
- expect(hasUnquotedTagDefault("{{a}} {{b | default: 'x' y}}")).toBe(true);
211
- });
212
-
213
- it('ignores pipes inside quotes and allows chained filters', () => {
214
- expect(hasUnquotedTagDefault("{{name | replace: '| default:', 'x'}}")).toBe(false);
215
- expect(hasUnquotedTagDefault("{{name | default: 'a | default: b'}}")).toBe(false);
216
- expect(hasUnquotedTagDefault("{{name | default: 'a|b'}}")).toBe(false);
217
- expect(hasUnquotedTagDefault("{{name | default: 'x' | append: '!'}}")).toBe(false);
218
- expect(hasUnquotedTagDefault("{{name | append: 'x' | default: 'y'}}")).toBe(false);
219
- });
220
-
221
- it('rejects backslash-escaped quotes since Liquid has no escapes', () => {
222
- expect(hasUnquotedTagDefault("{{name | default: 'it\\'s'}}")).toBe(true);
223
- });
224
- });
225
-
226
- describe('validateTagsCore default quote check', () => {
227
- const run = (content) => validateTagsCore({
228
- contentForBraceCheck: content, contentForUnsubscribeScan: content, tags: null, currentModule: 'default', isFullMode: true,
229
- });
230
-
231
- it('marks unquoted default as invalid with isDefaultQuoteError', () => {
232
- expect(run('{{name | default: Rafeeq}}')).toEqual(expect.objectContaining({ valid: false, isBraceError: false, isDefaultQuoteError: true }));
233
- });
234
-
235
- it('keeps quoted default valid', () => {
236
- expect(run("{{name | default: 'Rafeeq'}}")).toEqual(expect.objectContaining({ valid: true, isDefaultQuoteError: false }));
237
- });
238
-
239
- it('reports only brace error when braces are not closed', () => {
240
- expect(run('{{name | default: Rafeeq}')).toEqual(expect.objectContaining({ isBraceError: true, isDefaultQuoteError: false }));
241
- });
242
- });
243
-
244
196
  describe("validateTags", () => {
245
197
  const tagsParam = [
246
198
  {
@@ -29,7 +29,6 @@ import _ from 'lodash';
29
29
  import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
30
30
  import { createStructuredSelector } from 'reselect';
31
31
  import messages from './messages';
32
- import TagFallbackPanel from './TagFallbackPanel';
33
32
  import { makeSelectLoyaltyPromotionDisplay } from '../../v2Containers/Cap/selectors';
34
33
  import { CARD_RELATED_TAGS, HOSPITALITY_RELATED_TAGS, CUSTOMER_BARCODE_TAG, GET_TRANSLATION_MAPPED ,JAPANESE_HELP_TEXT, TAG_TRANSLATION_DOC} from '../../constants/unified';
35
34
  import { hasCardBasedScope, hasCustomerBarcodeFeatureEnabled, hasHospitalityBasedScope } from '../../utils/common';
@@ -39,7 +38,7 @@ import { hidingDateTagsForJpLocale } from '../../v2Containers/TagList/utils';
39
38
 
40
39
  const {Search} = CapInput;
41
40
 
42
- export class CapTagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
41
+ class CapTagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
43
42
  constructor(props) {
44
43
  super(props);
45
44
  this.state = {
@@ -56,8 +55,6 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
56
55
  selectedContext: 'Outbound',
57
56
  isLoadingLoyaltyTags: false,
58
57
  isLoadingContextChange: false,
59
- // leaf tag clicked from the list, fallback panel is shown for it
60
- selectedTag: null,
61
58
  };
62
59
  this.renderTags = this.renderTags.bind(this);
63
60
  this.getSearchedExpandedKeys = this.getSearchedExpandedKeys.bind(this);
@@ -88,11 +85,6 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
88
85
  });
89
86
  }
90
87
 
91
- // hidePopover mode: modal is closed by the parent, go back to the tag list for next open
92
- if (prevProps.visibleTaglist && !this.props.visibleTaglist && this.state.selectedTag) {
93
- this.setState({ selectedTag: null, selectedNodeKey: '' });
94
- }
95
-
96
88
  // Reset loading states when tags are received after context change
97
89
  if ((this.state.isLoadingLoyaltyTags || this.state.isLoadingContextChange)
98
90
  && this.props.tags !== prevProps.tags) {
@@ -226,15 +218,8 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
226
218
  if (ifDynamicTag) {
227
219
  this.renderDynamicTagFlow();
228
220
  } else {
229
- const nodeData = selectedNode.props || selectedNode;
230
- this.setState({
231
- selectedTag: {
232
- tagKey: selectedTagValue,
233
- tagName: nodeData?.tagName,
234
- parentName: nodeData?.parentName,
235
- info,
236
- },
237
- });
221
+ this.props.onSelect([selectedTagValue], info);
222
+ this.setState({visible: false});
238
223
  }
239
224
  } else if (!isLeaf) {
240
225
  this.handleOnExpand(selectedKeys[0]);
@@ -253,18 +238,8 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
253
238
  this.setState({expandedKeys, autoExpandParent: false});
254
239
  };
255
240
 
256
- handleFallbackBack = () => {
257
- this.setState({selectedTag: null, selectedNodeKey: ''});
258
- };
259
-
260
- handleFallbackInsert = (tagValue) => {
261
- const { info } = this.state.selectedTag || {};
262
- this.props.onSelect([tagValue], info);
263
- this.setState({visible: false, selectedTag: null, selectedNodeKey: ''});
264
- };
265
-
266
241
  togglePopoverVisibility = (visible) => {
267
- this.setState(visible ? {visible} : {visible, selectedTag: null, selectedNodeKey: ''});
242
+ this.setState({visible});
268
243
  // Call onVisibleChange callback if provided (for triggering API calls when popover opens)
269
244
  if (this.props.onVisibleChange) {
270
245
  this.props.onVisibleChange(visible);
@@ -275,7 +250,7 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
275
250
  this.setState({showModal: true, visible: false});
276
251
  };
277
252
 
278
- renderTags = (tags, parentPath = '', parentName = '') => {
253
+ renderTags = (tags, parentPath = '') => {
279
254
  const searchString = this.state.searchValue || '';
280
255
  const {
281
256
  disableRelatedTags, childTagsToDisable, parentTagstoDisable,
@@ -316,7 +291,7 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
316
291
  || tagNameWithoutUnderscore.includes(searchStringLower));
317
292
  if (_.has(val, 'subtags')) {
318
293
  const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
319
- const temp = this.renderTags(val?.subtags, nodeKey, val?.name);
294
+ const temp = this.renderTags(val?.subtags, nodeKey);
320
295
  if (temp?.length) {
321
296
  const node = {
322
297
  title: disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val?.name}</CapTooltip> : val?.name,
@@ -349,8 +324,6 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
349
324
  key: nodeKey,
350
325
  tag: val,
351
326
  tagKey: rawKey,
352
- tagName: val?.desc || val?.name,
353
- parentName,
354
327
  isLeaf: true,
355
328
  disabled: childDisabled,
356
329
  };
@@ -396,24 +369,12 @@ export class CapTagList extends React.Component { // eslint-disable-line react/p
396
369
  key: 'loyalty',
397
370
  },
398
371
  ];
399
- const { selectedTag } = this.state;
400
- const contentSection = selectedTag ? (
401
- <CapRow useLegacy className="cap-tag-list-popover-inner">
402
- <TagFallbackPanel
403
- tagKey={selectedTag?.tagKey}
404
- tagName={selectedTag?.tagName}
405
- parentName={selectedTag?.parentName}
406
- onBack={this.handleFallbackBack}
407
- onInsert={this.handleFallbackInsert}
408
- />
409
- </CapRow>
410
- ) : (
372
+ const contentSection = (
411
373
  <CapRow useLegacy className="cap-tag-list-popover-inner">
412
374
  <CapSpin tip={formatMessage(messages.gettingTags)} spinning={shouldShowLoading}>
413
375
  <Search
414
376
  style={{ marginBottom: 8, width: '250px'}}
415
377
  placeholder={formatMessage(messages.search)}
416
- value={this.state.searchValue}
417
378
  onChange={this.onChange} />
418
379
  {moduleFilterEnabled ? (
419
380
  <CapSelect
@@ -58,48 +58,4 @@ export default defineMessages({
58
58
  id: `creatives.componentsV2.CapTagList.labelFetchErrorMsg`,
59
59
  defaultMessage: 'Unable to fetch the labels. Please try again later'
60
60
  },
61
- fallbackBehaviour: {
62
- id: `creatives.componentsV2.CapTagList.fallbackBehaviour`,
63
- defaultMessage: 'Fallback behaviour',
64
- },
65
- fallbackBehaviourDesc: {
66
- id: `creatives.componentsV2.CapTagList.fallbackBehaviourDesc`,
67
- defaultMessage: 'If the tag has no value for a customer',
68
- },
69
- dontSendMessage: {
70
- id: `creatives.componentsV2.CapTagList.dontSendMessage`,
71
- defaultMessage: 'Don’t send message',
72
- },
73
- sendWithNullValue: {
74
- id: `creatives.componentsV2.CapTagList.sendWithNullValue`,
75
- defaultMessage: 'Send with null value',
76
- },
77
- fallbackValue: {
78
- id: `creatives.componentsV2.CapTagList.fallbackValue`,
79
- defaultMessage: 'Fallback value',
80
- },
81
- fallbackValuePlaceholder: {
82
- id: `creatives.componentsV2.CapTagList.fallbackValuePlaceholder`,
83
- defaultMessage: 'Enter fallback value',
84
- },
85
- fallbackValueInvalid: {
86
- id: `creatives.componentsV2.CapTagList.fallbackValueInvalid`,
87
- defaultMessage: 'Fallback value cannot contain { } or both single and double quotes',
88
- },
89
- addsToMessageAs: {
90
- id: `creatives.componentsV2.CapTagList.addsToMessageAs`,
91
- defaultMessage: 'Adds to the message as',
92
- },
93
- insertTag: {
94
- id: `creatives.componentsV2.CapTagList.insertTag`,
95
- defaultMessage: 'Insert tag',
96
- },
97
- back: {
98
- id: `creatives.componentsV2.CapTagList.back`,
99
- defaultMessage: 'Back',
100
- },
101
- copy: {
102
- id: `creatives.componentsV2.CapTagList.copy`,
103
- defaultMessage: 'Copy',
104
- },
105
61
  });
@@ -56,116 +56,4 @@
56
56
 
57
57
  .ant-popover-container.tag-list-popover-container.tag-list-popover-container {
58
58
  background-color: $CAP_WHITE;
59
- }
60
- .tag-fallback-panel {
61
- width: 20rem;
62
- max-width: 100%;
63
-
64
- .tag-fallback-header {
65
- padding-bottom: $CAP_SPACE_16;
66
- margin-bottom: $CAP_SPACE_16;
67
- border-bottom: 1px solid $CAP_G07;
68
- }
69
-
70
- .tag-fallback-title-row {
71
- gap: $CAP_SPACE_16;
72
- }
73
-
74
- .tag-fallback-back {
75
- flex-shrink: 0;
76
- color: $FONT_COLOR_02;
77
- cursor: pointer;
78
- }
79
-
80
- .tag-fallback-tag-name {
81
- margin: 0;
82
- min-width: 0;
83
- word-break: break-word;
84
- font-size: 1rem;
85
- font-weight: $FONT_WEIGHT_MEDIUM;
86
- line-height: 1.5rem;
87
- color: $FONT_COLOR_01;
88
- }
89
-
90
- // indented by back icon width + gap, so it starts below the tag name
91
- .tag-fallback-group-name {
92
- margin: $CAP_SPACE_02 0 0 calc(#{$CAP_SPACE_24} + #{$CAP_SPACE_16});
93
- word-break: break-word;
94
- font-size: 0.8rem;
95
- font-weight: $FONT_WEIGHT_REGULAR;
96
- color: $FONT_COLOR_02;
97
- }
98
-
99
- .tag-fallback-heading {
100
- margin: 0;
101
- font-size: $FONT_SIZE_M;
102
- font-weight: $FONT_WEIGHT_MEDIUM;
103
- line-height: 1.43rem;
104
- color: $FONT_COLOR_01;
105
- }
106
-
107
- .tag-fallback-subtext {
108
- margin-top: $CAP_SPACE_02;
109
- font-size: $FONT_SIZE_S;
110
- font-weight: $FONT_WEIGHT_REGULAR;
111
- color: $FONT_COLOR_02;
112
- }
113
-
114
- .tag-fallback-options {
115
- display: flex;
116
- flex-direction: column;
117
- margin: $CAP_SPACE_16 0;
118
-
119
- .ant-radio-wrapper,
120
- .ant-radio-wrapper span {
121
- font-size: $FONT_SIZE_M;
122
- font-weight: $FONT_WEIGHT_REGULAR;
123
- color: $FONT_COLOR_01;
124
- }
125
- }
126
-
127
- .tag-fallback-input {
128
- margin-bottom: $CAP_SPACE_16;
129
- }
130
-
131
- .tag-fallback-preview-label {
132
- margin: $CAP_SPACE_24 0 $CAP_SPACE_08;
133
- font-size: $FONT_SIZE_S;
134
- font-weight: $FONT_WEIGHT_REGULAR;
135
- color: $FONT_COLOR_02;
136
- }
137
-
138
- .tag-fallback-preview-row {
139
- gap: $CAP_SPACE_12;
140
- }
141
-
142
- .tag-fallback-preview {
143
- flex: 1;
144
- min-width: 0;
145
- padding: $CAP_SPACE_08 $CAP_SPACE_12;
146
- border: 1px solid $CAP_COLOR_01;
147
- border-radius: $CAP_SPACE_04;
148
- background: $BG_08;
149
- color: map-get($CAP_PRIMARY, hover);
150
- font-family: 'Roboto Mono', Menlo, Consolas, monospace;
151
- font-size: $FONT_SIZE_S;
152
- line-height: 1.143rem;
153
- word-break: break-all;
154
- }
155
-
156
- .tag-fallback-copy {
157
- flex-shrink: 0;
158
- color: $FONT_COLOR_02;
159
- cursor: pointer;
160
-
161
- &:hover {
162
- color: $FONT_COLOR_01;
163
- }
164
- }
165
-
166
- .tag-fallback-footer {
167
- margin-top: $CAP_SPACE_16;
168
- padding-top: $CAP_SPACE_12;
169
- border-top: 1px solid $CAP_G07;
170
- }
171
- }
59
+ }
@@ -81,8 +81,7 @@ const tagsTypes = {
81
81
  const errorMessageForTags = {
82
82
  MISSING_TAG_ERROR: 'missingTagsError',
83
83
  GENERIC_VALIDATION_ERROR: 'genericValidationError',
84
- TAG_BRACKET_COUNT_MISMATCH_ERROR: 'tagBracketCountMismatchError',
85
- TAG_DEFAULT_QUOTE_ERROR: 'tagDefaultQuoteError',
84
+ TAG_BRACKET_COUNT_MISMATCH_ERROR: 'tagBracketCountMismatchError'
86
85
  };
87
86
 
88
87
  // Isolated input for EMAIL template-name: only this tiny component re-renders on each keystroke.
@@ -857,11 +856,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
857
856
  if (tagResult.valid) {
858
857
  errorData[count][`sms-editor${index > 1 ? index : ''}`] = false;
859
858
  } else {
860
- const { MISSING_TAG_ERROR, GENERIC_VALIDATION_ERROR, TAG_BRACKET_COUNT_MISMATCH_ERROR, TAG_DEFAULT_QUOTE_ERROR } = errorMessageForTags || {};
861
- const { missingTags, isBraceError, isDefaultQuoteError } = tagResult;
862
- let smsEditorError = isDefaultQuoteError ? TAG_DEFAULT_QUOTE_ERROR : GENERIC_VALIDATION_ERROR;
863
- if (isBraceError) smsEditorError = TAG_BRACKET_COUNT_MISMATCH_ERROR;
864
- errorData[count][`sms-editor${index > 1 ? index : ''}`] = missingTags && missingTags.length ? MISSING_TAG_ERROR : smsEditorError;
859
+ const { MISSING_TAG_ERROR, GENERIC_VALIDATION_ERROR, TAG_BRACKET_COUNT_MISMATCH_ERROR } = errorMessageForTags || {};
860
+ const { missingTags, isBraceError } = tagResult;
861
+ errorData[count][`sms-editor${index > 1 ? index : ''}`] = missingTags && missingTags.length ? MISSING_TAG_ERROR : (isBraceError ? TAG_BRACKET_COUNT_MISMATCH_ERROR : GENERIC_VALIDATION_ERROR);
865
862
  errorData[count][`bracket-error`] = isBraceError && TAG_BRACKET_COUNT_MISMATCH_ERROR;
866
863
  isValid = false;
867
864
  }
@@ -995,7 +992,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
995
992
  if(this.props.schema && this.props.schema.channel && this.props.schema.channel.toUpperCase() === "MOBILEPUSH"){
996
993
  let androidValid = true, iosValid = true;
997
994
  let isOnlyAndroid = false, isOnlyIos = false;
998
- const { TAG_BRACKET_COUNT_MISMATCH_ERROR, TAG_DEFAULT_QUOTE_ERROR } = errorMessageForTags;
995
+ const { TAG_BRACKET_COUNT_MISMATCH_ERROR } = errorMessageForTags;
999
996
  const androidData = {};
1000
997
  if (this.state.formData && this.state.formData[0]) {
1001
998
  for(let data in this.state.formData[0]){
@@ -1044,8 +1041,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1044
1041
  if (tagValidationResponse.valid) {
1045
1042
  errorData[parseInt(index)][`message-editor${selector}`] = false;
1046
1043
  } else {
1047
- const { isBraceError, isDefaultQuoteError } = tagValidationResponse;
1048
- errorData[parseInt(index)][`message-editor${selector}`] = isBraceError ? TAG_BRACKET_COUNT_MISMATCH_ERROR : (isDefaultQuoteError ? TAG_DEFAULT_QUOTE_ERROR : true);
1044
+ const { isBraceError } = tagValidationResponse;
1045
+ errorData[parseInt(index)][`message-editor${selector}`] = isBraceError ? TAG_BRACKET_COUNT_MISMATCH_ERROR : true;
1049
1046
  errorData[parseInt(index)][`bracket-error`] = isBraceError && TAG_BRACKET_COUNT_MISMATCH_ERROR;
1050
1047
  isValid = false;
1051
1048
  }
@@ -1076,8 +1073,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1076
1073
  if (tagValidationResponse.valid) {
1077
1074
  errorData[parseInt(index)][`message-title${selector}`] = false;
1078
1075
  } else {
1079
- const { isBraceError, isDefaultQuoteError } = tagValidationResponse;
1080
- errorData[parseInt(index)][`message-title${selector}`] = isBraceError ? TAG_BRACKET_COUNT_MISMATCH_ERROR : (isDefaultQuoteError ? TAG_DEFAULT_QUOTE_ERROR : true);
1076
+ const {isBraceError} = tagValidationResponse;
1077
+ errorData[parseInt(index)][`message-title${selector}`] = isBraceError ? TAG_BRACKET_COUNT_MISMATCH_ERROR : true;
1081
1078
  errorData[parseInt(index)][`bracket-error`] = isBraceError && TAG_BRACKET_COUNT_MISMATCH_ERROR;
1082
1079
  isValid = false;
1083
1080
  }
@@ -1361,9 +1358,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1361
1358
  if (tagValidationResponse?.isBraceError){
1362
1359
  errorString += this.props.intl.formatMessage(globalMessages.unbalanacedCurlyBraces);
1363
1360
  }
1364
- if (tagValidationResponse?.isDefaultQuoteError) {
1365
- errorString += this.props.intl.formatMessage(globalMessages.unquotedTagDefaultValue);
1366
- }
1367
1361
  if (tagValidationResponse?.isContentEmpty) {
1368
1362
  errorString += this.props.intl.formatMessage(messages.emailBodyEmptyError);
1369
1363
  // Adds a bypass for cases where content is initially empty in the creation flow.
@@ -2928,7 +2922,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2928
2922
  const errorType = (isVersionEnable ? errorData[`${currentTab - 1}`][val.id] : errorData[val.id]);
2929
2923
  const ifError = checkValidation && errorType;
2930
2924
  const messageContent = isVersionEnable ? formData[`${currentTab - 1}`][val.id] : formData[val.id];
2931
- const { MISSING_TAG_ERROR, TAG_BRACKET_COUNT_MISMATCH_ERROR, TAG_DEFAULT_QUOTE_ERROR } = errorMessageForTags;
2925
+ const { MISSING_TAG_ERROR, TAG_BRACKET_COUNT_MISMATCH_ERROR } = errorMessageForTags;
2932
2926
  const { formatMessage } = this.props.intl;
2933
2927
 
2934
2928
  const aiContentBotDisabled = isAiContentBotDisabled();
@@ -2941,9 +2935,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2941
2935
  case TAG_BRACKET_COUNT_MISMATCH_ERROR:
2942
2936
  errorMessageText = formatMessage(globalMessages.unbalanacedCurlyBraces);
2943
2937
  break;
2944
- case TAG_DEFAULT_QUOTE_ERROR:
2945
- errorMessageText = formatMessage(globalMessages.unquotedTagDefaultValue);
2946
- break;
2947
2938
  case true:
2948
2939
  errorMessageText = formatMessage(messages.genericTagsValidationError);
2949
2940
  break;
@@ -3573,7 +3564,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3573
3564
  const errorType = isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id];
3574
3565
  const aiContentBotDisabled = isAiContentBotDisabled();
3575
3566
  ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
3576
- const { TAG_BRACKET_COUNT_MISMATCH_ERROR, TAG_DEFAULT_QUOTE_ERROR } = errorMessageForTags;
3567
+ const { TAG_BRACKET_COUNT_MISMATCH_ERROR } = errorMessageForTags;
3577
3568
  const { formatMessage } = this.props.intl;
3578
3569
  const value = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id];
3579
3570
  // Show personalization error for title field inline (same as message textarea) when restrictPersonalization is true
@@ -3581,10 +3572,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3581
3572
  if (hasPersonalizationError) {
3582
3573
  ifError = true;
3583
3574
  }
3584
- let errorMessageText = val.errorMessage && ifError ? val.errorMessage : '';
3585
- if (errorType === TAG_BRACKET_COUNT_MISMATCH_ERROR) errorMessageText = formatMessage(globalMessages.unbalanacedCurlyBraces);
3586
- if (errorType === TAG_DEFAULT_QUOTE_ERROR) errorMessageText = formatMessage(globalMessages.unquotedTagDefaultValue);
3587
- if (hasPersonalizationError) errorMessageText = formatMessage(messages.personalizationTagsErrorMessage);
3575
+ let errorMessageText = hasPersonalizationError
3576
+ ? formatMessage(messages.personalizationTagsErrorMessage)
3577
+ : (errorType === TAG_BRACKET_COUNT_MISMATCH_ERROR ? formatMessage(globalMessages.unbalanacedCurlyBraces) : (val.errorMessage && ifError ? val.errorMessage : ''));
3588
3578
  if (styling === 'semantic') {
3589
3579
  const isEmailStandaloneHighFreq = val.standalone && this.props.schema?.channel?.toUpperCase() === EMAIL;
3590
3580
  if (isEmailStandaloneHighFreq) {
@@ -12,7 +12,6 @@ import { TEMPLATE_NAME_FIELD } from '../../constants';
12
12
  // boolean true). Mirrors errorMessageForTags.TAG_BRACKET_COUNT_MISMATCH_ERROR.
13
13
  export const ERROR_VALUE = {
14
14
  BRACKET: 'tagBracketCountMismatchError',
15
- DEFAULT_QUOTE: 'tagDefaultQuoteError',
16
15
  };
17
16
 
18
17
  // Legacy tab semantics: 1-based currentTab, 1=Android, 2=iOS (Classic.js:483-486).
@@ -69,6 +69,6 @@ export default function getEditorErrorDescriptor(legacyFormData = {}, ctx = {})
69
69
  if (!field?.errorMessage) return null;
70
70
  return {
71
71
  text: field.errorMessage,
72
- kind: [ERROR_VALUE.BRACKET, ERROR_VALUE.DEFAULT_QUOTE].includes(editorError) ? EDITOR_ERROR_KIND.BRACE : EDITOR_ERROR_KIND.MISSING,
72
+ kind: editorError === ERROR_VALUE.BRACKET ? EDITOR_ERROR_KIND.BRACE : EDITOR_ERROR_KIND.MISSING,
73
73
  };
74
74
  }
@@ -5,7 +5,6 @@
5
5
  */
6
6
  import validateMobilePush, { isValidExternalLink } from '../validate';
7
7
  import { ERROR_VALUE } from '../config';
8
- import * as tagValidations from '../../../../../../utils/tagValidations';
9
8
 
10
9
  const baseOptions = { tags: [], isFullMode: true, isEmbedded: false };
11
10
 
@@ -262,62 +261,6 @@ describe('channels/mobilepush/validate', () => {
262
261
  expect(result.platform.androidValid).toBe(true); // NOT cleared, like the editor
263
262
  expect(result.isValid).toBe(false);
264
263
  });
265
-
266
- describe('unquoted tag default value', () => {
267
- afterEach(() => jest.restoreAllMocks());
268
-
269
- it('EDITOR: writes DEFAULT_QUOTE, bracket-error stays false and the tab flag is kept', () => {
270
- const result = validateMobilePush(bothPlatforms({
271
- 0: {
272
- 'message-title': 'hello', 'message-editor': 'hi {{name | default: Rafeeq}}', "base": true, "tabKey": 'k0',
273
- },
274
- }), baseOptions);
275
- expect(result.isValid).toBe(false);
276
- expect(result.errorData[0]['message-editor']).toBe(ERROR_VALUE.DEFAULT_QUOTE);
277
- expect(result.errorData[0]['bracket-error']).toBe(false);
278
- expect(result.platform.androidValid).toBe(true);
279
- });
280
-
281
- it('TITLE: writes DEFAULT_QUOTE and bracket-error stays false', () => {
282
- const result = validateMobilePush(bothPlatforms({
283
- 0: {
284
- 'message-title': 'hi {{name | default: }}', 'message-editor': 'body', "base": true, "tabKey": 'k0',
285
- },
286
- }), baseOptions);
287
- expect(result.isValid).toBe(false);
288
- expect(result.errorData[0]['message-title']).toBe(ERROR_VALUE.DEFAULT_QUOTE);
289
- expect(result.errorData[0]['bracket-error']).toBe(false);
290
- });
291
-
292
- it('iOS tab uses the suffixed ids for DEFAULT_QUOTE', () => {
293
- const result = validateMobilePush(bothPlatforms({
294
- 1: { 'message-title2': "{{a | default: x}}", 'message-editor2': "{{b | default: y}}", "tabKey": 'k1' },
295
- }), baseOptions);
296
- expect(result.errorData[1]['message-editor2']).toBe(ERROR_VALUE.DEFAULT_QUOTE);
297
- expect(result.errorData[1]['message-title2']).toBe(ERROR_VALUE.DEFAULT_QUOTE);
298
- });
299
-
300
- it('quoted default value stays valid', () => {
301
- const result = validateMobilePush(bothPlatforms({
302
- 0: {
303
- 'message-title': "hi {{name | default: 'Rafeeq'}}", 'message-editor': "{{name | default: ''}}", "base": true, "tabKey": 'k0',
304
- },
305
- }), baseOptions);
306
- expect(result.errorData[0]['message-title']).toBe(false);
307
- expect(result.errorData[0]['message-editor']).toBe(false);
308
- });
309
-
310
- it('invalid without brace/quote error (e.g. missing tags) falls back to generic true', () => {
311
- jest.spyOn(tagValidations, 'validateTagsCore').mockReturnValue({
312
- valid: false, missingTags: ['unsubscribe'], isBraceError: false, isDefaultQuoteError: false,
313
- });
314
- const result = validateMobilePush(bothPlatforms(), baseOptions);
315
- expect(result.errorData[0]['message-editor']).toBe(true);
316
- expect(result.errorData[0]['message-title']).toBe(true);
317
- expect(result.errorData[0]['bracket-error']).toBe(false);
318
- expect(result.isValid).toBe(false);
319
- });
320
- });
321
264
  });
322
265
 
323
266
  describe('isValidExternalLink', () => {