@capillarytech/creatives-library 9.0.26 → 9.0.29
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
|
@@ -237,39 +237,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
237
237
|
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'create', undefined, isBEESupport, isBEEAppEnable);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
// The <Email> direct path (SlideBoxContent routes here when
|
|
241
|
-
// templateData.base.is_drag_drop is true) bypasses EmailWrapper/useEmailWrapper,
|
|
242
|
-
// so Templates.BEETemplate is never seeded and a created/edited drag-drop would
|
|
243
|
-
// open as the HTML editor. Seed isDragDrop + the BEE plugin from the inline
|
|
244
|
-
// templateData so it opens as BEE.
|
|
245
|
-
if (_.isEmpty(this.props.Templates.BEETemplate) && !_.isEmpty(this.props.templateData)) {
|
|
246
|
-
const td = this.props.templateData;
|
|
247
|
-
const activeTab = _.get(td, 'versions.base.activeTab', 'en');
|
|
248
|
-
// This path bypasses setEditData, so seed the subject from the inline
|
|
249
|
-
// templateData too (otherwise the title is empty for a created drag-drop).
|
|
250
|
-
const inlineSubject = _.get(td, 'base.subject')
|
|
251
|
-
|| _.get(td, `versions.base.${activeTab}.subject`)
|
|
252
|
-
|| _.get(td, 'versions.base.subject')
|
|
253
|
-
|| _.get(td, 'emailSubject')
|
|
254
|
-
|| _.get(td, 'subject');
|
|
255
|
-
if (inlineSubject) {
|
|
256
|
-
formData['template-subject'] = inlineSubject;
|
|
257
|
-
}
|
|
258
|
-
const inlineIsDragDrop = _.get(td, 'base.is_drag_drop')
|
|
259
|
-
|| _.get(td, `versions.base.${activeTab}.is_drag_drop`)
|
|
260
|
-
|| _.get(td, 'versions.base.is_drag_drop')
|
|
261
|
-
|| _.get(td, 'is_drag_drop');
|
|
262
|
-
if ((inlineIsDragDrop === true || inlineIsDragDrop === 1) && isBEEAppEnable) {
|
|
263
|
-
this.setState({ isDragDrop: true });
|
|
264
|
-
const inlineDragDropId = _.get(td, 'base.drag_drop_id')
|
|
265
|
-
|| _.get(td, 'base.id')
|
|
266
|
-
|| _.get(td, `versions.base.${activeTab}.drag_drop_id`)
|
|
267
|
-
|| _.get(td, `versions.base.${activeTab}.id`)
|
|
268
|
-
|| _.get(td, 'drag_drop_id')
|
|
269
|
-
|| _.get(td, 'id');
|
|
270
|
-
this.props.actions.getCmsSetting(BEE_PLUGIN, inlineDragDropId, this.props.params.id ? 'open' : 'create', undefined, isBEESupport, isBEEAppEnable);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
240
|
const hasUploadedContent = !this.props.params?.id && this.props.Templates?.selectedEmailLayout && !_.isEmpty(formData);
|
|
274
241
|
this.setState({
|
|
275
242
|
content: (this.props.Templates.selectedEmailLayout ? this.props.Templates.selectedEmailLayout : ''),
|
|
@@ -586,21 +553,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
586
553
|
const beeToken = `BEEeditor${currentTab > 1 ? currentTab : ''}token`;
|
|
587
554
|
let beeJsonValue = '';
|
|
588
555
|
const selectedId = _.get(this.props, 'Email.templateDetails._id', '') || _.get(this.props, 'Templates.BEETemplate.versions.base.drag_drop_id', '');
|
|
589
|
-
|
|
590
|
-
// Embedded journey content: the inline templateData carries the user's
|
|
591
|
-
// edited BEE json (base.json_content), which is more current than the
|
|
592
|
-
// reusable template fetched via getTemplateDetails. Prefer it so a
|
|
593
|
-
// re-edit shows the saved edit instead of the original template. For
|
|
594
|
-
// the create/gallery flow this key is absent, so we fall through to the
|
|
595
|
-
// existing sources (template details / BEETemplate) unchanged.
|
|
596
|
-
beeJsonValue = _.get(nextProps, 'templateData.base.json_content', '')
|
|
597
|
-
|| _.get(nextProps, 'templateData.json_content', '');
|
|
598
|
-
|
|
556
|
+
|
|
599
557
|
// Get beeJsonValue from template data - check multiple sources
|
|
600
558
|
// First check if it's already in formData (from setEditData)
|
|
601
|
-
|
|
602
|
-
beeJsonValue = _.get(this.state, `formData[${currentTab - 1}][${langId}].json-content`, '');
|
|
603
|
-
}
|
|
559
|
+
beeJsonValue = _.get(this.state, `formData[${currentTab - 1}][${langId}].json-content`, '');
|
|
604
560
|
|
|
605
561
|
// Also check formData.base
|
|
606
562
|
if (!beeJsonValue) {
|
|
@@ -1183,14 +1139,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1183
1139
|
const type = this.props.location.query.type;
|
|
1184
1140
|
|
|
1185
1141
|
formData['template-name'] = editData.name;
|
|
1186
|
-
|
|
1187
|
-
// emailSubject) over the fetched template's subject, so subject edits persist
|
|
1188
|
-
// on re-open. setEditData runs once (guarded by editDataSet), so this is a
|
|
1189
|
-
// one-time load-time override and won't fight typing in the subject field.
|
|
1190
|
-
const inlineSubject = _.get(this.props, 'templateData.base.subject', '')
|
|
1191
|
-
|| _.get(this.props, 'templateData.emailSubject', '')
|
|
1192
|
-
|| _.get(this.props, 'templateData.subject', '');
|
|
1193
|
-
const subject = inlineSubject || _.get(editData, 'versions.base.subject', '');
|
|
1142
|
+
const subject = _.get(editData, 'versions.base.subject', '');
|
|
1194
1143
|
formData['template-subject'] = subject;
|
|
1195
1144
|
formData.base = editData.versions.base;
|
|
1196
1145
|
|
|
@@ -234,18 +234,13 @@ const useEmailWrapper = ({
|
|
|
234
234
|
// New flow: When template details are loaded and it's a BEE template, set it in Templates.BEETemplate
|
|
235
235
|
// This allows Email component to properly initialize and call getCmsSetting
|
|
236
236
|
const hasTemplateDetails = Email?.templateDetails && !isEmpty(Email.templateDetails);
|
|
237
|
-
// Inline templateData (e.g. a freshly-created drag-drop content, or a
|
|
238
|
-
// library add-creative -> select-template) is authoritative when no template
|
|
239
|
-
// details were fetched. Without seeding BEETemplate from it, setBEETemplate
|
|
240
|
-
// never fires for that flow and a BEE template opens as the HTML editor.
|
|
241
|
-
const hasTemplateDataProp = templateData && !isEmpty(templateData);
|
|
242
237
|
// Note: We check Email?.BEETemplate as a proxy, but the actual BEETemplate is in Templates reducer
|
|
243
238
|
// The Email component will detect it via this.props.Templates.BEETemplate
|
|
244
239
|
const hasBEETemplate = Email?.BEETemplate && !isEmpty(Email.BEETemplate);
|
|
245
240
|
|
|
246
|
-
if (
|
|
241
|
+
if (hasTemplateDetails && !hasBEETemplate && templatesActions?.setBEETemplate && !beeTemplateSetRef.current) {
|
|
247
242
|
// Check if it's a BEE template
|
|
248
|
-
const editTemplateData =
|
|
243
|
+
const editTemplateData = Email.templateDetails;
|
|
249
244
|
const getIsDragDrop = (data) => {
|
|
250
245
|
if (!data) return false;
|
|
251
246
|
const baseDragDrop = get(data, 'versions.base.is_drag_drop', false);
|
|
@@ -301,10 +296,10 @@ const useEmailWrapper = ({
|
|
|
301
296
|
}
|
|
302
297
|
|
|
303
298
|
// Reset ref when template changes (template details cleared)
|
|
304
|
-
if (!hasTemplateDetails &&
|
|
299
|
+
if (!hasTemplateDetails && beeTemplateSetRef.current) {
|
|
305
300
|
beeTemplateSetRef.current = false;
|
|
306
301
|
}
|
|
307
|
-
}, [Email?.templateDetails, Email?.BEETemplate, Email?.getTemplateDetailsInProgress, Email?.fetchingCmsSettings, templatesActions, emailActions, params?.id, location?.query, checkBeeEditorEnabled, isFullMode
|
|
302
|
+
}, [Email?.templateDetails, Email?.BEETemplate, Email?.getTemplateDetailsInProgress, Email?.fetchingCmsSettings, templatesActions, emailActions, params?.id, location?.query, checkBeeEditorEnabled, isFullMode]);
|
|
308
303
|
|
|
309
304
|
const onChange = useCallback((e) => {
|
|
310
305
|
const { target: { value } } = e;
|