@capillarytech/creatives-library 7.17.152-alpha.1 → 7.17.153

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.152-alpha.1",
4
+ "version": "7.17.153",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -15,6 +15,7 @@ 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
+
18
19
  const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
19
20
  /*const defaultScriptUrl = 'https://nightly.intouch.capillarytech.com/arya/ui/library/ckeditor/ckeditor.js';
20
21
  **Uncomment the above line to use CKEDITOR in local
@@ -173,7 +174,7 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
173
174
  // setTimeout(() => {
174
175
  // this.editorInstance.name = this.id;
175
176
  // }, 5000);
176
-
177
+
177
178
  }
178
179
  }
179
180
 
@@ -202,7 +203,7 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
202
203
  });
203
204
  }
204
205
  }
205
-
206
+
206
207
  onLoad = () => {
207
208
  this.setState({ scriptLoaded: true }, () => {
208
209
  this.initializeEditor();
@@ -211,7 +212,7 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
211
212
 
212
213
  initializeEditor = () => {
213
214
  if (this.unmounting) return;
214
-
215
+
215
216
  if (!window.CKEDITOR) {
216
217
  console.error("CKEditor not found");
217
218
  return;
@@ -219,13 +220,13 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
219
220
 
220
221
  let html = this.props.content;
221
222
  html = html.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"");
222
-
223
+
223
224
  this.editorInstance = window.CKEDITOR.appendTo(
224
225
  this.node,
225
226
  this.state.config,
226
227
  html
227
228
  );
228
-
229
+
229
230
 
230
231
  if (this.props.getEditorInstanse) {
231
232
  this.props.getEditorInstanse(this.editorInstance, this.props.id);
@@ -236,23 +237,22 @@ class Ckeditor extends React.Component { // eslint-disable-line react/prefer-sta
236
237
  // this.editorInstance.on('change', this.handleContentChange);
237
238
 
238
239
  // mode event is fired whenever mode is toggled from normal to source mode or vice versa
239
- // change event works only in wysiwyg(non-source) mode, key event works in both source & wysiwyg(non-source) mode but,
240
+ // change event works only in wysiwyg(non-source) mode, key event works in both source & wysiwyg(non-source) mode but,
240
241
  // key event doesn't get fired up while setting text to bold,italic etc..
241
- this.editorInstance.on('mode',()=>{
242
- if(this.editorInstance.mode==="source"){
243
- this.editorInstance.on('key',this.handleContentChange)
244
- }
245
- else{
246
- if(this.editorInstance.hasListeners("key")){
242
+ this.editorInstance.on('mode', () => {
243
+ if (this.editorInstance.mode === "source") {
244
+ this.editorInstance.on('key', this.handleContentChange);
245
+ } else {
246
+ if (this.editorInstance.hasListeners("key")) {
247
247
  /*Removing the 'key' listener is necessary. If not removed and the mode is switched in the following manner :
248
248
  source mode -> Non-source mode -> source mode,
249
- then under this scenario both 'key' and 'change' listener will get fired on entering text. Except that 'key' listener will not get fired when setting text to 'bold', 'italic' etc.
249
+ then under this scenario both 'key' and 'change' listener will get fired on entering text. Except that 'key' listener will not get fired when setting text to 'bold', 'italic' etc.
250
250
  */
251
- this.editorInstance.removeListener("key",this.handleContentChange)
251
+ this.editorInstance.removeListener("key", this.handleContentChange);
252
252
  }
253
- this.editorInstance.on('change',this.handleContentChange)
253
+ this.editorInstance.on('change', this.handleContentChange);
254
254
  }
255
- })
255
+ });
256
256
 
257
257
  _.forEach(this.props.events, (event, index) => {
258
258
  this.editorInstance.on(index, event);
@@ -569,9 +569,6 @@
569
569
  }
570
570
  }
571
571
  }
572
- .message-preview {
573
- left: 40%;
574
- }
575
572
  .android-push-message-Container, .iphone-push-message-Container{
576
573
  position: absolute;
577
574
  top: 11%;
@@ -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}
@@ -16,12 +16,12 @@ function SlideBoxFooter(props) {
16
16
  <div>
17
17
  {props.shouldShowDoneFooter() && (
18
18
  <div>
19
- { isFullMode && isTemplateNameEmpty &&
19
+ { isFullMode && isTemplateNameEmpty &&
20
20
  <CapError type="error">
21
21
  <FormattedMessage {...messages.templateNameEmpty} />
22
- </CapError>
22
+ </CapError>
23
23
  }
24
- <CapButton onClick={onSave} disabled={isTemplateNameEmpty ||fetchingCmsData || false}>
24
+ <CapButton onClick={onSave} disabled={isTemplateNameEmpty || fetchingCmsData || false}>
25
25
  {isFullMode ?
26
26
  getFullModeSaveBtn(slidBoxContent)
27
27
  :
@@ -52,5 +52,6 @@ SlideBoxFooter.propTypes = {
52
52
  shouldShowContinueFooter: PropTypes.func,
53
53
  shouldShowDoneFooter: PropTypes.func,
54
54
  isFullMode: PropTypes.bool,
55
+ isTemplateNameEmpty: PropTypes.bool,
55
56
  };
56
57
  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
+ if (syncTemplateName) {
561
+ syncTemplateName(_.isEmpty(templateName) && defaultTemplateName ? defaultTemplateName : templateName);
562
+ }
563
+
564
+ if (defaultData && _.isEmpty(templateName) && defaultTemplateName?.length >1 && isFullMode) {
565
+ formData['template-name'] = defaultTemplateName;
566
+ } else {
567
+ formData['template-name'] = templateName;
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 (this.props.isFullMode && showTemplateName) {
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 {
@@ -2767,6 +2778,7 @@ Email.propTypes = {
2767
2778
  getDefaultTags: PropTypes.string,
2768
2779
  currentOrgDetails: PropTypes.object,
2769
2780
  isLoadingMetaEntities: PropTypes.bool,
2781
+ syncTemplateName: PropTypes.func,
2770
2782
  // creativesContainerActions: PropTypes.object,
2771
2783
  isFullMode: PropTypes.bool,
2772
2784
  setIsLoadingContent: PropTypes.func,
@@ -101,10 +101,15 @@ 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}}) => {
105
- this.setState({ templateName: value });
106
- const isEmptyTemplateName = value.trim() ? false : true;
107
- this.setState({isTemplateNameEmpty : isEmptyTemplateName});
104
+ onTemplateNameChange = ({target: {value}}) => {
105
+ const {onEnterTemplateName, onRemoveTemplateName} = this.props;
106
+ const isEmptyTemplateName = !value?.trim();
107
+ this.setState({templateName: value, isTemplateNameEmpty: isEmptyTemplateName});
108
+ if (value && onEnterTemplateName) {
109
+ onEnterTemplateName();
110
+ } else if (onRemoveTemplateName) {
111
+ onRemoveTemplateName();
112
+ }
108
113
  }
109
114
  onChange = (e) => {
110
115
  this.props.onEmailModeChange(e.target.value);
@@ -131,8 +136,8 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
131
136
  gtmPush('creativeDetails', {
132
137
  channel: EMAIL,
133
138
  timeTaken,
134
- mode: 'uploadZip'
135
- });
139
+ mode: 'uploadZip',
140
+ });
136
141
  }
137
142
  handleFileUpload = (file = {}) => {
138
143
  const { templatesActions, intl, showNextStep, isUploading } = this.props;
@@ -185,7 +190,9 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
185
190
  useEditor = (id) => {
186
191
  this.setState({ modeContent: { id } }, this.props.showNextStep);
187
192
  }
188
-
193
+ onSyncTemplateName=(tempName) => {
194
+ this.setState({templateName: tempName});
195
+ }
189
196
  isShowEmailCreate = () => !_.isEmpty(this.state.selectedCreateMode) && (!_.isEmpty(this.props.EmailLayout) || this.props.SelectedEdmDefaultTemplate)
190
197
  render() {
191
198
  const {
@@ -243,10 +250,10 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
243
250
  {emailCreateMode === "upload" &&
244
251
  <div style={{ marginLeft: '8px' }}>
245
252
  <CapUploader onChange={this.useFileUpload} accept=".zip, .html, .htm" showUploadList={false}>
246
- { (isFullMode && isTemplateNameEmpty) &&
253
+ { (isFullMode && isTemplateNameEmpty) &&
247
254
  <CapError type="error">
248
255
  < FormattedMessage {...messages.emptyTemplateName} />
249
- </CapError>
256
+ </CapError>
250
257
  }
251
258
  <CapButton disabled={isFullMode && isTemplateNameEmpty}>{this.props.intl.formatMessage(messages.upload)}</CapButton>
252
259
  </CapUploader>
@@ -271,6 +278,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
271
278
  getDefaultTags={type}
272
279
  isFullMode={isFullMode}
273
280
  defaultData={{ 'template-name': templateName }}
281
+ syncTemplateName={this.onSyncTemplateName}
274
282
  cap={cap}
275
283
  showTemplateName={showTemplateName}
276
284
  onValidationFail={onValidationFail}
@@ -322,6 +330,8 @@ EmailWrapper.propTypes = {
322
330
  getCmsTemplatesInProgress: PropTypes.bool,
323
331
  currentOrgDetails: PropTypes.object,
324
332
  moduleType: PropTypes.string,
333
+ onEnterTemplateName: PropTypes.func,
334
+ onRemoveTemplateName: PropTypes.func,
325
335
  };
326
336
 
327
337
  const mapStateToProps = createStructuredSelector({
@@ -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,7 +159,16 @@ 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
  }
160
-
162
+
163
+ //sync back template name from from editing in create flow to wrapper when edited
164
+ const templateName = formData['template-name'];
165
+ const defaultTemplateName= get(defaultData, 'template-name') ?? ""
166
+ //sync back template name from from editing in create flow to wrapper when edited
167
+
168
+ if(syncTemplateName){
169
+ syncTemplateName(isEmpty(templateName) && defaultTemplateName?defaultTemplateName:templateName)
170
+ }
171
+
161
172
  // copy content code
162
173
  // if (newFormData[0]['copy-iphone-content'] === "") {
163
174
  //
@@ -179,8 +190,11 @@ 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
+ //assign newFormData['template-name'] to default name only once in inital render, if edited use latest form data
194
+ if (isFullMode && defaultData && isEmpty(templateName) && defaultTemplateName?.length>1) {
195
+ newFormData['template-name'] = defaultTemplateName;
196
+ } else {
197
+ newFormData['template-name'] = templateName;
184
198
  }
185
199
  if (inputField && inputField.id === "add-sec-cta") {
186
200
  if (!newFormData[0]["add-sec-cta"]) {
@@ -188,8 +202,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
188
202
  }
189
203
  }
190
204
  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});
205
+ if (isFullMode && showTemplateName) {
206
+ showTemplateName({formData: this.state.formData, onFormDataChange: this.onFormDataChange});
193
207
  }
194
208
  });
195
209
  };
@@ -1450,10 +1464,10 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
1450
1464
  //this function gets called from form bulder only when the form data is valid
1451
1465
  const obj = this.getTransformedData(formData);
1452
1466
  const content = getContent(obj);
1453
- const {
1467
+ const {
1454
1468
  definition: {
1455
- mode: definitionMode
1456
- }
1469
+ mode: definitionMode,
1470
+ },
1457
1471
  } = obj || {};
1458
1472
  const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
1459
1473
  this.props.actions.createTemplate(obj, (response) => {
@@ -1865,6 +1879,7 @@ Create.propTypes = {
1865
1879
  iosCtasData: PropTypes.array,
1866
1880
  injectedTags: PropTypes.object,
1867
1881
  defaultData: PropTypes.object,
1882
+ syncTemplateName: PropTypes.func,
1868
1883
  showTemplateName: PropTypes.func,
1869
1884
  isGetFormData: PropTypes.bool,
1870
1885
  onValidationFail: PropTypes.func,
@@ -56,6 +56,8 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
56
56
  templateName: "",
57
57
  };
58
58
  }
59
+
60
+
59
61
  onChange = (e) => {
60
62
  this.props.onMobilepushModeChange( e.target.value );
61
63
  };
@@ -68,6 +70,9 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
68
70
  onRemoveTemplateName();
69
71
  }
70
72
  }
73
+ onSyncTemplateName=(tempName) => {
74
+ this.setState({templateName: tempName});
75
+ }
71
76
  render() {
72
77
  const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData} = this.props;
73
78
  const {templateName} = this.state;
@@ -101,6 +106,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
101
106
  getFormLibraryData={getFormData}
102
107
  setIsLoadingContent={setIsLoadingContent}
103
108
  defaultData={{"template-name": templateName}}
109
+ syncTemplateName={this.onSyncTemplateName}
104
110
  location={{
105
111
  pathname: `/mobilepush/create/${mobilePushCreateMode}`,
106
112
  query,
@@ -1591,9 +1591,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1591
1591
  if (data.expandableDetails && data.expandableDetails.image) {
1592
1592
  bodyTextStyle.WebkitLineClamp = 3;
1593
1593
  }
1594
- const isFullMode = this.isFullMode();
1595
1594
  result = (
1596
- <div className={`${isFullMode} ? android-push-message-Container: message-preview android-push-message-Container `}>
1595
+ <div className="android-push-message-Container">
1597
1596
  <div className="message-pop align-left">
1598
1597
  <div className="message-container">
1599
1598
  <div className="app-name">
@@ -1403,7 +1403,8 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
1403
1403
  type: WHATSAPP,
1404
1404
  });
1405
1405
  };
1406
-
1406
+ const isMediatypeValid =()=> ((isMediaTypeImage && whatsappImageSrc === "") || (isMediaTypeVideo && whatsappVideoSrcAndPreview?.whatsappVideoSrc === "") || (isMediaTypeDoc && whatsappDocSource === ""))
1407
+
1407
1408
  const isDisableDone = () => {
1408
1409
  //if template name is not entered
1409
1410
  if (templateName.trim() === '' || templateNameError) {
@@ -1422,7 +1423,8 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
1422
1423
  return true;
1423
1424
  }
1424
1425
  //if media type is image, video or document and the mediaType file is not uploaded
1425
- if (!isMediaTypeText && host === HOST_KARIX && karixFileHandle === '') {
1426
+
1427
+ if (!isMediaTypeText && isMediatypeValid() ) {
1426
1428
  return true;
1427
1429
  }
1428
1430
  if (templateHeaderError || templateFooterError) {
@@ -2202,10 +2204,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
2202
2204
  Object.values(headerVarMappedData).some((inputValue) => inputValue === "") ||
2203
2205
  computeTextLength(MESSAGE_TEXT) > TEMPLATE_MESSAGE_MAX_LENGTH ||
2204
2206
  computeTextLength(HEADER_TEXT) > TEMPLATE_HEADER_MAX_LENGTH ||
2205
- (isBtnTypeCta && ctaData.some((btn) => btn?.url?.includes("{{1}}"))) ||
2206
- (isMediaTypeImage && whatsappImageSrc === "") ||
2207
- (isMediaTypeVideo && whatsappVideoSrcAndPreview?.whatsappVideoSrc === "") ||
2208
- (isMediaTypeDoc && whatsappDocSource === "");
2207
+ (isBtnTypeCta && ctaData.some((btn) => btn?.url?.includes("{{1}}"))) || isMediatypeValid();
2209
2208
 
2210
2209
  return (
2211
2210
  <CapSpin spinning={spin}>