@capillarytech/creatives-library 8.0.334-alpha.0 → 8.0.334-alpha.1
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/services/api.js +0 -20
- package/services/tests/api.test.js +0 -59
- package/v2Components/CapCustomSkeleton/index.js +1 -1
- package/v2Components/CapCustomSkeleton/tests/__snapshots__/index.test.js.snap +12 -12
- package/v2Components/FormBuilder/index.js +2 -0
- package/v2Containers/BeeEditor/index.js +13 -1
- package/v2Containers/Email/index.js +75 -38
- package/v2Containers/Email/reducer.js +2 -2
- package/v2Containers/Email/sagas.js +4 -1
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +2 -1
- package/v2Containers/Templates/ChannelTypeIllustration.js +6 -23
- package/v2Containers/Templates/_templates.scss +24 -99
- package/v2Containers/Templates/actions.js +0 -36
- package/v2Containers/Templates/constants.js +0 -23
- package/v2Containers/Templates/index.js +30 -287
- package/v2Containers/Templates/messages.js +0 -68
- package/v2Containers/Templates/reducer.js +0 -68
- package/v2Containers/Templates/sagas.js +1 -89
- package/v2Containers/Templates/selectors.js +0 -12
- package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +0 -12
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1114 -1375
- package/v2Containers/Templates/tests/index.test.js +0 -6
- package/v2Containers/Templates/tests/reducer.test.js +0 -178
- package/v2Containers/Templates/tests/sagas.test.js +8 -306
- package/v2Containers/Templates/tests/selector.test.js +0 -32
- package/v2Containers/Assets/images/archive_Empty_Illustration.svg +0 -9
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -361,26 +361,6 @@ export const deleteTemplate = ({channel, id}) => {
|
|
|
361
361
|
//return API.deleteResource(url);
|
|
362
362
|
};
|
|
363
363
|
|
|
364
|
-
export const archiveTemplate = ({ channel, id }) => {
|
|
365
|
-
const url = `${API_ENDPOINT}/templates/archive/${id}/${channel}`;
|
|
366
|
-
return request(url, getAPICallObject('PUT'));
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
export const unarchiveTemplate = ({ channel, id }) => {
|
|
370
|
-
const url = `${API_ENDPOINT}/templates/unarchive/${id}/${channel}`;
|
|
371
|
-
return request(url, getAPICallObject('PUT'));
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
export const bulkArchiveTemplates = ({ channel, ids }) => {
|
|
375
|
-
const url = `${API_ENDPOINT}/templates/archive/bulk/${channel}`;
|
|
376
|
-
return request(url, getAPICallObject('PUT', { ids }));
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
export const bulkUnarchiveTemplates = ({ channel, ids }) => {
|
|
380
|
-
const url = `${API_ENDPOINT}/templates/unarchive/bulk/${channel}`;
|
|
381
|
-
return request(url, getAPICallObject('PUT', { ids }));
|
|
382
|
-
};
|
|
383
|
-
|
|
384
364
|
export const deleteRcsTemplate = ({ templateName }) => {
|
|
385
365
|
const url = `${API_ENDPOINT}/templates/${templateName}/RCS`;
|
|
386
366
|
return request(url, getAPICallObject('DELETE'))
|
|
@@ -1086,62 +1086,3 @@ describe('createTestCustomer', () => {
|
|
|
1086
1086
|
expect(lastCall[1].body).toBe(JSON.stringify(payload));
|
|
1087
1087
|
});
|
|
1088
1088
|
});
|
|
1089
|
-
|
|
1090
|
-
import {
|
|
1091
|
-
archiveTemplate,
|
|
1092
|
-
unarchiveTemplate,
|
|
1093
|
-
bulkArchiveTemplates,
|
|
1094
|
-
bulkUnarchiveTemplates,
|
|
1095
|
-
} from '../api';
|
|
1096
|
-
|
|
1097
|
-
describe('archiveTemplate', () => {
|
|
1098
|
-
beforeEach(() => {
|
|
1099
|
-
global.fetch = jest.fn().mockReturnValue(Promise.resolve({ json: () => Promise.resolve({}) }));
|
|
1100
|
-
});
|
|
1101
|
-
|
|
1102
|
-
it('should call PUT on archive endpoint', () => {
|
|
1103
|
-
archiveTemplate({ channel: 'EMAIL', id: 'id123' });
|
|
1104
|
-
expect(global.fetch).toHaveBeenCalled();
|
|
1105
|
-
const lastCall = global.fetch.mock.calls[global.fetch.mock.calls.length - 1];
|
|
1106
|
-
expect(lastCall[1].method).toBe('PUT');
|
|
1107
|
-
});
|
|
1108
|
-
});
|
|
1109
|
-
|
|
1110
|
-
describe('unarchiveTemplate', () => {
|
|
1111
|
-
beforeEach(() => {
|
|
1112
|
-
global.fetch = jest.fn().mockReturnValue(Promise.resolve({ json: () => Promise.resolve({}) }));
|
|
1113
|
-
});
|
|
1114
|
-
|
|
1115
|
-
it('should call PUT on unarchive endpoint', () => {
|
|
1116
|
-
unarchiveTemplate({ channel: 'EMAIL', id: 'id123' });
|
|
1117
|
-
expect(global.fetch).toHaveBeenCalled();
|
|
1118
|
-
const lastCall = global.fetch.mock.calls[global.fetch.mock.calls.length - 1];
|
|
1119
|
-
expect(lastCall[1].method).toBe('PUT');
|
|
1120
|
-
});
|
|
1121
|
-
});
|
|
1122
|
-
|
|
1123
|
-
describe('bulkArchiveTemplates', () => {
|
|
1124
|
-
beforeEach(() => {
|
|
1125
|
-
global.fetch = jest.fn().mockReturnValue(Promise.resolve({ json: () => Promise.resolve({}) }));
|
|
1126
|
-
});
|
|
1127
|
-
|
|
1128
|
-
it('should call PUT on bulk archive endpoint with ids', () => {
|
|
1129
|
-
bulkArchiveTemplates({ channel: 'EMAIL', ids: ['id1', 'id2'] });
|
|
1130
|
-
expect(global.fetch).toHaveBeenCalled();
|
|
1131
|
-
const lastCall = global.fetch.mock.calls[global.fetch.mock.calls.length - 1];
|
|
1132
|
-
expect(lastCall[1].method).toBe('PUT');
|
|
1133
|
-
});
|
|
1134
|
-
});
|
|
1135
|
-
|
|
1136
|
-
describe('bulkUnarchiveTemplates', () => {
|
|
1137
|
-
beforeEach(() => {
|
|
1138
|
-
global.fetch = jest.fn().mockReturnValue(Promise.resolve({ json: () => Promise.resolve({}) }));
|
|
1139
|
-
});
|
|
1140
|
-
|
|
1141
|
-
it('should call PUT on bulk unarchive endpoint with ids', () => {
|
|
1142
|
-
bulkUnarchiveTemplates({ channel: 'EMAIL', ids: ['id1', 'id2'] });
|
|
1143
|
-
expect(global.fetch).toHaveBeenCalled();
|
|
1144
|
-
const lastCall = global.fetch.mock.calls[global.fetch.mock.calls.length - 1];
|
|
1145
|
-
expect(lastCall[1].method).toBe('PUT');
|
|
1146
|
-
});
|
|
1147
|
-
});
|
|
@@ -20,7 +20,7 @@ exports[`CapCustomSkeleton test renders correct CapCustomSkeleton component 1`]
|
|
|
20
20
|
>
|
|
21
21
|
<CapColumn
|
|
22
22
|
key="0"
|
|
23
|
-
lg={
|
|
23
|
+
lg={6}
|
|
24
24
|
md={8}
|
|
25
25
|
sm={12}
|
|
26
26
|
xs={24}
|
|
@@ -40,7 +40,7 @@ exports[`CapCustomSkeleton test renders correct CapCustomSkeleton component 1`]
|
|
|
40
40
|
</CapColumn>
|
|
41
41
|
<CapColumn
|
|
42
42
|
key="1"
|
|
43
|
-
lg={
|
|
43
|
+
lg={6}
|
|
44
44
|
md={8}
|
|
45
45
|
sm={12}
|
|
46
46
|
xs={24}
|
|
@@ -60,7 +60,7 @@ exports[`CapCustomSkeleton test renders correct CapCustomSkeleton component 1`]
|
|
|
60
60
|
</CapColumn>
|
|
61
61
|
<CapColumn
|
|
62
62
|
key="2"
|
|
63
|
-
lg={
|
|
63
|
+
lg={6}
|
|
64
64
|
md={8}
|
|
65
65
|
sm={12}
|
|
66
66
|
xs={24}
|
|
@@ -80,7 +80,7 @@ exports[`CapCustomSkeleton test renders correct CapCustomSkeleton component 1`]
|
|
|
80
80
|
</CapColumn>
|
|
81
81
|
<CapColumn
|
|
82
82
|
key="3"
|
|
83
|
-
lg={
|
|
83
|
+
lg={6}
|
|
84
84
|
md={8}
|
|
85
85
|
sm={12}
|
|
86
86
|
xs={24}
|
|
@@ -100,7 +100,7 @@ exports[`CapCustomSkeleton test renders correct CapCustomSkeleton component 1`]
|
|
|
100
100
|
</CapColumn>
|
|
101
101
|
<CapColumn
|
|
102
102
|
key="4"
|
|
103
|
-
lg={
|
|
103
|
+
lg={6}
|
|
104
104
|
md={8}
|
|
105
105
|
sm={12}
|
|
106
106
|
xs={24}
|
|
@@ -120,7 +120,7 @@ exports[`CapCustomSkeleton test renders correct CapCustomSkeleton component 1`]
|
|
|
120
120
|
</CapColumn>
|
|
121
121
|
<CapColumn
|
|
122
122
|
key="5"
|
|
123
|
-
lg={
|
|
123
|
+
lg={6}
|
|
124
124
|
md={8}
|
|
125
125
|
sm={12}
|
|
126
126
|
xs={24}
|
|
@@ -140,7 +140,7 @@ exports[`CapCustomSkeleton test renders correct CapCustomSkeleton component 1`]
|
|
|
140
140
|
</CapColumn>
|
|
141
141
|
<CapColumn
|
|
142
142
|
key="6"
|
|
143
|
-
lg={
|
|
143
|
+
lg={6}
|
|
144
144
|
md={8}
|
|
145
145
|
sm={12}
|
|
146
146
|
xs={24}
|
|
@@ -160,7 +160,7 @@ exports[`CapCustomSkeleton test renders correct CapCustomSkeleton component 1`]
|
|
|
160
160
|
</CapColumn>
|
|
161
161
|
<CapColumn
|
|
162
162
|
key="7"
|
|
163
|
-
lg={
|
|
163
|
+
lg={6}
|
|
164
164
|
md={8}
|
|
165
165
|
sm={12}
|
|
166
166
|
xs={24}
|
|
@@ -180,7 +180,7 @@ exports[`CapCustomSkeleton test renders correct CapCustomSkeleton component 1`]
|
|
|
180
180
|
</CapColumn>
|
|
181
181
|
<CapColumn
|
|
182
182
|
key="8"
|
|
183
|
-
lg={
|
|
183
|
+
lg={6}
|
|
184
184
|
md={8}
|
|
185
185
|
sm={12}
|
|
186
186
|
xs={24}
|
|
@@ -200,7 +200,7 @@ exports[`CapCustomSkeleton test renders correct CapCustomSkeleton component 1`]
|
|
|
200
200
|
</CapColumn>
|
|
201
201
|
<CapColumn
|
|
202
202
|
key="9"
|
|
203
|
-
lg={
|
|
203
|
+
lg={6}
|
|
204
204
|
md={8}
|
|
205
205
|
sm={12}
|
|
206
206
|
xs={24}
|
|
@@ -220,7 +220,7 @@ exports[`CapCustomSkeleton test renders correct CapCustomSkeleton component 1`]
|
|
|
220
220
|
</CapColumn>
|
|
221
221
|
<CapColumn
|
|
222
222
|
key="10"
|
|
223
|
-
lg={
|
|
223
|
+
lg={6}
|
|
224
224
|
md={8}
|
|
225
225
|
sm={12}
|
|
226
226
|
xs={24}
|
|
@@ -240,7 +240,7 @@ exports[`CapCustomSkeleton test renders correct CapCustomSkeleton component 1`]
|
|
|
240
240
|
</CapColumn>
|
|
241
241
|
<CapColumn
|
|
242
242
|
key="11"
|
|
243
|
-
lg={
|
|
243
|
+
lg={6}
|
|
244
244
|
md={8}
|
|
245
245
|
sm={12}
|
|
246
246
|
xs={24}
|
|
@@ -3998,6 +3998,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3998
3998
|
onContextChange={this.props.onContextChange}
|
|
3999
3999
|
moduleFilterEnabled={isModuleFilterEnabled}
|
|
4000
4000
|
eventContextTags={this.props?.eventContextTags}
|
|
4001
|
+
isGetBeeData={this.props?.isGetBeeData}
|
|
4002
|
+
getBEEData={this.props?.getBEEData}
|
|
4001
4003
|
/>
|
|
4002
4004
|
</CapColumn>
|
|
4003
4005
|
);
|
|
@@ -53,11 +53,14 @@ function BeeEditor(props) {
|
|
|
53
53
|
BEESelect,
|
|
54
54
|
currentOrgDetails,
|
|
55
55
|
eventContextTags,
|
|
56
|
+
isGetBeeData,
|
|
57
|
+
getBEEData,
|
|
56
58
|
} = props;
|
|
57
59
|
const { saveRowRequest } = BEESelect;
|
|
58
60
|
const {formatMessage} = intl;
|
|
59
61
|
const UNSUBSCRIBE = 'unsubscribe';
|
|
60
62
|
let beePluginInstance = null;
|
|
63
|
+
const isGetBeeDataRef = useRef(isGetBeeData);
|
|
61
64
|
const categoryOptions = [{key: 'cta', value: 'cta', label: formatMessage(messages.cta)},
|
|
62
65
|
{key: 'footer', value: 'footer', label: formatMessage(messages.footer)},
|
|
63
66
|
{key: 'header', value: 'header', label: formatMessage(messages.header)},
|
|
@@ -111,6 +114,10 @@ function BeeEditor(props) {
|
|
|
111
114
|
tokenDataRef.current = tokenData;
|
|
112
115
|
}, [tokenData]);
|
|
113
116
|
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
isGetBeeDataRef.current = isGetBeeData;
|
|
119
|
+
}, [isGetBeeData]);
|
|
120
|
+
|
|
114
121
|
useEffect(() => {
|
|
115
122
|
// Only initialize if we have both tokenData and beeJson
|
|
116
123
|
const currentTokenData = tokenDataRef.current;
|
|
@@ -220,7 +227,11 @@ function BeeEditor(props) {
|
|
|
220
227
|
},
|
|
221
228
|
},
|
|
222
229
|
onSave: (jsonFile, htmlFile) => {
|
|
223
|
-
|
|
230
|
+
if (isGetBeeDataRef.current) {
|
|
231
|
+
getBEEData(jsonFile, htmlFile);
|
|
232
|
+
} else {
|
|
233
|
+
saveBeeData(jsonFile, htmlFile);
|
|
234
|
+
}
|
|
224
235
|
},
|
|
225
236
|
onSaveRow: (rowJSON) => {
|
|
226
237
|
actions.createCustomRow(JSON.parse(rowJSON), callbackSaveRow);
|
|
@@ -414,6 +425,7 @@ BeeEditor.propTypes = {
|
|
|
414
425
|
onContextChange: PropTypes.func,
|
|
415
426
|
userLocale: PropTypes.string,
|
|
416
427
|
eventContextTags: PropTypes.array,
|
|
428
|
+
isGetBeeData: PropTypes.bool,
|
|
417
429
|
};
|
|
418
430
|
|
|
419
431
|
const mapStateToProps = () => createStructuredSelector({
|
|
@@ -91,6 +91,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
91
91
|
saveForm: false,
|
|
92
92
|
showTestAndPreviewSlidebox: false,
|
|
93
93
|
isTestAndPreviewMode: false, // Add flag to prevent validation during Test & Preview
|
|
94
|
+
isGetBeeData: false,
|
|
94
95
|
};
|
|
95
96
|
|
|
96
97
|
this.isTagLoaded = false;
|
|
@@ -509,6 +510,39 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
509
510
|
const formData = _.cloneDeep(this.state.formData);
|
|
510
511
|
|
|
511
512
|
const schema = _.cloneDeep(this.state.schema);
|
|
513
|
+
|
|
514
|
+
// Apply BEE/CK visibility synchronously into the schema before setState so that
|
|
515
|
+
// the committed state already has the correct display values — this prevents the
|
|
516
|
+
// race condition where hideEdmOptions (setTimeout) could be overwritten by a
|
|
517
|
+
// concurrent prop-triggered setState that clones the schema before it commits.
|
|
518
|
+
const isDragDropForHide = nextProps.Email.CmsSettings.isDragDrop && this.checkBeeEditorAllowedForLibrary();
|
|
519
|
+
_.forEach(schema.containers, (container) => {
|
|
520
|
+
if (container.isActive) {
|
|
521
|
+
_.forEach(container.tabBarExtraContent.sections[0].inputFields[0].cols, (col) => {
|
|
522
|
+
if (col.id === 'insert-image') {
|
|
523
|
+
col.style.display = isDragDropForHide ? 'none' : '';
|
|
524
|
+
}
|
|
525
|
+
if (col.id === 'tab-options-popover') {
|
|
526
|
+
col.colStyle.display = isDragDropForHide ? 'flex' : 'none';
|
|
527
|
+
_.forEach(col.content.sections[0].inputFields, (tabPopoverSection) => {
|
|
528
|
+
if (tabPopoverSection.cols[0].id === 'switch-editor-label') {
|
|
529
|
+
tabPopoverSection.cols[0].style.display = isDragDropForHide ? '' : 'none';
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
if (col.value && col.value.sections) {
|
|
533
|
+
_.forEach(col.value.sections[0].inputFields, (valueInputField) => {
|
|
534
|
+
_.forEach(valueInputField.cols, (valueCol) => {
|
|
535
|
+
if (valueCol.id === 'tab-option-icon') {
|
|
536
|
+
valueCol.colStyle = { ...valueCol.colStyle, display: hasSupportCKEditor() ? 'flex' : 'none' };
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
|
|
512
546
|
const langIndex = formData[this.state.currentTab - 1]?.selectedLanguages?.indexOf(langId);
|
|
513
547
|
|
|
514
548
|
const temp = (schema.containers || {})[this.state.currentTab - 1];
|
|
@@ -1957,7 +1991,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1957
1991
|
}
|
|
1958
1992
|
|
|
1959
1993
|
switchEditor = () => {
|
|
1960
|
-
this.setState({showConfirmationModal: true});
|
|
1994
|
+
this.setState({showConfirmationModal: true, isGetBeeData: true});
|
|
1961
1995
|
}
|
|
1962
1996
|
|
|
1963
1997
|
renameVersion = () => {
|
|
@@ -2791,43 +2825,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2791
2825
|
// }
|
|
2792
2826
|
}
|
|
2793
2827
|
handleOk = () => {
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
const langIndex = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
|
|
2797
|
-
|
|
2798
|
-
// Store current content before switching
|
|
2799
|
-
const currentContent = formData[`${this.state.currentTab - 1}`][activeLangTab]['template-content'];
|
|
2800
|
-
|
|
2801
|
-
// Update formData to mark as not drag-drop
|
|
2802
|
-
formData[`${this.state.currentTab - 1}`][activeLangTab].is_drag_drop = false;
|
|
2803
|
-
if (formData[`${this.state.currentTab - 1}`].base) {
|
|
2804
|
-
formData.base[activeLangTab].is_drag_drop = false;
|
|
2828
|
+
if (this.beeInstance) {
|
|
2829
|
+
this.beeInstance.save()
|
|
2805
2830
|
}
|
|
2806
|
-
|
|
2807
|
-
this.setState({
|
|
2808
|
-
mode: "switchEditor",
|
|
2809
|
-
formData
|
|
2810
|
-
}, () => {
|
|
2811
|
-
// No need to call handleEdmSave as we're switching to CKEditor
|
|
2812
|
-
let schema = _.cloneDeep(this.state.schema);
|
|
2813
|
-
_.forEach(schema.containers, (container, index) => {
|
|
2814
|
-
if (parseInt(index, 10) === (this.state.currentTab - 1)) {
|
|
2815
|
-
const temp = container;
|
|
2816
|
-
const langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
|
|
2817
|
-
|
|
2818
|
-
temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
|
|
2819
|
-
temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
|
|
2820
|
-
temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].colStyle.display = "none";
|
|
2821
|
-
}
|
|
2822
|
-
});
|
|
2823
|
-
schema = this.showInsertImageButton(schema);
|
|
2824
|
-
|
|
2825
|
-
this.setState({
|
|
2826
|
-
schema,
|
|
2827
|
-
showConfirmationModal: false,
|
|
2828
|
-
isSchemaChanged: true
|
|
2829
|
-
});
|
|
2830
|
-
});
|
|
2831
2831
|
}
|
|
2832
2832
|
|
|
2833
2833
|
handleCancel = () => {
|
|
@@ -3034,6 +3034,42 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
3034
3034
|
saveBeeInstance = (instance) => {
|
|
3035
3035
|
this.beeInstance = instance;
|
|
3036
3036
|
}
|
|
3037
|
+
|
|
3038
|
+
getBEEData = (json, html) => {
|
|
3039
|
+
this.setState((prevState) => {
|
|
3040
|
+
const formData = _.cloneDeep(prevState.formData);
|
|
3041
|
+
const activeLangTab = formData[`${prevState.currentTab - 1}`].activeTab;
|
|
3042
|
+
|
|
3043
|
+
// Mark as not drag-drop and capture BEE content in one pass
|
|
3044
|
+
formData[`${prevState.currentTab - 1}`][activeLangTab].is_drag_drop = false;
|
|
3045
|
+
formData[`${prevState.currentTab - 1}`][activeLangTab]['template-content'] = html;
|
|
3046
|
+
formData[`${prevState.currentTab - 1}`][activeLangTab]['json-content'] = json;
|
|
3047
|
+
formData.base[activeLangTab].is_drag_drop = false;
|
|
3048
|
+
formData.base[activeLangTab]['template-content'] = html;
|
|
3049
|
+
formData.base[activeLangTab]['json-content'] = json;
|
|
3050
|
+
|
|
3051
|
+
return { mode: "switchEditor", formData };
|
|
3052
|
+
}, () => {
|
|
3053
|
+
const { formData, currentTab } = this.state;
|
|
3054
|
+
const activeLangTab = formData[`${currentTab - 1}`].activeTab;
|
|
3055
|
+
let schema = _.cloneDeep(this.state.schema);
|
|
3056
|
+
|
|
3057
|
+
_.forEach(schema.containers, (container, index) => {
|
|
3058
|
+
if (parseInt(index, 10) === (currentTab - 1)) {
|
|
3059
|
+
const langTab = formData[`${currentTab - 1}`].selectedLanguages.indexOf(activeLangTab);
|
|
3060
|
+
container.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = { display: "" };
|
|
3061
|
+
container.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = { display: "none" };
|
|
3062
|
+
container.tabBarExtraContent.sections[0].inputFields[0].cols[4].colStyle.display = "none";
|
|
3063
|
+
}
|
|
3064
|
+
});
|
|
3065
|
+
|
|
3066
|
+
schema = this.showInsertImageButton(schema);
|
|
3067
|
+
this.setState({ schema, showConfirmationModal: false, isSchemaChanged: true }, () => {
|
|
3068
|
+
this.injectEvents(schema);
|
|
3069
|
+
});
|
|
3070
|
+
});
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3037
3073
|
saveBeeData = (json, html) => {
|
|
3038
3074
|
// Update state with new content
|
|
3039
3075
|
this.setState((prevState) => {
|
|
@@ -3045,7 +3081,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
3045
3081
|
formData[currentTab - 1][activeTab]['json-content'] = json;
|
|
3046
3082
|
formData.base[activeTab]['template-content'] = html;
|
|
3047
3083
|
formData.base[activeTab]['json-content'] = json;
|
|
3048
|
-
|
|
3049
3084
|
return {
|
|
3050
3085
|
...prevState,
|
|
3051
3086
|
formData,
|
|
@@ -3136,6 +3171,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
3136
3171
|
eventContextTags={this.props?.eventContextTags}
|
|
3137
3172
|
forwardedTags={this.props?.forwardedTags}
|
|
3138
3173
|
isLoyaltyModule={this.props?.isLoyaltyModule}
|
|
3174
|
+
isGetBeeData={this.state.isGetBeeData}
|
|
3175
|
+
getBEEData={this.getBEEData}
|
|
3139
3176
|
isTestAndPreviewMode={this.state.isTestAndPreviewMode} // Add flag to prevent validation
|
|
3140
3177
|
/> : ''}
|
|
3141
3178
|
</Col>
|
|
@@ -11,7 +11,7 @@ import * as types from './constants';
|
|
|
11
11
|
const initialState = fromJS({
|
|
12
12
|
createTemplateInProgress: false,
|
|
13
13
|
createResponse: {},
|
|
14
|
-
isBeeEnabled:
|
|
14
|
+
isBeeEnabled: null,
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
function emailReducer(state = initialState, action) {
|
|
@@ -150,7 +150,7 @@ function emailReducer(state = initialState, action) {
|
|
|
150
150
|
.set('fetchingCmsData', false)
|
|
151
151
|
.set('duplicateResponse', fromJS({}))
|
|
152
152
|
.set('cmsData', '')
|
|
153
|
-
.set('isBeeEnabled',
|
|
153
|
+
.set('isBeeEnabled', null);
|
|
154
154
|
case types.TRANSFORM_EMAIL_TEMPLATE_REQUEST:
|
|
155
155
|
return state.set("createTemplateInProgress", true);
|
|
156
156
|
default:
|
|
@@ -107,7 +107,10 @@ export function* getCmsSetting({
|
|
|
107
107
|
}) {
|
|
108
108
|
try {
|
|
109
109
|
const result = yield call(Api.getCmsTemplateSettingsV2, cmsType, projectId, cmsMode, langId, isEdmSupport, isBEEAppEnable);
|
|
110
|
-
|
|
110
|
+
const cmsAccountDetail = result.data?.response.cmsDetails || {};
|
|
111
|
+
const isBeeEnabled = cmsAccountDetail?.type === cmsType;
|
|
112
|
+
console.log(isBeeEnabled, "isBeeEnabled");
|
|
113
|
+
yield put({ type: types.GET_CMS_ACCOUNTS_SUCCESS, isBeeEnabled });
|
|
111
114
|
yield put({ type: types.GET_CMS_EDITOR_DETAILS_SUCCESS, settings: result.data.response.cmsDetails });
|
|
112
115
|
} catch (error) {
|
|
113
116
|
yield put({ type: types.GET_CMS_EDITOR_DETAILS_FAILURE, error });
|
|
@@ -231,6 +231,7 @@ const useEmailWrapper = ({
|
|
|
231
231
|
const hasTemplateDetails = Email?.templateDetails && !isEmpty(Email.templateDetails);
|
|
232
232
|
// Note: We check Email?.BEETemplate as a proxy, but the actual BEETemplate is in Templates reducer
|
|
233
233
|
// The Email component will detect it via this.props.Templates.BEETemplate
|
|
234
|
+
console.log(Email, "fkjhsgfgdkl");
|
|
234
235
|
const hasBEETemplate = Email?.BEETemplate && !isEmpty(Email.BEETemplate);
|
|
235
236
|
|
|
236
237
|
if (hasTemplateDetails && !hasBEETemplate && templatesActions?.setBEETemplate && !beeTemplateSetRef.current) {
|
|
@@ -251,7 +252,7 @@ const useEmailWrapper = ({
|
|
|
251
252
|
};
|
|
252
253
|
|
|
253
254
|
const isDragDrop = getIsDragDrop(editTemplateData);
|
|
254
|
-
|
|
255
|
+
console.log(isDragDrop, "isDragDrop");
|
|
255
256
|
// If it's a BEE template, set it in Templates.BEETemplate
|
|
256
257
|
if (isDragDrop) {
|
|
257
258
|
beeTemplateSetRef.current = true;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import zaloillustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
4
|
-
import inAppIllustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
5
|
-
import { FormattedMessage } from 'react-intl';
|
|
6
|
-
import { CapIllustration } from "@capillarytech/cap-ui-library";
|
|
7
3
|
import emailIllustration from '../Assets/images/emailIllustration.svg';
|
|
8
4
|
import smsIllustration from '../Assets/images/smsIllustration.svg';
|
|
9
5
|
import pushIllustration from '../Assets/images/pushIllustration.svg';
|
|
@@ -12,12 +8,13 @@ import lineIllustration from '../Assets/images/lineIllustration.svg';
|
|
|
12
8
|
import facebookIllustration from '../Assets/images/facebookIllustration.svg';
|
|
13
9
|
import whatsappIllustration from '../Assets/images/whatsappIllustration.png';
|
|
14
10
|
import whatsappOrZaloAccountIllustration from '../Assets/images/whatsappOrZaloAccountIllustration.svg';
|
|
15
|
-
import archiveEmptyStateIllustration from '../Assets/images/archive_Empty_Illustration.svg';
|
|
16
11
|
import rcsIllustration from '../Assets/images/rcsIllustration.png';
|
|
12
|
+
import zaloillustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
13
|
+
import inAppIllustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
17
14
|
import messages from './messages';
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
} from '../CreativesContainer/constants';
|
|
15
|
+
import { FormattedMessage } from 'react-intl';
|
|
16
|
+
import { CapIllustration } from "@capillarytech/cap-ui-library";
|
|
17
|
+
import { MOBILE_PUSH, SMS, EMAIL, LINE, VIBER, FACEBOOK, WHATSAPP, RCS, ZALO, INAPP, WEBPUSH } from '../CreativesContainer/constants';
|
|
21
18
|
|
|
22
19
|
|
|
23
20
|
// Configuration object for channel types
|
|
@@ -83,8 +80,7 @@ function ChannelTypeIllustration(props) {
|
|
|
83
80
|
isFullMode,
|
|
84
81
|
createTemplate,
|
|
85
82
|
currentChannel,
|
|
86
|
-
hostName
|
|
87
|
-
isArchivedMode,
|
|
83
|
+
hostName
|
|
88
84
|
} = props;
|
|
89
85
|
|
|
90
86
|
const templateText = useMemo(() => {
|
|
@@ -92,18 +88,6 @@ function ChannelTypeIllustration(props) {
|
|
|
92
88
|
return isFullMode ? templateIntlMsg : '';
|
|
93
89
|
}, [isFullMode]);
|
|
94
90
|
|
|
95
|
-
if (isArchivedMode) {
|
|
96
|
-
return (
|
|
97
|
-
<CapIllustration
|
|
98
|
-
illustrationImage={archiveEmptyStateIllustration}
|
|
99
|
-
title={<FormattedMessage {...messages.noArchivedCreatives} />}
|
|
100
|
-
description={<FormattedMessage {...messages.noArchivedCreativesDesc} />}
|
|
101
|
-
descriptionPosition="bottom"
|
|
102
|
-
descriptionClassName="illustration-desc archive-illustration"
|
|
103
|
-
/>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
91
|
const getChannelTypeIllustrationInfo = (type, hostName) => {
|
|
108
92
|
// Handle special cases with hostName dependency
|
|
109
93
|
if (type === WHATSAPP) {
|
|
@@ -212,6 +196,5 @@ ChannelTypeIllustration.propTypes = {
|
|
|
212
196
|
createTemplate: PropTypes.func.isRequired,
|
|
213
197
|
currentChannel: PropTypes.string,
|
|
214
198
|
hostName: PropTypes.string,
|
|
215
|
-
isArchivedMode: PropTypes.bool,
|
|
216
199
|
};
|
|
217
200
|
export default ChannelTypeIllustration;
|