@capillarytech/creatives-library 9.2.2-alpha.sprint-cap-214249.44 → 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 (89) hide show
  1. package/constants/unified.js +1 -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/common.js +6 -0
  7. package/utils/createMobilePushPayload.js +56 -50
  8. package/utils/tagValidations.js +4 -35
  9. package/utils/tests/createMobilePushPayload.test.js +168 -177
  10. package/utils/tests/tagValidations.test.js +0 -48
  11. package/v2Components/CapMpushCTA/index.js +57 -47
  12. package/v2Components/CapMpushCTA/index.scss +5 -43
  13. package/v2Components/CapTagList/index.js +7 -46
  14. package/v2Components/CapTagList/messages.js +0 -44
  15. package/v2Components/CapTagList/style.scss +1 -113
  16. package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +8 -11
  17. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -13
  18. package/v2Components/CommonTestAndPreview/constants.js +0 -2
  19. package/v2Components/CommonTestAndPreview/index.js +12 -51
  20. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +5 -83
  21. package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -100
  22. package/v2Components/FormBuilder/Classic.js +14 -24
  23. package/v2Components/FormBuilder/Functional/channels/mobilepush/config.js +0 -1
  24. package/v2Components/FormBuilder/Functional/channels/mobilepush/getEditorErrorDescriptor.js +1 -1
  25. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/validate.test.js +0 -57
  26. package/v2Components/FormBuilder/Functional/channels/mobilepush/validate.js +4 -4
  27. package/v2Components/FormBuilder/Functional/channels/sms/getEditorErrorDescriptor.js +0 -3
  28. package/v2Components/FormBuilder/Functional/channels/sms/tests/getEditorErrorDescriptor.test.js +0 -5
  29. package/v2Components/FormBuilder/Functional/channels/sms/tests/validate.test.js +0 -6
  30. package/v2Components/FormBuilder/Functional/channels/sms/validate.js +1 -3
  31. package/v2Components/FormBuilder/Functional/renderers/mpushRenderers.js +0 -3
  32. package/v2Components/FormBuilder/Functional/tests/mpushRenderers.test.js +0 -22
  33. package/v2Components/MobilePushPreviewV2/index.js +9 -22
  34. package/v2Components/TemplatePreview/_templatePreview.scss +2 -18
  35. package/v2Components/TemplatePreview/index.js +18 -20
  36. package/v2Components/TemplatePreview/tests/index.test.js +0 -69
  37. package/v2Containers/Cap/messages.js +0 -4
  38. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
  39. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/extractContentForPreview.js +2 -12
  40. package/v2Containers/CreativesContainer/SlideBoxContent.js +6 -4
  41. package/v2Containers/CreativesContainer/index.js +1 -2
  42. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -43
  43. package/v2Containers/InApp/index.js +1 -4
  44. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +0 -3
  45. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +0 -2
  46. package/v2Containers/Line/Container/Text/index.js +1 -3
  47. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +0 -16
  48. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +0 -18
  49. package/v2Containers/MobilePushNew/components/CtaButtons.js +47 -52
  50. package/v2Containers/MobilePushNew/components/MediaUploaders.js +345 -105
  51. package/v2Containers/MobilePushNew/components/PlatformContentFields.js +105 -127
  52. package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +208 -30
  53. package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +1484 -307
  54. package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +59 -165
  55. package/v2Containers/MobilePushNew/constants.js +0 -12
  56. package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +1 -63
  57. package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +0 -78
  58. package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +1 -40
  59. package/v2Containers/MobilePushNew/hooks/useUpload.js +46 -42
  60. package/v2Containers/MobilePushNew/index.js +290 -502
  61. package/v2Containers/MobilePushNew/index.scss +4 -151
  62. package/v2Containers/MobilePushNew/messages.js +6 -106
  63. package/v2Containers/MobilePushNew/tests/index.test.js +1 -483
  64. package/v2Containers/MobilePushNew/tests/utils.test.js +0 -110
  65. package/v2Containers/MobilePushNew/utils.js +0 -83
  66. package/v2Containers/Rcs/index.js +1 -8
  67. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -59
  68. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
  69. package/v2Containers/SmsTrai/Edit/index.js +5 -13
  70. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +0 -15
  71. package/v2Containers/Templates/_templates.scss +2 -10
  72. package/v2Containers/Templates/index.js +81 -86
  73. package/v2Containers/Templates/tests/index.test.js +0 -81
  74. package/v2Containers/Viber/index.js +1 -3
  75. package/v2Containers/WebPush/Create/utils/validation.js +0 -6
  76. package/v2Containers/WebPush/Create/utils/validation.test.js +0 -50
  77. package/v2Containers/Whatsapp/index.js +5 -9
  78. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +2 -2
  79. package/v2Containers/Zalo/index.js +1 -4
  80. package/v2Components/CapMpushCTA/tests/index.test.js +0 -150
  81. package/v2Components/CapTagList/TagFallbackPanel.js +0 -124
  82. package/v2Components/CapTagList/constants.js +0 -5
  83. package/v2Components/CapTagList/tests/TagFallback.test.js +0 -222
  84. package/v2Components/CapTagList/utils.js +0 -17
  85. package/v2Components/MobilePushPreviewV2/_mobilePushPreviewV2.scss +0 -7
  86. package/v2Components/MobilePushPreviewV2/tests/index.test.js +0 -55
  87. package/v2Components/TemplatePreview/_mobilePushPhone.scss +0 -72
  88. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/extractContentForPreview.test.js +0 -45
  89. package/v2Containers/MobilePushNew/components/TapLinkActions.js +0 -76
@@ -46,6 +46,7 @@ export const HOSPITALITY_BASED_SCOPE = 'HOSPITALITY_BASED_SCOPE';
46
46
  export const REGISTRATION_CUSTOM_FIELD = 'Registration custom fields';
47
47
  export const GIFT_CARDS = 'GIFT_CARDS';
48
48
  export const PROMO_ENGINE = 'PROMO_ENGINE';
49
+ export const ENABLE_NEW_MPUSH = 'ENABLE_NEW_MPUSH';
49
50
  export const ENABLE_NEW_EDITOR_FLOW_INAPP = 'ENABLE_NEW_EDITOR_FLOW_INAPP';
50
51
  // Per-channel flags for the FormBuilder V3 migration. Each routes its channel to
51
52
  // the new functional FormBuilder; later channels get their own flags (…_EMAIL).
@@ -160,9 +161,6 @@ export const UNSUBSCRIBE_TAG = 'unsubscribe';
160
161
  export const UNSUBSCRIBE_TAG_REGEX = new RegExp(`\\{\\{\\s*${UNSUBSCRIBE_TAG}\\s*\\}\\}`);
161
162
  /** Matches {{ ... }} and captures the inner tag content (for scanning content for tags). */
162
163
  export const TAG_CONTENT_REGEX = /{{([^}]+)}}/g;
163
- // `default:` filter inside a tag, and the same filter with a quoted value e.g. default: 'x'
164
- export const DEFAULT_FILTER_REGEX = /^\s*default\s*:/;
165
- export const QUOTED_DEFAULT_REGEX = /^\s*default\s*:\s*('[^']*'|"[^"]*")\s*$/;
166
164
  export const ENTRY_TRIGGER_TAG_REGEX = /\bentryTrigger\.\w+(?:\.\w+)?(?:\(\w+\))?/g;
167
165
  /** Strips characters not allowed in a downloaded file name, keeping alphanumerics, `-`, `_` and spaces. */
168
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.2-alpha.sprint-cap-214249.44",
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": "",
package/utils/common.js CHANGED
@@ -24,6 +24,7 @@ import {
24
24
  ENABLE_WECHAT,
25
25
  ENABLE_WEBPUSH,
26
26
  SUPPORT_CK_EDITOR,
27
+ ENABLE_NEW_MPUSH,
27
28
  ENABLE_NEW_EDITOR_FLOW_INAPP,
28
29
  ENABLE_NEW_FORMBUILDER_SMS,
29
30
  ENABLE_NEW_FORMBUILDER_MPUSH,
@@ -143,6 +144,11 @@ export const isEmailUnsubscribeTagOptional = Auth.hasFeatureAccess.bind(
143
144
  EMAIL_UNSUBSCRIBE_TAG_MANDATORY,
144
145
  );
145
146
 
147
+ export const hasNewMobilePushFeatureEnabled = Auth.hasFeatureAccess.bind(
148
+ null,
149
+ ENABLE_NEW_MPUSH,
150
+ );
151
+
146
152
  export const hasNewEditorFlowInAppEnabled = Auth.hasFeatureAccess.bind(
147
153
  null,
148
154
  ENABLE_NEW_EDITOR_FLOW_INAPP,
@@ -11,7 +11,6 @@ import {
11
11
  TEXT,
12
12
  } from "../v2Containers/MobilePushNew/constants";
13
13
  import messages from '../v2Containers/MobilePushNew/messages';
14
- import { appendDeepLinkParams } from '../v2Containers/MobilePushNew/utils';
15
14
 
16
15
  /**
17
16
  * Constructs the payload for Mobile Push, supporting both legacy and rich media as per backend contract.
@@ -28,7 +27,6 @@ import { appendDeepLinkParams } from '../v2Containers/MobilePushNew/utils';
28
27
  * @param {Object} params.accountData - Account data for the payload
29
28
  * @param {boolean} params.sameContent - Whether content is shared between platforms
30
29
  * @param {Object} params.options - Additional options
31
- * @param {string} [params.options.skipPlatform] - ANDROID or IOS: leave out a supported platform the user chose not to configure
32
30
  * @param {Object} params.intl - Internationalization object for messages
33
31
  */
34
32
  const createMobilePushPayload = ({
@@ -43,8 +41,8 @@ const createMobilePushPayload = ({
43
41
  intl,
44
42
  }) => {
45
43
  // Platform support checks must be at the top
46
- const isAndroidSupported = accountData?.configs?.android === '1' && options?.skipPlatform !== ANDROID;
47
- const isIosSupported = accountData?.configs?.ios === '1' && options?.skipPlatform !== IOS;
44
+ const isAndroidSupported = accountData?.configs?.android === '1';
45
+ const isIosSupported = accountData?.configs?.ios === '1';
48
46
 
49
47
  const {
50
48
  accountId: accountIdFromAccountData, id, licenseCode: licenseCodeFromAccountData, sourceAccountIdentifier, sourceType: sourceTypeFromAccountData, sourceTypeName,
@@ -123,33 +121,6 @@ const createMobilePushPayload = ({
123
121
  return payload;
124
122
  };
125
123
 
126
- /**
127
- * Carousel cards as Save sends them (also used by the Test & Preview payload)
128
- * @param {Array} carouselData - Editor carousel cards
129
- * @returns {Array} Cards with media only
130
- */
131
- export function buildCarouselCards(carouselData = []) {
132
- return (carouselData || []).map((card) => {
133
- const {
134
- mediaType,
135
- imageUrl,
136
- videoSrc,
137
- videoPreviewImg,
138
- } = card || {};
139
-
140
- return {
141
- mediaType: mediaType || IMAGE.toLowerCase(),
142
- imageUrl: imageUrl || '',
143
- videoSrc: videoSrc || '',
144
- // Thumbnail, so the phone preview can show the video card when editing
145
- ...(videoPreviewImg && { videoPreviewImg }),
146
- // No per-card tap: the notification tap is for the whole notification.
147
- // Dropping old card links also stops them refilling that tap on reopen.
148
- buttons: [],
149
- };
150
- });
151
- }
152
-
153
124
  /**
154
125
  * Builds platform-specific content for the payload
155
126
  * @param {Object} content - Platform content (Android/iOS)
@@ -158,7 +129,7 @@ export function buildCarouselCards(carouselData = []) {
158
129
  * @param {string} platform - Platform (ANDROID/IOS)
159
130
  * @returns {Object} Platform-specific content
160
131
  */
161
- export function buildPlatformContent(content, imageSrc, mpushVideoSrcAndPreview, platform) {
132
+ function buildPlatformContent(content, imageSrc, mpushVideoSrcAndPreview, platform) {
162
133
  const {
163
134
  title = '',
164
135
  message = '',
@@ -177,16 +148,18 @@ export function buildPlatformContent(content, imageSrc, mpushVideoSrcAndPreview,
177
148
  custom: buildCustomFields(content),
178
149
  };
179
150
 
180
- // Handle media types
181
- const style = content?.mediaType || expandableDetails?.style;
182
- const isCarousel = [CAROUSEL, MANUAL_CAROUSEL, AUTO_CAROUSEL, FILMSTRIP_CAROUSEL].includes(style);
183
-
184
- // Handle CTA (notification tap, for the whole notification, carousel included)
151
+ // Handle CTA
185
152
  if (actionOnClick) {
186
153
  let finalDeepLinkValue = deepLinkValue;
187
154
 
188
155
  if (linkType === DEEP_LINK && deepLinkKeysValue?.length > 0) {
189
- finalDeepLinkValue = appendDeepLinkKeysToUrl(deepLinkValue, deepLinkKeysValue);
156
+ // Check if the URL already contains the keys
157
+ const urlHasKeys = deepLinkKeysValue?.some((key) => deepLinkValue?.includes(`${key}=${key}`));
158
+
159
+ // Only append keys if they're not already in the URL
160
+ if (!urlHasKeys) {
161
+ finalDeepLinkValue = appendDeepLinkKeysToUrl(deepLinkValue, deepLinkKeysValue);
162
+ }
190
163
  }
191
164
 
192
165
  platformContent.cta = {
@@ -195,6 +168,9 @@ export function buildPlatformContent(content, imageSrc, mpushVideoSrcAndPreview,
195
168
  };
196
169
  }
197
170
 
171
+ // Handle media types
172
+ const style = content?.mediaType || expandableDetails?.style;
173
+
198
174
  // Determine the type field based on media type
199
175
  let templateType = TEXT; // Default type for NONE or BIG_TEXT
200
176
 
@@ -208,8 +184,7 @@ export function buildPlatformContent(content, imageSrc, mpushVideoSrcAndPreview,
208
184
  platformContent.expandableDetails.style = VIDEO;
209
185
  platformContent.expandableDetails.message = message;
210
186
  platformContent.expandableDetails.media = [{
211
- // This platform's own video; mpushVideoSrcAndPreview is shared by both tabs
212
- url: content?.videoSrc || content?.mediaList?.[0]?.url || '',
187
+ url: mpushVideoSrcAndPreview.mpushVideoSrc || (content?.mediaList?.[0]?.url || ''),
213
188
  text: content?.mediaList?.[0]?.text || '',
214
189
  type: VIDEO,
215
190
  }];
@@ -226,26 +201,50 @@ export function buildPlatformContent(content, imageSrc, mpushVideoSrcAndPreview,
226
201
  type: type.toLowerCase(),
227
202
  }];
228
203
  } else {
229
- // No mediaList: use this platform's own GIF
204
+ // If no mediaList but mpushVideoSrc exists
230
205
  platformContent.expandableDetails.style = GIF;
231
206
  platformContent.expandableDetails.message = message;
232
207
  platformContent.expandableDetails.media = [{
233
- url: content?.videoSrc || '',
208
+ url: mpushVideoSrcAndPreview.mpushVideoSrc,
234
209
  text: '',
235
210
  type: GIF, // Backend expects GIF type for GIFs
236
211
  }];
237
212
  }
238
213
  templateType = GIF;
239
- } else if (isCarousel) { // Handle CAROUSEL media types
214
+ } else if ([CAROUSEL, MANUAL_CAROUSEL, AUTO_CAROUSEL, FILMSTRIP_CAROUSEL].includes(style)) { // Handle CAROUSEL media types
240
215
  platformContent.expandableDetails.style = MANUAL_CAROUSEL;
241
216
  platformContent.expandableDetails.message = message;
242
- // A carousel tab hides the Buttons section; buttons added before switching aren't sent
243
- platformContent.expandableDetails.ctas = [];
244
217
  templateType = CAROUSEL;
245
218
 
246
219
  // Handle carouselData
247
220
  if (content?.carouselData?.length > 0) {
248
- platformContent.expandableDetails.carouselData = buildCarouselCards(content.carouselData);
221
+ platformContent.expandableDetails.carouselData = content.carouselData.map((card) => {
222
+ const {
223
+ mediaType,
224
+ imageUrl,
225
+ videoSrc,
226
+ buttons,
227
+ } = card || {};
228
+
229
+ return {
230
+ mediaType: mediaType || IMAGE.toLowerCase(),
231
+ imageUrl: imageUrl || '',
232
+ videoSrc: videoSrc || '',
233
+ buttons: buttons ? buttons.map((button) => {
234
+ const { linkType: buttonLinkType, deepLinkKeys, deepLinkValue: buttonDeepLinkValue } = button || {};
235
+ if (buttonLinkType === DEEP_LINK && deepLinkKeys && buttonDeepLinkValue) {
236
+ const deepLinkKeysArray = Array.isArray(deepLinkKeys) ? deepLinkKeys : [deepLinkKeys];
237
+ const updatedDeepLinkValue = appendDeepLinkKeysToUrl(buttonDeepLinkValue, deepLinkKeysArray);
238
+
239
+ return {
240
+ ...button,
241
+ deepLinkValue: updatedDeepLinkValue,
242
+ };
243
+ }
244
+ return button;
245
+ }) : [],
246
+ };
247
+ });
249
248
  }
250
249
 
251
250
  // Handle mediaList
@@ -306,14 +305,21 @@ function buildCustomFields(content) {
306
305
  }
307
306
 
308
307
  /**
309
- * Appends deep link params to URL
308
+ * Appends deep link keys to URL
310
309
  * @param {string} url - Base URL
311
- * @param {Array} keys - "key=value" entries (an old entry without "=" means key=key)
312
- * @returns {string} URL with the params
310
+ * @param {Array} keys - Deep link keys
311
+ * @returns {string} URL with appended keys
313
312
  */
314
313
  export function appendDeepLinkKeysToUrl(url, keys) {
315
314
  if (!url || !keys || !Array.isArray(keys) || keys?.length === 0) return url;
316
- return appendDeepLinkParams(url, keys);
315
+
316
+ const separator = url.includes('?') ? '&' : '?';
317
+ const validKeys = keys.filter((key) => typeof key === 'string' && key?.length > 0);
318
+ if (validKeys?.length === 0) return url;
319
+
320
+ const keyParams = validKeys.map((key) => `${key}=${key}`).join('&');
321
+
322
+ return `${url}${separator}${keyParams}`;
317
323
  }
318
324
 
319
325
  export default createMobilePushPayload;
@@ -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 = {