@capillarytech/creatives-library 7.10.0 → 7.10.1
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 +1 -1
- package/utils/common.js +7 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +16 -4
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +6 -4
- package/v2Containers/CreativesContainer/index.js +24 -4
- package/v2Containers/SmsTrai/Create/index.js +15 -8
- package/v2Containers/SmsTrai/Edit/index.js +35 -15
- package/v2Containers/SmsWrapper/index.js +14 -10
- package/v2Containers/Templates/index.js +12 -7
- package/v2Containers/TemplatesV2/index.js +2 -1
package/package.json
CHANGED
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
|
+
};
|
|
@@ -142,6 +142,7 @@ function SlideBoxContent(props) {
|
|
|
142
142
|
fbAdManager,
|
|
143
143
|
showDisabledFBInfo,
|
|
144
144
|
orgUnitId,
|
|
145
|
+
smsRegister,
|
|
145
146
|
} = props;
|
|
146
147
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
147
148
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -201,12 +202,18 @@ function SlideBoxContent(props) {
|
|
|
201
202
|
|
|
202
203
|
const getChannelPreviewContent = (templateDataObject) => {
|
|
203
204
|
switch (templateDataObject.type.toUpperCase()) {
|
|
204
|
-
case constants.SMS:
|
|
205
|
-
|
|
205
|
+
case constants.SMS: {
|
|
206
|
+
const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
207
|
+
const updatedSmsEditor = get(
|
|
208
|
+
templateDataObject,
|
|
209
|
+
`versions.base['updated-sms-editor']`,
|
|
210
|
+
'',
|
|
211
|
+
);
|
|
212
|
+
if (!isTraiDlt || updatedSmsEditor === '') {
|
|
206
213
|
return get(templateDataObject, `versions.base['sms-editor']`);
|
|
207
|
-
} else {
|
|
208
|
-
return templateDataObject.versions.base['updated-sms-editor']?.join('');
|
|
209
214
|
}
|
|
215
|
+
return updatedSmsEditor.join('');
|
|
216
|
+
}
|
|
210
217
|
case constants.LINE: {
|
|
211
218
|
const lineContents = get(templateDataObject, `versions.base.content.messages`, [{}]);
|
|
212
219
|
const previewContent = [];
|
|
@@ -347,6 +354,7 @@ function SlideBoxContent(props) {
|
|
|
347
354
|
messageStrategy={messageStrategy}
|
|
348
355
|
showDisabledFBInfo={showDisabledFBInfo}
|
|
349
356
|
orgUnitId={orgUnitId}
|
|
357
|
+
smsRegister={smsRegister}
|
|
350
358
|
/>
|
|
351
359
|
)}
|
|
352
360
|
{isPreview && (
|
|
@@ -416,6 +424,7 @@ function SlideBoxContent(props) {
|
|
|
416
424
|
onTestContentClicked={onTestContentClicked}
|
|
417
425
|
handleClose={handleClose}
|
|
418
426
|
onCreateComplete={onCreateComplete}
|
|
427
|
+
smsRegister={smsRegister}
|
|
419
428
|
/>
|
|
420
429
|
)}
|
|
421
430
|
{isEditFTP && (
|
|
@@ -463,6 +472,8 @@ function SlideBoxContent(props) {
|
|
|
463
472
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
464
473
|
onTestContentClicked={onTestContentClicked}
|
|
465
474
|
onCreateComplete={onCreateComplete}
|
|
475
|
+
smsRegister={smsRegister}
|
|
476
|
+
onShowTemplates={onShowTemplates}
|
|
466
477
|
/>
|
|
467
478
|
)}
|
|
468
479
|
|
|
@@ -716,5 +727,6 @@ SlideBoxContent.propTypes = {
|
|
|
716
727
|
fbAdManager: PropTypes.string,
|
|
717
728
|
showDisabledFBInfo: PropTypes.boolean,
|
|
718
729
|
orgUnitId: PropTypes.any,
|
|
730
|
+
smsRegister: PropTypes.any,
|
|
719
731
|
};
|
|
720
732
|
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 {
|
|
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
|
|
32
|
-
const showCreateTraiSMSHeader =
|
|
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;
|
|
@@ -286,14 +286,14 @@ class Creatives extends React.Component {
|
|
|
286
286
|
type: constants.FACEBOOK,
|
|
287
287
|
edit: true,
|
|
288
288
|
selectedFacebookAccount,
|
|
289
|
-
fbContentType
|
|
289
|
+
fbContentType,
|
|
290
290
|
};
|
|
291
291
|
} else {
|
|
292
292
|
creativesTemplateData = {
|
|
293
293
|
selectedMarketingObjective: templateData.selectedMarketingObjective,
|
|
294
294
|
edit: true,
|
|
295
295
|
type: channel,
|
|
296
|
-
fbContentType: templateData.fbContentType
|
|
296
|
+
fbContentType: templateData.fbContentType,
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
299
|
break;
|
|
@@ -357,7 +357,25 @@ class Creatives extends React.Component {
|
|
|
357
357
|
switch (channel) {
|
|
358
358
|
case constants.SMS:
|
|
359
359
|
if (template.value.base) {
|
|
360
|
-
|
|
360
|
+
const smsBase = template.value.base || {};
|
|
361
|
+
const { isFullMode, smsRegister } = this.props;
|
|
362
|
+
const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
363
|
+
const {
|
|
364
|
+
['updated-sms-editor']: updatedSmsEditor,
|
|
365
|
+
['sms-editor']: smsEditor,
|
|
366
|
+
} = smsBase;
|
|
367
|
+
if (!isTraiDlt || updatedSmsEditor === '') {
|
|
368
|
+
templateData.messageBody = smsEditor;
|
|
369
|
+
} else {
|
|
370
|
+
templateData.messageBody = updatedSmsEditor.join('');
|
|
371
|
+
const { template_id, template_name, header } = smsBase;
|
|
372
|
+
templateData.templateConfigs = {
|
|
373
|
+
templateId: template_id,
|
|
374
|
+
templateName: template_name,
|
|
375
|
+
template: smsEditor,
|
|
376
|
+
registeredSenderIds: header?.split(','),
|
|
377
|
+
};
|
|
378
|
+
}
|
|
361
379
|
}
|
|
362
380
|
break;
|
|
363
381
|
case constants.EMAIL:
|
|
@@ -771,7 +789,7 @@ class Creatives extends React.Component {
|
|
|
771
789
|
}
|
|
772
790
|
render() {
|
|
773
791
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
774
|
-
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor} = this.props;
|
|
792
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor, smsRegister} = this.props;
|
|
775
793
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
776
794
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
777
795
|
return (
|
|
@@ -795,6 +813,7 @@ class Creatives extends React.Component {
|
|
|
795
813
|
weChatTemplateType={weChatTemplateType}
|
|
796
814
|
showPrefix={!isUploading} // not show back button when email template is being uploaded
|
|
797
815
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
816
|
+
smsRegister={smsRegister}
|
|
798
817
|
/>}
|
|
799
818
|
content={
|
|
800
819
|
<SlideBoxContent
|
|
@@ -848,6 +867,7 @@ class Creatives extends React.Component {
|
|
|
848
867
|
handleClose={this.handleCloseSlideBox}
|
|
849
868
|
onFTPSubmit={getCreativesData}
|
|
850
869
|
editor={editor}
|
|
870
|
+
smsRegister={smsRegister}
|
|
851
871
|
messageStrategy={this.props.strategy}
|
|
852
872
|
orgUnitId={this.props.orgUnitId}
|
|
853
873
|
/>
|
|
@@ -18,7 +18,6 @@ import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
|
|
|
18
18
|
import Papa from 'papaparse';
|
|
19
19
|
import cloneDeep from 'lodash/cloneDeep';
|
|
20
20
|
import {
|
|
21
|
-
CAP_SPACE_12,
|
|
22
21
|
CAP_SPACE_16,
|
|
23
22
|
CAP_SPACE_24,
|
|
24
23
|
CAP_SPACE_32,
|
|
@@ -48,7 +47,13 @@ import messages from './messages';
|
|
|
48
47
|
import withCreatives from '../../../hoc/withCreatives';
|
|
49
48
|
|
|
50
49
|
export const SmsTraiCreate = (props) => {
|
|
51
|
-
const {
|
|
50
|
+
const {
|
|
51
|
+
intl,
|
|
52
|
+
actions,
|
|
53
|
+
onCreateComplete,
|
|
54
|
+
isFullMode,
|
|
55
|
+
onShowTemplates,
|
|
56
|
+
} = props;
|
|
52
57
|
const { formatMessage } = intl;
|
|
53
58
|
const [files, setFiles] = useState([]);
|
|
54
59
|
const [errorText, setErrorText] = useState('');
|
|
@@ -361,9 +366,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
361
366
|
tempArray.push(fileData[row]);
|
|
362
367
|
}
|
|
363
368
|
}
|
|
364
|
-
tempArray = tempArray.map((row) =>
|
|
365
|
-
return row.map((cell) => cell.replace(',', ' '));
|
|
366
|
-
});
|
|
369
|
+
tempArray = tempArray.map((row) => row.map((cell) => cell.replace(',', ' ')));
|
|
367
370
|
csvContent = tempArray
|
|
368
371
|
.map((e) => e.join(','))
|
|
369
372
|
.map((e) => e.replace(/(\r\n|\n|\r)/gm, ' '))
|
|
@@ -453,7 +456,11 @@ export const SmsTraiCreate = (props) => {
|
|
|
453
456
|
{ templates: savedData },
|
|
454
457
|
(resp, errorMessage) => {
|
|
455
458
|
createCallback({ errorMessage });
|
|
456
|
-
|
|
459
|
+
if (isFullMode) {
|
|
460
|
+
onCreateComplete();
|
|
461
|
+
} else {
|
|
462
|
+
onShowTemplates();
|
|
463
|
+
}
|
|
457
464
|
},
|
|
458
465
|
);
|
|
459
466
|
};
|
|
@@ -531,7 +538,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
531
538
|
{previewFileIndex !== null && (
|
|
532
539
|
<>
|
|
533
540
|
<CapRow span={24} className="upload-type-group-create-container">
|
|
534
|
-
|
|
541
|
+
<>
|
|
535
542
|
<CapDivider
|
|
536
543
|
type="horizontal"
|
|
537
544
|
className="upload-file-preview-divider-1"
|
|
@@ -636,7 +643,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
636
643
|
className="upload-file-preview-divider-2"
|
|
637
644
|
/>
|
|
638
645
|
{errorText && <CapError>{errorText}</CapError>}
|
|
639
|
-
|
|
646
|
+
</>
|
|
640
647
|
</CapRow>
|
|
641
648
|
</>
|
|
642
649
|
)}
|
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
LIBRARY,
|
|
43
43
|
} from './constants';
|
|
44
44
|
let varMap = {};
|
|
45
|
+
let traiData = {};
|
|
45
46
|
const { TextArea } = CapInput;
|
|
46
47
|
const { CapLabelInline } = CapLabel;
|
|
47
48
|
export const SmsTraiEdit = (props) => {
|
|
@@ -58,6 +59,9 @@ export const SmsTraiEdit = (props) => {
|
|
|
58
59
|
metaEntities,
|
|
59
60
|
injectedTags,
|
|
60
61
|
onCreateComplete,
|
|
62
|
+
isFullMode,
|
|
63
|
+
getFormSubscriptionData,
|
|
64
|
+
templateData = {},
|
|
61
65
|
} = props || {};
|
|
62
66
|
const { formatMessage } = intl;
|
|
63
67
|
const [loading, updateLoading] = useState(true);
|
|
@@ -104,13 +108,15 @@ export const SmsTraiEdit = (props) => {
|
|
|
104
108
|
}
|
|
105
109
|
return () => {
|
|
106
110
|
actions.resetEditTemplate();
|
|
111
|
+
varMap = {};
|
|
107
112
|
};
|
|
108
113
|
}, []);
|
|
109
114
|
|
|
110
115
|
//computing placeholder array for mapping values and rendering dynamic form
|
|
111
116
|
useEffect(() => {
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
traiData = isFullMode ? templateDetails : templateData;
|
|
118
|
+
if (traiData && !isEmpty(traiData)) {
|
|
119
|
+
let msg = get(traiData, `versions.base.sms-editor`);
|
|
114
120
|
const templateMessageArray = [];
|
|
115
121
|
//converting sms-editor string to an array split at '{#var#}'
|
|
116
122
|
//split and push string before '{#var#}[0 to index]', push '{#var#}',
|
|
@@ -134,16 +140,19 @@ export const SmsTraiEdit = (props) => {
|
|
|
134
140
|
//stop spinner
|
|
135
141
|
updateLoading(false);
|
|
136
142
|
}
|
|
137
|
-
}, [templateDetails]);
|
|
143
|
+
}, [templateDetails || templateData]);
|
|
138
144
|
|
|
139
145
|
useEffect(() => {
|
|
140
146
|
if (tempMsgArray.length !== 0) {
|
|
147
|
+
const traiBase = traiData?.versions?.base || {};
|
|
148
|
+
const {
|
|
149
|
+
['var-mapped']: varMapped = {},
|
|
150
|
+
['updated-sms-editor']: traiSmsEditor = '',
|
|
151
|
+
} = traiBase;
|
|
141
152
|
//if varMapped and updated-sms-editor is already present on non first edits
|
|
142
|
-
if (!isEmpty(
|
|
143
|
-
varMap = cloneDeep(
|
|
144
|
-
setUpdatedSmsEditor(
|
|
145
|
-
get(templateDetails, `versions.base.updated-sms-editor`),
|
|
146
|
-
);
|
|
153
|
+
if (!isEmpty(varMapped)) {
|
|
154
|
+
varMap = cloneDeep(varMapped);
|
|
155
|
+
setUpdatedSmsEditor(traiSmsEditor);
|
|
147
156
|
} else {
|
|
148
157
|
//computing varMap for first edit
|
|
149
158
|
let counter = 1;
|
|
@@ -197,10 +206,21 @@ export const SmsTraiEdit = (props) => {
|
|
|
197
206
|
} else {
|
|
198
207
|
//start spinner
|
|
199
208
|
updateLoading(true);
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
209
|
+
const traiVersions = traiData.versions || {};
|
|
210
|
+
traiVersions.base = {
|
|
211
|
+
...traiVersions.base,
|
|
212
|
+
'var-mapped': varMap,
|
|
213
|
+
'updated-sms-editor': updatedSmsEditor,
|
|
214
|
+
};
|
|
215
|
+
traiVersions.history = [traiVersions.base];
|
|
216
|
+
isFullMode
|
|
217
|
+
? actions.editTemplate(traiData, onUpdateTemplateComplete)
|
|
218
|
+
: getFormSubscriptionData({
|
|
219
|
+
value: traiData.versions,
|
|
220
|
+
_id: params && params.id,
|
|
221
|
+
validity: true,
|
|
222
|
+
type: SMS,
|
|
223
|
+
});
|
|
204
224
|
}
|
|
205
225
|
};
|
|
206
226
|
//Saving on done end
|
|
@@ -391,13 +411,13 @@ export const SmsTraiEdit = (props) => {
|
|
|
391
411
|
<>
|
|
392
412
|
<CapSpin spinning={loading}>
|
|
393
413
|
<CapRow>
|
|
394
|
-
{
|
|
414
|
+
{traiData && !isEmpty(traiData) && (
|
|
395
415
|
<TraiEditTemplateDetails>
|
|
396
416
|
<CapLabelInline type="label1">
|
|
397
417
|
{formatMessage(messages.templateLabel)}
|
|
398
418
|
</CapLabelInline>
|
|
399
419
|
<CapLabelInline type="label2">
|
|
400
|
-
{
|
|
420
|
+
{traiData.versions.base.template_name}
|
|
401
421
|
</CapLabelInline>
|
|
402
422
|
<CapLabelInline type="label1">
|
|
403
423
|
{formatMessage(messages.traiEditSeperator)}
|
|
@@ -406,7 +426,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
406
426
|
{formatMessage(messages.senderIdlabel)}
|
|
407
427
|
</CapLabelInline>
|
|
408
428
|
<CapLabelInline type="label2">
|
|
409
|
-
{
|
|
429
|
+
{traiData.versions.base.header}
|
|
410
430
|
</CapLabelInline>
|
|
411
431
|
</TraiEditTemplateDetails>
|
|
412
432
|
)}
|
|
@@ -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 {
|
|
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
|
|
48
|
+
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
47
49
|
return <>
|
|
48
50
|
{
|
|
49
|
-
isCreateSms && (
|
|
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 && (
|
|
64
|
+
{isEditSms && (isTraiDlt ?
|
|
61
65
|
<SmsTraiEdit
|
|
62
66
|
{...smsProps}
|
|
63
67
|
params={{id: templateData._id}}
|
|
64
68
|
templateData={templateData}
|
|
65
69
|
handleClose={handleClose}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
}
|