@capillarytech/creatives-library 2.0.63 → 2.0.65

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.
@@ -3074,7 +3074,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3074
3074
  const currentLang = this.state.formData[this.state.currentTab - 1].selectedLanguages[index];
3075
3075
  paneTabKey = this.state.formData[this.state.currentTab - 1] && this.state.formData[this.state.currentTab - 1][currentLang] && this.state.formData[this.state.currentTab - 1][currentLang].tabKey;
3076
3076
  }
3077
- if (pane.isSupported) {
3077
+ const isPaneSupported = typeof pane.isSupported === "boolean" ? pane.isSupported : true; // pane.isSupported field exists only in mpush schema, in other channels it is not
3078
+ if (isPaneSupported) {
3078
3079
  renderedPanes.push(
3079
3080
  <TabPane
3080
3081
  forceRender
@@ -177,7 +177,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
177
177
  onFormDataChange = (formData, tabCount) => {
178
178
  const newFormData = cloneDeep(formData);
179
179
  const {templateCta} = this.state;
180
- if (templateCta) {
180
+ if (!isEmpty(templateCta)) {
181
181
  newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-label`] = templateCta.name;
182
182
  newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action`] = templateCta.ctaTemplateDetails[0].buttonText;
183
183
  delete newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action2`];
@@ -420,6 +420,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
420
420
  return undefined;
421
421
  }).filter((custom) => custom),
422
422
  };
423
+ obj.name = isEmpty(obj.name) ? android['message-title'] : obj.name;
423
424
  }
424
425
  if (android['cta-deeplink'] && android['cta-deeplink'] !== "") {
425
426
  obj.versions.base.ANDROID.cta = {
@@ -452,6 +453,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
452
453
  return undefined;
453
454
  }).filter((custom) => custom),
454
455
  };
456
+ obj.name = isEmpty(obj.name) ? ios['message-title2'] : obj.name;
455
457
  }
456
458
  if (ios['cta-deeplink2'] && ios['cta-deeplink2'] !== "") {
457
459
  obj.versions.base.IOS.cta = {
@@ -560,6 +562,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
560
562
  }
561
563
  if (secondaryCtaIos) {
562
564
  obj.versions.base.IOS.expandableDetails.ctas = [];
565
+ const templateCtaId = get(this.state, "templateCta.ctaTemplateDetails[0].id");
563
566
  const cta = {
564
567
  actionText: ios['secondary-cta-1-label'],
565
568
  actionLabel: ios['secondary-cta-1-action'],
@@ -567,7 +570,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
567
570
  type: ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL"),
568
571
  actionLink: ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? (ios['cta-deeplink-secondary-cta-1-select2'] || ios['cta-deeplink-secondary-cta-1-select']) : ios['cta-deeplink-secondary-cta-1-text']),
569
572
  ioscdeepLinkName: this.getLinkName(ios['cta-deeplink-secondary-cta-1-select']),
570
- templateCtaId: get(this.state, "templateCta.ctaTemplateDetails[0].id"),
573
+ templateCtaId,
571
574
  };
572
575
  if (this.props.location.query.type === 'embedded') {
573
576
  delete cta.ioscdeepLinkName;
@@ -227,7 +227,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
227
227
  console.log('Form data changed is ', formData, tabCount, currentTab);
228
228
  const newFormData = _.cloneDeep(formData);
229
229
  const {templateCta} = this.state;
230
- if (templateCta) {
230
+ if (!_.isEmpty(templateCta)) {
231
231
  newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-label`] = templateCta.name;
232
232
  newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action`] = templateCta.ctaTemplateDetails[0].buttonText;
233
233
  delete newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action2`];
@@ -547,6 +547,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
547
547
 
548
548
  if (secondaryCtaIos) {
549
549
  obj.versions.base.IOS.expandableDetails.ctas = [];
550
+ const templateCtaId = get(this.state, "templateCta.ctaTemplateDetails[0].id");
551
+
550
552
  const cta = {
551
553
  actionText: ios['secondary-cta-1-label'],
552
554
  actionLabel: ios['secondary-cta-1-action'],
@@ -554,7 +556,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
554
556
  type: ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL"),
555
557
  actionLink: ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? ios['cta-deeplink-secondary-cta-1-select2'] : ios['cta-deeplink-secondary-cta-1-text2']),
556
558
  ioscdeepLinkName: this.getLinkName(ios['cta-deeplink-secondary-cta-1-select']),
557
- templateCtaId: get(this.state, "templateCta.ctaTemplateDetails[0].id"),
559
+ templateCtaId,
558
560
  };
559
561
  if (this.props.location.query.type === 'embedded') {
560
562
  delete cta.ioscdeepLinkName;
@@ -770,7 +772,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
770
772
 
771
773
  getSchemaForFormData = (formdata, inputSchema) => {
772
774
  let schema = inputSchema;
773
- const formData = _.cloneDeep(formData);
775
+ const formData = _.cloneDeep(formdata);
774
776
  if (!_.isEmpty(formData[0])) {
775
777
  if (formData[0]['cta-deeplink']) {
776
778
  formData[0]['add-pri-cta'] = true;
@@ -470,6 +470,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
470
470
  templateData.content = template.versions.base['sms-editor'];
471
471
  } else if (currentChannel === "EMAIL") {
472
472
  templateData.url = template.versions.base.preview_http_url;
473
+ } else if (currentChannel === "MOBILEPUSH" && template.type === "MOBILEPUSH") {
474
+ templateData.content = template;
473
475
  }
474
476
  return templateData;
475
477
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "2.0.63",
4
+ "version": "2.0.65",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",