@capillarytech/creatives-library 7.6.0 → 7.6.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/assets/DeviceForEmail.png +0 -0
- package/components/CapTagList/index.js +5 -5
- package/components/Card/index.js +1 -1
- package/components/Ckeditor/index.js +5 -5
- package/components/CustomPopOver/index.js +3 -3
- package/components/Edmeditor/index.js +4 -4
- package/components/EmailPreview/index.js +1 -1
- package/components/PreviewSideBar/index.js +3 -3
- package/components/Sidebar/index.js +1 -1
- package/components/SmsTest/index.js +4 -4
- package/components/TemplatePreview/index.js +2 -2
- package/components/Toastr/index.js +1 -1
- package/containers/Assets/Gallery/index.js +2 -2
- package/containers/Assets/Gallery/sagas.js +1 -1
- package/containers/Cap/actions.js +2 -2
- package/containers/Cap/reducer.js +1 -1
- package/containers/Cap/sagas.js +3 -3
- package/containers/Cap/selectors.js +1 -1
- package/containers/Ebill/actions.js +1 -1
- package/containers/Ebill/index.js +34 -34
- package/containers/Ebill/sagas.js +3 -3
- package/containers/Email/actions.js +2 -2
- package/containers/Email/index.js +171 -171
- package/containers/Email/reducer.js +1 -1
- package/containers/Email/sagas.js +6 -6
- package/containers/LanguageProvider/actions.js +1 -1
- package/containers/Line/Create/actions.js +5 -5
- package/containers/Line/Create/index.js +37 -37
- package/containers/Line/Create/sagas.js +7 -7
- package/containers/Line/Edit/actions.js +3 -3
- package/containers/Line/Edit/index.js +24 -24
- package/containers/Line/Edit/sagas.js +4 -4
- package/containers/MobilePush/Create/actions.js +2 -2
- package/containers/MobilePush/Create/index.js +35 -35
- package/containers/MobilePush/Create/sagas.js +2 -2
- package/containers/MobilePush/Edit/actions.js +3 -3
- package/containers/MobilePush/Edit/index.js +32 -32
- package/containers/MobilePush/Edit/sagas.js +5 -5
- package/containers/Sms/Create/actions.js +2 -2
- package/containers/Sms/Create/index.js +57 -57
- package/containers/Sms/Create/sagas.js +2 -2
- package/containers/Sms/Edit/actions.js +3 -3
- package/containers/Sms/Edit/index.js +44 -44
- package/containers/Sms/Edit/sagas.js +3 -3
- package/containers/TagList/index.js +9 -9
- package/containers/Templates/actions.js +5 -5
- package/containers/Templates/index.js +44 -44
- package/containers/Templates/sagas.js +5 -5
- package/containers/WeChat/MapTemplates/actions.js +1 -1
- package/containers/WeChat/MapTemplates/index.js +34 -34
- package/containers/WeChat/MapTemplates/sagas.js +2 -2
- package/containers/WeChat/RichmediaTemplates/Create/index.js +9 -9
- package/containers/WeChat/RichmediaTemplates/Edit/actions.js +1 -1
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +1 -1
- package/package.json +1 -1
- package/services/api.js +20 -24
- package/utils/authWrapper.js +2 -2
- package/utils/smsCharCount.js +5 -5
- package/v2Components/CapTagList/index.js +1 -1
- package/v2Components/CapVideoUpload/index.js +14 -6
- package/v2Components/Card/index.js +1 -1
- package/v2Components/Ckeditor/index.js +5 -5
- package/v2Components/CustomPopOver/index.js +3 -3
- package/v2Components/Edmeditor/index.js +4 -4
- package/v2Components/EmailMobilePreview/index.js +4 -4
- package/v2Components/EmailPreviewV2/index.js +4 -4
- package/v2Components/FormBuilder/index.js +3 -3
- package/v2Components/PreviewSideBar/index.js +3 -3
- package/v2Components/SmsTest/index.js +4 -4
- package/v2Components/TemplatePreview/index.js +5 -1
- package/v2Components/Toastr/index.js +1 -1
- package/v2Containers/Assets/Gallery/sagas.js +1 -1
- package/v2Containers/Cap/actions.js +1 -1
- package/v2Containers/Cap/index.js +2 -2
- package/v2Containers/Cap/reducer.js +1 -1
- package/v2Containers/Cap/sagas.js +3 -3
- package/v2Containers/Cap/selectors.js +1 -1
- package/v2Containers/CapFacebookPreview/actions.js +3 -15
- package/v2Containers/CapFacebookPreview/constants.js +3 -11
- package/v2Containers/CapFacebookPreview/index.js +6 -6
- package/v2Containers/CapFacebookPreview/reducer.js +3 -9
- package/v2Containers/CapFacebookPreview/sagas.js +6 -65
- package/v2Containers/CreativesContainer/SlideBoxContent.js +16 -7
- package/v2Containers/CreativesContainer/index.js +1 -0
- package/v2Containers/Ebill/actions.js +1 -1
- package/v2Containers/Ebill/index.js +34 -34
- package/v2Containers/Ebill/sagas.js +3 -3
- package/v2Containers/Email/reducer.js +1 -1
- package/v2Containers/EmailWrapper/index.js +4 -4
- package/v2Containers/Facebook/Advertisement/index.js +38 -15
- package/v2Containers/Facebook/Advertisement/index.scss +9 -0
- package/v2Containers/Facebook/Advertisement/messages.js +2 -2
- package/v2Containers/Facebook/actions.js +2 -1
- package/v2Containers/Facebook/reducer.js +3 -0
- package/v2Containers/Facebook/sagas.js +18 -7
- package/v2Containers/LanguageProvider/actions.js +1 -1
- package/v2Containers/Line/Container/actions.js +5 -5
- package/v2Containers/Line/Container/sagas.js +4 -4
- package/v2Containers/MobilePush/Create/actions.js +2 -2
- package/v2Containers/MobilePush/Create/index.js +1 -1
- package/v2Containers/MobilePush/Create/sagas.js +2 -2
- package/v2Containers/MobilePush/Edit/actions.js +3 -3
- package/v2Containers/MobilePush/Edit/index.js +26 -26
- package/v2Containers/MobilePush/Edit/sagas.js +5 -5
- package/v2Containers/Sms/Create/index.js +4 -4
- package/v2Containers/TagList/index.js +6 -6
- package/v2Containers/Templates/actions.js +5 -5
- package/v2Containers/Templates/index.js +23 -2
- package/v2Containers/Templates/sagas.js +4 -4
- package/v2Containers/Viber/actions.js +2 -2
- package/v2Containers/Viber/sagas.js +2 -2
- package/v2Containers/WeChat/MapTemplates/actions.js +1 -1
- package/v2Containers/WeChat/MapTemplates/index.js +19 -19
- package/v2Containers/WeChat/MapTemplates/sagas.js +3 -3
- package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Edit/actions.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Edit/sagas.js +1 -1
|
@@ -132,9 +132,9 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
if (supportedZipFormats.indexOf(fileExtension.toLowerCase()) !== -1) {
|
|
135
|
-
templatesActions.handleZipUpload(file, () => { //handle upload success
|
|
135
|
+
templatesActions.handleZipUpload(file.originFileObj, () => { //handle upload success
|
|
136
136
|
this.setState({ modeContent: { file } }, showNextStep);
|
|
137
|
-
|
|
137
|
+
stopTimerGA();
|
|
138
138
|
}, this.handleZipUploadError);
|
|
139
139
|
} else if (fileExtension === 'html' || fileExtension === 'htm') {
|
|
140
140
|
const reader = new FileReader();
|
|
@@ -145,7 +145,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
145
145
|
});
|
|
146
146
|
// showNextStep();
|
|
147
147
|
};
|
|
148
|
-
reader.readAsText(file);
|
|
148
|
+
reader.readAsText(file.originFileObj);
|
|
149
149
|
} else {
|
|
150
150
|
const message = {
|
|
151
151
|
key: "email-upload-error",
|
|
@@ -229,7 +229,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
229
229
|
<div>
|
|
230
230
|
{emailCreateMode === "upload" &&
|
|
231
231
|
<div style={{ marginLeft: '8px' }}>
|
|
232
|
-
<CapUploader
|
|
232
|
+
<CapUploader onChange={this.useFileUpload} accept=".zip, .html, .htm" showUploadList={false}>
|
|
233
233
|
<CapButton>{this.props.intl.formatMessage(messages.upload)}</CapButton>
|
|
234
234
|
</CapUploader>
|
|
235
235
|
{!_.isEmpty(EmailLayout) &&
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
IMAGE_VIDEO,
|
|
55
55
|
NO_CALL_TO_ACTION,
|
|
56
56
|
} from './constant';
|
|
57
|
-
|
|
57
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
58
58
|
export const Advertisement = (props) => {
|
|
59
59
|
const CarouselContainer = styled.div`
|
|
60
60
|
width: ${(styledProps) => styledProps.width || '22px'};
|
|
@@ -122,11 +122,28 @@ export const Advertisement = (props) => {
|
|
|
122
122
|
type,
|
|
123
123
|
fileParams,
|
|
124
124
|
indexFile) => {
|
|
125
|
+
let videoData = {};
|
|
126
|
+
if (type === 'video') {
|
|
127
|
+
const {
|
|
128
|
+
orgUnitFacebookPageSettingsMap = {},
|
|
129
|
+
employeeAccessToken: accessToken = "",
|
|
130
|
+
accountId = "",
|
|
131
|
+
} = selectedFacebookAccount;
|
|
132
|
+
const { pageAccessToken, pageId: pId } = orgUnitFacebookPageSettingsMap[pageId] || {};
|
|
133
|
+
videoData = {
|
|
134
|
+
accessToken,
|
|
135
|
+
actId: accountId,
|
|
136
|
+
pageAccessToken,
|
|
137
|
+
pageId: pId,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
125
140
|
actions.uploadFbAdAsset(file,
|
|
126
141
|
type,
|
|
127
142
|
fileParams,
|
|
128
|
-
indexFile
|
|
129
|
-
|
|
143
|
+
indexFile,
|
|
144
|
+
videoData,
|
|
145
|
+
);
|
|
146
|
+
}, [pageId]);
|
|
130
147
|
|
|
131
148
|
const paramObj = params || {};
|
|
132
149
|
|
|
@@ -142,7 +159,7 @@ export const Advertisement = (props) => {
|
|
|
142
159
|
|
|
143
160
|
useEffect(() => {
|
|
144
161
|
if ((params && params.id) || (templateData || {}).edit) {
|
|
145
|
-
const { FacebookAd = [],
|
|
162
|
+
const { FacebookAd = [], pageOrgUnitId: editPageId} = get(templateData, `versions.base.content`) || get(fbADData, `templateDetails.versions.base.content`) || {};
|
|
146
163
|
const editMessageTitle = (templateData || {}).name || get(fbADData, 'templateDetails.name');
|
|
147
164
|
const editFBContent = Object.values(FacebookAd);
|
|
148
165
|
if (editPageId) {
|
|
@@ -182,6 +199,7 @@ export const Advertisement = (props) => {
|
|
|
182
199
|
videoName,
|
|
183
200
|
videoHeight,
|
|
184
201
|
videoWidth,
|
|
202
|
+
videoId,
|
|
185
203
|
} = obj.video;
|
|
186
204
|
data.videoData = {
|
|
187
205
|
videoSrc,
|
|
@@ -189,6 +207,7 @@ export const Advertisement = (props) => {
|
|
|
189
207
|
videoHeight,
|
|
190
208
|
videoWidth,
|
|
191
209
|
previewUrl,
|
|
210
|
+
videoId,
|
|
192
211
|
};
|
|
193
212
|
}
|
|
194
213
|
newCarouselData[index] = {...defaultCarouselContent, ...data};
|
|
@@ -248,14 +267,16 @@ export const Advertisement = (props) => {
|
|
|
248
267
|
}, [selectedAd]);
|
|
249
268
|
|
|
250
269
|
const updateOnImageReUpload = useCallback(() => {
|
|
251
|
-
const newCarouselData =
|
|
270
|
+
const newCarouselData = cloneDeep(carouselData);
|
|
252
271
|
newCarouselData[activeIndex].imageData.imageSrc = '';
|
|
253
272
|
updateCarouselData(newCarouselData);
|
|
254
273
|
}, [carouselData, activeIndex]);
|
|
255
274
|
|
|
256
275
|
const setUpdateImageSrc = useCallback((val) => {
|
|
257
|
-
const newCarouselData =
|
|
258
|
-
newCarouselData[activeIndex].imageData
|
|
276
|
+
const newCarouselData = cloneDeep(carouselData);
|
|
277
|
+
newCarouselData[activeIndex].imageData = {
|
|
278
|
+
imageSrc: val,
|
|
279
|
+
};
|
|
259
280
|
updateCarouselData(newCarouselData);
|
|
260
281
|
actions.clearFbAdAsset(activeIndex);
|
|
261
282
|
}, [carouselData, activeIndex]);
|
|
@@ -314,6 +335,7 @@ export const Advertisement = (props) => {
|
|
|
314
335
|
videoHeight,
|
|
315
336
|
videoWidth,
|
|
316
337
|
previewUrl,
|
|
338
|
+
videoId,
|
|
317
339
|
} = obj.videoData;
|
|
318
340
|
data.video = {
|
|
319
341
|
previewImageUrl: previewUrl,
|
|
@@ -322,6 +344,7 @@ export const Advertisement = (props) => {
|
|
|
322
344
|
baseUrl: previewUrl.replace('/1040', ''),
|
|
323
345
|
videoHeight,
|
|
324
346
|
videoWidth,
|
|
347
|
+
videoId,
|
|
325
348
|
};
|
|
326
349
|
}
|
|
327
350
|
messageData.push(data);
|
|
@@ -332,7 +355,7 @@ export const Advertisement = (props) => {
|
|
|
332
355
|
base: {
|
|
333
356
|
content: {
|
|
334
357
|
FacebookAd: {...messageData},
|
|
335
|
-
pageId,
|
|
358
|
+
pageOrgUnitId: pageId,
|
|
336
359
|
},
|
|
337
360
|
},
|
|
338
361
|
},
|
|
@@ -780,7 +803,7 @@ export const Advertisement = (props) => {
|
|
|
780
803
|
}, [pageId]);
|
|
781
804
|
|
|
782
805
|
const selectedFacebookAccount = get(facebookTemplateData, 'selectedFacebookAccount', {});
|
|
783
|
-
const {orgUnitFacebookPageSettingsMap = {}, accessToken = "", accountId = "" } = selectedFacebookAccount;
|
|
806
|
+
const {orgUnitFacebookPageSettingsMap = {}, employeeAccessToken: accessToken = "", accountId = "" } = selectedFacebookAccount;
|
|
784
807
|
|
|
785
808
|
const getPageAccessOrgs = useCallback(() => {
|
|
786
809
|
const {status, data } = fbADData.orgOuData || {};
|
|
@@ -865,17 +888,17 @@ export const Advertisement = (props) => {
|
|
|
865
888
|
>
|
|
866
889
|
{editNameState ? <CapInput
|
|
867
890
|
type="input"
|
|
868
|
-
|
|
891
|
+
className="cap-input-edit-name"
|
|
869
892
|
onBlur={onEditFocusOut}
|
|
870
893
|
defaultValue={messageTitle || ''}
|
|
871
894
|
/> : messageTitle
|
|
872
895
|
}
|
|
873
|
-
{!editNameState && <CapLink
|
|
874
|
-
style={{display: "inline-flex"}}
|
|
875
|
-
title={<FormattedMessage {...messages.creativesTemplatesEditName}/>}
|
|
876
|
-
onClick={onClickEditName}
|
|
877
|
-
/>}
|
|
878
896
|
</CapHeading>
|
|
897
|
+
{!editNameState && <CapLink
|
|
898
|
+
className="cap-link-edit-name"
|
|
899
|
+
title={<FormattedMessage {...messages.creativesTemplatesEditName}/>}
|
|
900
|
+
onClick={onClickEditName}
|
|
901
|
+
/>}
|
|
879
902
|
</div>
|
|
880
903
|
<CapColumn span={12}>
|
|
881
904
|
{isFullMode && <><CapHeading
|
|
@@ -18,7 +18,16 @@ $classPrefix: add-facebook-ad-section;
|
|
|
18
18
|
white-space: nowrap;
|
|
19
19
|
min-width: 112px;
|
|
20
20
|
max-width: 920px;
|
|
21
|
+
display: inline-block;
|
|
21
22
|
}
|
|
23
|
+
.cap-input-edit-name{
|
|
24
|
+
width: 500px;
|
|
25
|
+
}
|
|
26
|
+
.cap-link-edit-name{
|
|
27
|
+
display: inline-block;
|
|
28
|
+
margin-bottom: 4px;
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
.cap-header-facebook-ad{
|
|
23
32
|
position: fixed;
|
|
24
33
|
top: 27px;
|
|
@@ -17,7 +17,7 @@ export default defineMessages({
|
|
|
17
17
|
},
|
|
18
18
|
imageVideoDesc: {
|
|
19
19
|
id: `${messagePrefix}.imageVideoDesc`,
|
|
20
|
-
defaultMessage: 'Create an Ad with one image or video
|
|
20
|
+
defaultMessage: 'Create an Ad with one image or video',
|
|
21
21
|
},
|
|
22
22
|
carouselTitle: {
|
|
23
23
|
id: `${messagePrefix}.carouselTitle`,
|
|
@@ -93,7 +93,7 @@ export default defineMessages({
|
|
|
93
93
|
},
|
|
94
94
|
video_slideshow: {
|
|
95
95
|
id: `${messagePrefix}.video_slideshow`,
|
|
96
|
-
defaultMessage: 'Video
|
|
96
|
+
defaultMessage: 'Video',
|
|
97
97
|
},
|
|
98
98
|
doneButtonLabel: {
|
|
99
99
|
id: `${messagePrefix}.doneButtonLabel`,
|
|
@@ -21,12 +21,13 @@ export const getMarketingObjectives = () => ({
|
|
|
21
21
|
type: GET_MARKETING_OBJECTIVES,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
export const uploadFbAdAsset = (file, assetType, fileParams, templateType) => ({
|
|
24
|
+
export const uploadFbAdAsset = (file, assetType, fileParams, templateType, videoData) => ({
|
|
25
25
|
type: UPLOAD_FB_AD_ASSET_REQUEST,
|
|
26
26
|
file,
|
|
27
27
|
assetType,
|
|
28
28
|
fileParams,
|
|
29
29
|
templateType,
|
|
30
|
+
videoData,
|
|
30
31
|
});
|
|
31
32
|
|
|
32
33
|
export const createTemplate = (template, callback) => ({
|
|
@@ -46,15 +46,18 @@ function facebookReducer(state = initialState, action) {
|
|
|
46
46
|
case UPLOAD_FB_AD_ASSET_REQUEST:
|
|
47
47
|
return state
|
|
48
48
|
.set('uploadAssetSuccess', false)
|
|
49
|
+
.set(templateType !== undefined ? `uploadAssetError${templateType}` : 'uploadAssetError', false, )
|
|
49
50
|
.set(templateType !== undefined ? `assetUploading${templateType}` : 'assetUploading', true);
|
|
50
51
|
case UPLOAD_FB_AD_ASSET_SUCCESS:
|
|
51
52
|
return state
|
|
52
53
|
.set('uploadAssetSuccess', (action.statusCode !== undefined && action.statusCode !== '' && action.statusCode < 300))
|
|
54
|
+
.set(templateType !== undefined ? `uploadAssetError${templateType}` : 'uploadAssetError', false, )
|
|
53
55
|
.set(templateType !== undefined ? `assetUploading${templateType}` : 'assetUploading', false)
|
|
54
56
|
.set(templateType !== undefined ? `uploadedAssetData${templateType}` : 'uploadedAssetData', action.data);
|
|
55
57
|
case UPLOAD_FB_AD_ASSET_FAILURE:
|
|
56
58
|
return state
|
|
57
59
|
.set('uploadAssetSuccess', false)
|
|
60
|
+
.set(templateType !== undefined ? `uploadAssetError${templateType}` : 'uploadAssetError', true, )
|
|
58
61
|
.set(templateType !== undefined ? `assetUploading${templateType}` : 'assetUploading', false);
|
|
59
62
|
case CREATE_FACEBOOK_AD_TEMPLATE_REQUEST:
|
|
60
63
|
return state
|
|
@@ -66,15 +66,26 @@ export function* getOrgOUs({ orgID } = {}) {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
export function* uploadFbAdAsset(file, assetType, fileParams
|
|
69
|
+
export function* uploadFbAdAsset(file, assetType, fileParams) {
|
|
70
70
|
try {
|
|
71
71
|
const result = yield call(Api.uploadFile, file, assetType, fileParams);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
let videoIdResponse = {};
|
|
73
|
+
if (file.assetType === 'video' && (result.status.code >= 200 && result.status.code < 300)) {
|
|
74
|
+
const {accessToken, actId, pageAccessToken, pageId} = file.videoData;
|
|
75
|
+
videoIdResponse = yield call(Api.getFacebookVideoId, {videoUrl: result.response.asset.metaInfo.secure_file_path, accessToken, actId, pageAccessToken, pageId});
|
|
76
|
+
}
|
|
77
|
+
if (result.status.isError) {
|
|
78
|
+
yield put({ type: UPLOAD_FB_AD_ASSET_FAILURE, error: result.status.message });
|
|
79
|
+
} else if (videoIdResponse.status?.isError) {
|
|
80
|
+
yield put({ type: UPLOAD_FB_AD_ASSET_FAILURE, error: result.status });
|
|
81
|
+
} else {
|
|
82
|
+
yield put({
|
|
83
|
+
type: UPLOAD_FB_AD_ASSET_SUCCESS,
|
|
84
|
+
data: {...result.response.asset, videoIdResponse: videoIdResponse.response},
|
|
85
|
+
statusCode: result.status ? result.status.code : '',
|
|
86
|
+
templateType: file.templateType,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
78
89
|
} catch (error) {
|
|
79
90
|
yield put({ type: UPLOAD_FB_AD_ASSET_FAILURE, error });
|
|
80
91
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as types from './constants';
|
|
8
8
|
|
|
9
9
|
export function createTemplate(template, callback) {
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
return {
|
|
12
12
|
type: types.CREATE_TEMPLATE_REQUEST,
|
|
13
13
|
template,
|
|
@@ -16,7 +16,7 @@ export function createTemplate(template, callback) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function clearCreateResponse() {
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
return {
|
|
21
21
|
type: types.CLEAR_CREATE_RESPONSE_REQUEST,
|
|
22
22
|
};
|
|
@@ -50,7 +50,7 @@ export function clearAsset(templateType) {
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
export function editTemplate(template, callback) {
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
return {
|
|
55
55
|
type: types.EDIT_TEMPLATE_REQUEST,
|
|
56
56
|
template,
|
|
@@ -59,7 +59,7 @@ export function editTemplate(template, callback) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export function getTemplateDetails(id, callback) {
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
return {
|
|
64
64
|
type: types.GET_TEMPLATE_DETAILS_REQUEST,
|
|
65
65
|
id,
|
|
@@ -69,7 +69,7 @@ export function getTemplateDetails(id, callback) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
export function clearEditResponse() {
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
return {
|
|
74
74
|
type: types.CLEAR_EDIT_RESPONSE_REQUEST,
|
|
75
75
|
};
|
|
@@ -34,13 +34,13 @@ export function* uploadAsset(file, assetType, fileParams ) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function* watchCreateTemplate() {
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
const watcher = yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
39
39
|
yield take(LOCATION_CHANGE);
|
|
40
40
|
yield cancel(watcher);
|
|
41
41
|
}
|
|
42
42
|
function* watchUploadAsset() {
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
const watcher = yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
45
45
|
yield take(LOCATION_CHANGE);
|
|
46
46
|
yield cancel(watcher);
|
|
@@ -70,7 +70,7 @@ export function* editTemplate({ template, callback }) {
|
|
|
70
70
|
|
|
71
71
|
export function* getTemplateDetails(id) {
|
|
72
72
|
try {
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
const result = yield call(Api.getTemplateDetails, id);
|
|
75
75
|
// const sidebar = result.response.sidebar;
|
|
76
76
|
yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
|
|
@@ -84,7 +84,7 @@ export function* getTemplateDetails(id) {
|
|
|
84
84
|
|
|
85
85
|
export function* getLineTemplatesList(params) {
|
|
86
86
|
try {
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
const result = yield call(Api.getAllTemplates, {channel: params.channel, queryParams: params.queryParams});
|
|
89
89
|
yield put({ type: types.GET_LINE_TEMPLATES_LIST_SUCCESS, data: result.response.templates, templateData: result.response.mapped});
|
|
90
90
|
} catch (error) {
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
import * as types from './constants';
|
|
8
8
|
|
|
9
9
|
export function createTemplate(template, callback) {
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
return {
|
|
12
12
|
type: types.CREATE_TEMPLATE_REQUEST, template, callback,
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function clearCreateResponse() {
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
return {
|
|
19
19
|
type: types.CLEAR_CREATE_RESPONSE_REQUEST,
|
|
20
20
|
};
|
|
@@ -9,7 +9,7 @@ import * as types from './constants';
|
|
|
9
9
|
export function* createTemplate(template) {
|
|
10
10
|
let errorMsg;
|
|
11
11
|
try {
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
const result = yield call(Api.createMobilePushTemplate, template);
|
|
14
14
|
if (result.message) {
|
|
15
15
|
errorMsg = result.message;
|
|
@@ -43,7 +43,7 @@ export function* getIosCtas(licenseCode) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function* watchCreateTemplate() {
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
const watcher = yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
48
48
|
yield take(LOCATION_CHANGE);
|
|
49
49
|
yield cancel(watcher);
|
|
@@ -14,14 +14,14 @@ export function defaultAction() {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function editTemplate(template, callback) {
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
return {
|
|
19
19
|
type: types.EDIT_TEMPLATE_REQUEST, template, callback,
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export function getTemplateDetails(id) {
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
return {
|
|
26
26
|
type: types.GET_TEMPLATE_DETAILS_REQUEST, id,
|
|
27
27
|
};
|
|
@@ -41,7 +41,7 @@ export function uploadAsset(file, assetType, fileParams, mode) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
export function clearEditResponse() {
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
return {
|
|
46
46
|
type: types.CLEAR_EDIT_RESPONSE_REQUEST,
|
|
47
47
|
};
|
|
@@ -58,7 +58,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
58
58
|
this.getLinkTypeFields = getLinkTypeFields.bind(this);
|
|
59
59
|
}
|
|
60
60
|
componentWillMount() {
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
this.props.actions.getWeCrmAccounts("mobilepush");
|
|
63
63
|
if (!this.props.Templates.selectedWeChatAccount && this.props.location.query.type !== 'embedded') {
|
|
64
64
|
const type = this.props.location.query.type;
|
|
@@ -74,7 +74,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
74
74
|
version: "v2",
|
|
75
75
|
};
|
|
76
76
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
componentDidMount() {
|
|
@@ -106,7 +106,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
106
106
|
}
|
|
107
107
|
const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount : this.props.Edit.selectedWeChatAccount);
|
|
108
108
|
if (this.props.location.query.type === 'embedded' && !nextProps.Edit.fetchingWeCrmAccounts && !_.isEqual(this.props.Edit.weCrmAccounts, nextProps.Edit.weCrmAccounts) && (!selectedWeChatAccount || _.isEmpty(selectedWeChatAccount))) {
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
this.setMobilePushAccountOptions(nextProps.Edit.weCrmAccounts);
|
|
111
111
|
}
|
|
112
112
|
if (!_.isEmpty(nextProps.Edit.selectedWeChatAccount) && !_.isEqual(this.props.Edit.selectedWeChatAccount, nextProps.Edit.selectedWeChatAccount) && (this.props.location.query.type === 'embedded') && this.props.location.query.module === "loyalty") {
|
|
@@ -190,7 +190,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
190
190
|
});
|
|
191
191
|
};
|
|
192
192
|
onFormDataChange = (formData, tabCount, currentTab, inputField) => {
|
|
193
|
-
|
|
193
|
+
|
|
194
194
|
const newFormData = _.cloneDeep(formData);
|
|
195
195
|
const {templateCta} = this.state;
|
|
196
196
|
if (!_.isEmpty(templateCta) && this.state.currentTab === 2) {
|
|
@@ -256,12 +256,12 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
256
256
|
};
|
|
257
257
|
|
|
258
258
|
onTabChange = (data) => {
|
|
259
|
-
|
|
259
|
+
|
|
260
260
|
this.setState({currentTab: data});
|
|
261
261
|
};
|
|
262
262
|
|
|
263
263
|
onTagSelect = (data, currentTab, srcComp) => {
|
|
264
|
-
|
|
264
|
+
|
|
265
265
|
const editorId = srcComp.target;
|
|
266
266
|
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
267
267
|
document.getElementById(editorId).focus();
|
|
@@ -272,7 +272,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
272
272
|
}
|
|
273
273
|
};
|
|
274
274
|
onUpdateTemplateComplete = () => {
|
|
275
|
-
|
|
275
|
+
|
|
276
276
|
const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
|
|
277
277
|
GA.timeTracker.stopTimer(TRACK_EDIT_MPUSH, {
|
|
278
278
|
category: 'Creatives',
|
|
@@ -598,13 +598,13 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
598
598
|
getMappedEvent = (id, event) => {
|
|
599
599
|
const map = this.state.eventsMap;
|
|
600
600
|
if (!map[id] || !map[id][event]) {
|
|
601
|
-
|
|
601
|
+
|
|
602
602
|
}
|
|
603
603
|
return map[id][event];
|
|
604
604
|
};
|
|
605
605
|
|
|
606
606
|
getCurrentWindow = (e) => {
|
|
607
|
-
|
|
607
|
+
|
|
608
608
|
const response = {
|
|
609
609
|
action: e.action,
|
|
610
610
|
value: 'edit',
|
|
@@ -614,13 +614,13 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
614
614
|
};
|
|
615
615
|
|
|
616
616
|
getFormData = (e) => {
|
|
617
|
-
|
|
617
|
+
|
|
618
618
|
const response = {
|
|
619
619
|
action: "getFormData",
|
|
620
620
|
value: this.getTransformedData(this.state.formData),
|
|
621
621
|
validity: this.state.isFormValid,
|
|
622
622
|
};
|
|
623
|
-
|
|
623
|
+
|
|
624
624
|
this.setState({checkValidation: true}, this.showError);
|
|
625
625
|
if (e) {
|
|
626
626
|
e.source.postMessage(JSON.stringify(response), e.origin);
|
|
@@ -630,7 +630,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
630
630
|
|
|
631
631
|
|
|
632
632
|
setEditState(data, schema) {
|
|
633
|
-
|
|
633
|
+
|
|
634
634
|
const tabCount = Object.keys(data.versions.base).length;
|
|
635
635
|
const formData = {};
|
|
636
636
|
if (this.props.location.query.type === 'embedded' && this.props.location.query.module === "loyalty") {
|
|
@@ -770,7 +770,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
770
770
|
formData[0].base = true;
|
|
771
771
|
// formData[0].tabKey = '1';
|
|
772
772
|
// formData[1].tabKey = '2';
|
|
773
|
-
|
|
773
|
+
|
|
774
774
|
this.setState({templateCta}, () => {
|
|
775
775
|
this.getSchemaForFormData(formData, schema);
|
|
776
776
|
this.setState({tabCount, formData, editData: data, currentTab: 1}, () => {
|
|
@@ -1356,7 +1356,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1356
1356
|
|
|
1357
1357
|
|
|
1358
1358
|
startTemplateCreation = (data) => {
|
|
1359
|
-
|
|
1359
|
+
|
|
1360
1360
|
if (!this.state.isContentEditLoaded && this.state.fullSchema && this.props.Edit.weCrmAccounts) {
|
|
1361
1361
|
const schema = JSON.stringify(data).indexOf("BIG_PICTURE") > -1 ? this.state.fullSchema.imageSchema : this.state.fullSchema.textSchema;
|
|
1362
1362
|
this.setMobilePushAccountOptions(this.props.Edit.weCrmAccounts, data.content.accId);
|
|
@@ -1372,7 +1372,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1372
1372
|
}
|
|
1373
1373
|
};
|
|
1374
1374
|
discardValues = () => {
|
|
1375
|
-
|
|
1375
|
+
|
|
1376
1376
|
this.resetSchema();
|
|
1377
1377
|
this.setState({
|
|
1378
1378
|
formData: {},
|
|
@@ -1398,7 +1398,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1398
1398
|
|
|
1399
1399
|
};
|
|
1400
1400
|
moveToTemplates = () => {
|
|
1401
|
-
|
|
1401
|
+
|
|
1402
1402
|
const modalContent = {
|
|
1403
1403
|
title: this.props.intl.formatMessage(messages.alertMessage),
|
|
1404
1404
|
body: this.props.intl.formatMessage(messages.goBackTemporaryChangesLost),
|
|
@@ -1473,17 +1473,17 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1473
1473
|
};
|
|
1474
1474
|
|
|
1475
1475
|
saveFormData = (formData) => {
|
|
1476
|
-
|
|
1476
|
+
|
|
1477
1477
|
const obj = this.getTransformedData(formData);
|
|
1478
|
-
|
|
1478
|
+
|
|
1479
1479
|
this.props.actions.editTemplate(obj, this.onUpdateTemplateComplete);
|
|
1480
1480
|
};
|
|
1481
1481
|
handleFrameTasks = (e) => {
|
|
1482
|
-
//
|
|
1482
|
+
//
|
|
1483
1483
|
const type = e.data;
|
|
1484
|
-
|
|
1484
|
+
|
|
1485
1485
|
if (typeof type === 'object') {
|
|
1486
|
-
//
|
|
1486
|
+
//
|
|
1487
1487
|
const action = type.action;
|
|
1488
1488
|
switch (action) {
|
|
1489
1489
|
case "startTemplateCreation":
|
|
@@ -1504,15 +1504,15 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1504
1504
|
this.getFormData(e);
|
|
1505
1505
|
break;
|
|
1506
1506
|
case "startTemplateCreation":
|
|
1507
|
-
|
|
1507
|
+
|
|
1508
1508
|
//this.getFormData(e);
|
|
1509
1509
|
break;
|
|
1510
1510
|
case "moveToTemplates":
|
|
1511
|
-
|
|
1511
|
+
|
|
1512
1512
|
this.moveToTemplates();
|
|
1513
1513
|
break;
|
|
1514
1514
|
case "validateContent":
|
|
1515
|
-
|
|
1515
|
+
|
|
1516
1516
|
this.validateContent(e);
|
|
1517
1517
|
break;
|
|
1518
1518
|
default:
|
|
@@ -1721,7 +1721,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1721
1721
|
tempContainer = this.injectContainer(tempContainer);
|
|
1722
1722
|
return tempContainer;
|
|
1723
1723
|
});
|
|
1724
|
-
|
|
1724
|
+
|
|
1725
1725
|
this.setState({schema, loadingContentEdit: false}, () => {
|
|
1726
1726
|
this.removeStandAlone();
|
|
1727
1727
|
});
|
|
@@ -1742,7 +1742,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1742
1742
|
this.setState({ schema });
|
|
1743
1743
|
};
|
|
1744
1744
|
handleOnTagsContextChange = (data) => {
|
|
1745
|
-
|
|
1745
|
+
|
|
1746
1746
|
const query = {
|
|
1747
1747
|
layout: 'mobilepush',
|
|
1748
1748
|
type: 'TAG',
|
|
@@ -8,9 +8,9 @@ import * as types from './constants';
|
|
|
8
8
|
export function* editTemplate(template) {
|
|
9
9
|
let errorMsg;
|
|
10
10
|
try {
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
const result = yield call(Api.createMobilePushTemplate, template);
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
if (result.message || result.status.code === 500) {
|
|
15
15
|
errorMsg = result.message;
|
|
16
16
|
}
|
|
@@ -23,7 +23,7 @@ export function* editTemplate(template) {
|
|
|
23
23
|
|
|
24
24
|
export function* getTemplateDetails(id) {
|
|
25
25
|
try {
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
const result = yield call(Api.getTemplateDetails, id);
|
|
28
28
|
// const sidebar = result.response.sidebar;
|
|
29
29
|
yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
|
|
@@ -50,7 +50,7 @@ export function* getIosCtas(licenseCode) {
|
|
|
50
50
|
|
|
51
51
|
export function* getMobilepushTemplatesList(params) {
|
|
52
52
|
try {
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
const result = yield call(Api.getAllTemplates, {channel: params.channel, queryParams: params.queryParams});
|
|
55
55
|
yield put({ type: types.GET_MOBILEPUSH_TEMPLATES_LIST_SUCCESS, data: result.response.templates, templateData: result.response.mapped});
|
|
56
56
|
} catch (error) {
|
|
@@ -59,7 +59,7 @@ export function* getMobilepushTemplatesList(params) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export function* fetchWeCrmAccounts(action) {
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
try {
|
|
64
64
|
const result = yield call(Api.fetchWeCrmAccounts, action.source);
|
|
65
65
|
yield [
|