@capillarytech/creatives-library 7.9.20 → 7.10.0
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 +0 -7
- package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -13
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +4 -6
- package/v2Containers/CreativesContainer/index.js +3 -5
- package/v2Containers/SmsTrai/Create/index.js +8 -15
- package/v2Containers/SmsWrapper/index.js +10 -14
- package/v2Containers/Templates/index.js +7 -12
- package/v2Containers/TemplatesV2/index.js +1 -2
package/package.json
CHANGED
package/utils/common.js
CHANGED
|
@@ -240,10 +240,3 @@ 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,7 +142,6 @@ function SlideBoxContent(props) {
|
|
|
142
142
|
fbAdManager,
|
|
143
143
|
showDisabledFBInfo,
|
|
144
144
|
orgUnitId,
|
|
145
|
-
smsRegister,
|
|
146
145
|
} = props;
|
|
147
146
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
148
147
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -202,15 +201,12 @@ function SlideBoxContent(props) {
|
|
|
202
201
|
|
|
203
202
|
const getChannelPreviewContent = (templateDataObject) => {
|
|
204
203
|
switch (templateDataObject.type.toUpperCase()) {
|
|
205
|
-
case constants.SMS:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const updatedSMSEditior = get(templateDataObject, `versions.base['updated-sms-editor']`, '');
|
|
209
|
-
if (!isTraiDlt || updatedSMSEditior === "") {
|
|
204
|
+
case constants.SMS:
|
|
205
|
+
if (!commonUtil.hasTraiDltFeature() || get(templateDataObject, `versions.base['updated-sms-editor']`) === "") {
|
|
210
206
|
return get(templateDataObject, `versions.base['sms-editor']`);
|
|
207
|
+
} else {
|
|
208
|
+
return templateDataObject.versions.base['updated-sms-editor']?.join('');
|
|
211
209
|
}
|
|
212
|
-
return updatedSMSEditior.join('');
|
|
213
|
-
}
|
|
214
210
|
case constants.LINE: {
|
|
215
211
|
const lineContents = get(templateDataObject, `versions.base.content.messages`, [{}]);
|
|
216
212
|
const previewContent = [];
|
|
@@ -351,7 +347,6 @@ function SlideBoxContent(props) {
|
|
|
351
347
|
messageStrategy={messageStrategy}
|
|
352
348
|
showDisabledFBInfo={showDisabledFBInfo}
|
|
353
349
|
orgUnitId={orgUnitId}
|
|
354
|
-
smsRegister={smsRegister}
|
|
355
350
|
/>
|
|
356
351
|
)}
|
|
357
352
|
{isPreview && (
|
|
@@ -421,7 +416,6 @@ function SlideBoxContent(props) {
|
|
|
421
416
|
onTestContentClicked={onTestContentClicked}
|
|
422
417
|
handleClose={handleClose}
|
|
423
418
|
onCreateComplete={onCreateComplete}
|
|
424
|
-
smsRegister={smsRegister}
|
|
425
419
|
/>
|
|
426
420
|
)}
|
|
427
421
|
{isEditFTP && (
|
|
@@ -469,8 +463,6 @@ function SlideBoxContent(props) {
|
|
|
469
463
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
470
464
|
onTestContentClicked={onTestContentClicked}
|
|
471
465
|
onCreateComplete={onCreateComplete}
|
|
472
|
-
smsRegister={smsRegister}
|
|
473
|
-
onShowTemplates={onShowTemplates}
|
|
474
466
|
/>
|
|
475
467
|
)}
|
|
476
468
|
|
|
@@ -724,6 +716,5 @@ SlideBoxContent.propTypes = {
|
|
|
724
716
|
fbAdManager: PropTypes.string,
|
|
725
717
|
showDisabledFBInfo: PropTypes.boolean,
|
|
726
718
|
orgUnitId: PropTypes.any,
|
|
727
|
-
smsRegister: PropTypes.any,
|
|
728
719
|
};
|
|
729
720
|
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 { hasTraiDltFeature } from '../../utils/common';
|
|
11
11
|
const PrefixWrapper = styled.div`
|
|
12
12
|
margin-right: 16px;
|
|
13
13
|
`;
|
|
@@ -25,12 +25,11 @@ 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
|
|
28
|
+
const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep } = props;
|
|
29
29
|
const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
|
|
30
30
|
const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
31
|
-
const
|
|
32
|
-
const showCreateTraiSMSHeader =
|
|
33
|
-
|
|
31
|
+
const isTraiDltFeature = hasTraiDltFeature();
|
|
32
|
+
const showCreateTraiSMSHeader = isTraiDltFeature && channel.toLowerCase() === "sms";
|
|
34
33
|
return (
|
|
35
34
|
<div key="creatives-container-slidebox-header-content">
|
|
36
35
|
{slidBoxContent === 'templates' && !showTemplateNameHeader && (
|
|
@@ -104,6 +103,5 @@ SlideBoxHeader.propTypes = {
|
|
|
104
103
|
channel: PropTypes.string,
|
|
105
104
|
shouldShowTemplateName: PropTypes.bool,
|
|
106
105
|
templateNameRenderProp: PropTypes.func,
|
|
107
|
-
smsRegister: PropTypes.any,
|
|
108
106
|
};
|
|
109
107
|
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
|
|
774
|
+
const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails, onTestContentClicked, onPreviewContentClicked, getCreativesData, fetchingCmsData, editor} = 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,7 +795,6 @@ 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}
|
|
799
798
|
/>}
|
|
800
799
|
content={
|
|
801
800
|
<SlideBoxContent
|
|
@@ -849,7 +848,6 @@ class Creatives extends React.Component {
|
|
|
849
848
|
handleClose={this.handleCloseSlideBox}
|
|
850
849
|
onFTPSubmit={getCreativesData}
|
|
851
850
|
editor={editor}
|
|
852
|
-
smsRegister={smsRegister}
|
|
853
851
|
messageStrategy={this.props.strategy}
|
|
854
852
|
orgUnitId={this.props.orgUnitId}
|
|
855
853
|
/>
|
|
@@ -18,6 +18,7 @@ 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,
|
|
21
22
|
CAP_SPACE_16,
|
|
22
23
|
CAP_SPACE_24,
|
|
23
24
|
CAP_SPACE_32,
|
|
@@ -47,13 +48,7 @@ import messages from './messages';
|
|
|
47
48
|
import withCreatives from '../../../hoc/withCreatives';
|
|
48
49
|
|
|
49
50
|
export const SmsTraiCreate = (props) => {
|
|
50
|
-
const {
|
|
51
|
-
intl,
|
|
52
|
-
actions,
|
|
53
|
-
onCreateComplete,
|
|
54
|
-
isFullMode,
|
|
55
|
-
onShowTemplates,
|
|
56
|
-
} = props;
|
|
51
|
+
const { intl, actions, onCreateComplete } = props;
|
|
57
52
|
const { formatMessage } = intl;
|
|
58
53
|
const [files, setFiles] = useState([]);
|
|
59
54
|
const [errorText, setErrorText] = useState('');
|
|
@@ -366,7 +361,9 @@ export const SmsTraiCreate = (props) => {
|
|
|
366
361
|
tempArray.push(fileData[row]);
|
|
367
362
|
}
|
|
368
363
|
}
|
|
369
|
-
tempArray = tempArray.map((row) =>
|
|
364
|
+
tempArray = tempArray.map((row) => {
|
|
365
|
+
return row.map((cell) => cell.replace(',', ' '));
|
|
366
|
+
});
|
|
370
367
|
csvContent = tempArray
|
|
371
368
|
.map((e) => e.join(','))
|
|
372
369
|
.map((e) => e.replace(/(\r\n|\n|\r)/gm, ' '))
|
|
@@ -456,11 +453,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
456
453
|
{ templates: savedData },
|
|
457
454
|
(resp, errorMessage) => {
|
|
458
455
|
createCallback({ errorMessage });
|
|
459
|
-
|
|
460
|
-
onCreateComplete();
|
|
461
|
-
} else {
|
|
462
|
-
onShowTemplates();
|
|
463
|
-
}
|
|
456
|
+
onCreateComplete();
|
|
464
457
|
},
|
|
465
458
|
);
|
|
466
459
|
};
|
|
@@ -538,7 +531,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
538
531
|
{previewFileIndex !== null && (
|
|
539
532
|
<>
|
|
540
533
|
<CapRow span={24} className="upload-type-group-create-container">
|
|
541
|
-
|
|
534
|
+
<div className="upload-file-preview">
|
|
542
535
|
<CapDivider
|
|
543
536
|
type="horizontal"
|
|
544
537
|
className="upload-file-preview-divider-1"
|
|
@@ -643,7 +636,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
643
636
|
className="upload-file-preview-divider-2"
|
|
644
637
|
/>
|
|
645
638
|
{errorText && <CapError>{errorText}</CapError>}
|
|
646
|
-
|
|
639
|
+
</div>
|
|
647
640
|
</CapRow>
|
|
648
641
|
</>
|
|
649
642
|
)}
|
|
@@ -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 { hasTraiDltFeature } 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,9 +26,7 @@ const SmsWrapper = (props) => {
|
|
|
26
26
|
onPreviewContentClicked,
|
|
27
27
|
onTestContentClicked,
|
|
28
28
|
onCreateComplete,
|
|
29
|
-
handleClose
|
|
30
|
-
smsRegister,
|
|
31
|
-
onShowTemplates,
|
|
29
|
+
handleClose
|
|
32
30
|
} = props;
|
|
33
31
|
|
|
34
32
|
const smsProps = {
|
|
@@ -45,15 +43,13 @@ const SmsWrapper = (props) => {
|
|
|
45
43
|
onPreviewContentClicked,
|
|
46
44
|
onTestContentClicked,
|
|
47
45
|
};
|
|
48
|
-
const
|
|
46
|
+
const isTraiDltFeature = hasTraiDltFeature();
|
|
49
47
|
return <>
|
|
50
48
|
{
|
|
51
|
-
isCreateSms && (
|
|
49
|
+
isCreateSms && (isTraiDltFeature ?
|
|
52
50
|
<SmsTraiCreate
|
|
53
51
|
isComponent
|
|
54
|
-
{...smsProps}
|
|
55
|
-
onShowTemplates={onShowTemplates}
|
|
56
|
-
/> :
|
|
52
|
+
{...smsProps}/> :
|
|
57
53
|
<SmsCreate
|
|
58
54
|
isComponent {
|
|
59
55
|
...smsProps
|
|
@@ -61,16 +57,16 @@ const SmsWrapper = (props) => {
|
|
|
61
57
|
/>
|
|
62
58
|
)
|
|
63
59
|
}
|
|
64
|
-
{isEditSms && (
|
|
60
|
+
{isEditSms && (isTraiDltFeature ?
|
|
65
61
|
<SmsTraiEdit
|
|
66
62
|
{...smsProps}
|
|
67
63
|
params={{id: templateData._id}}
|
|
68
64
|
templateData={templateData}
|
|
69
65
|
handleClose={handleClose}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
/>:<SmsEdit
|
|
67
|
+
{...smsProps}
|
|
68
|
+
params={{id: templateData._id}}
|
|
69
|
+
templateData={templateData}
|
|
74
70
|
/>
|
|
75
71
|
)}
|
|
76
72
|
</>;
|
|
@@ -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,11 +207,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
|
|
211
|
-
const {smsRegister, isFullMode} = this.props;
|
|
212
|
-
const isTraiDlt = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
213
|
-
return isTraiDlt;
|
|
214
|
-
}
|
|
210
|
+
|
|
215
211
|
componentDidMount() {
|
|
216
212
|
if (this.props.location.query.type === 'embedded' && this.isEnabledInLibraryModule("setLocale")) {
|
|
217
213
|
this.setLocale();
|
|
@@ -227,7 +223,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
227
223
|
queryParams.page = this.state.page;
|
|
228
224
|
queryParams.perPage = this.state.perPageLimit;
|
|
229
225
|
const channel = this.state.channel;
|
|
230
|
-
const isTraiDltFeature =
|
|
226
|
+
const isTraiDltFeature = commonUtil.hasTraiDltFeature();
|
|
231
227
|
if ((this.state.channel || '').toLowerCase() === "sms" && isTraiDltFeature) {
|
|
232
228
|
queryParams.traiEnable = true;
|
|
233
229
|
}
|
|
@@ -590,7 +586,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
590
586
|
if (activeMode === ACCOUNT_SELECTION_MODE) {
|
|
591
587
|
this.setTemplatesMode();
|
|
592
588
|
}
|
|
593
|
-
const isTraiDltFeature =
|
|
589
|
+
const isTraiDltFeature = commonUtil.hasTraiDltFeature();
|
|
594
590
|
if ((this.state.channel || '').toLowerCase() === "sms" && isTraiDltFeature) {
|
|
595
591
|
queryParams.traiEnable = true;
|
|
596
592
|
}
|
|
@@ -632,7 +628,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
632
628
|
}
|
|
633
629
|
}
|
|
634
630
|
}
|
|
635
|
-
|
|
631
|
+
|
|
636
632
|
this.setState({page, templatesCount}, () => {
|
|
637
633
|
queryParams.page = page;
|
|
638
634
|
queryParams.perPage = this.state.perPageLimit;
|
|
@@ -674,7 +670,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
674
670
|
}
|
|
675
671
|
if (currentChannel === SMS) {
|
|
676
672
|
filteredTemplates = this.filterSMSTemplates(templates);
|
|
677
|
-
isTraiDltFeature =
|
|
673
|
+
isTraiDltFeature = commonUtil.hasTraiDltFeature();
|
|
678
674
|
}
|
|
679
675
|
const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
|
|
680
676
|
const templateData =
|
|
@@ -2058,7 +2054,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2058
2054
|
const isfilterContentVisisble = true;
|
|
2059
2055
|
const isWechatEmbedded = !this.props.isFullMode && channel.toUpperCase() === WECHAT;
|
|
2060
2056
|
const channelLowerCase = (channel || '').toLowerCase();
|
|
2061
|
-
const isTraiDltFeature =
|
|
2057
|
+
const isTraiDltFeature = commonUtil.hasTraiDltFeature();
|
|
2062
2058
|
const filterContent = (( isfilterContentVisisble || [WECHAT, MOBILE_PUSH].includes(this.state.channel.toUpperCase())) && <div className="action-container">
|
|
2063
2059
|
{isfilterContentVisisble && <CapInput.Search
|
|
2064
2060
|
className="search-text"
|
|
@@ -2275,7 +2271,6 @@ Templates.propTypes = {
|
|
|
2275
2271
|
router: PropTypes.object,
|
|
2276
2272
|
viberActions: PropTypes.object,
|
|
2277
2273
|
facebookActions: PropTypes.object,
|
|
2278
|
-
smsRegister: PropTypes.any,
|
|
2279
2274
|
};
|
|
2280
2275
|
|
|
2281
2276
|
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
|
|
202
|
+
const {isFullMode, messageStrategy} = this.props;
|
|
203
203
|
if (!isFullMode) {
|
|
204
204
|
query = {type: 'embedded', module: 'library'};
|
|
205
205
|
switch (channel) {
|
|
@@ -232,7 +232,6 @@ 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}
|
|
236
235
|
/>);
|
|
237
236
|
}
|
|
238
237
|
}
|