@capillarytech/creatives-library 7.10.1 → 7.10.2
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/containers/App/constants.js +9 -0
- package/package.json +1 -1
- package/utils/common.js +6 -11
- package/v2Components/CapTagList/index.js +8 -2
- package/v2Containers/Cap/constants.js +1 -0
- package/v2Containers/Cap/reducer.js +3 -0
- package/v2Containers/Cap/selectors.js +1 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -16
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +4 -6
- package/v2Containers/CreativesContainer/index.js +4 -24
- package/v2Containers/SmsTrai/Create/index.js +6 -15
- package/v2Containers/SmsTrai/Create/messages.js +1 -1
- package/v2Containers/SmsTrai/Edit/index.js +15 -35
- package/v2Containers/SmsWrapper/index.js +10 -14
- package/v2Containers/Templates/index.js +7 -12
- package/v2Containers/TemplatesV2/index.js +1 -2
|
@@ -4,3 +4,12 @@ export const GET_SIDEBAR_FAILURE = 'app/App/GET_SIDEBAR_FAILURE';
|
|
|
4
4
|
|
|
5
5
|
export const STORE2DOOR_PLUS_ENABLED = 'STORE2DOOR_PLUS_ENABLED';
|
|
6
6
|
export const TRAI_DLT = 'TRAI_DLT';
|
|
7
|
+
|
|
8
|
+
export const CARD_RELATED_TAGS = [
|
|
9
|
+
'card_series',
|
|
10
|
+
'card_number',
|
|
11
|
+
'card_issue_date',
|
|
12
|
+
'card_status',
|
|
13
|
+
'card_series_name',
|
|
14
|
+
'card_name',
|
|
15
|
+
];
|
package/package.json
CHANGED
package/utils/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { Auth } from '@capillarytech/cap-ui-utils';
|
|
3
|
-
import { STORE2DOOR_PLUS_ENABLED, TRAI_DLT } from '../containers/App/constants';
|
|
3
|
+
import { STORE2DOOR_PLUS_ENABLED, TRAI_DLT, CARD_RELATED_TAGS } from '../containers/App/constants';
|
|
4
4
|
|
|
5
5
|
export function getUserNameById(userId, allUserList) {
|
|
6
6
|
let userName = "";
|
|
@@ -46,10 +46,12 @@ export const hasTraiDltFeature = Auth.hasFeatureAccess.bind(
|
|
|
46
46
|
export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails = [], disableTagsDetails = {}}) {
|
|
47
47
|
console.log('populating tags', (tagsList || []).length);
|
|
48
48
|
const mainTags = {};
|
|
49
|
-
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable} = disableTagsDetails;
|
|
49
|
+
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags} = disableTagsDetails;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const clonedTags = _.filter(tagsList, (tag) =>
|
|
52
|
+
!CARD_RELATED_TAGS.includes(tag?.definition?.value)
|
|
53
|
+
);
|
|
54
|
+
_.forEach(clonedTags, (temp) => {
|
|
53
55
|
const tag = temp.definition;
|
|
54
56
|
if (!tag['tag-header']) { //if tag doesn't have subtag(s), which means this tag itself is tag and not a tag header.
|
|
55
57
|
mainTags[tag.value] = {
|
|
@@ -240,10 +242,3 @@ export const bytes2Size = (bytes, decimals = 2) => {
|
|
|
240
242
|
|
|
241
243
|
return `${Math.ceil((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
242
244
|
};
|
|
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
|
-
};
|
|
@@ -15,9 +15,11 @@ import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
|
|
|
15
15
|
import { createStructuredSelector } from 'reselect';
|
|
16
16
|
import messages from './messages';
|
|
17
17
|
import { makeSelectLoyaltyPromotionDisplay } from '../../v2Containers/Cap/selectors';
|
|
18
|
+
import { CARD_RELATED_TAGS } from '../../containers/App/constants';
|
|
18
19
|
|
|
19
20
|
const {Search} = CapInput;
|
|
20
21
|
const {CapTreeNode} = CapTree;
|
|
22
|
+
|
|
21
23
|
class CapTagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
22
24
|
constructor(props) {
|
|
23
25
|
super(props);
|
|
@@ -133,10 +135,14 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
133
135
|
};
|
|
134
136
|
|
|
135
137
|
renderTags(tags, searchString = '') {
|
|
136
|
-
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable} = this.props.disableTagsDetails;
|
|
138
|
+
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags} = this.props.disableTagsDetails;
|
|
137
139
|
const list = [];
|
|
138
140
|
const loyaltyAttrDisableText = <FormattedMessage {...messages.loyaltyAttributeDisable} />;
|
|
139
|
-
_.
|
|
141
|
+
let clonedTags = _.cloneDeep(tags);
|
|
142
|
+
if (!showCardsRelatedTags) {
|
|
143
|
+
clonedTags = _.omit(clonedTags, CARD_RELATED_TAGS);
|
|
144
|
+
}
|
|
145
|
+
_.forEach(clonedTags, (val = '', key) => {
|
|
140
146
|
let supportedTagsString = '';
|
|
141
147
|
_.forEach(val.supportedTags, (supportedTag) => {
|
|
142
148
|
supportedTagsString += `${supportedTag} ,`;
|
|
@@ -29,6 +29,7 @@ export const GET_TOPBAR_MENU_DATA_FAILURE = 'creatives/cap/GET_TOPBAR_MENU_DATA_
|
|
|
29
29
|
export const CLEAR_TOPBAR_MENU_DATA = 'creatives/cap/CLEAR_TOPBAR_MENU_DATA';
|
|
30
30
|
|
|
31
31
|
export const SET_LOYALTY_PROMOTION_RELATED_CREATIVE_TAGS_DISPLAY = 'SET_LOYALTY_PROMOTION_RELATED_CREATIVE_TAGS_DISPLAY';
|
|
32
|
+
export const SET_CARD_RELATED_TAGS_VISIBILITY = 'SET_CARD_RELATED_TAGS_VISIBILITY';
|
|
32
33
|
|
|
33
34
|
export const CAMPAIGN_SETTINGS_URL = '/creatives/settings/message';
|
|
34
35
|
export const ORG_SETTINGS_URL = '/org/index';
|
|
@@ -121,6 +121,9 @@ function capReducer(state = fromJS(initialState.cap), action) {
|
|
|
121
121
|
.set('tagsToDisable', action.tagsToDisable)
|
|
122
122
|
.set('parentTagsToDisable', action.parentTagsToDisable);
|
|
123
123
|
}
|
|
124
|
+
case types.SET_CARD_RELATED_TAGS_VISIBILITY: {
|
|
125
|
+
return state.set('showCardsRelatedTags', action.showCardsRelatedTags);
|
|
126
|
+
}
|
|
124
127
|
default:
|
|
125
128
|
return state;
|
|
126
129
|
}
|
|
@@ -79,6 +79,7 @@ const makeSelectLoyaltyPromotionDisplay = () => createSelector(
|
|
|
79
79
|
disableRelatedTags: globalState.get('disableLoyaltyPromotionRelatedTags'),
|
|
80
80
|
childTagsToDisable: globalState.get('tagsToDisable') || [],
|
|
81
81
|
parentTagstoDisable: globalState.get('parentTagsToDisable') || [],
|
|
82
|
+
showCardsRelatedTags: globalState.get('showCardsRelatedTags') || false,
|
|
82
83
|
}),
|
|
83
84
|
);
|
|
84
85
|
|
|
@@ -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,18 +201,12 @@ function SlideBoxContent(props) {
|
|
|
202
201
|
|
|
203
202
|
const getChannelPreviewContent = (templateDataObject) => {
|
|
204
203
|
switch (templateDataObject.type.toUpperCase()) {
|
|
205
|
-
case constants.SMS:
|
|
206
|
-
|
|
207
|
-
const updatedSmsEditor = get(
|
|
208
|
-
templateDataObject,
|
|
209
|
-
`versions.base['updated-sms-editor']`,
|
|
210
|
-
'',
|
|
211
|
-
);
|
|
212
|
-
if (!isTraiDlt || updatedSmsEditor === '') {
|
|
204
|
+
case constants.SMS:
|
|
205
|
+
if (!commonUtil.hasTraiDltFeature() || get(templateDataObject, `versions.base['updated-sms-editor']`) === "") {
|
|
213
206
|
return get(templateDataObject, `versions.base['sms-editor']`);
|
|
207
|
+
} else {
|
|
208
|
+
return templateDataObject.versions.base['updated-sms-editor']?.join('');
|
|
214
209
|
}
|
|
215
|
-
return updatedSmsEditor.join('');
|
|
216
|
-
}
|
|
217
210
|
case constants.LINE: {
|
|
218
211
|
const lineContents = get(templateDataObject, `versions.base.content.messages`, [{}]);
|
|
219
212
|
const previewContent = [];
|
|
@@ -354,7 +347,6 @@ function SlideBoxContent(props) {
|
|
|
354
347
|
messageStrategy={messageStrategy}
|
|
355
348
|
showDisabledFBInfo={showDisabledFBInfo}
|
|
356
349
|
orgUnitId={orgUnitId}
|
|
357
|
-
smsRegister={smsRegister}
|
|
358
350
|
/>
|
|
359
351
|
)}
|
|
360
352
|
{isPreview && (
|
|
@@ -424,7 +416,6 @@ function SlideBoxContent(props) {
|
|
|
424
416
|
onTestContentClicked={onTestContentClicked}
|
|
425
417
|
handleClose={handleClose}
|
|
426
418
|
onCreateComplete={onCreateComplete}
|
|
427
|
-
smsRegister={smsRegister}
|
|
428
419
|
/>
|
|
429
420
|
)}
|
|
430
421
|
{isEditFTP && (
|
|
@@ -472,8 +463,6 @@ function SlideBoxContent(props) {
|
|
|
472
463
|
onPreviewContentClicked={onPreviewContentClicked}
|
|
473
464
|
onTestContentClicked={onTestContentClicked}
|
|
474
465
|
onCreateComplete={onCreateComplete}
|
|
475
|
-
smsRegister={smsRegister}
|
|
476
|
-
onShowTemplates={onShowTemplates}
|
|
477
466
|
/>
|
|
478
467
|
)}
|
|
479
468
|
|
|
@@ -727,6 +716,5 @@ SlideBoxContent.propTypes = {
|
|
|
727
716
|
fbAdManager: PropTypes.string,
|
|
728
717
|
showDisabledFBInfo: PropTypes.boolean,
|
|
729
718
|
orgUnitId: PropTypes.any,
|
|
730
|
-
smsRegister: PropTypes.any,
|
|
731
719
|
};
|
|
732
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;
|
|
@@ -357,25 +357,7 @@ class Creatives extends React.Component {
|
|
|
357
357
|
switch (channel) {
|
|
358
358
|
case constants.SMS:
|
|
359
359
|
if (template.value.base) {
|
|
360
|
-
|
|
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
|
-
}
|
|
360
|
+
templateData.messageBody = template.value.base['sms-editor'];
|
|
379
361
|
}
|
|
380
362
|
break;
|
|
381
363
|
case constants.EMAIL:
|
|
@@ -789,7 +771,7 @@ class Creatives extends React.Component {
|
|
|
789
771
|
}
|
|
790
772
|
render() {
|
|
791
773
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
792
|
-
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;
|
|
793
775
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
794
776
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
795
777
|
return (
|
|
@@ -813,7 +795,6 @@ class Creatives extends React.Component {
|
|
|
813
795
|
weChatTemplateType={weChatTemplateType}
|
|
814
796
|
showPrefix={!isUploading} // not show back button when email template is being uploaded
|
|
815
797
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
816
|
-
smsRegister={smsRegister}
|
|
817
798
|
/>}
|
|
818
799
|
content={
|
|
819
800
|
<SlideBoxContent
|
|
@@ -867,7 +848,6 @@ class Creatives extends React.Component {
|
|
|
867
848
|
handleClose={this.handleCloseSlideBox}
|
|
868
849
|
onFTPSubmit={getCreativesData}
|
|
869
850
|
editor={editor}
|
|
870
|
-
smsRegister={smsRegister}
|
|
871
851
|
messageStrategy={this.props.strategy}
|
|
872
852
|
orgUnitId={this.props.orgUnitId}
|
|
873
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('');
|
|
@@ -131,7 +126,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
131
126
|
`${selectedHeaderAlias.toUpperCase()} is mandatory and each ${selectedHeaderAlias.toUpperCase()} must contain either 6 letters or 6 numbers. It cannot contain special characters`,
|
|
132
127
|
);
|
|
133
128
|
} else if (index === approvalIndex && cell.toLowerCase() !== APPROVED) {
|
|
134
|
-
approvalErrorArray.push(`
|
|
129
|
+
approvalErrorArray.push(`Templates will be created for only approved/ registered templates.`);
|
|
135
130
|
} else if (!cell && index !== headerIndex && index !== approvalIndex) {
|
|
136
131
|
errorArray.push(`"${transformedResults[0][index]}"`);
|
|
137
132
|
}
|
|
@@ -456,11 +451,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
456
451
|
{ templates: savedData },
|
|
457
452
|
(resp, errorMessage) => {
|
|
458
453
|
createCallback({ errorMessage });
|
|
459
|
-
|
|
460
|
-
onCreateComplete();
|
|
461
|
-
} else {
|
|
462
|
-
onShowTemplates();
|
|
463
|
-
}
|
|
454
|
+
onCreateComplete();
|
|
464
455
|
},
|
|
465
456
|
);
|
|
466
457
|
};
|
|
@@ -538,7 +529,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
538
529
|
{previewFileIndex !== null && (
|
|
539
530
|
<>
|
|
540
531
|
<CapRow span={24} className="upload-type-group-create-container">
|
|
541
|
-
|
|
532
|
+
<div className="upload-file-preview">
|
|
542
533
|
<CapDivider
|
|
543
534
|
type="horizontal"
|
|
544
535
|
className="upload-file-preview-divider-1"
|
|
@@ -643,7 +634,7 @@ export const SmsTraiCreate = (props) => {
|
|
|
643
634
|
className="upload-file-preview-divider-2"
|
|
644
635
|
/>
|
|
645
636
|
{errorText && <CapError>{errorText}</CapError>}
|
|
646
|
-
|
|
637
|
+
</div>
|
|
647
638
|
</CapRow>
|
|
648
639
|
</>
|
|
649
640
|
)}
|
|
@@ -54,7 +54,7 @@ export default defineMessages({
|
|
|
54
54
|
},
|
|
55
55
|
fileMinlengthError: {
|
|
56
56
|
id: `${prefix}.fileMinlengthError`,
|
|
57
|
-
defaultMessage: 'Please select a
|
|
57
|
+
defaultMessage: 'Please select a CSV file with minimum 1 row of data and 1 row of headers',
|
|
58
58
|
},
|
|
59
59
|
fileMaxlengthError: {
|
|
60
60
|
id: `${prefix}.fileMaxlengthError`,
|
|
@@ -42,7 +42,6 @@ import {
|
|
|
42
42
|
LIBRARY,
|
|
43
43
|
} from './constants';
|
|
44
44
|
let varMap = {};
|
|
45
|
-
let traiData = {};
|
|
46
45
|
const { TextArea } = CapInput;
|
|
47
46
|
const { CapLabelInline } = CapLabel;
|
|
48
47
|
export const SmsTraiEdit = (props) => {
|
|
@@ -59,9 +58,6 @@ export const SmsTraiEdit = (props) => {
|
|
|
59
58
|
metaEntities,
|
|
60
59
|
injectedTags,
|
|
61
60
|
onCreateComplete,
|
|
62
|
-
isFullMode,
|
|
63
|
-
getFormSubscriptionData,
|
|
64
|
-
templateData = {},
|
|
65
61
|
} = props || {};
|
|
66
62
|
const { formatMessage } = intl;
|
|
67
63
|
const [loading, updateLoading] = useState(true);
|
|
@@ -108,15 +104,13 @@ export const SmsTraiEdit = (props) => {
|
|
|
108
104
|
}
|
|
109
105
|
return () => {
|
|
110
106
|
actions.resetEditTemplate();
|
|
111
|
-
varMap = {};
|
|
112
107
|
};
|
|
113
108
|
}, []);
|
|
114
109
|
|
|
115
110
|
//computing placeholder array for mapping values and rendering dynamic form
|
|
116
111
|
useEffect(() => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
let msg = get(traiData, `versions.base.sms-editor`);
|
|
112
|
+
if (templateDetails && !isEmpty(templateDetails)) {
|
|
113
|
+
let msg = get(templateDetails, `versions.base.sms-editor`);
|
|
120
114
|
const templateMessageArray = [];
|
|
121
115
|
//converting sms-editor string to an array split at '{#var#}'
|
|
122
116
|
//split and push string before '{#var#}[0 to index]', push '{#var#}',
|
|
@@ -140,19 +134,16 @@ export const SmsTraiEdit = (props) => {
|
|
|
140
134
|
//stop spinner
|
|
141
135
|
updateLoading(false);
|
|
142
136
|
}
|
|
143
|
-
}, [templateDetails
|
|
137
|
+
}, [templateDetails]);
|
|
144
138
|
|
|
145
139
|
useEffect(() => {
|
|
146
140
|
if (tempMsgArray.length !== 0) {
|
|
147
|
-
const traiBase = traiData?.versions?.base || {};
|
|
148
|
-
const {
|
|
149
|
-
['var-mapped']: varMapped = {},
|
|
150
|
-
['updated-sms-editor']: traiSmsEditor = '',
|
|
151
|
-
} = traiBase;
|
|
152
141
|
//if varMapped and updated-sms-editor is already present on non first edits
|
|
153
|
-
if (!isEmpty(
|
|
154
|
-
varMap = cloneDeep(
|
|
155
|
-
setUpdatedSmsEditor(
|
|
142
|
+
if (!isEmpty(get(templateDetails, `versions.base.var-mapped`))) {
|
|
143
|
+
varMap = cloneDeep(get(templateDetails, `versions.base.var-mapped`));
|
|
144
|
+
setUpdatedSmsEditor(
|
|
145
|
+
get(templateDetails, `versions.base.updated-sms-editor`),
|
|
146
|
+
);
|
|
156
147
|
} else {
|
|
157
148
|
//computing varMap for first edit
|
|
158
149
|
let counter = 1;
|
|
@@ -206,21 +197,10 @@ export const SmsTraiEdit = (props) => {
|
|
|
206
197
|
} else {
|
|
207
198
|
//start spinner
|
|
208
199
|
updateLoading(true);
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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
|
-
});
|
|
200
|
+
templateDetails.versions.base['var-mapped'] = varMap;
|
|
201
|
+
templateDetails.versions.base['updated-sms-editor'] = updatedSmsEditor;
|
|
202
|
+
templateDetails.versions.history = [templateDetails.versions.base];
|
|
203
|
+
actions.editTemplate(templateDetails, onUpdateTemplateComplete);
|
|
224
204
|
}
|
|
225
205
|
};
|
|
226
206
|
//Saving on done end
|
|
@@ -411,13 +391,13 @@ export const SmsTraiEdit = (props) => {
|
|
|
411
391
|
<>
|
|
412
392
|
<CapSpin spinning={loading}>
|
|
413
393
|
<CapRow>
|
|
414
|
-
{
|
|
394
|
+
{templateDetails && !isEmpty(templateDetails) && (
|
|
415
395
|
<TraiEditTemplateDetails>
|
|
416
396
|
<CapLabelInline type="label1">
|
|
417
397
|
{formatMessage(messages.templateLabel)}
|
|
418
398
|
</CapLabelInline>
|
|
419
399
|
<CapLabelInline type="label2">
|
|
420
|
-
{
|
|
400
|
+
{templateDetails.versions.base.template_name}
|
|
421
401
|
</CapLabelInline>
|
|
422
402
|
<CapLabelInline type="label1">
|
|
423
403
|
{formatMessage(messages.traiEditSeperator)}
|
|
@@ -426,7 +406,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
426
406
|
{formatMessage(messages.senderIdlabel)}
|
|
427
407
|
</CapLabelInline>
|
|
428
408
|
<CapLabelInline type="label2">
|
|
429
|
-
{
|
|
409
|
+
{templateDetails.versions.base.header}
|
|
430
410
|
</CapLabelInline>
|
|
431
411
|
</TraiEditTemplateDetails>
|
|
432
412
|
)}
|
|
@@ -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
|
}
|