@capillarytech/creatives-library 8.0.345-alpha.10 → 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.345-alpha.10",
4
+ "version": "8.0.345-alpha.11",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -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": {
@@ -302,6 +304,24 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
302
304
  if (!this.props.params?.id && this.props.Templates?.selectedEmailLayout) {
303
305
  this.setState((prev) => ({ loadingStatus: Math.max(prev.loadingStatus, 2) }));
304
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
+ }
305
325
  }
306
326
 
307
327
 
@@ -482,7 +502,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
482
502
  console.log('[Rafeeq manzoor] here we have data 2', nextProps.templateData, !_.isEmpty(nextProps.templateData), this.props.params.id, nextProps.isGetFormData);
483
503
  console.log('[Rafeeq manzoor] here we have data 3', _.isEmpty(_.get(this, `state.formData['template-subject']`)));
484
504
 
485
- if (this.state.isEdit && nextProps.location.query.module === "library" && !_.isEmpty(nextProps.templateData) && !this.props.params.id && !nextProps.isGetFormData && _.isEmpty(_.get(this, `state.formData['template-subject']`))) {
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;
486
507
  this.startTemplateCreation(nextProps.templateData);
487
508
  }
488
509
  if (nextProps.location.query.module === 'library' && nextProps.isGetFormData && (this.props.isGetFormData !== nextProps.isGetFormData)) {
package/.npmrx DELETED
@@ -1,2 +0,0 @@
1
- npm config set scope capillarytech
2
- //registry.npmjs.org/:_authToken=${NPM_TOKEN}