@capillarytech/creatives-library 7.10.8 → 7.10.10

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.
@@ -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';
@@ -26,7 +26,9 @@ const SmsWrapper = (props) => {
26
26
  onPreviewContentClicked,
27
27
  onTestContentClicked,
28
28
  onCreateComplete,
29
- handleClose
29
+ handleClose,
30
+ smsRegister,
31
+ onShowTemplates,
30
32
  } = props;
31
33
 
32
34
  const smsProps = {
@@ -43,13 +45,15 @@ const SmsWrapper = (props) => {
43
45
  onPreviewContentClicked,
44
46
  onTestContentClicked,
45
47
  };
46
- const isTraiDltFeature = hasTraiDltFeature();
48
+ const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
47
49
  return <>
48
50
  {
49
- isCreateSms && (isTraiDltFeature ?
51
+ isCreateSms && (isTraiDlt ?
50
52
  <SmsTraiCreate
51
53
  isComponent
52
- {...smsProps}/> :
54
+ {...smsProps}
55
+ onShowTemplates={onShowTemplates}
56
+ /> :
53
57
  <SmsCreate
54
58
  isComponent {
55
59
  ...smsProps
@@ -57,16 +61,16 @@ const SmsWrapper = (props) => {
57
61
  />
58
62
  )
59
63
  }
60
- {isEditSms && (isTraiDltFeature ?
64
+ {isEditSms && (isTraiDlt ?
61
65
  <SmsTraiEdit
62
66
  {...smsProps}
63
67
  params={{id: templateData._id}}
64
68
  templateData={templateData}
65
69
  handleClose={handleClose}
66
- />:<SmsEdit
67
- {...smsProps}
68
- params={{id: templateData._id}}
69
- templateData={templateData}
70
+ /> : <SmsEdit
71
+ {...smsProps}
72
+ params={{id: templateData._id}}
73
+ templateData={templateData}
70
74
  />
71
75
  )}
72
76
  </>;
@@ -155,7 +155,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
155
155
  this.prepareMobilePushPreviewData = this.prepareMobilePushPreviewData.bind(this);
156
156
  this.menuOnClickEvent = this.menuOnClickEvent.bind(this);
157
157
  }
158
-
158
+
159
159
  componentWillMount() {
160
160
  if (this.state.channel === '') {
161
161
  let channel = '';
@@ -207,7 +207,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
207
207
  }
208
208
  }
209
209
  }
210
-
210
+ checkDLTfeatureEnable = () => {
211
+ const {smsRegister, isFullMode} = this.props;
212
+ const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
213
+ return isTraiDlt;
214
+ }
211
215
  componentDidMount() {
212
216
  if (this.props.location.query.type === 'embedded' && this.isEnabledInLibraryModule("setLocale")) {
213
217
  this.setLocale();
@@ -223,7 +227,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
223
227
  queryParams.page = this.state.page;
224
228
  queryParams.perPage = this.state.perPageLimit;
225
229
  const channel = this.state.channel;
226
- const isTraiDltFeature = commonUtil.hasTraiDltFeature();
230
+ const isTraiDltFeature = this.checkDLTfeatureEnable();
227
231
  if ((this.state.channel || '').toLowerCase() === "sms" && isTraiDltFeature) {
228
232
  queryParams.traiEnable = true;
229
233
  }
@@ -586,7 +590,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
586
590
  if (activeMode === ACCOUNT_SELECTION_MODE) {
587
591
  this.setTemplatesMode();
588
592
  }
589
- const isTraiDltFeature = commonUtil.hasTraiDltFeature();
593
+ const isTraiDltFeature = this.checkDLTfeatureEnable();
590
594
  if ((this.state.channel || '').toLowerCase() === "sms" && isTraiDltFeature) {
591
595
  queryParams.traiEnable = true;
592
596
  }
@@ -628,7 +632,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
628
632
  }
629
633
  }
630
634
  }
631
-
635
+
632
636
  this.setState({page, templatesCount}, () => {
633
637
  queryParams.page = page;
634
638
  queryParams.perPage = this.state.perPageLimit;
@@ -670,7 +674,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
670
674
  }
671
675
  if (currentChannel === SMS) {
672
676
  filteredTemplates = this.filterSMSTemplates(templates);
673
- isTraiDltFeature = commonUtil.hasTraiDltFeature();
677
+ isTraiDltFeature = this.checkDLTfeatureEnable();
674
678
  }
675
679
  const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
676
680
  const templateData =
@@ -2054,7 +2058,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2054
2058
  const isfilterContentVisisble = true;
2055
2059
  const isWechatEmbedded = !this.props.isFullMode && channel.toUpperCase() === WECHAT;
2056
2060
  const channelLowerCase = (channel || '').toLowerCase();
2057
- const isTraiDltFeature = commonUtil.hasTraiDltFeature();
2061
+ const isTraiDltFeature = this.checkDLTfeatureEnable();
2058
2062
  const filterContent = (( isfilterContentVisisble || [WECHAT, MOBILE_PUSH].includes(this.state.channel.toUpperCase())) && <div className="action-container">
2059
2063
  {isfilterContentVisisble && <CapInput.Search
2060
2064
  className="search-text"
@@ -2271,6 +2275,7 @@ Templates.propTypes = {
2271
2275
  router: PropTypes.object,
2272
2276
  viberActions: PropTypes.object,
2273
2277
  facebookActions: PropTypes.object,
2278
+ smsRegister: PropTypes.any,
2274
2279
  };
2275
2280
 
2276
2281
  const mapStateToProps = createStructuredSelector({
@@ -199,7 +199,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
199
199
  getTemplatesComponent(channel) {
200
200
  // const templates = this.props.Templates[`${channel}Templates`];
201
201
  let query = {};
202
- const {isFullMode, messageStrategy} = this.props;
202
+ const {isFullMode, messageStrategy, smsRegister} = this.props;
203
203
  if (!isFullMode) {
204
204
  query = {type: 'embedded', module: 'library'};
205
205
  switch (channel) {
@@ -232,6 +232,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
232
232
  renderNewCardGrid={this.getTemplateDataForGrid}
233
233
  handlePeviewTemplate={this.props.handlePeviewTemplate}
234
234
  messageStrategy={this.props.messageStrategy}
235
+ smsRegister={smsRegister}
235
236
  />);
236
237
  }
237
238
  }