@capillarytech/creatives-library 8.0.69-alpha.8 → 8.0.69
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
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import Bugsnag from "@bugsnag/js";
|
|
4
3
|
import {
|
|
5
4
|
CapSlideBox,
|
|
6
5
|
CapHeader,
|
|
@@ -140,27 +139,21 @@ export class Creatives extends React.Component {
|
|
|
140
139
|
templateData.updatedByName = commonUtil.getUserNameById(userId, usersList);
|
|
141
140
|
this.setState({ slidBoxContent: constants.PREVIEW, templateData });
|
|
142
141
|
} else {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
host: hostName || this.props?.hostName || this.props.Templates?.senderDetails?.hostName,
|
|
159
|
-
id: template?._id,
|
|
160
|
-
preview: true,
|
|
161
|
-
actionCallback: this.actionCallback,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
142
|
+
const {
|
|
143
|
+
name = "",
|
|
144
|
+
sourceAccountIdentifier = "",
|
|
145
|
+
configs: { token = "" } = {},
|
|
146
|
+
} = get(this.props, "Templates.selectedZaloAccount", {});
|
|
147
|
+
const { hostName = '' } = get(this.props, "Templates.senderDetails", {});
|
|
148
|
+
this.props.zaloActions.getTemplateInfoById({
|
|
149
|
+
username: name,
|
|
150
|
+
oa_id: sourceAccountIdentifier,
|
|
151
|
+
token,
|
|
152
|
+
host: hostName,
|
|
153
|
+
id: template?._id,
|
|
154
|
+
preview: true,
|
|
155
|
+
actionCallback: this.actionCallback,
|
|
156
|
+
});
|
|
164
157
|
}
|
|
165
158
|
};
|
|
166
159
|
|
|
@@ -810,6 +803,7 @@ export class Creatives extends React.Component {
|
|
|
810
803
|
templateData = {
|
|
811
804
|
channel,
|
|
812
805
|
accountId,
|
|
806
|
+
sourceAccountIdentifier: selectedWhatsappAccount?.sourceAccountIdentifier || '',
|
|
813
807
|
accountName: accountDetails?.name || '',
|
|
814
808
|
messageBody: languages[0].content,
|
|
815
809
|
templateConfigs: {
|
|
@@ -12,7 +12,6 @@ import styled from 'styled-components';
|
|
|
12
12
|
import {injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
13
13
|
import { createStructuredSelector } from 'reselect';
|
|
14
14
|
import moment from "moment";
|
|
15
|
-
import Bugsnag from "@bugsnag/js";
|
|
16
15
|
import get from 'lodash/get';
|
|
17
16
|
import isEmpty from 'lodash/isEmpty';
|
|
18
17
|
import isEqual from 'lodash/isEqual';
|
|
@@ -51,8 +50,7 @@ import {
|
|
|
51
50
|
CapImage,
|
|
52
51
|
CapStatus,
|
|
53
52
|
CapColoredTag,
|
|
54
|
-
|
|
55
|
-
} from "@capillarytech/cap-ui-library";
|
|
53
|
+
} from '@capillarytech/cap-ui-library';
|
|
56
54
|
import { makeSelectTemplates, makeSelectTemplatesResponse } from './selectors';
|
|
57
55
|
import { makeSelectCreate as makeSelectCreateSms} from '../Sms/Create/selectors';
|
|
58
56
|
import { makeSelectCreate as makeSelectCreateMobilePush } from '../MobilePush/Create/selectors';
|
|
@@ -229,7 +227,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
229
227
|
hostName: '',
|
|
230
228
|
searchedZaloTemplates: [],
|
|
231
229
|
searchingZaloTemplate: false,
|
|
232
|
-
zaloPreviewItemId: {},
|
|
233
230
|
};
|
|
234
231
|
|
|
235
232
|
this.handleOnHoverItem = this.handleOnHoverItem.bind(this);
|
|
@@ -536,8 +533,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
536
533
|
params.accountId = Number(query.account_id);
|
|
537
534
|
this.getAllTemplates({params});
|
|
538
535
|
}
|
|
539
|
-
}
|
|
540
|
-
|
|
536
|
+
}
|
|
537
|
+
|
|
541
538
|
|
|
542
539
|
if (selectedChannel === "ebill" && nextProps.CreateEbill && nextProps.CreateEbill.createResponse && nextProps.CreateEbill.createResponse.templateId && nextProps.CreateEbill.createResponse.templateId !== '') {
|
|
543
540
|
const message = `${this.state.channel} ${this.props.intl.formatMessage(messages.templateDuplicateSuccess)}`;
|
|
@@ -663,7 +660,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
663
660
|
const isSingleAccount = weCrmAccountsList?.length === 1;
|
|
664
661
|
const selectedAccount = this.props.Templates[ACCOUNT_MAPPING_ON_CHANNEL[selectedChannel]] || {};
|
|
665
662
|
const hostName = this.getHostName(isSingleAccount ? weCrmAccountsList[0]?.sourceAccountIdentifier : selectedAccount?.sourceAccountIdentifier, senderDetails?.domainProperties);
|
|
666
|
-
|
|
667
663
|
if (!isEmpty(hostName)) {
|
|
668
664
|
const paramsDefault = {};
|
|
669
665
|
const {name, sourceAccountIdentifier, configs } = weCrmAccountsList?.[0] || {};
|
|
@@ -697,7 +693,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
697
693
|
}
|
|
698
694
|
const zaloPreviewUrl = get(nextProps, 'Zalo.zaloTemplatePreviewData.versions.base.content.zalo.previewUrl', '');
|
|
699
695
|
if (zaloPreviewUrl && this.state.channel.toLowerCase() === ZALO_LOWERCASE) {
|
|
700
|
-
this.setState({ zaloPreviewItemId: {} });
|
|
701
696
|
handlePreviewInNewTab(zaloPreviewUrl);
|
|
702
697
|
this.props.zaloActions.resetTemplatePreviewData();
|
|
703
698
|
}
|
|
@@ -831,6 +826,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
831
826
|
if (this.state.previewOpen) {
|
|
832
827
|
creativesParams.mode = 'preview';
|
|
833
828
|
creativesParams = {...creativesParams, ...this.state.previewTemplate};
|
|
829
|
+
|
|
834
830
|
}
|
|
835
831
|
return creativesParams;
|
|
836
832
|
}
|
|
@@ -924,7 +920,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
924
920
|
}
|
|
925
921
|
if (
|
|
926
922
|
this.state.channel.toLowerCase() === ZALO_LOWERCASE &&
|
|
927
|
-
!isEmpty(this.props.Templates?.selectedZaloAccount) &&
|
|
923
|
+
!isEmpty(this.props.Templates?.selectedZaloAccount) &&
|
|
928
924
|
!params?.isAccountSelection && !isEmpty(this.props.Templates?.selectedZaloAccount?.hostName)
|
|
929
925
|
) {
|
|
930
926
|
const {
|
|
@@ -986,7 +982,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
986
982
|
default:
|
|
987
983
|
return selectedWhatsappCategory === category;
|
|
988
984
|
}
|
|
989
|
-
}
|
|
985
|
+
}
|
|
990
986
|
return true;
|
|
991
987
|
}
|
|
992
988
|
filterWhatsappTemplates = (templates) => {
|
|
@@ -1076,7 +1072,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1076
1072
|
) : <>{children}</>
|
|
1077
1073
|
};
|
|
1078
1074
|
|
|
1079
|
-
getTemplateDataForGrid = ({templates = [], handlers, filterContent, channel, isLoading, loadingTip
|
|
1075
|
+
getTemplateDataForGrid = ({templates = [], handlers, filterContent, channel, isLoading, loadingTip}) => {
|
|
1080
1076
|
const currentChannel = channel.toUpperCase();
|
|
1081
1077
|
const {channel: stateChannel} = this.state;
|
|
1082
1078
|
const channelLowerCase = stateChannel.toLowerCase();
|
|
@@ -1108,12 +1104,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1108
1104
|
? this.getCreativesEditText(channelLowerCase)
|
|
1109
1105
|
: messages.selectButton
|
|
1110
1106
|
);
|
|
1111
|
-
|
|
1107
|
+
|
|
1112
1108
|
const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
|
|
1113
1109
|
const androidBodyType = get(template, 'versions.base.content.ANDROID.bodyType');
|
|
1114
1110
|
const iosBodyType = get(template, 'versions.base.content.IOS.bodyType');
|
|
1115
1111
|
const inappBodyType = androidBodyType || iosBodyType;
|
|
1116
|
-
const isZaloPreviewLoading = previewTemplateId === template?._id;
|
|
1117
1112
|
const templateData = {
|
|
1118
1113
|
key: `${currentChannel}-card-${template?.name}`,
|
|
1119
1114
|
title: (
|
|
@@ -1136,27 +1131,20 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1136
1131
|
</span>
|
|
1137
1132
|
),
|
|
1138
1133
|
extra: [
|
|
1139
|
-
|
|
1140
|
-
<
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
} else {
|
|
1154
|
-
handlers.handlePreviewClick(template);
|
|
1155
|
-
}
|
|
1156
|
-
}}
|
|
1157
|
-
/>
|
|
1158
|
-
)
|
|
1159
|
-
)
|
|
1134
|
+
this.getHoverComponent(
|
|
1135
|
+
<CapIcon
|
|
1136
|
+
className={`view-${channelLowerCase}`}
|
|
1137
|
+
style={{ marginRight: "16px" }}
|
|
1138
|
+
type="eye"
|
|
1139
|
+
onClick={() => {
|
|
1140
|
+
if (!this.props.isFullMode || this.props.isDltFromRcs) {
|
|
1141
|
+
this.props.handlePeviewTemplate(template);
|
|
1142
|
+
} else {
|
|
1143
|
+
handlers.handlePreviewClick(template);
|
|
1144
|
+
}
|
|
1145
|
+
}}
|
|
1146
|
+
/>
|
|
1147
|
+
),
|
|
1160
1148
|
],
|
|
1161
1149
|
hoverOption: (
|
|
1162
1150
|
<CapButton
|
|
@@ -1165,15 +1153,15 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1165
1153
|
? `edit-${channelLowerCase}`
|
|
1166
1154
|
: `select-${channelLowerCase}`
|
|
1167
1155
|
}
|
|
1168
|
-
onClick={e =>
|
|
1156
|
+
onClick={(e) =>
|
|
1169
1157
|
handlers.handleEditClick(e, template, undefined, undefined, {
|
|
1170
|
-
account: this.state.selectedAccount
|
|
1158
|
+
account: this.state.selectedAccount,
|
|
1171
1159
|
})
|
|
1172
1160
|
}
|
|
1173
1161
|
>
|
|
1174
1162
|
{hoverButtonText}
|
|
1175
1163
|
</CapButton>
|
|
1176
|
-
)
|
|
1164
|
+
),
|
|
1177
1165
|
};
|
|
1178
1166
|
const {
|
|
1179
1167
|
versions: {
|
|
@@ -1232,7 +1220,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1232
1220
|
break;
|
|
1233
1221
|
}
|
|
1234
1222
|
case MOBILE_PUSH:
|
|
1235
|
-
case INAPP:
|
|
1223
|
+
case INAPP:
|
|
1236
1224
|
templateData.content = template;
|
|
1237
1225
|
break;
|
|
1238
1226
|
case WECHAT:
|
|
@@ -1656,7 +1644,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1656
1644
|
prepareWeChatPreviewData(template) {
|
|
1657
1645
|
if (template && template.versions && template.versions.base && !isEmpty(template.versions.base)) {
|
|
1658
1646
|
if (template.definition && template.definition.msgcontent && template.definition.msgcontent === "RICH_MEDIA_WECHAT") {
|
|
1659
|
-
console.log("prepareWeChatPreviewData", template, JSON.stringify(template), template.versions.base.mediaList, JSON.stringify(template.versions.base.mediaList));
|
|
1660
1647
|
return template.versions.base.mediaList;
|
|
1661
1648
|
}
|
|
1662
1649
|
return this.prepareWeChatMappedPreviewData(template.versions.base.content, template.versions.base.Tag, template.versions.base.data);
|
|
@@ -2201,26 +2188,21 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2201
2188
|
this.setState({ previewTemplate: templateInfo });
|
|
2202
2189
|
}
|
|
2203
2190
|
} else {
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
this.props.
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
id: template?._id,
|
|
2220
|
-
preview: true,
|
|
2221
|
-
actionCallback: this.actionCallback
|
|
2222
|
-
});
|
|
2223
|
-
}
|
|
2191
|
+
const {
|
|
2192
|
+
name = "",
|
|
2193
|
+
sourceAccountIdentifier = "",
|
|
2194
|
+
configs: { token = "" } = {},
|
|
2195
|
+
hostName = "",
|
|
2196
|
+
} = get(this.props, "Templates.selectedZaloAccount", {});
|
|
2197
|
+
this.props.zaloActions.getTemplateInfoById({
|
|
2198
|
+
username: name,
|
|
2199
|
+
oa_id: sourceAccountIdentifier,
|
|
2200
|
+
token: token,
|
|
2201
|
+
host: hostName || this.state.hostName || this.props.Templates?.senderDetails?.hostName,
|
|
2202
|
+
id: template?._id,
|
|
2203
|
+
preview: true,
|
|
2204
|
+
actionCallback: this.actionCallback,
|
|
2205
|
+
});
|
|
2224
2206
|
}
|
|
2225
2207
|
}
|
|
2226
2208
|
|
|
@@ -2913,6 +2895,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2913
2895
|
window.open(`/creatives/ui/v2?channel=${WHATSAPP_LOWERCASE}&mode=${CREATE}`, "_blank");
|
|
2914
2896
|
}
|
|
2915
2897
|
|
|
2898
|
+
|
|
2916
2899
|
render() {
|
|
2917
2900
|
const isFullMode = this.isFullMode();
|
|
2918
2901
|
const { activeMode, channel, wechatFilter, lineFilter, smsFilter, templatesCount } = this.state;
|
|
@@ -3199,130 +3182,70 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
3199
3182
|
return (
|
|
3200
3183
|
<>
|
|
3201
3184
|
{activeMode === ACCOUNT_CHANGE_MODE && this.renderAccountSelection()}
|
|
3202
|
-
<div
|
|
3203
|
-
|
|
3204
|
-
this.props.isFullMode ? "full-mode" : "library-mode"
|
|
3205
|
-
}`}
|
|
3206
|
-
>
|
|
3207
|
-
<input
|
|
3208
|
-
type="file"
|
|
3209
|
-
id="filename"
|
|
3210
|
-
style={{ display: "none" }}
|
|
3211
|
-
accept=".zip, .html, .htm"
|
|
3212
|
-
onChange={event =>
|
|
3213
|
-
this.handleFileUpload(event, { files: event.target.files })
|
|
3214
|
-
}
|
|
3215
|
-
/>
|
|
3185
|
+
<div className={`creatives-templates-list ${this.props.isFullMode ? 'full-mode' : 'library-mode'}`}>
|
|
3186
|
+
<input type="file" id="filename" style={{ display: 'none'}} accept=".zip, .html, .htm" onChange={(event) => this.handleFileUpload(event, {files: event.target.files})} />
|
|
3216
3187
|
|
|
3217
|
-
{
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3188
|
+
{
|
|
3189
|
+
channel.toLowerCase() === WHATSAPP_LOWERCASE && showWhatsappCountWarning ? (
|
|
3190
|
+
<CapAlert message={whatsappCountExceedText} type="info" />
|
|
3191
|
+
) : null
|
|
3192
|
+
}
|
|
3221
3193
|
|
|
3222
|
-
{
|
|
3223
|
-
|
|
3224
|
-
message={formatMessage(messages.whatsappOnlyApprovedTemplates)}
|
|
3225
|
-
|
|
3226
|
-
|
|
3194
|
+
{
|
|
3195
|
+
channel.toLowerCase() === WHATSAPP_LOWERCASE && !isFullMode ? (
|
|
3196
|
+
<CapInfoNote message={formatMessage(messages.whatsappOnlyApprovedTemplates)} />
|
|
3197
|
+
) : null
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
{
|
|
3201
|
+
channel.toLowerCase() === ZALO_LOWERCASE && !isFullMode ? (
|
|
3202
|
+
<CapInfoNote message={formatMessage(messages.zaloOnlyApprovedTemplates)} />
|
|
3203
|
+
) : null
|
|
3204
|
+
}
|
|
3227
3205
|
|
|
3228
|
-
{channel.toLowerCase() === ZALO_LOWERCASE && !isFullMode ? (
|
|
3229
|
-
<CapInfoNote
|
|
3230
|
-
message={formatMessage(messages.zaloOnlyApprovedTemplates)}
|
|
3231
|
-
/>
|
|
3232
|
-
) : null}
|
|
3233
3206
|
<CapRow>
|
|
3234
|
-
<Pagination
|
|
3235
|
-
|
|
3236
|
-
this.props.Templates.getAllTemplatesInProgress
|
|
3237
|
-
}
|
|
3238
|
-
onPageChange={
|
|
3239
|
-
templates.length ? this.onPaginationChange : () => {}
|
|
3240
|
-
}
|
|
3241
|
-
paginationSelector="pagination-container"
|
|
3242
|
-
>
|
|
3243
|
-
{this.getTemplateDataForGrid({
|
|
3244
|
-
previewTemplateId: this.state.zaloPreviewItemId,
|
|
3245
|
-
isLoading,
|
|
3246
|
-
loadingTip,
|
|
3247
|
-
channel: this.state.channel,
|
|
3248
|
-
templates: this.state.searchingZaloTemplate
|
|
3249
|
-
? this.state.searchedZaloTemplates
|
|
3250
|
-
: this.props.TemplatesList,
|
|
3251
|
-
filterContent,
|
|
3252
|
-
handlers: {
|
|
3253
|
-
handlePreviewClick: this.handlePreviewClick,
|
|
3254
|
-
handleEditClick: this.handleEditClick
|
|
3255
|
-
}
|
|
3256
|
-
})}
|
|
3207
|
+
<Pagination templateInProgress={this.props.Templates.getAllTemplatesInProgress} onPageChange={templates.length ? this.onPaginationChange : () => {}} paginationSelector="pagination-container">
|
|
3208
|
+
{this.getTemplateDataForGrid({ isLoading, loadingTip, channel: this.state.channel, templates: this.state.searchingZaloTemplate ? this.state.searchedZaloTemplates : this.props.TemplatesList, filterContent, handlers: { handlePreviewClick: this.handlePreviewClick, handleEditClick: this.handleEditClick}})}
|
|
3257
3209
|
</Pagination>
|
|
3258
|
-
{showNoTemplatesFound &&
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
textAlign: "center",
|
|
3263
|
-
lineHeight: "65vh"
|
|
3264
|
-
}}
|
|
3265
|
-
>
|
|
3266
|
-
<CapHeading type="h6">
|
|
3267
|
-
{this.props.intl.formatMessage(messages.noTemplatesFound)}
|
|
3268
|
-
</CapHeading>
|
|
3269
|
-
</div>
|
|
3270
|
-
)}
|
|
3210
|
+
{showNoTemplatesFound &&
|
|
3211
|
+
<div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
|
|
3212
|
+
<CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesFound)}</CapHeading>
|
|
3213
|
+
</div>}
|
|
3271
3214
|
</CapRow>
|
|
3272
3215
|
|
|
3216
|
+
|
|
3273
3217
|
<CapRow>
|
|
3274
|
-
{!isEmpty(creativesParams.mode) &&
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
this.props,
|
|
3290
|
-
"Templates.selectedWeChatAccount",
|
|
3291
|
-
{}
|
|
3292
|
-
)}
|
|
3293
|
-
selectedAccount={this.state.selectedAccount}
|
|
3294
|
-
/>
|
|
3295
|
-
)}
|
|
3218
|
+
{!isEmpty(creativesParams.mode) && isFullMode && //creatives container for fullmode
|
|
3219
|
+
<CreativesContainer
|
|
3220
|
+
key={creativesParams.mode}
|
|
3221
|
+
messageDetails={{type: "default"}}
|
|
3222
|
+
creativesMode={creativesParams.mode}
|
|
3223
|
+
messages={messages}
|
|
3224
|
+
isFullMode={isFullMode}
|
|
3225
|
+
templateData={creativesParams}
|
|
3226
|
+
getCreativesData={() => { this.onCreateComplete(true); }}
|
|
3227
|
+
channel={route.name.toUpperCase()}
|
|
3228
|
+
handleCloseCreatives={this.onCreateComplete}
|
|
3229
|
+
selectedWeChatAccount={get(this.props, 'Templates.selectedWeChatAccount', {})}
|
|
3230
|
+
selectedAccount={this.state.selectedAccount}
|
|
3231
|
+
/>
|
|
3232
|
+
}
|
|
3296
3233
|
</CapRow>
|
|
3297
3234
|
<CapRow>
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
this.state.previewTemplate
|
|
3311
|
-
? this.state.previewTemplate.updatedAt
|
|
3312
|
-
: ""
|
|
3313
|
-
}
|
|
3314
|
-
updatedByName={commonUtil.getUserNameById(
|
|
3315
|
-
parseInt(this.state.previewTemplate.updatedBy, 10),
|
|
3316
|
-
commonUtil.getMergedUserList(this.props.Templates.userList)
|
|
3317
|
-
)}
|
|
3318
|
-
/>
|
|
3319
|
-
)}
|
|
3235
|
+
|
|
3236
|
+
{(this.state.channel.toLowerCase() === 'ebill' || this.state.channel.toLowerCase() === 'email') && htmlPreviewContent && <EmailPreview
|
|
3237
|
+
header={previewHeader}
|
|
3238
|
+
content={htmlPreviewContent}
|
|
3239
|
+
show={this.state.showHtmlPreview}
|
|
3240
|
+
device={this.state.device}
|
|
3241
|
+
handleClose={this.toggleEmailPreview}
|
|
3242
|
+
changePreviewDevice={this.changePreviewDevice}
|
|
3243
|
+
versions={get(this.state, 'previewTemplate.versions', {})}
|
|
3244
|
+
lastModified={this.state.previewTemplate ? this.state.previewTemplate.updatedAt : ''}
|
|
3245
|
+
updatedByName={commonUtil.getUserNameById(parseInt(this.state.previewTemplate.updatedBy, 10), commonUtil.getMergedUserList(this.props.Templates.userList))}
|
|
3246
|
+
/>}
|
|
3320
3247
|
<CapSlideBox
|
|
3321
|
-
header={
|
|
3322
|
-
<h3>
|
|
3323
|
-
{this.props.intl.formatMessage(messages.layoutSelection)}
|
|
3324
|
-
</h3>
|
|
3325
|
-
}
|
|
3248
|
+
header={(<h3>{this.props.intl.formatMessage(messages.layoutSelection)}</h3>)}
|
|
3326
3249
|
width={60}
|
|
3327
3250
|
content={cmsTemplateSelectionContent}
|
|
3328
3251
|
show={this.state.showEdmEmailTemplates}
|
|
@@ -3332,6 +3255,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
3332
3255
|
/>
|
|
3333
3256
|
{this.renderDeleteConfirmationModal()}
|
|
3334
3257
|
</CapRow>
|
|
3258
|
+
|
|
3335
3259
|
</div>
|
|
3336
3260
|
</>
|
|
3337
3261
|
);
|
|
@@ -7,8 +7,6 @@ import * as Api from '../../services/api';
|
|
|
7
7
|
import * as types from './constants';
|
|
8
8
|
import { saveCdnConfigs, removeAllCdnLocalStorageItems } from '../../utils/cdnTransformation';
|
|
9
9
|
import { COPY_OF } from '../../containers/App/constants';
|
|
10
|
-
import { ZALO_TEMPLATE_INFO_REQUEST } from '../Zalo/constants';
|
|
11
|
-
import { getTemplateInfoById } from '../Zalo/saga';
|
|
12
10
|
// Individual exports for testing
|
|
13
11
|
export function* getAllTemplates(channel, queryParams) {
|
|
14
12
|
try {
|
|
@@ -223,10 +221,6 @@ export function* watchGetCdnTransformationConfig() {
|
|
|
223
221
|
);
|
|
224
222
|
}
|
|
225
223
|
|
|
226
|
-
export function* watchForGetTemplateInfoById() {
|
|
227
|
-
yield takeLatest(ZALO_TEMPLATE_INFO_REQUEST, getTemplateInfoById);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
224
|
// All sagas to be loaded
|
|
231
225
|
export default [
|
|
232
226
|
watchGetAllTemplates,
|
|
@@ -251,7 +245,6 @@ export function* v2TemplateSaga() {
|
|
|
251
245
|
watchGetCdnTransformationConfig(),
|
|
252
246
|
watchFetchWeCrmAccounts(),
|
|
253
247
|
watchGetSenderDetails(),
|
|
254
|
-
watchForGetTemplateInfoById(),
|
|
255
248
|
]);
|
|
256
249
|
}
|
|
257
250
|
|