@capillarytech/creatives-library 9.0.21 → 9.0.24

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "9.0.21",
4
+ "version": "9.0.24",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -197,9 +197,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
197
197
  // Embedded campaign content is authoritative via the inline templateData
198
198
  // prop; fetching by id would pull reusable-template data and drop the
199
199
  // inline BEE json_content. Only fetch for real reusable-template edits.
200
- if (this.props.params.id && this.props.location.query.type !== 'embedded') {
201
200
  this.props.actions.getTemplateDetails(this.props.params.id, 'email');
202
- }
203
201
  });
204
202
  }
205
203
  // formData[0] = {
@@ -462,7 +460,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
462
460
  }
463
461
  }
464
462
 
465
- if (this.state.isEdit && !this.state.editDataSet && !_.isEmpty(nextProps.Email.templateDetails) && !_.isEmpty(this.state.schema) && nextProps.location.query.type !== 'embedded') {
463
+ if (this.state.isEdit && !this.state.editDataSet && !_.isEmpty(nextProps.Email.templateDetails) && !_.isEmpty(this.state.schema)) {
466
464
  this.setState({editDataSet: true}, () => {
467
465
  this.setEditData(nextProps.Email.templateDetails);
468
466
  // Update template name in parent if available
@@ -617,9 +615,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
617
615
  'json-content': finalBeeJsonValue,
618
616
  };
619
617
 
620
- // Ensure template-subject is preserved at the top level
618
+ // Ensure template-subject is preserved at the top level. For embedded
619
+ // content templateDetails isn't fetched, so also read the subject from
620
+ // the inline templateData prop (base.subject / subject / emailSubject).
621
621
  if (formData['template-subject'] === undefined || formData['template-subject'] === '') {
622
- const subjectFromEditData = _.get(nextProps, 'Email.templateDetails.versions.base.subject', '');
622
+ const subjectFromEditData = _.get(nextProps, 'Email.templateDetails.versions.base.subject', '')
623
+ || _.get(nextProps, 'templateData.base.subject', '')
624
+ || _.get(nextProps, 'templateData.subject', '')
625
+ || _.get(nextProps, 'templateData.emailSubject', '');
623
626
  if (subjectFromEditData) {
624
627
  formData['template-subject'] = subjectFromEditData;
625
628
  }
@@ -2473,8 +2476,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2473
2476
  formData[0].selectedLanguages = [];
2474
2477
  let tabKey;
2475
2478
  if ((this.props.location.query.isLanguageSupport === undefined || this.props.location.query.isLanguageSupport === 'false')) {
2476
- // If formData['template-subject'] is empty, assign an empty string; otherwise, retain its current value or use data.base.subject.
2477
- formData['template-subject'] = formData?.['template-subject'] === '' ? '' : (data?.base?.subject || '');
2479
+ // Prefer the saved subject from the inline templateData (base.subject);
2480
+ // fall back to any existing value. The previous `=== '' ? '' :` guard kept
2481
+ // an empty subject on open for embedded content (which routes through
2482
+ // startTemplateCreation), dropping data.base.subject.
2483
+ formData['template-subject'] = data?.base?.subject || formData?.['template-subject'] || '';
2478
2484
  const baseLanguage = this.props.currentOrgDetails.basic_details.base_language;
2479
2485
  let languageIndex = _.findIndex(this.supportedLanguages, {iso_code: baseLanguage});
2480
2486