@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
|
@@ -32,6 +32,12 @@ import {
|
|
|
32
32
|
makeSelectUpdatePreviewErrors,
|
|
33
33
|
makeSelectFetchPrefilledValuesError,
|
|
34
34
|
makeSelectFetchPrefilledValuesErrors,
|
|
35
|
+
makeSelectSenderDetailsForChannel,
|
|
36
|
+
makeSelectSenderDetailsByChannel,
|
|
37
|
+
makeSelectWeCrmAccounts,
|
|
38
|
+
makeSelectIsLoadingSenderDetails,
|
|
39
|
+
makeSelectFetchSenderDetailsError,
|
|
40
|
+
makeSelectFetchWeCrmAccountsError,
|
|
35
41
|
} from '../selectors';
|
|
36
42
|
|
|
37
43
|
describe('CommonTestAndPreview Selectors', () => {
|
|
@@ -101,6 +107,19 @@ describe('CommonTestAndPreview Selectors', () => {
|
|
|
101
107
|
fetchPrefilledValuesErrors: [
|
|
102
108
|
{ code: 7078, message: 'User profile not found' },
|
|
103
109
|
],
|
|
110
|
+
senderDetailsByChannel: {
|
|
111
|
+
SMS: [
|
|
112
|
+
{ domainId: 1, domainName: 'SMS Domain', gsmSenders: [{ value: 'sender1' }] },
|
|
113
|
+
],
|
|
114
|
+
EMAIL: [],
|
|
115
|
+
WHATSAPP: [],
|
|
116
|
+
},
|
|
117
|
+
wecrmAccounts: [
|
|
118
|
+
{ name: 'WeCRM Account 1', sourceAccountIdentifier: 'waba-1' },
|
|
119
|
+
],
|
|
120
|
+
isLoadingSenderDetails: false,
|
|
121
|
+
fetchSenderDetailsError: null,
|
|
122
|
+
fetchWeCrmAccountsError: null,
|
|
104
123
|
},
|
|
105
124
|
});
|
|
106
125
|
|
|
@@ -550,6 +569,133 @@ describe('CommonTestAndPreview Selectors', () => {
|
|
|
550
569
|
});
|
|
551
570
|
});
|
|
552
571
|
|
|
572
|
+
describe('makeSelectSenderDetailsForChannel', () => {
|
|
573
|
+
it('should select sender details for given channel as JS array', () => {
|
|
574
|
+
const selector = makeSelectSenderDetailsForChannel('SMS');
|
|
575
|
+
const result = selector(mockState);
|
|
576
|
+
|
|
577
|
+
expect(result).toBeDefined();
|
|
578
|
+
expect(Array.isArray(result)).toBe(true);
|
|
579
|
+
expect(result.length).toBe(1);
|
|
580
|
+
expect(result[0].domainName).toBe('SMS Domain');
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
it('should return empty array for channel with no data', () => {
|
|
584
|
+
const selector = makeSelectSenderDetailsForChannel('EMAIL');
|
|
585
|
+
const result = selector(mockState);
|
|
586
|
+
|
|
587
|
+
expect(result).toEqual([]);
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
it('should return empty array when substate or byChannel missing', () => {
|
|
591
|
+
const emptyState = fromJS({});
|
|
592
|
+
const selector = makeSelectSenderDetailsForChannel('SMS');
|
|
593
|
+
const result = selector(emptyState);
|
|
594
|
+
|
|
595
|
+
expect(result).toEqual([]);
|
|
596
|
+
});
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
describe('makeSelectSenderDetailsByChannel', () => {
|
|
600
|
+
it('should select senderDetailsByChannel and convert to JS object', () => {
|
|
601
|
+
const selector = makeSelectSenderDetailsByChannel();
|
|
602
|
+
const result = selector(mockState);
|
|
603
|
+
|
|
604
|
+
expect(result).toBeDefined();
|
|
605
|
+
expect(result.SMS).toBeDefined();
|
|
606
|
+
expect(Array.isArray(result.SMS)).toBe(true);
|
|
607
|
+
expect(result.SMS[0].domainName).toBe('SMS Domain');
|
|
608
|
+
expect(result.EMAIL).toEqual([]);
|
|
609
|
+
expect(result.WHATSAPP).toEqual([]);
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
it('should return empty object when domain is missing', () => {
|
|
613
|
+
const emptyState = fromJS({});
|
|
614
|
+
const selector = makeSelectSenderDetailsByChannel();
|
|
615
|
+
const result = selector(emptyState);
|
|
616
|
+
|
|
617
|
+
expect(result).toEqual({});
|
|
618
|
+
});
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
describe('makeSelectWeCrmAccounts', () => {
|
|
622
|
+
it('should select wecrmAccounts and convert to JS array', () => {
|
|
623
|
+
const selector = makeSelectWeCrmAccounts();
|
|
624
|
+
const result = selector(mockState);
|
|
625
|
+
|
|
626
|
+
expect(result).toBeDefined();
|
|
627
|
+
expect(Array.isArray(result)).toBe(true);
|
|
628
|
+
expect(result.length).toBe(1);
|
|
629
|
+
expect(result[0].name).toBe('WeCRM Account 1');
|
|
630
|
+
expect(result[0].sourceAccountIdentifier).toBe('waba-1');
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
it('should return empty array when wecrmAccounts is missing', () => {
|
|
634
|
+
const emptyState = fromJS({ commonTestAndPreview: {} });
|
|
635
|
+
const selector = makeSelectWeCrmAccounts();
|
|
636
|
+
const result = selector(emptyState);
|
|
637
|
+
|
|
638
|
+
expect(result).toEqual([]);
|
|
639
|
+
});
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
describe('makeSelectIsLoadingSenderDetails', () => {
|
|
643
|
+
it('should select isLoadingSenderDetails flag', () => {
|
|
644
|
+
const selector = makeSelectIsLoadingSenderDetails();
|
|
645
|
+
const result = selector(mockState);
|
|
646
|
+
|
|
647
|
+
expect(result).toBe(false);
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
it('should return true when loading', () => {
|
|
651
|
+
const loadingState = fromJS({
|
|
652
|
+
commonTestAndPreview: { isLoadingSenderDetails: true },
|
|
653
|
+
});
|
|
654
|
+
const selector = makeSelectIsLoadingSenderDetails();
|
|
655
|
+
const result = selector(loadingState);
|
|
656
|
+
|
|
657
|
+
expect(result).toBe(true);
|
|
658
|
+
});
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
describe('makeSelectFetchSenderDetailsError', () => {
|
|
662
|
+
it('should select fetchSenderDetailsError from state', () => {
|
|
663
|
+
const selector = makeSelectFetchSenderDetailsError();
|
|
664
|
+
const result = selector(mockState);
|
|
665
|
+
|
|
666
|
+
expect(result).toBeNull();
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
it('should return error when present', () => {
|
|
670
|
+
const errorState = fromJS({
|
|
671
|
+
commonTestAndPreview: { fetchSenderDetailsError: 'Sender fetch failed' },
|
|
672
|
+
});
|
|
673
|
+
const selector = makeSelectFetchSenderDetailsError();
|
|
674
|
+
const result = selector(errorState);
|
|
675
|
+
|
|
676
|
+
expect(result).toBe('Sender fetch failed');
|
|
677
|
+
});
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
describe('makeSelectFetchWeCrmAccountsError', () => {
|
|
681
|
+
it('should select fetchWeCrmAccountsError from state', () => {
|
|
682
|
+
const selector = makeSelectFetchWeCrmAccountsError();
|
|
683
|
+
const result = selector(mockState);
|
|
684
|
+
|
|
685
|
+
expect(result).toBeNull();
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
it('should return error when present', () => {
|
|
689
|
+
const errorState = fromJS({
|
|
690
|
+
commonTestAndPreview: { fetchWeCrmAccountsError: 'WeCRM fetch failed' },
|
|
691
|
+
});
|
|
692
|
+
const selector = makeSelectFetchWeCrmAccountsError();
|
|
693
|
+
const result = selector(errorState);
|
|
694
|
+
|
|
695
|
+
expect(result).toBe('WeCRM fetch failed');
|
|
696
|
+
});
|
|
697
|
+
});
|
|
698
|
+
|
|
553
699
|
describe('Edge Cases', () => {
|
|
554
700
|
it('should handle undefined state gracefully', () => {
|
|
555
701
|
const selector = makeSelectCustomers();
|
|
@@ -186,6 +186,7 @@ export const ErrorInfoNote = (props) => {
|
|
|
186
186
|
errorMessages,
|
|
187
187
|
onErrorClick,
|
|
188
188
|
onClose,
|
|
189
|
+
isLiquidEnabled = true,
|
|
189
190
|
intl,
|
|
190
191
|
useLegacyDisplay = false, // Use simple list display instead of tabs (for BEE Editor)
|
|
191
192
|
} = props;
|
|
@@ -229,7 +230,7 @@ export const ErrorInfoNote = (props) => {
|
|
|
229
230
|
const standardErrors = Array.isArray(rawStandardErrors) ? rawStandardErrors : [];
|
|
230
231
|
const liquidErrors = Array.isArray(rawLiquidErrors) ? rawLiquidErrors : [];
|
|
231
232
|
const hasStandardErrors = standardErrors.length > 0;
|
|
232
|
-
const hasLiquidErrors = liquidErrors.length > 0;
|
|
233
|
+
const hasLiquidErrors = liquidErrors.length > 0 && isLiquidEnabled;
|
|
233
234
|
|
|
234
235
|
if (!hasStandardErrors && !hasLiquidErrors) {
|
|
235
236
|
return null;
|
|
@@ -356,7 +357,7 @@ export const ErrorInfoNote = (props) => {
|
|
|
356
357
|
className="error-info-note__tabs"
|
|
357
358
|
/>
|
|
358
359
|
<CapRow className="error-info-note__actions">
|
|
359
|
-
{hasLiquidErrors && (
|
|
360
|
+
{hasLiquidErrors && isLiquidEnabled && (
|
|
360
361
|
<CapButton
|
|
361
362
|
type="flat"
|
|
362
363
|
className="error-info-note__liquid-doc"
|
|
@@ -451,6 +452,7 @@ ErrorInfoNote.defaultProps = {
|
|
|
451
452
|
},
|
|
452
453
|
onErrorClick: null,
|
|
453
454
|
onClose: null,
|
|
455
|
+
isLiquidEnabled: true,
|
|
454
456
|
intl: null,
|
|
455
457
|
useLegacyDisplay: false, // Use simple list display for BEE Editor
|
|
456
458
|
};
|
|
@@ -477,6 +479,7 @@ ErrorInfoNote.propTypes = {
|
|
|
477
479
|
}),
|
|
478
480
|
onErrorClick: PropTypes.func,
|
|
479
481
|
onClose: PropTypes.func,
|
|
482
|
+
isLiquidEnabled: PropTypes.bool,
|
|
480
483
|
intl: PropTypes.object,
|
|
481
484
|
useLegacyDisplay: PropTypes.bool, // Use simple list display for BEE Editor
|
|
482
485
|
};
|