@capillarytech/creatives-library 8.0.345-alpha.1 → 8.0.345-alpha.11
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
CHANGED
|
@@ -705,8 +705,27 @@ export function SlideBoxContent(props) {
|
|
|
705
705
|
// and getDetails?type=BEE_PLUGIN would never fire. Routing BEE
|
|
706
706
|
// templates through the direct <Email> path — which is already
|
|
707
707
|
// battle-tested for the CKEditor flow — sidesteps that entirely.
|
|
708
|
+
const vBase = templateData?.versions?.base;
|
|
709
|
+
const vBaseActiveTab = vBase?.activeTab || vBase?.selectedLanguages?.[0] || 'en';
|
|
708
710
|
const isBEETemplate = templateData?.base?.is_drag_drop === true
|
|
709
|
-
|| templateData?.base?.is_drag_drop === 1
|
|
711
|
+
|| templateData?.base?.is_drag_drop === 1
|
|
712
|
+
|| vBase?.[vBaseActiveTab]?.is_drag_drop === true
|
|
713
|
+
|| vBase?.[vBaseActiveTab]?.is_drag_drop === 1;
|
|
714
|
+
console.log('[SlideBoxContent] BEE routing debug', {
|
|
715
|
+
supportCKEditor,
|
|
716
|
+
'templateData._id': templateData?._id,
|
|
717
|
+
'templateData.type': templateData?.type,
|
|
718
|
+
'templateData.base': templateData?.base,
|
|
719
|
+
'templateData.base.is_drag_drop': templateData?.base?.is_drag_drop,
|
|
720
|
+
'templateData.base.drag_drop_id': templateData?.base?.drag_drop_id,
|
|
721
|
+
vBase,
|
|
722
|
+
vBaseActiveTab,
|
|
723
|
+
'vBase[vBaseActiveTab]': vBase?.[vBaseActiveTab],
|
|
724
|
+
'vBase[vBaseActiveTab].is_drag_drop': vBase?.[vBaseActiveTab]?.is_drag_drop,
|
|
725
|
+
'vBase[vBaseActiveTab].drag_drop_id': vBase?.[vBaseActiveTab]?.drag_drop_id,
|
|
726
|
+
isBEETemplate,
|
|
727
|
+
routingTo: (supportCKEditor || isBEETemplate) ? 'Email (direct)' : 'EmailWrapper',
|
|
728
|
+
});
|
|
710
729
|
if (supportCKEditor || isBEETemplate) {
|
|
711
730
|
return (
|
|
712
731
|
<Email
|
|
@@ -966,10 +966,13 @@ export class Creatives extends React.Component {
|
|
|
966
966
|
case constants.EMAIL:
|
|
967
967
|
if (template?.value?.base) {
|
|
968
968
|
let emailBase = template.value.base;
|
|
969
|
-
const { html_content } = emailBase || {};
|
|
969
|
+
const { html_content, drag_drop_id: formDragDropId } = emailBase || {};
|
|
970
970
|
if (!html_content) {
|
|
971
971
|
emailBase = templateRecords.base;
|
|
972
972
|
}
|
|
973
|
+
if (!emailBase.drag_drop_id && formDragDropId) {
|
|
974
|
+
emailBase = { ...emailBase, drag_drop_id: formDragDropId };
|
|
975
|
+
}
|
|
973
976
|
const newHtmlContent = await updateImagesInHtml(html_content);
|
|
974
977
|
templateData = {
|
|
975
978
|
...templateData, ...emailBase, emailBody: newHtmlContent, emailSubject: (emailBase && emailBase.subject) ? emailBase.subject : '',
|
|
@@ -32,7 +32,7 @@ import * as creativesContainerActions from '../CreativesContainer/actions';
|
|
|
32
32
|
import withCreatives from '../../hoc/withCreatives';
|
|
33
33
|
import { EMAIL } from '../CreativesContainer/constants';
|
|
34
34
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
35
|
-
import { TRACK_CREATE_EMAIL, TRACK_EDIT_EMAIL, BEE_PLUGIN, CREATE, EDIT } from '../App/constants';
|
|
35
|
+
import { TRACK_CREATE_EMAIL, TRACK_EDIT_EMAIL, BEE_PLUGIN, CREATE, EDIT, LOYALTY } from '../App/constants';
|
|
36
36
|
import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
37
37
|
import { gtmPush } from '../../utils/gtmTrackers';
|
|
38
38
|
const {CapCustomCardList} = CapCustomCard;
|
|
@@ -98,6 +98,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
98
98
|
this.edmEvent = undefined;
|
|
99
99
|
// When schema is set after CmsSettings (e.g. library create BEE), allow BEE init to run once
|
|
100
100
|
this.schemaJustFilledForBee = false;
|
|
101
|
+
// Guard: prevent startTemplateCreation being called twice (componentDidMount + componentWillReceiveProps)
|
|
102
|
+
this.templateCreationStarted = false;
|
|
101
103
|
this.supportedLanguages = this.getSupportedLanguages(props);
|
|
102
104
|
this.map = {
|
|
103
105
|
"template-name": {
|
|
@@ -224,6 +226,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
224
226
|
|| _.get(this.props.Templates.BEETemplate, 'versions.base.drag_drop_id')
|
|
225
227
|
|| _.get(this.props.Templates.BEETemplate, 'versions.base.id')
|
|
226
228
|
|| this.props.Templates.BEETemplate?._id;
|
|
229
|
+
console.log('[Rafeeq manzoor] comes here 1');
|
|
227
230
|
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'open', undefined, isBEESupport, isBEEAppEnable);
|
|
228
231
|
} else if (this.props.location.query.module !== "library" || (this.props.location.query.module === "library" && !this.props.templateData)) {
|
|
229
232
|
// Extract drag_drop_id - check multiple possible paths
|
|
@@ -234,6 +237,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
234
237
|
|| _.get(this.props.Templates.BEETemplate, 'versions.base.drag_drop_id')
|
|
235
238
|
|| _.get(this.props.Templates.BEETemplate, 'versions.base.id')
|
|
236
239
|
|| this.props.Templates.BEETemplate?._id;
|
|
240
|
+
console.log('[Rafeeq manzoor] comes here 2');
|
|
237
241
|
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'create', undefined, isBEESupport, isBEEAppEnable);
|
|
238
242
|
}
|
|
239
243
|
}
|
|
@@ -286,8 +290,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
286
290
|
|
|
287
291
|
if (this.props.params.id) {
|
|
288
292
|
const activeTabForLang = beeTemplate.versions?.base?.activeTab || 'en';
|
|
293
|
+
console.log('[Rafeeq manzoor] comes here 3');
|
|
289
294
|
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'open', activeTabForLang, isBEESupport, isBEEAppEnable);
|
|
290
295
|
} else {
|
|
296
|
+
console.log('[Rafeeq manzoor] comes here 4');
|
|
291
297
|
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'create', undefined, isBEESupport, isBEEAppEnable);
|
|
292
298
|
}
|
|
293
299
|
}
|
|
@@ -298,6 +304,24 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
298
304
|
if (!this.props.params?.id && this.props.Templates?.selectedEmailLayout) {
|
|
299
305
|
this.setState((prev) => ({ loadingStatus: Math.max(prev.loadingStatus, 2) }));
|
|
300
306
|
}
|
|
307
|
+
|
|
308
|
+
// For loyalty library mode: componentWillReceiveProps may never fire if Redux state is
|
|
309
|
+
// already stable after mount (schema cached, BEETemplate already empty). Call
|
|
310
|
+
// startTemplateCreation directly here so the BEE editor always initialises.
|
|
311
|
+
if (
|
|
312
|
+
!this.templateCreationStarted
|
|
313
|
+
&& this.state.isEdit
|
|
314
|
+
&& this.props.moduleType === LOYALTY
|
|
315
|
+
&& this.props.location.query.module === 'library'
|
|
316
|
+
&& !_.isEmpty(this.props.templateData)
|
|
317
|
+
&& !this.props.params.id
|
|
318
|
+
&& !this.props.isGetFormData
|
|
319
|
+
&& _.isEmpty(_.get(this, `state.formData['template-subject']`))
|
|
320
|
+
) {
|
|
321
|
+
this.templateCreationStarted = true;
|
|
322
|
+
console.log('[componentDidMount] loyalty library - calling startTemplateCreation directly', this.props.templateData);
|
|
323
|
+
this.startTemplateCreation(this.props.templateData);
|
|
324
|
+
}
|
|
301
325
|
}
|
|
302
326
|
|
|
303
327
|
|
|
@@ -331,6 +355,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
331
355
|
this.getFormData();
|
|
332
356
|
}
|
|
333
357
|
}
|
|
358
|
+
console.log('[Rafeeq manzoor] nextProps', nextProps, _.isEmpty(this.state.formData));
|
|
334
359
|
if (this.state.languageDataSet && nextProps.Templates.selectedEmailLayout && nextProps.Templates.selectedEmailLayout !== '' && !_.isEqual(this.props.Templates.selectedEmailLayout, nextProps.Templates.selectedEmailLayout )) {
|
|
335
360
|
this.setNewLanguageContent(nextProps.Templates.selectedEmailLayout);
|
|
336
361
|
}
|
|
@@ -359,6 +384,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
359
384
|
}, 0);
|
|
360
385
|
}
|
|
361
386
|
if (nextProps.currentOrgDetails && nextProps.currentOrgDetails.basic_details && !_.isEmpty(nextProps.currentOrgDetails.basic_details) && _.isEmpty(this.state.formData)) {
|
|
387
|
+
console.log('[Rafeeq manzoor] if condition');
|
|
362
388
|
const formData = this.initFormData(nextProps);
|
|
363
389
|
formData['template-version-options'] = [
|
|
364
390
|
{
|
|
@@ -452,8 +478,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
452
478
|
// Extract langId from active tab
|
|
453
479
|
const activeTabForLang = beeTemplate.versions?.base?.activeTab || 'en';
|
|
454
480
|
if (hasParamsId) {
|
|
481
|
+
console.log('[Rafeeq manzoor] comes here 5');
|
|
455
482
|
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'open', activeTabForLang, isBEESupport, isBEEAppEnable);
|
|
456
483
|
} else if (nextProps.location.query.module !== "library" || (nextProps.location.query.module === "library" && !nextProps.templateData)) {
|
|
484
|
+
console.log('[Rafeeq manzoor] comes here 6');
|
|
457
485
|
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'create', undefined, isBEESupport, isBEEAppEnable);
|
|
458
486
|
}
|
|
459
487
|
}
|
|
@@ -470,7 +498,12 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
470
498
|
}
|
|
471
499
|
});
|
|
472
500
|
}
|
|
473
|
-
|
|
501
|
+
console.log('[Rafeeq manzoor] here we have data 1', this.state.isEdit, nextProps.location.query.module);
|
|
502
|
+
console.log('[Rafeeq manzoor] here we have data 2', nextProps.templateData, !_.isEmpty(nextProps.templateData), this.props.params.id, nextProps.isGetFormData);
|
|
503
|
+
console.log('[Rafeeq manzoor] here we have data 3', _.isEmpty(_.get(this, `state.formData['template-subject']`)));
|
|
504
|
+
|
|
505
|
+
if (!this.templateCreationStarted && this.state.isEdit && nextProps.moduleType === LOYALTY && nextProps.location.query.module === "library" && !_.isEmpty(nextProps.templateData) && !this.props.params.id && !nextProps.isGetFormData && _.isEmpty(_.get(this, `state.formData['template-subject']`))) {
|
|
506
|
+
this.templateCreationStarted = true;
|
|
474
507
|
this.startTemplateCreation(nextProps.templateData);
|
|
475
508
|
}
|
|
476
509
|
if (nextProps.location.query.module === 'library' && nextProps.isGetFormData && (this.props.isGetFormData !== nextProps.isGetFormData)) {
|
|
@@ -1238,6 +1271,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1238
1271
|
// formData.base.activeTab = language;
|
|
1239
1272
|
// }
|
|
1240
1273
|
if (language && editData.versions.base[language].is_drag_drop && isBEEAppEnable) {
|
|
1274
|
+
console.log('[Rafeeq manzoor] comes here 7');
|
|
1241
1275
|
this.props.actions.getCmsSetting(BEE_PLUGIN, editData._id, 'open', language, isBEESupport, isBEEAppEnable);
|
|
1242
1276
|
}
|
|
1243
1277
|
});
|
|
@@ -1461,6 +1495,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1461
1495
|
const currentTab = this.state.currentTab - 1;
|
|
1462
1496
|
const baseLanguage = this.props.currentOrgDetails.basic_details.base_language ? this.props.currentOrgDetails.basic_details.base_language : 'en';
|
|
1463
1497
|
if (formData[currentTab][baseLanguage].is_drag_drop && isBEEAppEnable) {
|
|
1498
|
+
console.log('[Rafeeq manzoor] comes here 8');
|
|
1464
1499
|
this.props.actions.getCmsSetting(BEE_PLUGIN, formData[currentTab][baseLanguage].drag_drop_id, 'duplicate', baseLanguage, isEdmSupport, isBEEAppEnable);
|
|
1465
1500
|
}
|
|
1466
1501
|
});
|
|
@@ -1639,6 +1674,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1639
1674
|
if (content.id) {
|
|
1640
1675
|
tmpData.id = content.id;
|
|
1641
1676
|
}
|
|
1677
|
+
if (content.drag_drop_id) {
|
|
1678
|
+
tmpData.drag_drop_id = content.drag_drop_id;
|
|
1679
|
+
}
|
|
1642
1680
|
}
|
|
1643
1681
|
newFormData.base = _.cloneDeep(tmpData);
|
|
1644
1682
|
newFormData.secondary_templates.push({template_data: tmpData});
|
|
@@ -2515,6 +2553,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2515
2553
|
const isBEEAppEnable = this.checkBeeEditorAllowedForLibrary();
|
|
2516
2554
|
if (templates.drag_drop_id && isBEEAppEnable) {
|
|
2517
2555
|
tempData.drag_drop_id = templates.drag_drop_id;
|
|
2556
|
+
console.log('[Rafeeq manzoor] comes here 9');
|
|
2518
2557
|
this.props.actions.getCmsSetting(BEE_PLUGIN, tempData._id, 'open', tempData.iso_code, isEdmSupport, isBEEAppEnable);
|
|
2519
2558
|
}
|
|
2520
2559
|
// formData.usingTabContainer = true;
|
|
@@ -2535,13 +2574,17 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2535
2574
|
});
|
|
2536
2575
|
this.addLanguage(false, formData, false, additionalLanguages);
|
|
2537
2576
|
}
|
|
2577
|
+
console.log("[Rafeeq manzoor] comes here lib 1", formData[0])
|
|
2538
2578
|
formData.base = _.cloneDeep(formData[0]);
|
|
2539
2579
|
if (formData?.['template-subject'] !== '') {
|
|
2580
|
+
console.log("[Rafeeq manzoor] comes here lib 1 if", formData)
|
|
2540
2581
|
this.setState({formData, loading: false, injectedTags: data.tags, tabKey, isDragDrop: (data.base.is_drag_drop !== 0 )}, () => {
|
|
2541
2582
|
// this.setState({tabKey: ''});
|
|
2542
2583
|
const isBEEEnable = this.checkBeeEditorAllowedForLibrary();
|
|
2584
|
+
console.log("[Rafeeq manzoor] comes here lib 1 isBEEEnable", isBEEEnable)
|
|
2543
2585
|
_.forEach(formData[0].selectedLanguages, (language) => {
|
|
2544
2586
|
if (formData[0][language].is_drag_drop && isBEEEnable) {
|
|
2587
|
+
console.log('[Rafeeq manzoor] comes here 10');
|
|
2545
2588
|
this.props.actions.getCmsSetting(BEE_PLUGIN, formData[0][language].drag_drop_id, 'open', language, isEdmSupport, isBEEEnable);
|
|
2546
2589
|
}
|
|
2547
2590
|
});
|
|
@@ -2884,6 +2927,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2884
2927
|
// let getQuery = '';
|
|
2885
2928
|
const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
|
|
2886
2929
|
const isBEEAppEnable = this.checkBeeEditorAllowedForLibrary();
|
|
2930
|
+
console.log('[Rafeeq manzoor] comes here 11');
|
|
2887
2931
|
this.props.actions.getCmsSetting(BEE_PLUGIN, data._id, 'create', this.state.formData[this.state.currentTab - 1].activeTab, isEdmSupport, isBEEAppEnable);
|
|
2888
2932
|
// this.props.templatesActions.setEdmTemplate(data);
|
|
2889
2933
|
this.toggleEdmEmailTemplateSelection();
|