@capillarytech/creatives-library 7.17.136 → 7.17.137

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.17.136",
4
+ "version": "7.17.137",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -15,10 +15,10 @@ import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
15
15
  import './style.scss';
16
16
  // import messages from './messages';
17
17
  const loadScript = require('load-script');
18
- const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
19
- /*const defaultScriptUrl = 'https://nightly.intouch.capillarytech.com/arya/ui/library/ckeditor/ckeditor.js';
20
- **Uncomment the above line to use CKEDITOR in local
21
- */
18
+ // const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
19
+ const defaultScriptUrl = 'https://nightly.intouch.capillarytech.com/arya/ui/library/ckeditor/ckeditor.js';
20
+ // **Uncomment the above line to use CKEDITOR in local
21
+ // */
22
22
  const user = localStorage.getItem('user');
23
23
  let locale = 'en';
24
24
  if (user && JSON.parse(user).lang) {
@@ -173,7 +173,7 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
173
173
  // setTimeout(() => {
174
174
  // this.editorInstance.name = this.id;
175
175
  // }, 5000);
176
-
176
+
177
177
  }
178
178
  }
179
179
 
@@ -219,7 +219,7 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
219
219
 
220
220
  let html = this.props.content;
221
221
  html = html.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"");
222
-
222
+
223
223
  this.editorInstance = window.CKEDITOR.appendTo(
224
224
  this.node,
225
225
  this.state.config,
@@ -22,7 +22,7 @@ import {
22
22
  import CapNavigation from '@capillarytech/cap-ui-library/CapNavigation';
23
23
  import configPath from '../../config/path';
24
24
  import * as Api from '../../services/api';
25
- import {CapLeftNavigatioOpenCss, CapLeftNavigationCss} from './style';
25
+ import { CapLeftNavigatioOpenCss, CapLeftNavigationCss } from './style';
26
26
  import { EMBEDDED } from './constants';
27
27
 
28
28
  const CapWrapper = styled.div`
@@ -48,7 +48,7 @@ export class NavigationBar extends React.Component {
48
48
  }
49
49
 
50
50
  initializeSelectedProduct = () => {
51
- const {location, intl: {formatMessage}} = this.props;
51
+ const { location, intl: { formatMessage } } = this.props;
52
52
  const { pathname } = location;
53
53
  const parentModule = pathname.substring(pathname.lastIndexOf('/') + 1);
54
54
  switch (parentModule) {
@@ -95,14 +95,14 @@ export class NavigationBar extends React.Component {
95
95
  };
96
96
 
97
97
  onHelpIconClick = () => {
98
- const {helpUrl} = this.state;
98
+ const { helpUrl } = this.state;
99
99
  if (helpUrl) {
100
100
  window.open(helpUrl, '_blank');
101
101
  }
102
102
  };
103
103
 
104
104
  getTopbarIcons = (showDocumentationBot = false, isLatestLeftNavigationEnabled = false) => {
105
- const {settingsIcon} = this.state;
105
+ const { settingsIcon } = this.state;
106
106
  const ICONS = [
107
107
  {
108
108
  iconType: 'help',
@@ -112,7 +112,7 @@ export class NavigationBar extends React.Component {
112
112
  ];
113
113
  if (!isLatestLeftNavigationEnabled) {
114
114
  ICONS.push(settingsIcon);
115
- }
115
+ }
116
116
  return showDocumentationBot ? ICONS.slice(1) : ICONS; // If showDocumentationBot is true, help icon will be replaced by Aira icon on UI
117
117
 
118
118
  };
@@ -149,8 +149,10 @@ export class NavigationBar extends React.Component {
149
149
  handleLeftNavBarExpanded,
150
150
  leftNavbarExpandedProp,
151
151
  } = this.props;
152
+
152
153
  const accessibleDocFeatures = get(userData, 'currentOrgDetails.accessibleFeatures', []);
153
154
  const showDocumentationBot = !accessibleDocFeatures.includes(AI_DOCUMENTATION_BOT_DISABLED);
155
+
154
156
  const dropdownMenuProps = this.getDropdownMenu();
155
157
  const {
156
158
  currentOrgDetails: {
@@ -160,7 +162,7 @@ export class NavigationBar extends React.Component {
160
162
  const isLatestLeftNavigationEnabled = accessibleFeatures?.includes(
161
163
  ENABLE_NEW_LEFT_NAVIGATION,
162
164
  );
163
- const topbarIcons = this.getTopbarIcons(showDocumentationBot,isLatestLeftNavigationEnabled);
165
+ const topbarIcons = this.getTopbarIcons(showDocumentationBot, isLatestLeftNavigationEnabled);
164
166
  const topbarMenuDataModified = isLatestLeftNavigationEnabled ? [] : topbarMenuData;
165
167
  const headerOverideCss = isLatestLeftNavigationEnabled && (leftNavbarExpandedProp ? CapLeftNavigatioOpenCss : CapLeftNavigationCss);
166
168
  return (
@@ -592,6 +592,8 @@ export function SlideBoxContent(props) {
592
592
  cap={cap}
593
593
  onResetStep={onResetStep}
594
594
  showTemplateName={showTemplateName}
595
+ onEnterTemplateName={onEnterTemplateName}
596
+ onRemoveTemplateName={onRemoveTemplateName}
595
597
  onValidationFail={onValidationFail}
596
598
  forwardedTags={forwardedTags}
597
599
  selectedOfferDetails={selectedOfferDetails}
@@ -14,14 +14,15 @@ function SlideBoxFooter(props) {
14
14
  return (
15
15
  <div>
16
16
  <div>
17
+
17
18
  {props.shouldShowDoneFooter() && (
18
19
  <div>
19
- { isFullMode && isTemplateNameEmpty &&
20
+ { isFullMode && isTemplateNameEmpty &&
20
21
  <CapError type="error">
21
22
  <FormattedMessage {...messages.templateNameEmpty} />
22
- </CapError>
23
+ </CapError>
23
24
  }
24
- <CapButton onClick={onSave} disabled={isTemplateNameEmpty ||fetchingCmsData || false}>
25
+ <CapButton onClick={onSave} disabled={isTemplateNameEmpty || fetchingCmsData || false}>
25
26
  {isFullMode ?
26
27
  getFullModeSaveBtn(slidBoxContent)
27
28
  :
@@ -31,7 +32,7 @@ function SlideBoxFooter(props) {
31
32
  {/* {isFullMode && <CapButton type="secondary" onClick={onDiscard}><FormattedMessage {...messages.creativesTemplatesDiscard}/></CapButton>} */}
32
33
  </div>)}
33
34
  {props.shouldShowContinueFooter() &&
34
- <CapButton onClick={onCreateNextStep}>
35
+ <CapButton onClick={onCreateNextStep} >
35
36
  <FormattedMessage {...messages.continue} />
36
37
  </CapButton>
37
38
  }
@@ -52,5 +53,6 @@ SlideBoxFooter.propTypes = {
52
53
  shouldShowContinueFooter: PropTypes.func,
53
54
  shouldShowDoneFooter: PropTypes.func,
54
55
  isFullMode: PropTypes.bool,
56
+ isTemplateNameEmpty: PropTypes.bool,
55
57
  };
56
58
  export default SlideBoxFooter;
@@ -84,7 +84,7 @@ export class Creatives extends React.Component {
84
84
 
85
85
  componentDidMount() {
86
86
  GA.timeTracker.startTimer(CREATIVES_CONTAINER);
87
- if(!this.props?.isFullMode){
87
+ if (!this.props?.isFullMode) {
88
88
  this.props?.templateActions.getCdnTransformationConfig();
89
89
  }
90
90
  }
@@ -598,7 +598,7 @@ export class Creatives extends React.Component {
598
598
  const type = (get(this.props, "messageDetails.type") || '').toLowerCase();
599
599
  const sourceType = get(channelTemplate, 'definition.sourceType');
600
600
  if (type === LOYALTY) {
601
- if(sourceType === 'MAPP_SDK') {
601
+ if (sourceType === 'MAPP_SDK') {
602
602
  templateData.templateId = get(channelTemplate, '_id');
603
603
  templateData.licenseCode = get(channelTemplate, 'definition.licenseCode');
604
604
  templateData.gatewayId = get(channelTemplate, 'definition.gatewayId');
@@ -741,10 +741,10 @@ export class Creatives extends React.Component {
741
741
  header,
742
742
  footer,
743
743
  headerVarMapped,
744
- headerTemplate
744
+ headerTemplate,
745
745
  };
746
746
  const {
747
- whatsappDocName = '', whatsappDocSize, whatsappDocPages, whatsappDocImg = ''
747
+ whatsappDocName = '', whatsappDocSize, whatsappDocPages, whatsappDocImg = '',
748
748
  } = whatsappDocParams;
749
749
  switch (mediaType) {
750
750
  case (WHATSAPP_MEDIA_TYPES.IMAGE):
@@ -970,10 +970,10 @@ export class Creatives extends React.Component {
970
970
  const templateData = this.state.templateData ? this.state.templateData : template; //select existing or create new content
971
971
  const channel = templateData.type;
972
972
  const creativesData = this.getCreativesData(channel, template, templateData );// convers data to consumer understandable format
973
- creativesData.then(data=>{
973
+ creativesData.then((data) => {
974
974
  this.logGTMEvent(channel, data);
975
975
  this.props.getCreativesData(data);// send data to consumer
976
- })
976
+ });
977
977
  },
978
978
  );
979
979
  }
@@ -1031,7 +1031,7 @@ export class Creatives extends React.Component {
1031
1031
  }
1032
1032
  } else if (channel === constants.EMAIL && isFullMode) {
1033
1033
  const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL && currentStep !== 'createTemplateContent';
1034
- showFooter = isEmailCreate && emailCreateMode;
1034
+ showFooter = isEmailCreate && emailCreateMode && templateNameExists;
1035
1035
  }
1036
1036
  if (channel === constants.EMAIL && emailCreateMode === "upload") {
1037
1037
  showFooter = showFooter && !this.props.isUploading;
@@ -1105,7 +1105,7 @@ export class Creatives extends React.Component {
1105
1105
  onChange={(ev) => {
1106
1106
  const value = ev.currentTarget.value;
1107
1107
  const isEmptyTemplateName = value.trim() ? false : true;
1108
- this.setState({isTemplateNameEmpty : isEmptyTemplateName});
1108
+ this.setState({isTemplateNameEmpty: isEmptyTemplateName});
1109
1109
  const newFormData = {...formData, 'template-name': value};
1110
1110
  onFormDataChange(newFormData);
1111
1111
  }}
@@ -1116,7 +1116,7 @@ export class Creatives extends React.Component {
1116
1116
  if ([constants.EMAIL, constants.MOBILE_PUSH, constants.INAPP].includes(channel) && (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate')) {
1117
1117
  const name = get(formData, 'template-name');
1118
1118
  if (channel === constants.EMAIL && !name && slidBoxContent === 'createTemplate') {
1119
- this.setState({isTemplateNameEmpty:true});
1119
+ this.setState({isTemplateNameEmpty: true});
1120
1120
  }
1121
1121
  this.templateContainerDetails = {formData, onFormDataChange};
1122
1122
  if (name && !isEditName) {
@@ -546,18 +546,29 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
546
546
  window.removeEventListener("message", this.handleFrameTasks);
547
547
  this.props.actions.clearStoreValues();
548
548
  this.props.actions.clearCRUDResponse();
549
- delete window?.[CREATIVES_S3_ASSET_FILESIZES]
549
+ delete window?.[CREATIVES_S3_ASSET_FILESIZES];
550
550
  }
551
551
 
552
552
  onFormDataChange = (updatedFormData, tabCount, currentTab) => {
553
553
  // this.transformFormData(formData);
554
554
  const formData = {...updatedFormData};
555
- if (this.props.defaultData && _.isEmpty(formData['template-name']) && this.props.isFullMode) {
556
- formData['template-name'] = _.get(this.props, "defaultData['template-name']");
555
+ const {defaultData = {}, isFullMode, showTemplateName, syncTemplateName} = this.props;
556
+ const templateName = formData['template-name'];
557
+ const defaultTemplateName = _.get(defaultData, 'template-name', "");
558
+
559
+ //sync back template name from from editing in create flow to wrapper when edited
560
+
561
+ if (_.isEmpty(templateName) && defaultTemplateName) {
562
+ syncTemplateName(defaultTemplateName);
563
+ } else {
564
+ syncTemplateName(templateName);
565
+ }
566
+ if (defaultData && _.isEmpty(templateName) && defaultTemplateName?.length >1 && isFullMode) {
567
+ formData['template-name'] = defaultTemplateName;
557
568
  }
558
569
  this.setState({formData, tabCount, isSchemaChanged: false}, () => {
559
- if (this.props.isFullMode) {
560
- this.props.showTemplateName({formData, onFormDataChange: this.onFormDataChange});
570
+ if (isFullMode) {
571
+ showTemplateName({formData, onFormDataChange: this.onFormDataChange});
561
572
  }
562
573
  });
563
574
  if (currentTab) {
@@ -647,7 +658,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
647
658
  this.state.editorInstanse.insertHtml(`${anchor}`);
648
659
  } else if (data === CUSTOMER_BARCODE_TAG && this.state.editorInstanse) {
649
660
  this.state.editorInstanse.insertHtml(`<img src="https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/8ebc8301-e262-45a6-bdab-ff0de91a.png?code={{${data}}}" />`);
650
- } else if (this.state.editorInstanse){
661
+ } else if (this.state.editorInstanse) {
651
662
  this.state.editorInstanse.insertHtml(`{{${data}}}`);
652
663
  }
653
664
  //this.resetCkEditorInstance(currentTab, formData, true, data);
@@ -2409,7 +2420,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2409
2420
 
2410
2421
  // if (saveCount === 0) {
2411
2422
 
2412
- this.props.actions.transformEmailTemplate(obj, (newEmail)=>{
2423
+ this.props.actions.transformEmailTemplate(obj, (newEmail) => {
2413
2424
  this.props.actions.createTemplate(newEmail, this.onUpdateTemplateComplete);
2414
2425
  });
2415
2426
  // } else {
@@ -2772,6 +2783,7 @@ Email.propTypes = {
2772
2783
  setIsLoadingContent: PropTypes.func,
2773
2784
  injectedTags: PropTypes.object,
2774
2785
  defaultData: PropTypes.object,
2786
+ syncTemplateName: PropTypes.func,
2775
2787
  showTemplateName: PropTypes.func,
2776
2788
  onValidationFail: PropTypes.func,
2777
2789
  selectedOfferDetails: PropTypes.array,
@@ -101,10 +101,16 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
101
101
  this.props.onResetStep();
102
102
  this.props.templatesActions.resetTemplateData();
103
103
  }
104
- onTemplateNameChange = ({target:{value}}) => {
104
+ onTemplateNameChange = ({target: {value}}) => {
105
+ const {onEnterTemplateName, onRemoveTemplateName} = this.props;
105
106
  this.setState({ templateName: value });
106
- const isEmptyTemplateName = value.trim() ? false : true;
107
- this.setState({isTemplateNameEmpty : isEmptyTemplateName});
107
+ const isEmptyTemplateName = value?.trim()?.length === 0;
108
+ this.setState({isTemplateNameEmpty: isEmptyTemplateName});
109
+ if (value && onEnterTemplateName) {
110
+ onEnterTemplateName();
111
+ } else if (onRemoveTemplateName) {
112
+ onRemoveTemplateName();
113
+ }
108
114
  }
109
115
  onChange = (e) => {
110
116
  this.props.onEmailModeChange(e.target.value);
@@ -131,8 +137,8 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
131
137
  gtmPush('creativeDetails', {
132
138
  channel: EMAIL,
133
139
  timeTaken,
134
- mode: 'uploadZip'
135
- });
140
+ mode: 'uploadZip',
141
+ });
136
142
  }
137
143
  handleFileUpload = (file = {}) => {
138
144
  const { templatesActions, intl, showNextStep, isUploading } = this.props;
@@ -185,7 +191,9 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
185
191
  useEditor = (id) => {
186
192
  this.setState({ modeContent: { id } }, this.props.showNextStep);
187
193
  }
188
-
194
+ onSyncTemplateName=(tempName) => {
195
+ this.setState({templateName: tempName});
196
+ }
189
197
  isShowEmailCreate = () => !_.isEmpty(this.state.selectedCreateMode) && (!_.isEmpty(this.props.EmailLayout) || this.props.SelectedEdmDefaultTemplate)
190
198
  render() {
191
199
  const {
@@ -243,10 +251,10 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
243
251
  {emailCreateMode === "upload" &&
244
252
  <div style={{ marginLeft: '8px' }}>
245
253
  <CapUploader onChange={this.useFileUpload} accept=".zip, .html, .htm" showUploadList={false}>
246
- { (isFullMode && isTemplateNameEmpty) &&
254
+ { (isFullMode && isTemplateNameEmpty) &&
247
255
  <CapError type="error">
248
256
  < FormattedMessage {...messages.emptyTemplateName} />
249
- </CapError>
257
+ </CapError>
250
258
  }
251
259
  <CapButton disabled={isFullMode && isTemplateNameEmpty}>{this.props.intl.formatMessage(messages.upload)}</CapButton>
252
260
  </CapUploader>
@@ -271,6 +279,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
271
279
  getDefaultTags={type}
272
280
  isFullMode={isFullMode}
273
281
  defaultData={{ 'template-name': templateName }}
282
+ syncTemplateName={this.onSyncTemplateName}
274
283
  cap={cap}
275
284
  showTemplateName={showTemplateName}
276
285
  onValidationFail={onValidationFail}
@@ -281,6 +290,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
281
290
  editor={editor}
282
291
  moduleType={moduleType}
283
292
  />}
293
+
284
294
  {!isShowEmailCreate && (
285
295
  <CmsTemplatesComponent
286
296
  cmsTemplates={CmsTemplates}
@@ -322,6 +332,8 @@ EmailWrapper.propTypes = {
322
332
  getCmsTemplatesInProgress: PropTypes.bool,
323
333
  currentOrgDetails: PropTypes.object,
324
334
  moduleType: PropTypes.string,
335
+ onEnterTemplateName: PropTypes.func,
336
+ onRemoveTemplateName: PropTypes.func,
325
337
  };
326
338
 
327
339
  const mapStateToProps = createStructuredSelector({
@@ -31,7 +31,7 @@ import { GA } from '@capillarytech/cap-ui-utils';
31
31
  import { CREATE, TRACK_CREATE_MPUSH } from '../../App/constants';
32
32
  import { MOBILE_PUSH } from '../../CreativesContainer/constants';
33
33
  import { getContent } from '../commonMethods';
34
- import { getCdnUrl } from '../../../utils/cdnTransformation'
34
+ import { getCdnUrl } from '../../../utils/cdnTransformation';
35
35
 
36
36
  const PrefixWrapper = styled.div`
37
37
  margin-right: 16px;
@@ -149,6 +149,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
149
149
  onFormDataChange = (formData, tabCount, currentTab, inputField) => {
150
150
  const newFormData = cloneDeep(formData);
151
151
  const {templateCta} = this.state;
152
+ const {syncTemplateName, defaultData = {}, isFullMode, showTemplateName} = this.props;
153
+
152
154
  if (!isEmpty(templateCta)) {
153
155
  newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-label`] = get(templateCta, 'name');
154
156
  newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action`] = get(templateCta, 'ctaTemplateDetails[0].buttonText');
@@ -157,6 +159,15 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
157
159
  newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-action2`] = get(templateCta, 'ctaTemplateDetails[1].buttonText');
158
160
  }
159
161
  }
162
+ const templateName = formData['template-name'];
163
+ const defaultTemplateName= get(defaultData, 'template-name') ?? ""
164
+ //sync back template name from from editing in create flow to wrapper when edited
165
+ if (isEmpty(templateName) && defaultTemplateName) {
166
+ syncTemplateName(defaultTemplateName);
167
+ } else {
168
+ syncTemplateName(templateName);
169
+ }
170
+
160
171
 
161
172
  // copy content code
162
173
  // if (newFormData[0]['copy-iphone-content'] === "") {
@@ -179,8 +190,12 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
179
190
  // newFormData[1]['copy-android-content'] = "";
180
191
  // }
181
192
  // }
182
- if (this.props.isFullMode && this.props.defaultData && isEmpty(formData['template-name'])) {
183
- newFormData['template-name'] = get(this.props, "defaultData['template-name']");
193
+
194
+ //assign newFormData['template-name'] to default name only once in inital render, if edited use latest form data
195
+ if (isFullMode && defaultData && isEmpty(templateName) && defaultTemplateName?.length>1) {
196
+ newFormData['template-name'] = defaultTemplateName;
197
+ } else {
198
+ newFormData['template-name'] = templateName;
184
199
  }
185
200
  if (inputField && inputField.id === "add-sec-cta") {
186
201
  if (!newFormData[0]["add-sec-cta"]) {
@@ -188,8 +203,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
188
203
  }
189
204
  }
190
205
  this.setState({formData: newFormData, tabCount, isSchemaChanged: !this.state.isSchemaChanged}, () => {
191
- if (this.props.isFullMode) {
192
- this.props.showTemplateName({formData: this.state.formData, onFormDataChange: this.onFormDataChange});
206
+ if (isFullMode) {
207
+ showTemplateName({formData: this.state.formData, onFormDataChange: this.onFormDataChange});
193
208
  }
194
209
  });
195
210
  };
@@ -204,7 +219,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
204
219
  this.setState({currentTab: data});
205
220
  };
206
221
  onTemplateNameChange = () => {
207
- //
222
+ //
208
223
  };
209
224
 
210
225
 
@@ -368,7 +383,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
368
383
  };
369
384
  obj.type = 'MOBILEPUSH';
370
385
  obj.name = formData['template-name'];
371
- if(this.props?.Templates?.selectedWeChatAccount?.sourceTypeName === 'MAPP_SDK') {
386
+ if (this.props?.Templates?.selectedWeChatAccount?.sourceTypeName === 'MAPP_SDK') {
372
387
  obj.definition = {
373
388
  accountId: this.props.Templates.selectedWeChatAccount.id,
374
389
  licenseCode: this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier,
@@ -1450,10 +1465,10 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
1450
1465
  //this function gets called from form bulder only when the form data is valid
1451
1466
  const obj = this.getTransformedData(formData);
1452
1467
  const content = getContent(obj);
1453
- const {
1468
+ const {
1454
1469
  definition: {
1455
- mode: definitionMode
1456
- }
1470
+ mode: definitionMode,
1471
+ },
1457
1472
  } = obj || {};
1458
1473
  const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
1459
1474
  this.props.actions.createTemplate(obj, (response) => {
@@ -1469,9 +1484,9 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
1469
1484
  timeTaken,
1470
1485
  content,
1471
1486
  mode: CREATE,
1472
- imageAdded: definitionMode === 'image'
1487
+ imageAdded: definitionMode === 'image',
1473
1488
  });
1474
-
1489
+
1475
1490
  this.discardValues();
1476
1491
  const message = this.props.intl.formatMessage(messages.messageCreateSuccess);
1477
1492
  CapNotification.success({message, key: 'createMpushSuccess'});
@@ -1865,6 +1880,7 @@ Create.propTypes = {
1865
1880
  iosCtasData: PropTypes.array,
1866
1881
  injectedTags: PropTypes.object,
1867
1882
  defaultData: PropTypes.object,
1883
+ syncTemplateName: PropTypes.func,
1868
1884
  showTemplateName: PropTypes.func,
1869
1885
  isGetFormData: PropTypes.bool,
1870
1886
  onValidationFail: PropTypes.func,
@@ -1893,4 +1909,4 @@ export default withCreatives({
1893
1909
  mapStateToProps,
1894
1910
  mapDispatchToProps,
1895
1911
  userAuth: false,
1896
- });
1912
+ });
@@ -56,6 +56,9 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
56
56
  templateName: "",
57
57
  };
58
58
  }
59
+
60
+
61
+
59
62
  onChange = (e) => {
60
63
  this.props.onMobilepushModeChange( e.target.value );
61
64
  };
@@ -68,6 +71,10 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
68
71
  onRemoveTemplateName();
69
72
  }
70
73
  }
74
+
75
+ onSyncTemplateName=(tempName)=>{
76
+ this.setState({templateName: tempName});
77
+ }
71
78
  render() {
72
79
  const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData} = this.props;
73
80
  const {templateName} = this.state;
@@ -101,6 +108,8 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
101
108
  getFormLibraryData={getFormData}
102
109
  setIsLoadingContent={setIsLoadingContent}
103
110
  defaultData={{"template-name": templateName}}
111
+ syncTemplateName={this.onSyncTemplateName}
112
+
104
113
  location={{
105
114
  pathname: `/mobilepush/create/${mobilePushCreateMode}`,
106
115
  query,
@@ -1368,7 +1368,7 @@ export const Whatsapp = (props) => {
1368
1368
  return true;
1369
1369
  }
1370
1370
  //if media type is image, video or document and the mediaType file is not uploaded
1371
- if (!isMediaTypeText && host === HOST_KARIX && karixFileHandle === '') {
1371
+ if (!isMediaTypeText && [HOST_KARIX, HOST_GUPSHUP].includes(host) && karixFileHandle === '') {
1372
1372
  return true;
1373
1373
  }
1374
1374
  if (templateHeaderError || templateFooterError) {