@capillarytech/creatives-library 9.0.28 → 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,41 +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
|
-
const inlineIsDragDrop = _.get(td, 'base.is_drag_drop')
|
|
249
|
-
|| _.get(td, `versions.base.${activeTab}.is_drag_drop`)
|
|
250
|
-
|| _.get(td, 'versions.base.is_drag_drop')
|
|
251
|
-
|| _.get(td, 'is_drag_drop');
|
|
252
|
-
// BEE-ONLY: everything below is gated on is_drag_drop so this fallback
|
|
253
|
-
// never touches the HTML/CKEditor flow (which also has an empty BEETemplate).
|
|
254
|
-
if ((inlineIsDragDrop === true || inlineIsDragDrop === 1) && isBEEAppEnable) {
|
|
255
|
-
this.setState({ isDragDrop: true });
|
|
256
|
-
// This path bypasses setEditData, so seed the subject from the inline
|
|
257
|
-
// templateData too (otherwise the title is empty for a created drag-drop).
|
|
258
|
-
const inlineSubject = _.get(td, 'base.subject')
|
|
259
|
-
|| _.get(td, `versions.base.${activeTab}.subject`)
|
|
260
|
-
|| _.get(td, 'versions.base.subject')
|
|
261
|
-
|| _.get(td, 'emailSubject')
|
|
262
|
-
|| _.get(td, 'subject');
|
|
263
|
-
if (inlineSubject) {
|
|
264
|
-
formData['template-subject'] = inlineSubject;
|
|
265
|
-
}
|
|
266
|
-
const inlineDragDropId = _.get(td, 'base.drag_drop_id')
|
|
267
|
-
|| _.get(td, 'base.id')
|
|
268
|
-
|| _.get(td, `versions.base.${activeTab}.drag_drop_id`)
|
|
269
|
-
|| _.get(td, `versions.base.${activeTab}.id`)
|
|
270
|
-
|| _.get(td, 'drag_drop_id')
|
|
271
|
-
|| _.get(td, 'id');
|
|
272
|
-
this.props.actions.getCmsSetting(BEE_PLUGIN, inlineDragDropId, this.props.params.id ? 'open' : 'create', undefined, isBEESupport, isBEEAppEnable);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
240
|
const hasUploadedContent = !this.props.params?.id && this.props.Templates?.selectedEmailLayout && !_.isEmpty(formData);
|
|
276
241
|
this.setState({
|
|
277
242
|
content: (this.props.Templates.selectedEmailLayout ? this.props.Templates.selectedEmailLayout : ''),
|
|
@@ -588,21 +553,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
588
553
|
const beeToken = `BEEeditor${currentTab > 1 ? currentTab : ''}token`;
|
|
589
554
|
let beeJsonValue = '';
|
|
590
555
|
const selectedId = _.get(this.props, 'Email.templateDetails._id', '') || _.get(this.props, 'Templates.BEETemplate.versions.base.drag_drop_id', '');
|
|
591
|
-
|
|
592
|
-
// Embedded journey content: the inline templateData carries the user's
|
|
593
|
-
// edited BEE json (base.json_content), which is more current than the
|
|
594
|
-
// reusable template fetched via getTemplateDetails. Prefer it so a
|
|
595
|
-
// re-edit shows the saved edit instead of the original template. For
|
|
596
|
-
// the create/gallery flow this key is absent, so we fall through to the
|
|
597
|
-
// existing sources (template details / BEETemplate) unchanged.
|
|
598
|
-
beeJsonValue = _.get(nextProps, 'templateData.base.json_content', '')
|
|
599
|
-
|| _.get(nextProps, 'templateData.json_content', '');
|
|
600
|
-
|
|
556
|
+
|
|
601
557
|
// Get beeJsonValue from template data - check multiple sources
|
|
602
558
|
// First check if it's already in formData (from setEditData)
|
|
603
|
-
|
|
604
|
-
beeJsonValue = _.get(this.state, `formData[${currentTab - 1}][${langId}].json-content`, '');
|
|
605
|
-
}
|
|
559
|
+
beeJsonValue = _.get(this.state, `formData[${currentTab - 1}][${langId}].json-content`, '');
|
|
606
560
|
|
|
607
561
|
// Also check formData.base
|
|
608
562
|
if (!beeJsonValue) {
|
|
@@ -1185,21 +1139,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1185
1139
|
const type = this.props.location.query.type;
|
|
1186
1140
|
|
|
1187
1141
|
formData['template-name'] = editData.name;
|
|
1188
|
-
|
|
1189
|
-
// (base.subject / emailSubject) over the fetched template's subject so subject
|
|
1190
|
-
// edits persist on re-open. Gated on is_drag_drop so the HTML/CKEditor flow is
|
|
1191
|
-
// untouched (it keeps using editData.versions.base.subject as before).
|
|
1192
|
-
// setEditData runs once (editDataSet), so this is a one-time load-time override.
|
|
1193
|
-
const tdIsDragDrop = _.get(this.props, 'templateData.base.is_drag_drop') === true
|
|
1194
|
-
|| _.get(this.props, 'templateData.base.is_drag_drop') === 1
|
|
1195
|
-
|| _.get(this.props, 'templateData.is_drag_drop') === true
|
|
1196
|
-
|| _.get(this.props, 'templateData.is_drag_drop') === 1;
|
|
1197
|
-
const inlineSubject = tdIsDragDrop
|
|
1198
|
-
? (_.get(this.props, 'templateData.base.subject', '')
|
|
1199
|
-
|| _.get(this.props, 'templateData.emailSubject', '')
|
|
1200
|
-
|| _.get(this.props, 'templateData.subject', ''))
|
|
1201
|
-
: '';
|
|
1202
|
-
const subject = inlineSubject || _.get(editData, 'versions.base.subject', '');
|
|
1142
|
+
const subject = _.get(editData, 'versions.base.subject', '');
|
|
1203
1143
|
formData['template-subject'] = subject;
|
|
1204
1144
|
formData.base = editData.versions.base;
|
|
1205
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;
|