@capillarytech/creatives-library 7.9.18 → 7.9.19

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.9.18",
4
+ "version": "7.9.19",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/utils/common.js CHANGED
@@ -240,3 +240,10 @@ export const bytes2Size = (bytes, decimals = 2) => {
240
240
 
241
241
  return `${Math.ceil((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
242
242
  };
243
+
244
+ export const isTraiDLTEnable = (isFullMode, smsRegister) => {
245
+ const isTraiDltFeatureForOrg = hasTraiDltFeature();
246
+ const isTariEnableforLib = (!isFullMode && smsRegister === "DLT" ) || isFullMode;
247
+ const isTraiDltFeature = isTraiDltFeatureForOrg && isTariEnableforLib;
248
+ return isTraiDltFeature;
249
+ };
@@ -202,13 +202,15 @@ function SlideBoxContent(props) {
202
202
 
203
203
  const getChannelPreviewContent = (templateDataObject) => {
204
204
  switch (templateDataObject.type.toUpperCase()) {
205
- case constants.SMS:
206
- if (!commonUtil.hasTraiDltFeature() || get(templateDataObject, `versions.base['updated-sms-editor']`) === "") {
205
+ case constants.SMS: {
206
+ const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
207
+
208
+ const updatedSMSEditior = get(templateDataObject, `versions.base['updated-sms-editor']`, '');
209
+ if (!isTraiDlt || updatedSMSEditior === "") {
207
210
  return get(templateDataObject, `versions.base['sms-editor']`);
208
- } else {
209
- return templateDataObject.versions.base['updated-sms-editor']?.join('');
210
211
  }
211
- return get(templateDataObject, `versions.base['sms-editor']`);
212
+ return updatedSMSEditior.join('');
213
+ }
212
214
  case constants.LINE: {
213
215
  const lineContents = get(templateDataObject, `versions.base.content.messages`, [{}]);
214
216
  const previewContent = [];
@@ -721,5 +723,6 @@ SlideBoxContent.propTypes = {
721
723
  fbAdManager: PropTypes.string,
722
724
  showDisabledFBInfo: PropTypes.boolean,
723
725
  orgUnitId: PropTypes.any,
726
+ smsRegister: PropTypes.any,
724
727
  };
725
728
  export default SlideBoxContent;
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
7
7
  import messages from './messages';
8
8
  import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
9
9
  import { NO_COMMUNICATION, FTP } from '../App/constants';
10
- import { hasTraiDltFeature } from '../../utils/common';
10
+ import { isTraiDLTEnable } from '../../utils/common';
11
11
  const PrefixWrapper = styled.div`
12
12
  margin-right: 16px;
13
13
  `;
@@ -25,11 +25,12 @@ function getChannelLabel(channel = '') {
25
25
 
26
26
 
27
27
  function SlideBoxHeader(props) {
28
- const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep } = props;
28
+ const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep, smsRegister } = props;
29
29
  const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
30
30
  const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
31
- const isTraiDltFeature = hasTraiDltFeature();
32
- const showCreateTraiSMSHeader = isTraiDltFeature && channel.toLowerCase() === "sms";
31
+ const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
32
+ const showCreateTraiSMSHeader = isTraiDlt && channel.toLowerCase() === "sms";
33
+
33
34
  return (
34
35
  <div key="creatives-container-slidebox-header-content">
35
36
  {slidBoxContent === 'templates' && !showTemplateNameHeader && (
@@ -103,5 +104,6 @@ SlideBoxHeader.propTypes = {
103
104
  channel: PropTypes.string,
104
105
  shouldShowTemplateName: PropTypes.bool,
105
106
  templateNameRenderProp: PropTypes.func,
107
+ smsRegister: PropTypes.any,
106
108
  };
107
109
  export default SlideBoxHeader;
@@ -795,6 +795,7 @@ class Creatives extends React.Component {
795
795
  weChatTemplateType={weChatTemplateType}
796
796
  showPrefix={!isUploading} // not show back button when email template is being uploaded
797
797
  templateStep={this.creativesTemplateSteps[templateStep]}
798
+ smsRegister={smsRegister}
798
799
  />}
799
800
  content={
800
801
  <SlideBoxContent
@@ -6,7 +6,7 @@
6
6
  import PropTypes from 'prop-types';
7
7
  import React from 'react';
8
8
  import SmsCreate from '../Sms/Create';
9
- import { hasTraiDltFeature } from '../../utils/common';
9
+ import { isTraiDLTEnable } from '../../utils/common';
10
10
  import SmsEdit from '../Sms/Edit';
11
11
  import SmsTraiCreate from '../SmsTrai/Create';
12
12
  import SmsTraiEdit from '../SmsTrai/Edit';
@@ -44,12 +44,10 @@ const SmsWrapper = (props) => {
44
44
  onPreviewContentClicked,
45
45
  onTestContentClicked,
46
46
  };
47
- const isTraiDltFeatureForOrg = hasTraiDltFeature();
48
- const isTariEnableforLib = (!isFullMode && smsRegister === "DLT" ) || isFullMode;
49
- const isTraiDltFeature = isTraiDltFeatureForOrg && isTariEnableforLib;
47
+ const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
50
48
  return <>
51
49
  {
52
- isCreateSms && (isTraiDltFeature ?
50
+ isCreateSms && (isTraiDlt ?
53
51
  <SmsTraiCreate
54
52
  isComponent
55
53
  {...smsProps}/> :
@@ -60,7 +58,7 @@ const SmsWrapper = (props) => {
60
58
  />
61
59
  )
62
60
  }
63
- {isEditSms && (isTraiDltFeature ?
61
+ {isEditSms && (isTraiDlt ?
64
62
  <SmsTraiEdit
65
63
  {...smsProps}
66
64
  params={{id: templateData._id}}
@@ -208,11 +208,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
208
208
  }
209
209
  }
210
210
  checkDLTfeatureEnable = () => {
211
- const isTraiDltFeatureForOrg = commonUtil.hasTraiDltFeature();
212
211
  const {smsRegister, isFullMode} = this.props;
213
- const isTariEnableforLib = (!isFullMode && smsRegister === "DLT" ) || isFullMode;
214
- const isTraiDltFeature = isTraiDltFeatureForOrg && isTariEnableforLib;
215
- return isTraiDltFeature;
212
+ const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
213
+ return isTraiDlt;
216
214
  }
217
215
  componentDidMount() {
218
216
  if (this.props.location.query.type === 'embedded' && this.isEnabledInLibraryModule("setLocale")) {
@@ -2277,6 +2275,7 @@ Templates.propTypes = {
2277
2275
  router: PropTypes.object,
2278
2276
  viberActions: PropTypes.object,
2279
2277
  facebookActions: PropTypes.object,
2278
+ smsRegister: PropTypes.any,
2280
2279
  };
2281
2280
 
2282
2281
  const mapStateToProps = createStructuredSelector({