@capillarytech/creatives-library 8.0.290-alpha.3 → 8.0.290
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/constants/unified.js +1 -0
- package/initialState.js +2 -0
- package/package.json +1 -1
- package/utils/common.js +8 -5
- package/utils/commonUtils.js +85 -4
- package/utils/tagValidations.js +222 -84
- package/utils/tests/commonUtil.test.js +124 -147
- package/utils/tests/tagValidations.test.js +358 -280
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +33 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +397 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.scss +35 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/TECH_DETAILING_DELIVERY_SETTINGS.md +725 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +92 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +243 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +111 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +91 -0
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +33 -1
- package/v2Components/CommonTestAndPreview/actions.js +20 -0
- package/v2Components/CommonTestAndPreview/constants.js +10 -0
- package/v2Components/CommonTestAndPreview/index.js +133 -15
- package/v2Components/CommonTestAndPreview/reducer.js +47 -0
- package/v2Components/CommonTestAndPreview/sagas.js +60 -0
- package/v2Components/CommonTestAndPreview/selectors.js +51 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +782 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +200 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +235 -0
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +127 -0
- package/v2Components/CommonTestAndPreview/tests/actions.test.js +50 -0
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +18 -0
- package/v2Components/CommonTestAndPreview/tests/index.test.js +214 -1
- package/v2Components/CommonTestAndPreview/tests/reducer.test.js +118 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +145 -0
- package/v2Components/CommonTestAndPreview/tests/selectors.test.js +146 -0
- package/v2Components/ErrorInfoNote/index.js +5 -2
- package/v2Components/FormBuilder/index.js +162 -84
- package/v2Components/FormBuilder/messages.js +8 -0
- package/v2Components/HtmlEditor/HTMLEditor.js +5 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +15 -0
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +2 -1
- package/v2Components/TestAndPreviewSlidebox/index.js +14 -0
- package/v2Containers/Cap/mockData.js +14 -0
- package/v2Containers/Cap/reducer.js +55 -3
- package/v2Containers/Cap/tests/reducer.test.js +102 -0
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +1 -3
- package/v2Containers/CreativesContainer/index.js +6 -19
- package/v2Containers/Email/index.js +5 -1
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +62 -10
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +115 -12
- package/v2Containers/FTP/index.js +51 -2
- package/v2Containers/FTP/messages.js +4 -0
- package/v2Containers/InApp/index.js +96 -1
- package/v2Containers/InApp/tests/index.test.js +6 -17
- package/v2Containers/InappAdvance/index.js +103 -2
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +24 -3
- package/v2Containers/Line/Container/Text/index.js +1 -0
- package/v2Containers/MobilePush/Create/index.js +16 -6
- package/v2Containers/MobilePush/Edit/index.js +16 -6
- package/v2Containers/MobilePushNew/index.js +33 -2
- package/v2Containers/Rcs/index.js +37 -12
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +667 -16
- package/v2Containers/Sms/Create/index.js +3 -35
- package/v2Containers/Sms/Create/messages.js +0 -4
- package/v2Containers/Sms/Edit/index.js +3 -33
- package/v2Containers/Sms/commonMethods.js +6 -6
- package/v2Containers/SmsTrai/Edit/index.js +47 -6
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +147 -6
- package/v2Containers/Viber/index.js +1 -0
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +3 -1
- package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +7 -0
- package/v2Containers/WebPush/Create/index.js +2 -2
- package/v2Containers/WebPush/Create/utils/validation.js +2 -17
- package/v2Containers/WebPush/Create/utils/validation.test.js +24 -0
- package/v2Containers/Whatsapp/index.js +18 -10
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +25849 -3524
- package/v2Containers/Zalo/index.js +11 -3
|
@@ -183,8 +183,10 @@ describe('validation', () => {
|
|
|
183
183
|
describe('validateMessageContent', () => {
|
|
184
184
|
const mockValidationConfig = {
|
|
185
185
|
tagsParam: [],
|
|
186
|
+
injectedTagsParams: [],
|
|
186
187
|
location: {},
|
|
187
188
|
tagModule: '',
|
|
189
|
+
eventContextTags: [],
|
|
188
190
|
};
|
|
189
191
|
|
|
190
192
|
beforeEach(() => {
|
|
@@ -223,6 +225,17 @@ describe('validation', () => {
|
|
|
223
225
|
});
|
|
224
226
|
});
|
|
225
227
|
|
|
228
|
+
it('should return error message for unsupported tags', () => {
|
|
229
|
+
validateTags.mockReturnValue({
|
|
230
|
+
unsupportedTags: ['tag1', 'tag2'],
|
|
231
|
+
});
|
|
232
|
+
const result = validateMessageContent('Message with {tag1} and {tag2}', mockFormatMessage, mockMessages, mockValidationConfig);
|
|
233
|
+
expect(result).toBe('Unsupported tags: tag1, tag2');
|
|
234
|
+
expect(mockFormatMessage).toHaveBeenCalledWith(globalMessages.unsupportedTagsValidationError, {
|
|
235
|
+
unsupportedTags: 'tag1, tag2',
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
|
|
226
239
|
it('should return error message for unbalanced curly braces', () => {
|
|
227
240
|
validateTags.mockReturnValue({
|
|
228
241
|
isBraceError: true,
|
|
@@ -232,11 +245,22 @@ describe('validation', () => {
|
|
|
232
245
|
expect(mockFormatMessage).toHaveBeenCalledWith(globalMessages.unbalanacedCurlyBraces);
|
|
233
246
|
});
|
|
234
247
|
|
|
248
|
+
it('should return error message for both unsupported tags and brace error (unsupported tags takes precedence)', () => {
|
|
249
|
+
validateTags.mockReturnValue({
|
|
250
|
+
unsupportedTags: ['tag1'],
|
|
251
|
+
isBraceError: true,
|
|
252
|
+
});
|
|
253
|
+
const result = validateMessageContent('Message with {tag1}', mockFormatMessage, mockMessages, mockValidationConfig);
|
|
254
|
+
expect(result).toBe('Unsupported tags: tag1');
|
|
255
|
+
});
|
|
256
|
+
|
|
235
257
|
it('should pass validation config to validateTags', () => {
|
|
236
258
|
const customConfig = {
|
|
237
259
|
tagsParam: [{ id: 1, name: 'Tag1' }],
|
|
260
|
+
injectedTagsParams: [{ id: 2, name: 'Tag2' }],
|
|
238
261
|
location: { query: { type: 'test' } },
|
|
239
262
|
tagModule: 'custom',
|
|
263
|
+
eventContextTags: [{ id: 3, name: 'Tag3' }],
|
|
240
264
|
};
|
|
241
265
|
validateTags.mockReturnValue({});
|
|
242
266
|
validateMessageContent('Valid message', mockFormatMessage, mockMessages, customConfig);
|
|
@@ -637,21 +637,22 @@ export const Whatsapp = (props) => {
|
|
|
637
637
|
validateTags({
|
|
638
638
|
content: contentData.join(""),
|
|
639
639
|
tagsParam: tags,
|
|
640
|
+
injectedTagsParams: injectedTags,
|
|
640
641
|
location,
|
|
641
642
|
tagModule: getDefaultTags,
|
|
643
|
+
eventContextTags,
|
|
642
644
|
isFullMode,
|
|
643
645
|
}) || {};
|
|
646
|
+
const unsupportedTagsLengthCheck =
|
|
647
|
+
validationResponse?.unsupportedTags?.length > 0;
|
|
644
648
|
if (type === HEADER_TEXT) {
|
|
645
649
|
headerTagValidationResponse = validationResponse;
|
|
646
|
-
updateIsHeaderTagValidationError(
|
|
650
|
+
updateIsHeaderTagValidationError(unsupportedTagsLengthCheck);
|
|
647
651
|
} else if (type === CAROUSEL_TEXT) {
|
|
648
|
-
return [
|
|
649
|
-
{ fieldName: "carouselTagValidationErrMessage", value: validationResponse.isBraceError ? validationResponse : {} },
|
|
650
|
-
{ fieldName: "carouselTagValidationErr", value: validationResponse.isBraceError },
|
|
651
|
-
];
|
|
652
|
+
return [{fieldName: "carouselTagValidationErrMessage", value: validationResponse}, {fieldName: "carouselTagValidationErr", value: unsupportedTagsLengthCheck}];
|
|
652
653
|
} else {
|
|
653
654
|
tagValidationResponse = validationResponse;
|
|
654
|
-
updateIsTagValidationError(
|
|
655
|
+
updateIsTagValidationError(unsupportedTagsLengthCheck);
|
|
655
656
|
}
|
|
656
657
|
}
|
|
657
658
|
};
|
|
@@ -2681,11 +2682,18 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2681
2682
|
} else {
|
|
2682
2683
|
validationResponse = tagValidationResponse;
|
|
2683
2684
|
}
|
|
2684
|
-
const { isBraceError } = validationResponse
|
|
2685
|
+
const { unsupportedTags = [], isBraceError } = validationResponse;
|
|
2686
|
+
|
|
2687
|
+
let tagError = "";
|
|
2688
|
+
if (unsupportedTags.length > 0) {
|
|
2689
|
+
tagError = formatMessage(globalMessages.unsupportedTagsValidationError, {
|
|
2690
|
+
unsupportedTags,
|
|
2691
|
+
});
|
|
2692
|
+
}
|
|
2685
2693
|
if (isBraceError) {
|
|
2686
|
-
|
|
2694
|
+
tagError = formatMessage(globalMessages.unbalanacedCurlyBraces);
|
|
2687
2695
|
}
|
|
2688
|
-
return
|
|
2696
|
+
return <CapError>{tagError}</CapError>;
|
|
2689
2697
|
};
|
|
2690
2698
|
|
|
2691
2699
|
const editModeContent = () => (
|
|
@@ -3204,7 +3212,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
3204
3212
|
<TestAndPreviewSlidebox
|
|
3205
3213
|
show={propsShowTestAndPreviewSlidebox || showTestAndPreviewSlidebox}
|
|
3206
3214
|
onClose={handleCloseTestAndPreview}
|
|
3207
|
-
formData={
|
|
3215
|
+
formData={getTemplateContent()}
|
|
3208
3216
|
content={getTemplateContent()}
|
|
3209
3217
|
currentChannel={WHATSAPP}
|
|
3210
3218
|
/>
|