@capillarytech/creatives-library 7.10.43 → 7.10.45

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": "7.10.43",
4
+ "version": "7.10.45",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -47,7 +47,12 @@ function SlideBoxHeader(props) {
47
47
  const isWhatsappEdit = channel.toLowerCase() === WHATSAPP && slidBoxContent === 'editTemplate';
48
48
  const whatsappOverview = isWhatsappEdit && isFullMode;
49
49
  const headerMessage = whatsappOverview ? messages.whatsappOverview : messages.editMessageContent;
50
- const whatsappTemplateCategory = get(templateData, `versions.base.content.whatsapp.category`, '');
50
+ const {
51
+ whatsappTemplateName,
52
+ whatsappTemplateCategory,
53
+ } = templateData;
54
+ const whatsappName = whatsappTemplateName || templateData?.name;
55
+ const whatsappCategory = whatsappTemplateCategory || get(templateData, `versions.base.content.whatsapp.category`, '');
51
56
 
52
57
  return (
53
58
  <div key="creatives-container-slidebox-header-content">
@@ -80,10 +85,10 @@ function SlideBoxHeader(props) {
80
85
  isWhatsappEdit && (
81
86
  <>
82
87
  {renderWhatsappData("label1", <FormattedMessage {...whatsppMsg.templateNameLabel} />)}
83
- {renderWhatsappData("label2", templateData?.name)}
88
+ {renderWhatsappData("label2", whatsappName)}
84
89
  {renderWhatsappData("label3", <FormattedMessage {...whatsppMsg.labelSeperator} />)}
85
90
  {renderWhatsappData("label1", <FormattedMessage {...whatsppMsg.templateCategoryLabel} />)}
86
- {renderWhatsappData("label2", formatString(whatsappTemplateCategory))}
91
+ {renderWhatsappData("label2", formatString(whatsappCategory))}
87
92
  {renderWhatsappData("label3", <FormattedMessage {...whatsppMsg.labelSeperator} />)}
88
93
  {renderWhatsappData("label1", <FormattedMessage {...whatsppMsg.languageLabel} />)}
89
94
  {renderWhatsappData("label2", <FormattedMessage {...whatsppMsg.templateLanguageEnglish} />)}
@@ -601,12 +601,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
601
601
  creativesParams._id = pathname.split('/')[3];
602
602
  creativesParams.modeType = pathname.split('/')[4];
603
603
  creativesParams.account = pathname.split('/')[5];
604
- if (this.state.channel.toLowerCase() === WHATSAPP_LOWERCASE){
604
+ if (this.state.channel.toLowerCase() === WHATSAPP_LOWERCASE) {
605
605
  const whatsappSelectedTemplateData = this.selectTemplate(creativesParams._id) || {};
606
- creativesParams = {
607
- ...creativesParams,
608
- ...whatsappSelectedTemplateData,
609
- };
606
+ const { name = '', versions = {} } = whatsappSelectedTemplateData;
607
+ creativesParams.whatsappTemplateName = name;
608
+ creativesParams.whatsappTemplateCategory = get(versions, `base.content.whatsapp.category`, '');
610
609
  }
611
610
  }
612
611
  creativesParams.type = this.state.channel.toUpperCase();
@@ -135,9 +135,11 @@ export const Whatsapp = (props) => {
135
135
  const paramObj = params || {};
136
136
  useEffect(() => {
137
137
  const { id } = paramObj;
138
- if (id && !get(templateData, `versions.base.content`)) {
139
- setSpin(true);
140
- actions.getTemplateDetails(id);
138
+ if (id) {
139
+ if (isFullMode) {
140
+ setSpin(true);
141
+ actions.getTemplateDetails(id);
142
+ }
141
143
  setEditFlow(true);
142
144
  }
143
145
  //cleanup code