@capillarytech/creatives-library 7.9.17 → 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 +1 -1
- package/utils/common.js +7 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +12 -4
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +6 -4
- package/v2Containers/CreativesContainer/index.js +5 -3
- package/v2Containers/SmsWrapper/index.js +10 -9
- 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,15 @@ 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
|
+
|
|
208
|
+
const updatedSMSEditior = get(templateDataObject, `versions.base['updated-sms-editor']`, '');
|
|
209
|
+
if (!isTraiDlt || updatedSMSEditior === "") {
|
|
206
210
|
return get(templateDataObject, `versions.base['sms-editor']`);
|
|
207
|
-
} else {
|
|
208
|
-
return templateDataObject.versions.base['updated-sms-editor']?.join('');
|
|
209
211
|
}
|
|
212
|
+
return updatedSMSEditior.join('');
|
|
213
|
+
}
|
|
210
214
|
case constants.LINE: {
|
|
211
215
|
const lineContents = get(templateDataObject, `versions.base.content.messages`, [{}]);
|
|
212
216
|
const previewContent = [];
|
|
@@ -347,6 +351,7 @@ function SlideBoxContent(props) {
|
|
|
347
351
|
messageStrategy={messageStrategy}
|
|
348
352
|
showDisabledFBInfo={showDisabledFBInfo}
|
|
349
353
|
orgUnitId={orgUnitId}
|
|
354
|
+
smsRegister={smsRegister}
|
|
350
355
|
/>
|
|
351
356
|
)}
|
|
352
357
|
{isPreview && (
|
|
@@ -416,6 +421,7 @@ function SlideBoxContent(props) {
|
|
|
416
421
|
onTestContentClicked={onTestContentClicked}
|
|
417
422
|
handleClose={handleClose}
|
|
418
423
|
onCreateComplete={onCreateComplete}
|
|
424
|
+
smsRegister={smsRegister}
|
|
419
425
|
/>
|
|
420
426
|
)}
|
|
421
427
|
{isEditFTP && (
|
|
@@ -463,6 +469,7 @@ function SlideBoxContent(props) {
|
|
|
463
469
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
464
470
|
onTestContentClicked={onTestContentClicked}
|
|
465
471
|
onCreateComplete={onCreateComplete}
|
|
472
|
+
smsRegister={smsRegister}
|
|
466
473
|
/>
|
|
467
474
|
)}
|
|
468
475
|
|
|
@@ -716,5 +723,6 @@ SlideBoxContent.propTypes = {
|
|
|
716
723
|
fbAdManager: PropTypes.string,
|
|
717
724
|
showDisabledFBInfo: PropTypes.boolean,
|
|
718
725
|
orgUnitId: PropTypes.any,
|
|
726
|
+
smsRegister: PropTypes.any,
|
|
719
727
|
};
|
|
720
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 {
|
|
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;
|
|
@@ -771,7 +771,7 @@ class Creatives extends React.Component {
|
|
|
771
771
|
}
|
|
772
772
|
render() {
|
|
773
773
|
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;
|
|
774
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor, smsRegister} = this.props;
|
|
775
775
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
776
776
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
777
777
|
return (
|
|
@@ -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
|
|
@@ -848,6 +849,7 @@ class Creatives extends React.Component {
|
|
|
848
849
|
handleClose={this.handleCloseSlideBox}
|
|
849
850
|
onFTPSubmit={getCreativesData}
|
|
850
851
|
editor={editor}
|
|
852
|
+
smsRegister={smsRegister}
|
|
851
853
|
messageStrategy={this.props.strategy}
|
|
852
854
|
orgUnitId={this.props.orgUnitId}
|
|
853
855
|
/>
|
|
@@ -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,8 @@ const SmsWrapper = (props) => {
|
|
|
26
26
|
onPreviewContentClicked,
|
|
27
27
|
onTestContentClicked,
|
|
28
28
|
onCreateComplete,
|
|
29
|
-
handleClose
|
|
29
|
+
handleClose,
|
|
30
|
+
smsRegister,
|
|
30
31
|
} = props;
|
|
31
32
|
|
|
32
33
|
const smsProps = {
|
|
@@ -43,10 +44,10 @@ const SmsWrapper = (props) => {
|
|
|
43
44
|
onPreviewContentClicked,
|
|
44
45
|
onTestContentClicked,
|
|
45
46
|
};
|
|
46
|
-
const
|
|
47
|
+
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
47
48
|
return <>
|
|
48
49
|
{
|
|
49
|
-
isCreateSms && (
|
|
50
|
+
isCreateSms && (isTraiDlt ?
|
|
50
51
|
<SmsTraiCreate
|
|
51
52
|
isComponent
|
|
52
53
|
{...smsProps}/> :
|
|
@@ -57,16 +58,16 @@ const SmsWrapper = (props) => {
|
|
|
57
58
|
/>
|
|
58
59
|
)
|
|
59
60
|
}
|
|
60
|
-
{isEditSms && (
|
|
61
|
+
{isEditSms && (isTraiDlt ?
|
|
61
62
|
<SmsTraiEdit
|
|
62
63
|
{...smsProps}
|
|
63
64
|
params={{id: templateData._id}}
|
|
64
65
|
templateData={templateData}
|
|
65
66
|
handleClose={handleClose}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
/> : <SmsEdit
|
|
68
|
+
{...smsProps}
|
|
69
|
+
params={{id: templateData._id}}
|
|
70
|
+
templateData={templateData}
|
|
70
71
|
/>
|
|
71
72
|
)}
|
|
72
73
|
</>;
|
|
@@ -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
|
}
|