@capillarytech/creatives-library 8.0.334 → 8.0.336
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/package.json +1 -1
- package/utils/tests/tagValidations.test.js +0 -20
- package/v2Components/CapTagList/index.js +23 -28
- package/v2Components/CapTagList/style.scss +0 -29
- package/v2Components/CapTagListWithInput/index.js +0 -4
- package/v2Components/CapWhatsappCTA/index.js +0 -2
- package/v2Components/FormBuilder/index.js +2 -7
- package/v2Components/HtmlEditor/HTMLEditor.js +1 -6
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +0 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +2 -927
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +0 -3
- package/v2Containers/BeeEditor/index.js +16 -4
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -28
- package/v2Containers/CreativesContainer/index.js +0 -3
- package/v2Containers/Email/index.js +75 -39
- package/v2Containers/Email/reducer.js +2 -2
- package/v2Containers/Email/sagas.js +3 -1
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -2
- package/v2Containers/Email/tests/sagas.test.js +230 -0
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1 -6
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +0 -3
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +2 -20
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +1 -16
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +0 -4
- package/v2Containers/EmailWrapper/index.js +0 -4
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +0 -1
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +0 -9
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +0 -1
- package/v2Containers/MobilePush/Create/index.js +0 -2
- package/v2Containers/MobilePush/Edit/index.js +0 -2
- package/v2Containers/MobilepushWrapper/index.js +1 -3
- package/v2Containers/Rcs/index.js +0 -1
- package/v2Containers/Sms/Create/index.js +0 -2
- package/v2Containers/Sms/Edit/index.js +0 -2
- package/v2Containers/SmsTrai/Edit/index.js +0 -2
- package/v2Containers/SmsWrapper/index.js +0 -2
- package/v2Containers/TagList/index.js +5 -62
- package/v2Containers/TagList/messages.js +0 -4
- package/v2Containers/TagList/tests/TagList.test.js +20 -124
- package/v2Containers/TagList/tests/mockdata.js +0 -17
- package/v2Containers/Viber/index.js +0 -3
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +2 -0
- package/v2Containers/WebPush/Create/index.js +1 -9
- package/v2Containers/Whatsapp/index.js +0 -5
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +0 -20
- package/v2Containers/Zalo/index.js +0 -2
- package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +0 -63
|
@@ -88,6 +88,55 @@ describe('Email Templates Sagas', () => {
|
|
|
88
88
|
.run();
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
+
it('should handle creating a template successfully with onCreateTemplateComplete callback', () => {
|
|
92
|
+
const onCreateTemplateComplete = jest.fn();
|
|
93
|
+
const template = { id: 1, name: 'New Template', onCreateTemplateComplete };
|
|
94
|
+
const fakeResponse = {
|
|
95
|
+
success: true,
|
|
96
|
+
response: { id: 1, name: 'New Template', status: 'created' },
|
|
97
|
+
status: { code: 200 },
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return expectSaga(sagas.createTemplate, template)
|
|
101
|
+
.provide([
|
|
102
|
+
[matchers.call.fn(Api.createEmailTemplate), fakeResponse],
|
|
103
|
+
])
|
|
104
|
+
.put({
|
|
105
|
+
type: types.CREATE_TEMPLATE_SUCCESS,
|
|
106
|
+
data: fakeResponse.response,
|
|
107
|
+
statusCode: 200,
|
|
108
|
+
errorMsg: undefined,
|
|
109
|
+
})
|
|
110
|
+
.run()
|
|
111
|
+
.then(() => {
|
|
112
|
+
expect(onCreateTemplateComplete).toHaveBeenCalledWith(fakeResponse.response);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should handle creating a template successfully when result has no status (statusCode empty string)', () => {
|
|
117
|
+
const onCreateTemplateComplete = jest.fn();
|
|
118
|
+
const template = { id: 1, name: 'New Template', onCreateTemplateComplete };
|
|
119
|
+
const fakeResponse = {
|
|
120
|
+
success: true,
|
|
121
|
+
response: { id: 1, name: 'New Template' },
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
return expectSaga(sagas.createTemplate, template)
|
|
125
|
+
.provide([
|
|
126
|
+
[matchers.call.fn(Api.createEmailTemplate), fakeResponse],
|
|
127
|
+
])
|
|
128
|
+
.put({
|
|
129
|
+
type: types.CREATE_TEMPLATE_SUCCESS,
|
|
130
|
+
data: fakeResponse.response,
|
|
131
|
+
statusCode: '',
|
|
132
|
+
errorMsg: undefined,
|
|
133
|
+
})
|
|
134
|
+
.run()
|
|
135
|
+
.then(() => {
|
|
136
|
+
expect(onCreateTemplateComplete).toHaveBeenCalledWith(fakeResponse.response);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
91
140
|
it('should handle errors when creating a template fails', () => {
|
|
92
141
|
const template = { id: 1, name: 'New Template' };
|
|
93
142
|
const fakeError = new Error('Failed to create template');
|
|
@@ -150,6 +199,29 @@ describe('Email Templates Sagas', () => {
|
|
|
150
199
|
.run();
|
|
151
200
|
});
|
|
152
201
|
|
|
202
|
+
it('should handle successful asset upload with no status (empty statusCode)', () => {
|
|
203
|
+
const uploadResponse = {
|
|
204
|
+
response: {
|
|
205
|
+
asset: {
|
|
206
|
+
id: 1,
|
|
207
|
+
url: 'http://example.com/asset.jpg',
|
|
208
|
+
metaInfo: { secure_file_path: 'path', file_size: 1024 },
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
return expectSaga(sagas.uploadAsset, file, assetType, fileParams)
|
|
214
|
+
.provide([
|
|
215
|
+
[matchers.call.fn(Api.uploadFile), uploadResponse],
|
|
216
|
+
])
|
|
217
|
+
.put({
|
|
218
|
+
type: types.UPLOAD_ASSET_SUCCESS,
|
|
219
|
+
data: uploadResponse.response.asset,
|
|
220
|
+
statusCode: '',
|
|
221
|
+
})
|
|
222
|
+
.run();
|
|
223
|
+
});
|
|
224
|
+
|
|
153
225
|
it('should handle failure in asset upload', () => {
|
|
154
226
|
const error = new Error('Failed to upload asset');
|
|
155
227
|
|
|
@@ -275,6 +347,37 @@ describe('getAllAssets saga', () => {
|
|
|
275
347
|
.run();
|
|
276
348
|
});
|
|
277
349
|
|
|
350
|
+
it('should handle success when page > 1 (isReset false)', () => {
|
|
351
|
+
const fakeResponse = {
|
|
352
|
+
status: { code: 200 },
|
|
353
|
+
response: [{ id: 3, name: 'Asset 3' }],
|
|
354
|
+
};
|
|
355
|
+
const payload = { assetType: 'image', queryParams: { page: 2 } };
|
|
356
|
+
|
|
357
|
+
return expectSaga(sagas.getAllAssets, payload)
|
|
358
|
+
.provide([
|
|
359
|
+
[matchers.call.fn(Api.getAllAssets), fakeResponse],
|
|
360
|
+
])
|
|
361
|
+
.put({
|
|
362
|
+
type: types.GET_ALL_ASSETS_SUCCESS,
|
|
363
|
+
data: fakeResponse.response,
|
|
364
|
+
isReset: false,
|
|
365
|
+
})
|
|
366
|
+
.run();
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
it('should handle failure when fetching all assets throws an error', () => {
|
|
370
|
+
const error = new Error('Network error');
|
|
371
|
+
const payload = { assetType: 'image', queryParams: { page: 1 } };
|
|
372
|
+
|
|
373
|
+
return expectSaga(sagas.getAllAssets, payload)
|
|
374
|
+
.provide([
|
|
375
|
+
[matchers.call.fn(Api.getAllAssets), throwError(error)],
|
|
376
|
+
])
|
|
377
|
+
.put({ type: types.GET_ALL_ASSETS_FAILURE, error })
|
|
378
|
+
.run();
|
|
379
|
+
});
|
|
380
|
+
|
|
278
381
|
describe('getCmsAccounts saga', () => {
|
|
279
382
|
it('should handle successful CMS accounts fetch with matching type', () => {
|
|
280
383
|
const cmsType = 'bee';
|
|
@@ -463,6 +566,20 @@ describe('getAllAssets saga', () => {
|
|
|
463
566
|
.run();
|
|
464
567
|
});
|
|
465
568
|
|
|
569
|
+
it('should use "Unknown error" fallback when statusCode is also undefined', () => {
|
|
570
|
+
const template = { id: 1, name: 'New Template' };
|
|
571
|
+
const fakeResponse = {
|
|
572
|
+
success: false,
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
return expectSaga(sagas.createTemplate, template)
|
|
576
|
+
.provide([
|
|
577
|
+
[matchers.call.fn(Api.createEmailTemplate), fakeResponse],
|
|
578
|
+
])
|
|
579
|
+
.put({ type: types.CREATE_TEMPLATE_FAILURE, errorMsg: 'API Error: Unknown error' })
|
|
580
|
+
.run();
|
|
581
|
+
});
|
|
582
|
+
|
|
466
583
|
it('should handle callback error gracefully', () => {
|
|
467
584
|
const template = {
|
|
468
585
|
id: 1,
|
|
@@ -569,3 +686,116 @@ describe('getAllAssets saga', () => {
|
|
|
569
686
|
});
|
|
570
687
|
});
|
|
571
688
|
});
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
describe('getCmsSetting saga', () => {
|
|
692
|
+
const basePayload = {
|
|
693
|
+
cmsType: 'bee',
|
|
694
|
+
projectId: 1,
|
|
695
|
+
cmsMode: 'normal',
|
|
696
|
+
langId: 1,
|
|
697
|
+
isEdmSupport: false,
|
|
698
|
+
isBEEAppEnable: true,
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
it('should handle successful settings fetch with matching type (isBeeEnabled true)', () => {
|
|
702
|
+
const fakeResponse = {
|
|
703
|
+
data: {
|
|
704
|
+
response: {
|
|
705
|
+
cmsDetails: { type: 'bee', settings: {} },
|
|
706
|
+
},
|
|
707
|
+
},
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
return expectSaga(sagas.getCmsSetting, basePayload)
|
|
711
|
+
.provide([
|
|
712
|
+
[matchers.call.fn(Api.getCmsTemplateSettingsV2), fakeResponse],
|
|
713
|
+
])
|
|
714
|
+
.put({ type: types.GET_CMS_ACCOUNTS_SUCCESS, isBeeEnabled: true })
|
|
715
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: fakeResponse.data.response.cmsDetails })
|
|
716
|
+
.run();
|
|
717
|
+
});
|
|
718
|
+
|
|
719
|
+
it('should handle successful settings fetch with non-matching type (isBeeEnabled false)', () => {
|
|
720
|
+
const fakeResponse = {
|
|
721
|
+
data: {
|
|
722
|
+
response: {
|
|
723
|
+
cmsDetails: { type: 'ck', settings: {} },
|
|
724
|
+
},
|
|
725
|
+
},
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
return expectSaga(sagas.getCmsSetting, basePayload)
|
|
729
|
+
.provide([
|
|
730
|
+
[matchers.call.fn(Api.getCmsTemplateSettingsV2), fakeResponse],
|
|
731
|
+
])
|
|
732
|
+
.put({ type: types.GET_CMS_ACCOUNTS_SUCCESS, isBeeEnabled: false })
|
|
733
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: fakeResponse.data.response.cmsDetails })
|
|
734
|
+
.run();
|
|
735
|
+
});
|
|
736
|
+
|
|
737
|
+
it('should handle successful settings fetch when cmsDetails is undefined (fallback to empty object)', () => {
|
|
738
|
+
const fakeResponse = {
|
|
739
|
+
data: {
|
|
740
|
+
response: {},
|
|
741
|
+
},
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
return expectSaga(sagas.getCmsSetting, basePayload)
|
|
745
|
+
.provide([
|
|
746
|
+
[matchers.call.fn(Api.getCmsTemplateSettingsV2), fakeResponse],
|
|
747
|
+
])
|
|
748
|
+
.put({ type: types.GET_CMS_ACCOUNTS_SUCCESS, isBeeEnabled: false })
|
|
749
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: undefined })
|
|
750
|
+
.run();
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
it('should handle error when fetching CMS settings fails', () => {
|
|
754
|
+
const fakeError = new Error('Failed to fetch CMS settings');
|
|
755
|
+
|
|
756
|
+
return expectSaga(sagas.getCmsSetting, basePayload)
|
|
757
|
+
.provide([
|
|
758
|
+
[matchers.call.fn(Api.getCmsTemplateSettingsV2), throwError(fakeError)],
|
|
759
|
+
])
|
|
760
|
+
.put({ type: types.GET_CMS_EDITOR_DETAILS_FAILURE, error: fakeError })
|
|
761
|
+
.run();
|
|
762
|
+
});
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
describe('getCmsData saga', () => {
|
|
767
|
+
const payload = { cmsType: 'bee', projectId: 1, langId: 1 };
|
|
768
|
+
|
|
769
|
+
it('should handle successful CMS data fetch', () => {
|
|
770
|
+
const fakeResponse = {
|
|
771
|
+
data: {
|
|
772
|
+
response: {
|
|
773
|
+
data: { html: '<p>content</p>' },
|
|
774
|
+
langId: 1,
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
return expectSaga(sagas.getCmsData, payload)
|
|
780
|
+
.provide([
|
|
781
|
+
[matchers.call.fn(Api.getCmsTemplateDataV2), fakeResponse],
|
|
782
|
+
])
|
|
783
|
+
.put({
|
|
784
|
+
type: types.GET_CMS_EDITOR_DATA_SUCCESS,
|
|
785
|
+
data: fakeResponse.data.response.data,
|
|
786
|
+
langId: fakeResponse.data.response.langId,
|
|
787
|
+
})
|
|
788
|
+
.run();
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
it('should handle error when fetching CMS data fails', () => {
|
|
792
|
+
const fakeError = new Error('Failed to fetch CMS data');
|
|
793
|
+
|
|
794
|
+
return expectSaga(sagas.getCmsData, payload)
|
|
795
|
+
.provide([
|
|
796
|
+
[matchers.call.fn(Api.getCmsTemplateDataV2), throwError(fakeError)],
|
|
797
|
+
])
|
|
798
|
+
.put({ type: types.GET_CMS_EDITOR_DATA_FAILURE, error: fakeError })
|
|
799
|
+
.run();
|
|
800
|
+
});
|
|
801
|
+
});
|
|
@@ -54,7 +54,6 @@ const EmailHTMLEditor = (props) => {
|
|
|
54
54
|
globalActions,
|
|
55
55
|
loadingTags,
|
|
56
56
|
eventContextTags,
|
|
57
|
-
waitEventContextTags,
|
|
58
57
|
forwardedTags,
|
|
59
58
|
selectedOfferDetails,
|
|
60
59
|
currentOrgDetails,
|
|
@@ -511,7 +510,7 @@ const EmailHTMLEditor = (props) => {
|
|
|
511
510
|
setTagValidationError(null);
|
|
512
511
|
}
|
|
513
512
|
}
|
|
514
|
-
}, [tags, injectedTags, location, getDefaultTags, eventContextTags,
|
|
513
|
+
}, [tags, injectedTags, location, getDefaultTags, eventContextTags, showLiquidErrorInFooter]);
|
|
515
514
|
|
|
516
515
|
// Store the last validation state received from HTMLEditor
|
|
517
516
|
const lastValidationStateRef = useRef(null);
|
|
@@ -1101,7 +1100,6 @@ const EmailHTMLEditor = (props) => {
|
|
|
1101
1100
|
injectedTags={injectedTags || {}}
|
|
1102
1101
|
selectedOfferDetails={selectedOfferDetails}
|
|
1103
1102
|
eventContextTags={eventContextTags}
|
|
1104
|
-
waitEventContextTags={waitEventContextTags}
|
|
1105
1103
|
showHeading
|
|
1106
1104
|
showTagList
|
|
1107
1105
|
showInput
|
|
@@ -1126,7 +1124,6 @@ const EmailHTMLEditor = (props) => {
|
|
|
1126
1124
|
injectedTags={injectedTags}
|
|
1127
1125
|
location={location}
|
|
1128
1126
|
eventContextTags={eventContextTags}
|
|
1129
|
-
waitEventContextTags={waitEventContextTags}
|
|
1130
1127
|
selectedOfferDetails={selectedOfferDetails}
|
|
1131
1128
|
channel={EMAIL}
|
|
1132
1129
|
userLocale={intl.locale || 'en'}
|
|
@@ -1154,7 +1151,6 @@ EmailHTMLEditor.propTypes = {
|
|
|
1154
1151
|
globalActions: PropTypes.object,
|
|
1155
1152
|
loadingTags: PropTypes.bool,
|
|
1156
1153
|
eventContextTags: PropTypes.array,
|
|
1157
|
-
waitEventContextTags: PropTypes.object,
|
|
1158
1154
|
forwardedTags: PropTypes.object,
|
|
1159
1155
|
selectedOfferDetails: PropTypes.array,
|
|
1160
1156
|
currentOrgDetails: PropTypes.object,
|
|
@@ -1201,7 +1197,6 @@ EmailHTMLEditor.defaultProps = {
|
|
|
1201
1197
|
globalActions: {},
|
|
1202
1198
|
loadingTags: false,
|
|
1203
1199
|
eventContextTags: [],
|
|
1204
|
-
waitEventContextTags: {},
|
|
1205
1200
|
forwardedTags: {},
|
|
1206
1201
|
selectedOfferDetails: [],
|
|
1207
1202
|
currentOrgDetails: {},
|
|
@@ -173,7 +173,6 @@ const EmailWrapperView = ({
|
|
|
173
173
|
forwardedTags,
|
|
174
174
|
selectedOfferDetails,
|
|
175
175
|
eventContextTags,
|
|
176
|
-
waitEventContextTags,
|
|
177
176
|
getFormdata,
|
|
178
177
|
isGetFormData,
|
|
179
178
|
getLiquidTags,
|
|
@@ -247,7 +246,6 @@ const EmailWrapperView = ({
|
|
|
247
246
|
globalActions,
|
|
248
247
|
loadingTags,
|
|
249
248
|
eventContextTags,
|
|
250
|
-
waitEventContextTags,
|
|
251
249
|
forwardedTags,
|
|
252
250
|
selectedOfferDetails,
|
|
253
251
|
currentOrgDetails,
|
|
@@ -373,7 +371,6 @@ EmailWrapperView.propTypes = {
|
|
|
373
371
|
forwardedTags: PropTypes.object,
|
|
374
372
|
selectedOfferDetails: PropTypes.array,
|
|
375
373
|
eventContextTags: PropTypes.array,
|
|
376
|
-
waitEventContextTags: PropTypes.object,
|
|
377
374
|
emailActions: PropTypes.object,
|
|
378
375
|
Email: PropTypes.object,
|
|
379
376
|
templateData: PropTypes.object,
|
|
@@ -71,10 +71,7 @@ jest.mock('../../../../v2Components/HtmlEditor/index.lazy', () => {
|
|
|
71
71
|
}));
|
|
72
72
|
|
|
73
73
|
return (
|
|
74
|
-
<div
|
|
75
|
-
data-testid="html-editor"
|
|
76
|
-
data-wait-event-context-tags={JSON.stringify(props.waitEventContextTags ?? null)}
|
|
77
|
-
>
|
|
74
|
+
<div data-testid="html-editor">
|
|
78
75
|
<button
|
|
79
76
|
onClick={() => props.onContentChange && props.onContentChange('<p>New content</p>')}
|
|
80
77
|
data-testid="trigger-content-change"
|
|
@@ -133,10 +130,7 @@ jest.mock('../../../../v2Components/HtmlEditor', () => {
|
|
|
133
130
|
}));
|
|
134
131
|
|
|
135
132
|
return (
|
|
136
|
-
<div
|
|
137
|
-
data-testid="html-editor"
|
|
138
|
-
data-wait-event-context-tags={JSON.stringify(props.waitEventContextTags ?? null)}
|
|
139
|
-
>
|
|
133
|
+
<div data-testid="html-editor">
|
|
140
134
|
<button
|
|
141
135
|
onClick={() => props.onContentChange && props.onContentChange('<p>New content</p>')}
|
|
142
136
|
data-testid="trigger-content-change"
|
|
@@ -370,7 +364,6 @@ const defaultProps = {
|
|
|
370
364
|
},
|
|
371
365
|
loadingTags: false,
|
|
372
366
|
eventContextTags: [],
|
|
373
|
-
waitEventContextTags: {},
|
|
374
367
|
forwardedTags: {},
|
|
375
368
|
selectedOfferDetails: [],
|
|
376
369
|
currentOrgDetails: {
|
|
@@ -529,17 +522,6 @@ describe('EmailHTMLEditor', () => {
|
|
|
529
522
|
});
|
|
530
523
|
});
|
|
531
524
|
|
|
532
|
-
describe('waitEventContextTags', () => {
|
|
533
|
-
it('forwards waitEventContextTags to HTMLEditor', () => {
|
|
534
|
-
const waitMap = { b1: { eventName: 'E', blockName: 'B', tags: ['t'] } };
|
|
535
|
-
renderWithIntl({ waitEventContextTags: waitMap });
|
|
536
|
-
expect(screen.getByTestId('html-editor')).toHaveAttribute(
|
|
537
|
-
'data-wait-event-context-tags',
|
|
538
|
-
JSON.stringify(waitMap),
|
|
539
|
-
);
|
|
540
|
-
});
|
|
541
|
-
});
|
|
542
|
-
|
|
543
525
|
describe('Content Initialization', () => {
|
|
544
526
|
it('initializes with empty content in create mode', () => {
|
|
545
527
|
renderWithIntl({ isGetFormData: false });
|
|
@@ -37,14 +37,7 @@ jest.mock('../EmailHTMLEditor', () => {
|
|
|
37
37
|
getContentForPreview: jest.fn(() => '<p>Test</p>'),
|
|
38
38
|
}));
|
|
39
39
|
|
|
40
|
-
return
|
|
41
|
-
<div
|
|
42
|
-
data-testid="email-html-editor"
|
|
43
|
-
data-wait-event-context-tags={JSON.stringify(props.waitEventContextTags ?? null)}
|
|
44
|
-
>
|
|
45
|
-
HTML Editor
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
40
|
+
return <div data-testid="email-html-editor">HTML Editor</div>;
|
|
48
41
|
});
|
|
49
42
|
});
|
|
50
43
|
|
|
@@ -144,7 +137,6 @@ const defaultProps = {
|
|
|
144
137
|
forwardedTags: {},
|
|
145
138
|
selectedOfferDetails: [],
|
|
146
139
|
eventContextTags: [],
|
|
147
|
-
waitEventContextTags: {},
|
|
148
140
|
getFormdata: jest.fn(),
|
|
149
141
|
isGetFormData: false,
|
|
150
142
|
getLiquidTags: jest.fn(),
|
|
@@ -179,13 +171,6 @@ describe('EmailWrapperView', () => {
|
|
|
179
171
|
jest.clearAllMocks();
|
|
180
172
|
});
|
|
181
173
|
|
|
182
|
-
it('passes waitEventContextTags to EmailHTMLEditor when HTML editor is shown', () => {
|
|
183
|
-
const waitMap = { b1: { eventName: 'E', blockName: 'B', tags: [] } };
|
|
184
|
-
renderWithIntl({ waitEventContextTags: waitMap });
|
|
185
|
-
const el = screen.getByTestId('email-html-editor');
|
|
186
|
-
expect(el).toHaveAttribute('data-wait-event-context-tags', JSON.stringify(waitMap));
|
|
187
|
-
});
|
|
188
|
-
|
|
189
174
|
describe('Mode Selection UI', () => {
|
|
190
175
|
it('renders mode selection when step is MODE_SELECTION', () => {
|
|
191
176
|
renderWithIntl({ step: STEPS.MODE_SELECTION });
|
|
@@ -51,7 +51,6 @@ const useEmailWrapper = ({
|
|
|
51
51
|
editor,
|
|
52
52
|
moduleType,
|
|
53
53
|
eventContextTags,
|
|
54
|
-
waitEventContextTags,
|
|
55
54
|
isLoyaltyModule,
|
|
56
55
|
// Props for CmsTemplates component
|
|
57
56
|
cmsTemplatesLoader,
|
|
@@ -252,7 +251,6 @@ const useEmailWrapper = ({
|
|
|
252
251
|
};
|
|
253
252
|
|
|
254
253
|
const isDragDrop = getIsDragDrop(editTemplateData);
|
|
255
|
-
|
|
256
254
|
// If it's a BEE template, set it in Templates.BEETemplate
|
|
257
255
|
if (isDragDrop) {
|
|
258
256
|
beeTemplateSetRef.current = true;
|
|
@@ -738,7 +736,6 @@ const useEmailWrapper = ({
|
|
|
738
736
|
selectedEditorMode, // Pass selected mode to Email component (only for HTML_EDITOR)
|
|
739
737
|
moduleType,
|
|
740
738
|
eventContextTags,
|
|
741
|
-
waitEventContextTags,
|
|
742
739
|
isLoyaltyModule,
|
|
743
740
|
showTestAndPreviewSlidebox,
|
|
744
741
|
handleTestAndPreview,
|
|
@@ -768,7 +765,6 @@ const useEmailWrapper = ({
|
|
|
768
765
|
editor,
|
|
769
766
|
moduleType,
|
|
770
767
|
eventContextTags,
|
|
771
|
-
waitEventContextTags,
|
|
772
768
|
isLoyaltyModule,
|
|
773
769
|
showTestAndPreviewSlidebox,
|
|
774
770
|
handleTestAndPreview,
|
|
@@ -63,7 +63,6 @@ const EmailWrapper = (props) => {
|
|
|
63
63
|
onEnterTemplateName,
|
|
64
64
|
onRemoveTemplateName,
|
|
65
65
|
eventContextTags,
|
|
66
|
-
waitEventContextTags,
|
|
67
66
|
isLoyaltyModule,
|
|
68
67
|
cmsTemplatesLoader,
|
|
69
68
|
onPreviewContentClicked,
|
|
@@ -131,7 +130,6 @@ const EmailWrapper = (props) => {
|
|
|
131
130
|
onEnterTemplateName,
|
|
132
131
|
onRemoveTemplateName,
|
|
133
132
|
eventContextTags,
|
|
134
|
-
waitEventContextTags,
|
|
135
133
|
isLoyaltyModule,
|
|
136
134
|
cmsTemplatesLoader,
|
|
137
135
|
onPreviewContentClicked,
|
|
@@ -186,7 +184,6 @@ const EmailWrapper = (props) => {
|
|
|
186
184
|
forwardedTags={forwardedTags}
|
|
187
185
|
selectedOfferDetails={selectedOfferDetails}
|
|
188
186
|
eventContextTags={eventContextTags}
|
|
189
|
-
waitEventContextTags={waitEventContextTags}
|
|
190
187
|
getFormdata={getFormdata}
|
|
191
188
|
isGetFormData={isGetFormData}
|
|
192
189
|
getLiquidTags={globalActionsProp?.getLiquidTags}
|
|
@@ -244,7 +241,6 @@ EmailWrapper.propTypes = {
|
|
|
244
241
|
onEnterTemplateName: PropTypes.func,
|
|
245
242
|
onRemoveTemplateName: PropTypes.func,
|
|
246
243
|
eventContextTags: PropTypes.array,
|
|
247
|
-
waitEventContextTags: PropTypes.object,
|
|
248
244
|
isLoyaltyModule: PropTypes.bool,
|
|
249
245
|
onPreviewContentClicked: PropTypes.func,
|
|
250
246
|
onTestContentClicked: PropTypes.func,
|
|
@@ -102,7 +102,6 @@ describe('useEmailWrapper', () => {
|
|
|
102
102
|
editor: null,
|
|
103
103
|
moduleType: '',
|
|
104
104
|
eventContextTags: [],
|
|
105
|
-
waitEventContextTags: {},
|
|
106
105
|
isLoyaltyModule: false,
|
|
107
106
|
cmsTemplatesLoader: false,
|
|
108
107
|
currentOrgDetails: { id: 'org1' },
|
|
@@ -121,14 +120,6 @@ describe('useEmailWrapper', () => {
|
|
|
121
120
|
expect(result.current.onTemplateNameChange).toBeInstanceOf(Function);
|
|
122
121
|
});
|
|
123
122
|
|
|
124
|
-
it('passes waitEventContextTags through emailProps', () => {
|
|
125
|
-
const waitMap = { block1: { eventName: 'E', blockName: 'B', tags: [] } };
|
|
126
|
-
const { result } = renderHook(() =>
|
|
127
|
-
useEmailWrapper({ ...mockProps, waitEventContextTags: waitMap }),
|
|
128
|
-
);
|
|
129
|
-
expect(result.current.emailProps.waitEventContextTags).toEqual(waitMap);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
123
|
it('handles template name change correctly', () => {
|
|
133
124
|
const { result } = renderHook(() => useEmailWrapper(mockProps));
|
|
134
125
|
|
|
@@ -1966,7 +1966,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1966
1966
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1967
1967
|
isFullMode={this.props.isFullMode}
|
|
1968
1968
|
eventContextTags={this.props?.eventContextTags}
|
|
1969
|
-
waitEventContextTags={this.props?.waitEventContextTags}
|
|
1970
1969
|
messageDetails={this.props?.messageDetails}
|
|
1971
1970
|
restrictPersonalization={this.props.restrictPersonalization}
|
|
1972
1971
|
/>
|
|
@@ -2069,7 +2068,6 @@ Create.propTypes = {
|
|
|
2069
2068
|
onPreviewContentClicked: PropTypes.func,
|
|
2070
2069
|
onTestContentClicked: PropTypes.func,
|
|
2071
2070
|
eventContextTags: PropTypes.array,
|
|
2072
|
-
waitEventContextTags: PropTypes.object,
|
|
2073
2071
|
getLiquidTags: PropTypes.func,
|
|
2074
2072
|
showLiquidErrorInFooter: PropTypes.func,
|
|
2075
2073
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
@@ -2233,7 +2233,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2233
2233
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
2234
2234
|
isFullMode={this.props.isFullMode}
|
|
2235
2235
|
eventContextTags={this.props?.eventContextTags}
|
|
2236
|
-
waitEventContextTags={this.props?.waitEventContextTags}
|
|
2237
2236
|
restrictPersonalization={this.props.restrictPersonalization}
|
|
2238
2237
|
/>;
|
|
2239
2238
|
})()}
|
|
@@ -2340,7 +2339,6 @@ Edit.propTypes = {
|
|
|
2340
2339
|
onTestContentClicked: PropTypes.func,
|
|
2341
2340
|
creativesMode: PropTypes.string,
|
|
2342
2341
|
eventContextTags: PropTypes.array,
|
|
2343
|
-
waitEventContextTags: PropTypes.object,
|
|
2344
2342
|
getLiquidTags: PropTypes.func,
|
|
2345
2343
|
showLiquidErrorInFooter: PropTypes.func,
|
|
2346
2344
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
@@ -72,7 +72,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
render() {
|
|
75
|
-
const {mobilePushCreateMode, step, getFormData, getLiquidTags, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = [],
|
|
75
|
+
const {mobilePushCreateMode, step, getFormData, getLiquidTags, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = [], showTestAndPreviewSlidebox, handleTestAndPreview, handleCloseTestAndPreview, restrictPersonalization, isAnonymousType, onPersonalizationTokensChange} = this.props;
|
|
76
76
|
const {templateName} = this.state;
|
|
77
77
|
const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
|
|
78
78
|
return (
|
|
@@ -121,7 +121,6 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
121
121
|
templateData={templateData}
|
|
122
122
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
123
123
|
eventContextTags={eventContextTags}
|
|
124
|
-
waitEventContextTags={waitEventContextTags}
|
|
125
124
|
showLiquidErrorInFooter={this.props.showLiquidErrorInFooter}
|
|
126
125
|
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
127
126
|
handleTestAndPreview={handleTestAndPreview}
|
|
@@ -156,7 +155,6 @@ MobilepushWrapper.propTypes = {
|
|
|
156
155
|
type: PropTypes.string,
|
|
157
156
|
onValidationFail: PropTypes.func,
|
|
158
157
|
eventContextTags: PropTypes.array,
|
|
159
|
-
waitEventContextTags: PropTypes.object,
|
|
160
158
|
showLiquidErrorInFooter: PropTypes.func,
|
|
161
159
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
162
160
|
handleTestAndPreview: PropTypes.func,
|
|
@@ -1096,7 +1096,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1096
1096
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
1097
1097
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
1098
1098
|
eventContextTags={this.props?.eventContextTags}
|
|
1099
|
-
waitEventContextTags={this.props?.waitEventContextTags}
|
|
1100
1099
|
/>
|
|
1101
1100
|
</CapColumn>
|
|
1102
1101
|
</CapRow>
|
|
@@ -1133,7 +1132,6 @@ Create.propTypes = {
|
|
|
1133
1132
|
isLoadingMetaEntities: PropTypes.bool,
|
|
1134
1133
|
selectedOfferDetails: PropTypes.array,
|
|
1135
1134
|
eventContextTags: PropTypes.array,
|
|
1136
|
-
waitEventContextTags: PropTypes.object,
|
|
1137
1135
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
1138
1136
|
handleTestAndPreview: PropTypes.func,
|
|
1139
1137
|
handleCloseTestAndPreview: PropTypes.func,
|
|
@@ -1091,7 +1091,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1091
1091
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
1092
1092
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
1093
1093
|
eventContextTags={this.props?.eventContextTags}
|
|
1094
|
-
waitEventContextTags={this.props?.waitEventContextTags}
|
|
1095
1094
|
messageDetails={this.props?.messageDetails}
|
|
1096
1095
|
/>
|
|
1097
1096
|
</CapColumn>
|
|
@@ -1132,7 +1131,6 @@ Edit.propTypes = {
|
|
|
1132
1131
|
injectedTags: PropTypes.object,
|
|
1133
1132
|
selectedOfferDetails: PropTypes.array,
|
|
1134
1133
|
eventContextTags: PropTypes.array,
|
|
1135
|
-
waitEventContextTags: PropTypes.object,
|
|
1136
1134
|
messageDetails: PropTypes.object,
|
|
1137
1135
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
1138
1136
|
handleTestAndPreview: PropTypes.func,
|
|
@@ -82,7 +82,6 @@ export const SmsTraiEdit = (props) => {
|
|
|
82
82
|
templateData = {},
|
|
83
83
|
selectedOfferDetails,
|
|
84
84
|
eventContextTags,
|
|
85
|
-
waitEventContextTags,
|
|
86
85
|
fetchingLiquidTags,
|
|
87
86
|
getLiquidTags,
|
|
88
87
|
showLiquidErrorInFooter,
|
|
@@ -661,7 +660,6 @@ export const SmsTraiEdit = (props) => {
|
|
|
661
660
|
hidePopover={disablehandler()}
|
|
662
661
|
selectedOfferDetails={selectedOfferDetails}
|
|
663
662
|
eventContextTags={eventContextTags}
|
|
664
|
-
waitEventContextTags={waitEventContextTags}
|
|
665
663
|
/>
|
|
666
664
|
)}
|
|
667
665
|
/>
|
|
@@ -30,7 +30,6 @@ const SmsWrapper = (props) => {
|
|
|
30
30
|
smsRegister,
|
|
31
31
|
onShowTemplates,
|
|
32
32
|
eventContextTags,
|
|
33
|
-
waitEventContextTags,
|
|
34
33
|
showLiquidErrorInFooter,
|
|
35
34
|
getLiquidTags,
|
|
36
35
|
showTestAndPreviewSlidebox,
|
|
@@ -54,7 +53,6 @@ const SmsWrapper = (props) => {
|
|
|
54
53
|
onPreviewContentClicked,
|
|
55
54
|
onTestContentClicked,
|
|
56
55
|
eventContextTags,
|
|
57
|
-
waitEventContextTags,
|
|
58
56
|
showLiquidErrorInFooter,
|
|
59
57
|
getLiquidTags,
|
|
60
58
|
showTestAndPreviewSlidebox,
|