@capillarytech/creatives-library 3.1.49 → 3.2.1
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/app.js +1 -1
- package/components/FormBuilder/index.js +1 -1
- package/components/Header/index.js +3 -4
- package/components/Header/messages.js +0 -4
- package/config/app.js +2 -4
- package/containers/Assets/Gallery/index.js +1 -1
- package/containers/Cap/index.js +5 -4
- package/containers/Email/index.js +2 -2
- package/containers/Email/messages.js +0 -8
- package/containers/LanguageProvider/index.js +4 -28
- package/containers/Templates/index.js +2 -2
- package/containers/Templates/messages.js +4 -24
- package/containers/WeChat/MapTemplates/messages.js +0 -4
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +0 -24
- package/i18n.js +9 -16
- package/index.js +0 -6
- package/package.json +4 -1
- package/reducers.js +1 -1
- package/routes.js +1 -2
- package/services/api.js +2 -11
- package/translations/en.json +56 -119
- package/translations/zh.json +53 -116
- package/utils/smsCharCountV2.js +1 -1
- package/v2Components/CapTagList/index.js +2 -2
- package/v2Components/FormBuilder/index.js +4 -7
- package/v2Components/NavigationBar/index.js +17 -11
- package/v2Components/NavigationBar/messages.js +0 -28
- package/v2Components/NewCallTask/index.js +1 -3
- package/v2Components/TopBar/index.js +0 -3
- package/v2Components/TopBar/messages.js +0 -8
- package/v2Containers/Assets/Gallery/index.js +6 -12
- package/v2Containers/Assets/Gallery/messages.js +0 -4
- package/v2Containers/CallTask/index.js +1 -3
- package/v2Containers/Cap/index.js +2 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -14
- package/v2Containers/CreativesContainer/index.js +1 -6
- package/v2Containers/Email/index.js +7 -10
- package/v2Containers/Email/messages.js +0 -16
- package/v2Containers/EmailWrapper/index.js +9 -12
- package/v2Containers/LanguageProvider/actions.js +4 -9
- package/v2Containers/LanguageProvider/constants.js +1 -7
- package/v2Containers/LanguageProvider/index.js +12 -49
- package/v2Containers/LanguageProvider/reducer.js +9 -11
- package/v2Containers/LanguageProvider/selectors.js +1 -1
- package/v2Containers/MobilePush/Create/index.js +1 -2
- package/v2Containers/MobilePush/Create/messages.js +0 -4
- package/v2Containers/MobilePush/Edit/index.js +1 -2
- package/v2Containers/MobilePush/Edit/messages.js +0 -4
- package/v2Containers/Sms/Create/index.js +1 -3
- package/v2Containers/Sms/Create/messages.js +0 -16
- package/v2Containers/Sms/Edit/index.js +1 -3
- package/v2Containers/Sms/Edit/messages.js +0 -16
- package/v2Containers/TagList/index.js +0 -43
- package/v2Containers/Templates/_templates.scss +1 -9
- package/v2Containers/Templates/index.js +53 -66
- package/v2Containers/TemplatesV2/_templatesV2.scss +5 -0
- package/v2Containers/TemplatesV2/index.js +54 -54
- package/v2Containers/WeChat/MapTemplates/index.js +2 -1
- package/v2Containers/WeChat/MapTemplates/messages.js +5 -9
- package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +0 -10
- package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +0 -9
- package/v2Containers/WeChat/RichmediaTemplates/Create/constants.js +0 -3
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +4 -146
- package/v2Containers/WeChat/RichmediaTemplates/Create/messages.js +57 -86
- package/v2Containers/WeChat/RichmediaTemplates/Create/reducer.js +1 -24
- package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +0 -45
- package/v2Containers/WeChat/RichmediaTemplates/Edit/constants.js +0 -4
- package/v2Containers/WeChat/RichmediaTemplates/Edit/index.js +1 -8
- package/v2Containers/WeChat/Wrapper/_wrapper.scss +1 -9
- package/v2Containers/WeChat/Wrapper/messages.js +5 -5
|
@@ -17,7 +17,7 @@ import cloneDeep from 'lodash/cloneDeep';
|
|
|
17
17
|
import forEach from 'lodash/forEach';
|
|
18
18
|
import isEqual from 'lodash/isEqual';
|
|
19
19
|
import get from 'lodash/get';
|
|
20
|
-
import { CapRow, CapColumn, CapButton, CapCard, CapSpin, CapInput, CapHeading, CapDivider, CapIcon, CapLink, CapLabel, CapNotification
|
|
20
|
+
import { CapRow, CapColumn, CapButton, CapCard, CapSpin, CapInput, CapHeading, CapDivider, CapIcon, CapLink, CapLabel, CapNotification } from '@capillarytech/cap-ui-library';
|
|
21
21
|
import makeSelectCreate, {makeSelectTemplates, getAssetDetails, getContentAssetDetails} from './selectors';
|
|
22
22
|
import * as actions from './actions';
|
|
23
23
|
import richmediaschema from './richmediaschema';
|
|
@@ -26,8 +26,6 @@ import messages from './messages';
|
|
|
26
26
|
import FormBuilder from '../../../../v2Components/FormBuilder';
|
|
27
27
|
import WechatRichmediaTemplatePreview from '../../../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
|
|
28
28
|
import noImage from '../../../../assets/noImage.png';
|
|
29
|
-
import Pagination from '../../../../v2Components/Pagination';
|
|
30
|
-
import { CAP_SPACE_08, CAP_SPACE_12, CAP_SPACE_20, CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
31
29
|
|
|
32
30
|
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
33
31
|
constructor(props) {
|
|
@@ -104,13 +102,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
104
102
|
type: 'confirm',
|
|
105
103
|
id: 'template-back-confirm-modal',
|
|
106
104
|
},
|
|
107
|
-
showExistingTemplates: false,
|
|
108
|
-
existingTemplatesPageNo: 1,
|
|
109
|
-
existingTemplatesPageLimit: 25,
|
|
110
|
-
sortBy: 'Most Recent',
|
|
111
|
-
searchText: '',
|
|
112
|
-
pagination: true,
|
|
113
|
-
scrollDebounce: true,
|
|
114
105
|
};
|
|
115
106
|
this.onFormDataChange = this.onFormDataChange.bind(this);
|
|
116
107
|
this.cancelHandler = this.cancelHandler.bind(this);
|
|
@@ -845,126 +836,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
845
836
|
});
|
|
846
837
|
return true;
|
|
847
838
|
}
|
|
848
|
-
|
|
849
|
-
onChooseExistingTemplate = (template, e) => {
|
|
850
|
-
e.stopPropagation();
|
|
851
|
-
const content = get(template, 'versions.base.mediaList[0]', {});
|
|
852
|
-
let postCommentsValue = 'No one';
|
|
853
|
-
const templateData = cloneDeep(this.state.templateData);
|
|
854
|
-
|
|
855
|
-
if (content.only_fans_can_comment && content.need_open_comment) {
|
|
856
|
-
postCommentsValue = 'Only followers';
|
|
857
|
-
} else if (content.need_open_comment) {
|
|
858
|
-
postCommentsValue = 'Anyone';
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
templateData[this.state.currentContentId] = {
|
|
862
|
-
formData: {
|
|
863
|
-
'title-value': content.title,
|
|
864
|
-
'author-value': content.author,
|
|
865
|
-
'cover-abstract-value': content.digest,
|
|
866
|
-
'content-value': content.content,
|
|
867
|
-
'source-link-value': content.content_source_url,
|
|
868
|
-
'post-comments-value': postCommentsValue,
|
|
869
|
-
'show-cover-pic-value': content.show_cover_pic,
|
|
870
|
-
},
|
|
871
|
-
imageUrl: content.image_url,
|
|
872
|
-
mediaId: content.thumb_media_id,
|
|
873
|
-
};
|
|
874
|
-
this.setState({ templateData });
|
|
875
|
-
this.onCloseExistingTemplatesSlideBox();
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
getExistingTemplates = () => {
|
|
879
|
-
const { searchText, sortBy, existingTemplatesPageNo, existingTemplatesPageLimit } = this.state;
|
|
880
|
-
const { selectedWeChatAccount } = this.props.Templates;
|
|
881
|
-
|
|
882
|
-
this.setState({showExistingTemplates: true});
|
|
883
|
-
const queryParams = {
|
|
884
|
-
name: searchText || '',
|
|
885
|
-
sortBy: sortBy,
|
|
886
|
-
wecrmId: selectedWeChatAccount.configs.wecrm_app_id,
|
|
887
|
-
wecrmToken: selectedWeChatAccount.configs.wecrm_token,
|
|
888
|
-
originalId: selectedWeChatAccount.sourceAccountIdentifier,
|
|
889
|
-
page: existingTemplatesPageNo,
|
|
890
|
-
perPage: existingTemplatesPageLimit,
|
|
891
|
-
};
|
|
892
|
-
this.props.actions.getAllTemplates('wechat', queryParams);
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
searchTemplate = (data) => {
|
|
896
|
-
this.setState({searchText: data}, () => {
|
|
897
|
-
this.getExistingTemplates();
|
|
898
|
-
});
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
onPaginationChange = () => {
|
|
902
|
-
if (this.props.Create.pagination && this.state.scrollDebounce) {
|
|
903
|
-
this.setState((prevState) => ({
|
|
904
|
-
existingTemplatesPageNo: prevState.existingTemplatesPageNo + 1,
|
|
905
|
-
scrollDebounce: false,
|
|
906
|
-
}),
|
|
907
|
-
() => {
|
|
908
|
-
this.getExistingTemplates();
|
|
909
|
-
setTimeout(() => {
|
|
910
|
-
this.setState({ scrollDebounce: true })
|
|
911
|
-
}, 500);
|
|
912
|
-
});
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
existingTemplatesContent = () => {
|
|
917
|
-
const { getAllTemplatesInProgress, templates = [] } = this.props.Create;
|
|
918
|
-
return (
|
|
919
|
-
<CapSpin style={{textAlign: "center"}} spinning={getAllTemplatesInProgress}>
|
|
920
|
-
<CapInput.Search
|
|
921
|
-
className="search-text"
|
|
922
|
-
style={{ width: '100%', marginBottom: CAP_SPACE_16 }}
|
|
923
|
-
placeholder={this.props.intl.formatMessage(messages.searchText)}
|
|
924
|
-
value={this.state.searchText}
|
|
925
|
-
onChange={(e) => this.searchTemplate(e.target.value)}
|
|
926
|
-
onClear={() => this.searchTemplate('')}
|
|
927
|
-
/>
|
|
928
|
-
<Pagination style={{ height: 'calc(100vh - 150px)', overflowY: 'auto' }} onPageChange={templates.length && this.onPaginationChange}>
|
|
929
|
-
{ templates.map((template) => (
|
|
930
|
-
<CapCard
|
|
931
|
-
key={template._id}
|
|
932
|
-
bordered={false}
|
|
933
|
-
bodyStyle={{
|
|
934
|
-
padding: 0,
|
|
935
|
-
borderRadius: '4px',
|
|
936
|
-
width: '276px',
|
|
937
|
-
border: '16px solid #f4f5f7',
|
|
938
|
-
}}
|
|
939
|
-
onClick={(e) => this.onChooseExistingTemplate(template, e)}
|
|
940
|
-
style={{ paddingBottom: CAP_SPACE_12 }}
|
|
941
|
-
>
|
|
942
|
-
<div>
|
|
943
|
-
<div className="custom-image">
|
|
944
|
-
<img alt="" width="244px" height="136px" src={template.versions.base.mediaList[0].image_url} />
|
|
945
|
-
</div>
|
|
946
|
-
<div className="existing-template-title-card">
|
|
947
|
-
<CapHeading type="h5" className="overflow-wrap-fields">{template.name || "Title"}</CapHeading>
|
|
948
|
-
</div>
|
|
949
|
-
</div>
|
|
950
|
-
</CapCard>
|
|
951
|
-
))
|
|
952
|
-
}
|
|
953
|
-
</Pagination>
|
|
954
|
-
</CapSpin>
|
|
955
|
-
);
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
onCloseExistingTemplatesSlideBox = () => {
|
|
959
|
-
this.setState({
|
|
960
|
-
showExistingTemplates: false,
|
|
961
|
-
existingTemplatesPageNo: 1,
|
|
962
|
-
existingTemplatesPageLimit: 25,
|
|
963
|
-
searchText: '',
|
|
964
|
-
pagination: true,
|
|
965
|
-
});
|
|
966
|
-
}
|
|
967
|
-
|
|
968
839
|
updateContentData = () => {
|
|
969
840
|
this.state.editorInstanse.insertHtml(`<img src='${this.props.ContentImageData.metaInfo.wechatUrl}' alt='Capillary Image'>`);
|
|
970
841
|
this.props.actions.clearContentImageStore();
|
|
@@ -974,9 +845,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
974
845
|
const addRichMediaMenu = (
|
|
975
846
|
<>
|
|
976
847
|
<div style={{width: '292px'}}><CapDivider /></div>
|
|
977
|
-
<CapHeading type="h5" style={{marginBottom: '8px'}}>
|
|
978
|
-
<CapButton type="dashed" onClick={this.
|
|
979
|
-
<CapButton type="dashed" onClick={this.menuOnClickEvent} prefix={<CapIcon size="s" type="add-media" />} style={{backgroundColor: 'white'}}>{this.props.intl.formatMessage(messages.newMedia)}</CapButton>
|
|
848
|
+
<CapHeading type="h5" style={{marginBottom: '8px'}}>Add rich media content</CapHeading>
|
|
849
|
+
<CapButton type="dashed" onClick={this.menuOnClickEvent} prefix={<CapIcon size="s" type="add-media" />} style={{backgroundColor: 'white'}}>New media</CapButton>
|
|
980
850
|
</>
|
|
981
851
|
);
|
|
982
852
|
return addRichMediaMenu;
|
|
@@ -1032,7 +902,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1032
902
|
const schema = this.returnCurrentSchema();
|
|
1033
903
|
const formData = this.returnCurrentFormData();
|
|
1034
904
|
const { isIframe } = this.state;
|
|
1035
|
-
const { intl } = this.props;
|
|
1036
905
|
this.updateImageData();
|
|
1037
906
|
if (this.props.ContentImageData && this.props.ContentImageData.metaInfo && this.props.ContentImageData.metaInfo.wechatUrl) {
|
|
1038
907
|
this.updateContentData();
|
|
@@ -1058,7 +927,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1058
927
|
</CapColumn>
|
|
1059
928
|
<CapColumn span={15}>
|
|
1060
929
|
{ !isIframe && <CapInput
|
|
1061
|
-
label=
|
|
930
|
+
label="Name of the template"
|
|
1062
931
|
value={this.state.templateName}
|
|
1063
932
|
onChange={this.templateNameHandler}
|
|
1064
933
|
size="large"
|
|
@@ -1087,17 +956,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1087
956
|
</CapRow>
|
|
1088
957
|
</div>
|
|
1089
958
|
</div>
|
|
1090
|
-
<CapSlideBox
|
|
1091
|
-
header={(
|
|
1092
|
-
<CapHeading type="h3">
|
|
1093
|
-
{intl.formatMessage(messages.existingMediaHeader)}
|
|
1094
|
-
</CapHeading>
|
|
1095
|
-
)}
|
|
1096
|
-
content={this.existingTemplatesContent()}
|
|
1097
|
-
show={this.state.showExistingTemplates}
|
|
1098
|
-
handleClose={this.onCloseExistingTemplatesSlideBox}
|
|
1099
|
-
size="size-s"
|
|
1100
|
-
/>
|
|
1101
959
|
</CapSpin>
|
|
1102
960
|
</div>
|
|
1103
961
|
);
|
|
@@ -5,262 +5,233 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { defineMessages } from 'react-intl';
|
|
7
7
|
|
|
8
|
-
const scope = 'creatives.containersV2.richMedia.Create';
|
|
9
8
|
export default defineMessages({
|
|
10
9
|
"header": {
|
|
11
|
-
id:
|
|
10
|
+
id: 'creatives.containersV2.richMedia.create.header',
|
|
12
11
|
defaultMessage: 'This is Create container !',
|
|
13
12
|
},
|
|
14
13
|
"titleCharacterCount": {
|
|
15
|
-
id:
|
|
14
|
+
id: 'creatives.containersV2.richMedia.create.titleCharacterCount',
|
|
16
15
|
defaultMessage: 'Title exceeds character count limit by',
|
|
17
16
|
},
|
|
18
17
|
"authorCharacterCount": {
|
|
19
|
-
id:
|
|
18
|
+
id: 'creatives.containersV2.richMedia.create.authorCharacterCount',
|
|
20
19
|
defaultMessage: 'Author exceeds character count limit by',
|
|
21
20
|
},
|
|
22
21
|
"coverAbstractCharacterCount": {
|
|
23
|
-
id:
|
|
22
|
+
id: 'creatives.containersV2.richMedia.create.coverAbstractCharacterCount',
|
|
24
23
|
defaultMessage: 'Cover abstract exceeds character count limit by',
|
|
25
24
|
},
|
|
26
25
|
"saveSuccess": {
|
|
27
|
-
id:
|
|
26
|
+
id: 'creatives.containersV2.richMedia.create.saveSuccess',
|
|
28
27
|
defaultMessage: 'Template saved successfully',
|
|
29
28
|
},
|
|
30
29
|
"modalTitle": {
|
|
31
|
-
id:
|
|
30
|
+
id: 'creatives.containersV2.richMedia.create.modalTitle',
|
|
32
31
|
defaultMessage: 'Alert',
|
|
33
32
|
},
|
|
34
33
|
"modalBody": {
|
|
35
|
-
id:
|
|
34
|
+
id: 'creatives.containersV2.richMedia.create.modalBody',
|
|
36
35
|
defaultMessage: 'Do you really want to go back? All your temporary changes will be lost!',
|
|
37
36
|
},
|
|
38
37
|
"deleteContent": {
|
|
39
|
-
id:
|
|
38
|
+
id: 'creatives.containersV2.richMedia.create.deleteContent',
|
|
40
39
|
defaultMessage: 'Do you really want to delete? All your temporary changes will be lost!',
|
|
41
40
|
},
|
|
42
41
|
"emptyTemplateName": {
|
|
43
|
-
id:
|
|
42
|
+
id: 'creatives.containersV2.richMedia.create.emptyTemplateName',
|
|
44
43
|
defaultMessage: 'Cannot leave template name empty',
|
|
45
44
|
},
|
|
46
45
|
"wrongFormatFile": {
|
|
47
|
-
id:
|
|
46
|
+
id: 'creatives.containersV2.richMedia.create.wrongFormatFile',
|
|
48
47
|
defaultMessage: 'Wrong file upoaded. Please upload image file',
|
|
49
48
|
},
|
|
50
49
|
"formEmpty": {
|
|
51
|
-
id:
|
|
50
|
+
id: 'creatives.containersV2.richMedia.create.formEmpty',
|
|
52
51
|
defaultMessage: 'Cannot leave form empty',
|
|
53
52
|
},
|
|
54
53
|
"titleEmpty": {
|
|
55
|
-
id:
|
|
54
|
+
id: 'creatives.containersV2.richMedia.create.titleEmpty',
|
|
56
55
|
defaultMessage: 'Cannot leave title field empty',
|
|
57
56
|
},
|
|
58
57
|
"noImage": {
|
|
59
|
-
id:
|
|
58
|
+
id: 'creatives.containersV2.richMedia.create.noImage',
|
|
60
59
|
defaultMessage: 'Please upload an image',
|
|
61
60
|
},
|
|
62
61
|
"sourceLinkEmpty": {
|
|
63
|
-
id:
|
|
62
|
+
id: 'creatives.containersV2.richMedia.create.sourceLinkEmpty',
|
|
64
63
|
defaultMessage: 'Cannot leave source link field empty',
|
|
65
64
|
},
|
|
66
65
|
"contentEmpty": {
|
|
67
|
-
id:
|
|
66
|
+
id: 'creatives.containersV2.richMedia.create.contentEmpty',
|
|
68
67
|
defaultMessage: 'Cannot leave content field empty',
|
|
69
68
|
},
|
|
70
69
|
"titleNameRepeated": {
|
|
71
|
-
id:
|
|
70
|
+
id: 'creatives.containersV2.richMedia.create.titleNameRepeated',
|
|
72
71
|
defaultMessage: 'Title name cannot be repeated',
|
|
73
72
|
},
|
|
74
73
|
"wrongUrl": {
|
|
75
|
-
id:
|
|
74
|
+
id: 'creatives.containersV2.richMedia.create.wrongUrl',
|
|
76
75
|
defaultMessage: 'Enter correct URL',
|
|
77
76
|
},
|
|
78
77
|
"maxContentCount": {
|
|
79
|
-
id:
|
|
78
|
+
id: 'creatives.containersV2.richMedia.create.maxContentCount',
|
|
80
79
|
defaultMessage: 'You have reached the maximum template size',
|
|
81
80
|
},
|
|
82
81
|
"addNewRichmedia": {
|
|
83
|
-
id:
|
|
82
|
+
id: 'creatives.containersV2.richMedia.create.addNewRichmedia',
|
|
84
83
|
defaultMessage: 'Add richmedia content',
|
|
85
84
|
},
|
|
86
85
|
'Title': {
|
|
87
|
-
id:
|
|
86
|
+
id: 'creatives.containersV2.richMedia.create.Title',
|
|
88
87
|
defaultMessage: 'Title',
|
|
89
88
|
},
|
|
90
89
|
'Please input title': {
|
|
91
|
-
id:
|
|
90
|
+
id: 'creatives.containersV2.richMedia.create.Please_input_title',
|
|
92
91
|
defaultMessage: 'Please input title',
|
|
93
92
|
},
|
|
94
93
|
'Author': {
|
|
95
|
-
id:
|
|
94
|
+
id: 'creatives.containersV2.richMedia.create.Author',
|
|
96
95
|
defaultMessage: 'Author',
|
|
97
96
|
},
|
|
98
97
|
'Please input author': {
|
|
99
|
-
id:
|
|
98
|
+
id: 'creatives.containersV2.richMedia.create.Please_input_author',
|
|
100
99
|
defaultMessage: 'Please input author',
|
|
101
100
|
},
|
|
102
101
|
'Cover image': {
|
|
103
|
-
id:
|
|
102
|
+
id: 'creatives.containersV2.richMedia.create.Cover_image',
|
|
104
103
|
defaultMessage: 'Cover image',
|
|
105
104
|
},
|
|
106
105
|
'Cover abstract': {
|
|
107
|
-
id:
|
|
106
|
+
id: 'creatives.containersV2.richMedia.create.Cover_abstract',
|
|
108
107
|
defaultMessage: 'Cover abstract',
|
|
109
108
|
},
|
|
110
109
|
'Please input cover abstract': {
|
|
111
|
-
id:
|
|
110
|
+
id: 'creatives.containersV2.richMedia.create.Please_input_cover_abstract',
|
|
112
111
|
defaultMessage: 'Please input cover abstract',
|
|
113
112
|
},
|
|
114
113
|
'Content': {
|
|
115
|
-
id:
|
|
114
|
+
id: 'creatives.containersV2.richMedia.create.Content',
|
|
116
115
|
defaultMessage: 'Content',
|
|
117
116
|
},
|
|
118
117
|
'Please input content': {
|
|
119
|
-
id:
|
|
118
|
+
id: 'creatives.containersV2.richMedia.create.Please_input_content',
|
|
120
119
|
defaultMessage: 'Please input content',
|
|
121
120
|
},
|
|
122
121
|
'Show cover picture': {
|
|
123
|
-
id:
|
|
122
|
+
id: 'creatives.containersV2.richMedia.create.Show_cover_picture',
|
|
124
123
|
defaultMessage: 'Show cover picture',
|
|
125
124
|
},
|
|
126
125
|
'Who can post comments on this content': {
|
|
127
|
-
id:
|
|
126
|
+
id: 'creatives.containersV2.richMedia.create.Who_can_post_comments_on_this_content',
|
|
128
127
|
defaultMessage: 'Who can post comments on this content',
|
|
129
128
|
},
|
|
130
129
|
'No one': {
|
|
131
|
-
id:
|
|
130
|
+
id: 'creatives.containersV2.richMedia.create.No_one',
|
|
132
131
|
defaultMessage: 'No one',
|
|
133
132
|
},
|
|
134
133
|
'Anyone': {
|
|
135
|
-
id:
|
|
134
|
+
id: 'creatives.containersV2.richMedia.create.Anyone',
|
|
136
135
|
defaultMessage: 'Anyone',
|
|
137
136
|
},
|
|
138
137
|
'Only followers': {
|
|
139
|
-
id:
|
|
138
|
+
id: 'creatives.containersV2.richMedia.create.Only_followers',
|
|
140
139
|
defaultMessage: 'Only followers',
|
|
141
140
|
},
|
|
142
141
|
'visibility': {
|
|
143
|
-
id:
|
|
142
|
+
id: 'creatives.containersV2.richMedia.create.visibility',
|
|
144
143
|
defaultMessage: 'visibility',
|
|
145
144
|
},
|
|
146
145
|
'delete': {
|
|
147
|
-
id:
|
|
146
|
+
id: 'creatives.containersV2.richMedia.create.delete',
|
|
148
147
|
defaultMessage: 'delete',
|
|
149
148
|
},
|
|
150
149
|
'This field is required!': {
|
|
151
|
-
id:
|
|
150
|
+
id: 'creatives.containersV2.richMedia.create.requiredField',
|
|
152
151
|
defaultMessage: 'This field is required!',
|
|
153
152
|
},
|
|
154
153
|
"Write a brief headline to draw customer's attention": {
|
|
155
|
-
id:
|
|
154
|
+
id: 'creatives.containersV2.richMedia.create.titleInductiveText',
|
|
156
155
|
defaultMessage: "Write a brief headline to draw customer's attention",
|
|
157
156
|
},
|
|
158
157
|
"Brand/name that your customer will recognise": {
|
|
159
|
-
id:
|
|
158
|
+
id: 'creatives.containersV2.richMedia.create.authorInductiveText',
|
|
160
159
|
defaultMessage: "Brand/name that your customer will recognise",
|
|
161
160
|
},
|
|
162
161
|
'Resolution 360 x 200': {
|
|
163
|
-
id:
|
|
162
|
+
id: 'creatives.containersV2.richMedia.create.resolutionText',
|
|
164
163
|
defaultMessage: 'Resolution 360 x 200',
|
|
165
164
|
},
|
|
166
165
|
'The relevant image that complements title.': {
|
|
167
|
-
id:
|
|
166
|
+
id: 'creatives.containersV2.richMedia.create.coverImageTitle',
|
|
168
167
|
defaultMessage: 'The relevant image that complements title.',
|
|
169
168
|
},
|
|
170
169
|
'Upload Image': {
|
|
171
|
-
id:
|
|
170
|
+
id: 'creatives.containersV2.richMedia.create.uploadImage',
|
|
172
171
|
defaultMessage: 'Upload Image',
|
|
173
172
|
},
|
|
174
173
|
'A short description help customers learn more': {
|
|
175
|
-
id:
|
|
174
|
+
id: 'creatives.containersV2.richMedia.create.coverAbstractInductive',
|
|
176
175
|
defaultMessage: 'A short description help customers learn more',
|
|
177
176
|
},
|
|
178
177
|
'Article content': {
|
|
179
|
-
id:
|
|
178
|
+
id: 'creatives.containersV2.richMedia.create.articleContent',
|
|
180
179
|
defaultMessage: 'Article content',
|
|
181
180
|
},
|
|
182
181
|
'Insert Image': {
|
|
183
|
-
id:
|
|
182
|
+
id: 'creatives.containersV2.richMedia.create.insertImage',
|
|
184
183
|
defaultMessage: 'Insert Image',
|
|
185
184
|
},
|
|
186
185
|
'Read more link': {
|
|
187
|
-
id:
|
|
186
|
+
id: 'creatives.containersV2.richMedia.create.readMoreLink',
|
|
188
187
|
defaultMessage: 'Read more link',
|
|
189
188
|
},
|
|
190
189
|
'Link to help customers discover more about the brand.': {
|
|
191
|
-
id:
|
|
190
|
+
id: 'creatives.containersV2.richMedia.create.linkInductiveText',
|
|
192
191
|
defaultMessage: 'Link to help customers discover more about the brand.',
|
|
193
192
|
},
|
|
194
193
|
'somethingWentWrong': {
|
|
195
|
-
id:
|
|
194
|
+
id: 'creatives.containersV2.richMedia.create.somethingWentWrong',
|
|
196
195
|
defaultMessage: 'Something went wrong!!',
|
|
197
196
|
},
|
|
198
197
|
'Template with the same name exists. Please try another template name.': {
|
|
199
|
-
id:
|
|
198
|
+
id: 'creatives.containersV2.richMedia.create.templateNameExists',
|
|
200
199
|
defaultMessage: 'Template with the same name exists. Please try another template name.',
|
|
201
200
|
},
|
|
202
|
-
'Template name already exists': {
|
|
203
|
-
id: 'creatives.containersV2.richMedia.create.templateNameAlreadyExists',
|
|
204
|
-
defaultMessage: 'Template name already exists',
|
|
205
|
-
},
|
|
206
201
|
'Template name cannot be blank!': {
|
|
207
|
-
id:
|
|
202
|
+
id: 'creatives.containersV2.richMedia.create.templateNameBlank',
|
|
208
203
|
defaultMessage: 'Template name cannot be blank',
|
|
209
204
|
},
|
|
210
205
|
'Template name contains only whitespaces': {
|
|
211
|
-
id:
|
|
206
|
+
id: 'creatives.containersV2.richMedia.create.templateNameContainsWS',
|
|
212
207
|
defaultMessage: 'Template name contains only whitespaces',
|
|
213
208
|
},
|
|
214
209
|
'Please provide payload to the wechat template': {
|
|
215
|
-
id:
|
|
210
|
+
id: 'creatives.containersV2.richMedia.create.payloadMissing',
|
|
216
211
|
defaultMessage: 'Please provide payload to create wechat template',
|
|
217
212
|
},
|
|
218
213
|
'Please provide source account identifier': {
|
|
219
|
-
id:
|
|
214
|
+
id: 'creatives.containersV2.richMedia.create.sourceIdentMissing',
|
|
220
215
|
defaultMessage: 'Please provide source account identifier',
|
|
221
216
|
},
|
|
222
217
|
'Please provide sufficient parameters to generate richmedia message payload': {
|
|
223
|
-
id:
|
|
218
|
+
id: 'creatives.containersV2.richMedia.create.sufficientPayload',
|
|
224
219
|
defaultMessage: 'Please provide sufficient parameters to generate richmedia message payload',
|
|
225
220
|
},
|
|
226
221
|
'Please provide sufficient params to create richmedia wechat template': {
|
|
227
|
-
id:
|
|
222
|
+
id: 'creatives.containersV2.richMedia.create.sufficientParam',
|
|
228
223
|
defaultMessage: 'Please provide sufficient params to create richmedia wechat template',
|
|
229
224
|
},
|
|
230
225
|
'Upload has failed': {
|
|
231
|
-
id:
|
|
226
|
+
id: 'creatives.containersV2.richMedia.create.uploadFailed',
|
|
232
227
|
defaultMessage: 'Upload has failed',
|
|
233
228
|
},
|
|
234
229
|
'Template with the same name exists': {
|
|
235
|
-
id:
|
|
230
|
+
id: 'creatives.containersV2.richMedia.create.sameTemplateExists',
|
|
236
231
|
defaultMessage: 'Template with the same name exists',
|
|
237
232
|
},
|
|
238
233
|
'Failed to get File content': {
|
|
239
|
-
id:
|
|
234
|
+
id: 'creatives.containersV2.richMedia.create.fileContentFailed',
|
|
240
235
|
defaultMessage: 'Failed to get File content',
|
|
241
236
|
},
|
|
242
|
-
'addRichMediaContent': {
|
|
243
|
-
id: `${scope}.addRichMediaContent`,
|
|
244
|
-
defaultMessage: 'Add rich media content',
|
|
245
|
-
},
|
|
246
|
-
'newMedia': {
|
|
247
|
-
id: `${scope}.newMedia`,
|
|
248
|
-
defaultMessage: 'New media',
|
|
249
|
-
},
|
|
250
|
-
'nameOfTemplate': {
|
|
251
|
-
id: `${scope}.nameOfTemplate`,
|
|
252
|
-
defaultMessage: 'Name of the template',
|
|
253
|
-
},
|
|
254
|
-
'existingMedia': {
|
|
255
|
-
id: `${scope}.existingMedia`,
|
|
256
|
-
defaultMessage: 'Existing media',
|
|
257
|
-
},
|
|
258
|
-
'existingMediaHeader': {
|
|
259
|
-
id: `${scope}.existingMediaHeader`,
|
|
260
|
-
defaultMessage: 'Rich media templates',
|
|
261
|
-
},
|
|
262
|
-
'searchText': {
|
|
263
|
-
id: `${scope}.searchText`,
|
|
264
|
-
defaultMessage: 'Search Templates',
|
|
265
|
-
},
|
|
266
237
|
});
|
|
@@ -5,13 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { fromJS } from 'immutable';
|
|
8
|
-
import unionBy from 'lodash/unionBy';
|
|
9
8
|
import * as types from './constants';
|
|
10
9
|
|
|
11
|
-
const initialState = fromJS({
|
|
12
|
-
getAllTemplatesInProgress: false,
|
|
13
|
-
templates: [],
|
|
14
|
-
});
|
|
10
|
+
const initialState = fromJS({});
|
|
15
11
|
|
|
16
12
|
function createReducer(state = initialState, action) {
|
|
17
13
|
switch (action.type) {
|
|
@@ -56,25 +52,6 @@ function createReducer(state = initialState, action) {
|
|
|
56
52
|
return state
|
|
57
53
|
.set('saveTemplateSuccess', false)
|
|
58
54
|
.set('savingTemplate', false);
|
|
59
|
-
case types.GET_ALL_TEMPLATES_REQUEST:
|
|
60
|
-
return state
|
|
61
|
-
.set('getAllTemplatesInProgress', true).set('templateError', {});
|
|
62
|
-
case types.GET_ALL_TEMPLATES_SUCCESS:
|
|
63
|
-
const { data, isReset } = action;
|
|
64
|
-
if (isReset) {
|
|
65
|
-
return state
|
|
66
|
-
.set('getAllTemplatesInProgress', false)
|
|
67
|
-
.set('pagination', true)
|
|
68
|
-
.set('templates', data ? data.templates : [])
|
|
69
|
-
.set('isSearch', data ? data.search : false);
|
|
70
|
-
}
|
|
71
|
-
return state
|
|
72
|
-
.set('getAllTemplatesInProgress', false)
|
|
73
|
-
.set('pagination', data ? Boolean(data.templates.length) : true)
|
|
74
|
-
.set('templates', data ? unionBy(state.get('templates'), data.templates, '_id') : state.get('templates'))
|
|
75
|
-
.set('isSearch', data ? data.search : false);
|
|
76
|
-
case types.GET_ALL_TEMPLATES_FAILURE:
|
|
77
|
-
return state.set('getAllTemplatesInProgress', false).set('templateError', action.error);
|
|
78
55
|
default:
|
|
79
56
|
return state;
|
|
80
57
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { take, cancel, call, put, takeLatest } from 'redux-saga/effects';
|
|
2
2
|
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
|
-
import orderBy from 'lodash/orderBy';
|
|
4
|
-
import moment from 'moment';
|
|
5
3
|
import * as Api from '../../../../services/api';
|
|
6
4
|
import * as types from './constants';
|
|
7
5
|
// import testschema from './testschema';
|
|
@@ -35,48 +33,6 @@ export function* saveTemplate({template, callback}) {
|
|
|
35
33
|
yield put({ type: types.SAVE_TEMPLATE_FAILURE, error });
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
|
-
|
|
39
|
-
export function* getAllTemplates(action) {
|
|
40
|
-
try {
|
|
41
|
-
const result = yield call(Api.getAllTemplates, action);
|
|
42
|
-
const channelTemplates = {
|
|
43
|
-
templates: result.response.richmedia,
|
|
44
|
-
};
|
|
45
|
-
if (
|
|
46
|
-
action.channel === 'wechat' &&
|
|
47
|
-
action.queryParams &&
|
|
48
|
-
action.queryParams.sortBy
|
|
49
|
-
) {
|
|
50
|
-
if (action.queryParams.sortBy.toLocaleLowerCase() === ("Most Recent").toLocaleLowerCase()) {
|
|
51
|
-
channelTemplates.templates = orderBy(channelTemplates.templates, (template) => moment(template.updatedAt), ['desc']);
|
|
52
|
-
// channelTemplates.templates.sort((a, b) => {
|
|
53
|
-
// const dateA = new Date(a.updatedAt);
|
|
54
|
-
// const dateB = new Date(b.updatedAt);
|
|
55
|
-
// return dateB - dateA;
|
|
56
|
-
// });
|
|
57
|
-
} else if (action.queryParams.sortBy.toLocaleLowerCase() === ("Alphabetically").toLocaleLowerCase()) {
|
|
58
|
-
channelTemplates.templates.sort((a, b) => b.name - a.name);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
yield put({
|
|
62
|
-
type: types.GET_ALL_TEMPLATES_SUCCESS,
|
|
63
|
-
data: channelTemplates,
|
|
64
|
-
isReset: action.queryParams.page === 1,
|
|
65
|
-
});
|
|
66
|
-
} catch (error) {
|
|
67
|
-
yield put({
|
|
68
|
-
type: types.GET_ALL_TEMPLATES_FAILURE,
|
|
69
|
-
error,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function* watchGetAllTemplates() {
|
|
75
|
-
const watcher = yield takeLatest(types.GET_ALL_TEMPLATES_REQUEST, getAllTemplates);
|
|
76
|
-
yield take(LOCATION_CHANGE);
|
|
77
|
-
yield cancel(watcher);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
36
|
function* watchUploadAsset() {
|
|
81
37
|
const watcher = yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
82
38
|
yield take(LOCATION_CHANGE);
|
|
@@ -92,5 +48,4 @@ export default [
|
|
|
92
48
|
defaultSaga,
|
|
93
49
|
watchUploadAsset,
|
|
94
50
|
watchSaveTemplate,
|
|
95
|
-
watchGetAllTemplates,
|
|
96
51
|
];
|
|
@@ -8,7 +8,3 @@ export const DEFAULT_ACTION = 'app/Edit/DEFAULT_ACTION';
|
|
|
8
8
|
export const GET_TEMPLATE_DETAILS_REQUEST = 'app/v2Containers/WeChat/RichmediaTemplates/Edit/GET_TEMPLATE_DETAILS_REQUEST';
|
|
9
9
|
export const GET_TEMPLATE_DETAILS_SUCCESS = 'app/v2Containers/WeChat/RichmediaTemplates/Edit/GET_TEMPLATE_DETAILS_SUCCESS';
|
|
10
10
|
export const GET_TEMPLATE_DETAILS_FAILURE = 'app/v2Containers/WeChat/RichmediaTemplates/Edit/GET_TEMPLATE_DETAILS_FAILURE';
|
|
11
|
-
|
|
12
|
-
export const NO_ONE = 'No one';
|
|
13
|
-
export const ONLY_FOLLOWERS = 'Only followers';
|
|
14
|
-
export const ANYONE = 'Anyone';
|
|
@@ -15,7 +15,6 @@ import { CapSpin } from '@capillarytech/cap-ui-library';
|
|
|
15
15
|
import { createStructuredSelector } from 'reselect';
|
|
16
16
|
import makeSelectEdit, { makeSelectTemplates } from './selectors';
|
|
17
17
|
import * as actions from './actions';
|
|
18
|
-
import { NO_ONE, ONLY_FOLLOWERS, ANYONE } from './constants';
|
|
19
18
|
import Create from '../Create';
|
|
20
19
|
import { getCommonProps } from '../../helper';
|
|
21
20
|
|
|
@@ -40,18 +39,12 @@ export class Edit extends React.PureComponent { // eslint-disable-line react/pre
|
|
|
40
39
|
if (!_.isEmpty(templateDetails)) {
|
|
41
40
|
_.forEach(templateDetails.versions.base.mediaList, (content) => {
|
|
42
41
|
const formData = {};
|
|
43
|
-
let postCommentsValue = NO_ONE;
|
|
44
|
-
if (content.only_fans_can_comment && content.need_open_comment) {
|
|
45
|
-
postCommentsValue = ONLY_FOLLOWERS;
|
|
46
|
-
} else if (content.need_open_comment) {
|
|
47
|
-
postCommentsValue = ANYONE;
|
|
48
|
-
}
|
|
49
42
|
formData['title-value'] = content.title;
|
|
50
43
|
formData['author-value'] = content.author;
|
|
51
44
|
formData['cover-abstract-value'] = content.digest;
|
|
52
45
|
formData['content-value'] = content.content;
|
|
53
46
|
formData['source-link-value'] = content.content_source_url;
|
|
54
|
-
formData['post-comments-value'] =
|
|
47
|
+
formData['post-comments-value'] = content.post_comments_scope;
|
|
55
48
|
formData['show-cover-pic-value'] = content.show_cover_pic;
|
|
56
49
|
templateData[contentId] = {
|
|
57
50
|
formData,
|