@capillarytech/creatives-library 3.1.47 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/app.js +1 -1
  2. package/components/FormBuilder/index.js +1 -1
  3. package/components/Header/index.js +3 -4
  4. package/components/Header/messages.js +0 -4
  5. package/config/app.js +2 -4
  6. package/containers/Assets/Gallery/index.js +1 -1
  7. package/containers/Cap/index.js +5 -4
  8. package/containers/Email/index.js +2 -2
  9. package/containers/Email/messages.js +0 -8
  10. package/containers/LanguageProvider/index.js +4 -28
  11. package/containers/Templates/index.js +2 -2
  12. package/containers/Templates/messages.js +4 -24
  13. package/containers/WeChat/MapTemplates/messages.js +0 -4
  14. package/containers/WeChat/RichmediaTemplates/Create/messages.js +0 -24
  15. package/i18n.js +9 -16
  16. package/index.js +0 -6
  17. package/package.json +4 -1
  18. package/reducers.js +1 -1
  19. package/routes.js +1 -2
  20. package/services/api.js +2 -11
  21. package/translations/en.json +56 -110
  22. package/translations/zh.json +53 -107
  23. package/utils/smsCharCountV2.js +1 -1
  24. package/v2Components/CapTagList/index.js +2 -2
  25. package/v2Components/FormBuilder/index.js +4 -7
  26. package/v2Components/NavigationBar/index.js +10 -9
  27. package/v2Components/NewCallTask/index.js +1 -3
  28. package/v2Components/TopBar/index.js +0 -3
  29. package/v2Components/TopBar/messages.js +0 -8
  30. package/v2Containers/Assets/Gallery/index.js +1 -1
  31. package/v2Containers/Assets/Gallery/messages.js +0 -4
  32. package/v2Containers/CallTask/index.js +1 -3
  33. package/v2Containers/Cap/index.js +2 -3
  34. package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -14
  35. package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -2
  36. package/v2Containers/CreativesContainer/index.js +2 -10
  37. package/v2Containers/CreativesContainer/index.scss +3 -6
  38. package/v2Containers/Email/index.js +7 -10
  39. package/v2Containers/Email/messages.js +0 -8
  40. package/v2Containers/EmailWrapper/index.js +9 -12
  41. package/v2Containers/LanguageProvider/actions.js +4 -9
  42. package/v2Containers/LanguageProvider/constants.js +1 -7
  43. package/v2Containers/LanguageProvider/index.js +12 -49
  44. package/v2Containers/LanguageProvider/reducer.js +9 -11
  45. package/v2Containers/LanguageProvider/selectors.js +1 -1
  46. package/v2Containers/MobilePush/Create/index.js +1 -2
  47. package/v2Containers/MobilePush/Create/messages.js +0 -4
  48. package/v2Containers/MobilePush/Edit/index.js +1 -2
  49. package/v2Containers/MobilePush/Edit/messages.js +0 -4
  50. package/v2Containers/Sms/Create/index.js +1 -3
  51. package/v2Containers/Sms/Create/messages.js +0 -16
  52. package/v2Containers/Sms/Edit/index.js +1 -3
  53. package/v2Containers/Sms/Edit/messages.js +0 -16
  54. package/v2Containers/TagList/index.js +0 -43
  55. package/v2Containers/Templates/_templates.scss +1 -9
  56. package/v2Containers/Templates/index.js +52 -65
  57. package/v2Containers/TemplatesV2/_templatesV2.scss +5 -0
  58. package/v2Containers/TemplatesV2/index.js +54 -54
  59. package/v2Containers/WeChat/MapTemplates/index.js +7 -2
  60. package/v2Containers/WeChat/MapTemplates/messages.js +5 -9
  61. package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +0 -10
  62. package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +0 -9
  63. package/v2Containers/WeChat/RichmediaTemplates/Create/constants.js +0 -3
  64. package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +21 -154
  65. package/v2Containers/WeChat/RichmediaTemplates/Create/messages.js +46 -119
  66. package/v2Containers/WeChat/RichmediaTemplates/Create/reducer.js +1 -24
  67. package/v2Containers/WeChat/RichmediaTemplates/Create/sagas.js +1 -46
  68. package/v2Containers/WeChat/RichmediaTemplates/Edit/constants.js +0 -4
  69. package/v2Containers/WeChat/RichmediaTemplates/Edit/index.js +1 -8
  70. package/v2Containers/WeChat/RichmediaTemplates/View/index.js +7 -0
  71. package/v2Containers/WeChat/Wrapper/_wrapper.scss +1 -9
  72. package/v2Containers/WeChat/Wrapper/messages.js +5 -5
  73. package/hoc/withStyles.js +0 -12
  74. package/v2Containers/LanguageProvider/sagas.js +0 -39
  75. package/v2Containers/TemplatesV2/TemplatesV2.style.js +0 -29
@@ -17,17 +17,17 @@ 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, CapSlideBox } from '@capillarytech/cap-ui-library';
20
+ import { CapRow, CapColumn, CapButton, CapCard, CapSpin, CapInput, CapHeading, CapDivider, CapIcon, CapLink, CapLabel } 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';
24
24
  import './_createRichmedia.scss';
25
25
  import messages from './messages';
26
+ import * as globalActions from '../../../Cap/actions';
27
+ import {getMessageObject} from '../../../../utils/messageUtils';
26
28
  import FormBuilder from '../../../../v2Components/FormBuilder';
27
29
  import WechatRichmediaTemplatePreview from '../../../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
28
30
  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
31
 
32
32
  export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
33
33
  constructor(props) {
@@ -104,13 +104,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
104
104
  type: 'confirm',
105
105
  id: 'template-back-confirm-modal',
106
106
  },
107
- showExistingTemplates: false,
108
- existingTemplatesPageNo: 1,
109
- existingTemplatesPageLimit: 25,
110
- sortBy: 'Most Recent',
111
- searchText: '',
112
- pagination: true,
113
- scrollDebounce: true,
114
107
  };
115
108
  this.onFormDataChange = this.onFormDataChange.bind(this);
116
109
  this.cancelHandler = this.cancelHandler.bind(this);
@@ -153,14 +146,12 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
153
146
  }
154
147
  if (nextProps.Create.saveTemplateRes && !isEmpty(nextProps.Create.saveTemplateRes) && nextProps.Create.saveTemplateSuccess && !isEqual(nextProps.Create.saveTemplateRes, this.props.Create.saveTemplateRes)) {
155
148
  this.setState({loading: false});
156
- CapNotification.success({
157
- message: this.props.intl.formatMessage(messages.saveSuccess),
158
- });
149
+ const message = getMessageObject('success', this.props.intl.formatMessage(messages.saveSuccess), true);
150
+ this.props.globalActions.addMessageToQueue(message);
159
151
  }
160
152
  if (!nextProps.Create.saveTemplateSuccess && nextProps.Create.saveTemplateSuccess !== undefined && nextProps.Create.saveTemplateErrorMessage && nextProps.Create.saveTemplateErrorMessage !== this.props.Create.saveTemplateErrorMessage) {
161
153
  this.setState({loading: false});
162
- this.showErrorMessage(this.props.intl.formatMessage(messages[nextProps.Create.saveTemplateErrorMessage] || messages.somethingWentWrong));
163
- this.props.onValidationFail();
154
+ this.showErrorMessage(nextProps.Create.saveTemplateErrorMessage);
164
155
  }
165
156
  if (!isEqual(nextProps.templateName, this.props.templateName)) {
166
157
  this.setState({templateName: nextProps.templateName});
@@ -182,13 +173,16 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
182
173
  }
183
174
  onContentChange = (evt) => {
184
175
  const templateData = cloneDeep(this.state.templateData);
176
+ console.log('oncontentchange onChange ', evt, evt.editor.getData(), templateData);
185
177
  templateData[this.state.currentContentId].formData['content-value'] = evt.editor.getData();
186
178
  this.setState({templateData});
187
179
  }
188
180
  getEditorInstanse = (instance, id) => {
181
+ console.log('Got editor Instance ', instance, id);
189
182
  window.CKEDITOR.on( 'instanceReady', ( event ) => {
190
183
  this.setState({editorInstanse: event.editor});
191
184
  event.editor.on( 'focus', () => {
185
+ console.log( 'focused', event.editor, this );
192
186
  this.setState({editorInstanse: event.editor});
193
187
  });
194
188
  });
@@ -204,6 +198,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
204
198
  this.setState({isFormValid});
205
199
  }
206
200
  getCurrentWindow(e) {
201
+ console.log("moveToTemplates richmedia getCurrentWindow");
207
202
  const response = {
208
203
  action: e.action,
209
204
  value: 'edit',
@@ -286,9 +281,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
286
281
  return temp;
287
282
  }
288
283
  showErrorMessage = (errorMessage) => {
289
- CapNotification.error({
290
- message: errorMessage,
291
- });
284
+ const message = getMessageObject('error', errorMessage, true);
285
+ this.props.globalActions.addMessageToQueue(message);
292
286
  }
293
287
  checkFormFieldsCount = () => {
294
288
  const templateData = cloneDeep(this.state.templateData);
@@ -568,6 +562,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
568
562
  }
569
563
  }
570
564
  uploadImage = (data, uploadId) => {
565
+ console.log("uploadImage", data, uploadId);
571
566
  if (data.type === "wrong file") {
572
567
  this.showErrorMessage(this.props.intl.formatMessage(messages.wrongFormatFile));
573
568
  } else {
@@ -606,10 +601,12 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
606
601
  }
607
602
  viewContent = (id, e) => {
608
603
  e.stopPropagation();
604
+ console.log("moveContentUpward viewContent", id);
609
605
  this.setState({currentContentId: id});
610
606
  }
611
607
  deleteContent = (id, e) => {
612
608
  e.stopPropagation();
609
+ console.log("clicked delete", id);
613
610
  const modalContent = {
614
611
  title: this.props.intl.formatMessage(messages.modalTitle),
615
612
  body: this.props.intl.formatMessage(messages.deleteContent),
@@ -651,6 +648,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
651
648
  templateData[id] = cloneDeep(templateData[id - 1]);
652
649
  templateData[id - 1] = temp;
653
650
  currentContentId = id - 1;
651
+ console.log("moveContentUpward", id, this.state.currentContentId, currentContentId);
654
652
  this.setState({templateData, currentContentId});
655
653
  }
656
654
  getCardActionBar = (contentBlocks, id) => (
@@ -845,126 +843,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
845
843
  });
846
844
  return true;
847
845
  }
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
846
  updateContentData = () => {
969
847
  this.state.editorInstanse.insertHtml(`<img src='${this.props.ContentImageData.metaInfo.wechatUrl}' alt='Capillary Image'>`);
970
848
  this.props.actions.clearContentImageStore();
@@ -974,9 +852,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
974
852
  const addRichMediaMenu = (
975
853
  <>
976
854
  <div style={{width: '292px'}}><CapDivider /></div>
977
- <CapHeading type="h5" style={{marginBottom: '8px'}}>{this.props.intl.formatMessage(messages.addRichMediaContent)}</CapHeading>
978
- <CapButton type="dashed" onClick={this.getExistingTemplates} prefix={<CapIcon size="s" type="media" />} style={{backgroundColor: 'white', width: '142px', marginRight: CAP_SPACE_08, paddingLeft: CAP_SPACE_12}}>{this.props.intl.formatMessage(messages.existingMedia)}</CapButton>
979
- <CapButton type="dashed" onClick={this.menuOnClickEvent} prefix={<CapIcon size="s" type="add-media" />} style={{backgroundColor: 'white'}}>{this.props.intl.formatMessage(messages.newMedia)}</CapButton>
855
+ <CapHeading type="h5" style={{marginBottom: '8px'}}>Add rich media content</CapHeading>
856
+ <CapButton type="dashed" onClick={this.menuOnClickEvent} prefix={<CapIcon size="s" type="add-media" />} style={{backgroundColor: 'white'}}>New media</CapButton>
980
857
  </>
981
858
  );
982
859
  return addRichMediaMenu;
@@ -1032,7 +909,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
1032
909
  const schema = this.returnCurrentSchema();
1033
910
  const formData = this.returnCurrentFormData();
1034
911
  const { isIframe } = this.state;
1035
- const { intl } = this.props;
1036
912
  this.updateImageData();
1037
913
  if (this.props.ContentImageData && this.props.ContentImageData.metaInfo && this.props.ContentImageData.metaInfo.wechatUrl) {
1038
914
  this.updateContentData();
@@ -1058,7 +934,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
1058
934
  </CapColumn>
1059
935
  <CapColumn span={15}>
1060
936
  { !isIframe && <CapInput
1061
- label={this.props.intl.formatMessage(messages.nameOfTemplate)}
937
+ label="Name of the template"
1062
938
  value={this.state.templateName}
1063
939
  onChange={this.templateNameHandler}
1064
940
  size="large"
@@ -1087,17 +963,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
1087
963
  </CapRow>
1088
964
  </div>
1089
965
  </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
966
  </CapSpin>
1102
967
  </div>
1103
968
  );
@@ -1116,6 +981,7 @@ Create.propTypes = {
1116
981
  Templates: PropTypes.object,
1117
982
  ImageData: PropTypes.object,
1118
983
  actions: PropTypes.object,
984
+ globalActions: PropTypes.object,
1119
985
  Create: PropTypes.object,
1120
986
  intl: intlShape.isRequired,
1121
987
  ContentImageData: PropTypes.object,
@@ -1136,6 +1002,7 @@ const mapStateToProps = createStructuredSelector({
1136
1002
  function mapDispatchToProps(dispatch) {
1137
1003
  return {
1138
1004
  actions: bindActionCreators(actions, dispatch),
1005
+ globalActions: bindActionCreators(globalActions, dispatch),
1139
1006
  };
1140
1007
  }
1141
1008
 
@@ -5,262 +5,189 @@
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: `${scope}.header`,
10
+ id: 'creatives.containersV2.Create.header',
12
11
  defaultMessage: 'This is Create container !',
13
12
  },
14
13
  "titleCharacterCount": {
15
- id: `${scope}.titleCharacterCount`,
14
+ id: 'creatives.containersV2.Create.titleCharacterCount',
16
15
  defaultMessage: 'Title exceeds character count limit by',
17
16
  },
18
17
  "authorCharacterCount": {
19
- id: `${scope}.authorCharacterCount`,
18
+ id: 'creatives.containersV2.Create.authorCharacterCount',
20
19
  defaultMessage: 'Author exceeds character count limit by',
21
20
  },
22
21
  "coverAbstractCharacterCount": {
23
- id: `${scope}.coverAbstractCharacterCount`,
22
+ id: 'creatives.containersV2.Create.coverAbstractCharacterCount',
24
23
  defaultMessage: 'Cover abstract exceeds character count limit by',
25
24
  },
26
25
  "saveSuccess": {
27
- id: `${scope}.saveSuccess`,
26
+ id: 'creatives.containersV2.Create.saveSuccess',
28
27
  defaultMessage: 'Template saved successfully',
29
28
  },
30
29
  "modalTitle": {
31
- id: `${scope}.modalTitle`,
30
+ id: 'creatives.containersV2.Create.modalTitle',
32
31
  defaultMessage: 'Alert',
33
32
  },
34
33
  "modalBody": {
35
- id: `${scope}.modalBody`,
34
+ id: 'creatives.containersV2.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: `${scope}.deleteContent`,
38
+ id: 'creatives.containersV2.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: `${scope}.emptyTemplateName`,
42
+ id: 'creatives.containersV2.Create.emptyTemplateName',
44
43
  defaultMessage: 'Cannot leave template name empty',
45
44
  },
46
45
  "wrongFormatFile": {
47
- id: `${scope}.wrongFormatFile`,
46
+ id: 'creatives.containersV2.Create.wrongFormatFile',
48
47
  defaultMessage: 'Wrong file upoaded. Please upload image file',
49
48
  },
50
49
  "formEmpty": {
51
- id: `${scope}.formEmpty`,
50
+ id: 'creatives.containersV2.Create.formEmpty',
52
51
  defaultMessage: 'Cannot leave form empty',
53
52
  },
54
53
  "titleEmpty": {
55
- id: `${scope}.titleEmpty`,
54
+ id: 'creatives.containersV2.Create.titleEmpty',
56
55
  defaultMessage: 'Cannot leave title field empty',
57
56
  },
58
57
  "noImage": {
59
- id: `${scope}.noImage`,
58
+ id: 'creatives.containersV2.Create.noImage',
60
59
  defaultMessage: 'Please upload an image',
61
60
  },
62
61
  "sourceLinkEmpty": {
63
- id: `${scope}.sourceLinkEmpty`,
62
+ id: 'creatives.containersV2.Create.sourceLinkEmpty',
64
63
  defaultMessage: 'Cannot leave source link field empty',
65
64
  },
66
65
  "contentEmpty": {
67
- id: `${scope}.contentEmpty`,
66
+ id: 'creatives.containersV2.Create.contentEmpty',
68
67
  defaultMessage: 'Cannot leave content field empty',
69
68
  },
70
69
  "titleNameRepeated": {
71
- id: `${scope}.titleNameRepeated`,
70
+ id: 'creatives.containersV2.Create.titleNameRepeated',
72
71
  defaultMessage: 'Title name cannot be repeated',
73
72
  },
74
73
  "wrongUrl": {
75
- id: `${scope}.wrongUrl`,
74
+ id: 'creatives.containersV2.Create.wrongUrl',
76
75
  defaultMessage: 'Enter correct URL',
77
76
  },
78
77
  "maxContentCount": {
79
- id: `${scope}.maxContentCount`,
78
+ id: 'creatives.containersV2.Create.maxContentCount',
80
79
  defaultMessage: 'You have reached the maximum template size',
81
80
  },
82
81
  "addNewRichmedia": {
83
- id: `${scope}.addNewRichmedia`,
82
+ id: 'creatives.containersV2.Create.addNewRichmedia',
84
83
  defaultMessage: 'Add richmedia content',
85
84
  },
86
85
  'Title': {
87
- id: `${scope}.Title`,
86
+ id: 'creatives.containersV2.Create.Title',
88
87
  defaultMessage: 'Title',
89
88
  },
90
89
  'Please input title': {
91
- id: `${scope}.Please_input_title`,
90
+ id: 'creatives.containersV2.Create.Please_input_title',
92
91
  defaultMessage: 'Please input title',
93
92
  },
94
93
  'Author': {
95
- id: `${scope}.Author`,
94
+ id: 'creatives.containersV2.Create.Author',
96
95
  defaultMessage: 'Author',
97
96
  },
98
97
  'Please input author': {
99
- id: `${scope}.Please_input_author`,
98
+ id: 'creatives.containersV2.Create.Please_input_author',
100
99
  defaultMessage: 'Please input author',
101
100
  },
102
101
  'Cover image': {
103
- id: `${scope}.Cover_image`,
102
+ id: 'creatives.containersV2.Create.Cover_image',
104
103
  defaultMessage: 'Cover image',
105
104
  },
106
105
  'Cover abstract': {
107
- id: `${scope}.Cover_abstract`,
106
+ id: 'creatives.containersV2.Create.Cover_abstract',
108
107
  defaultMessage: 'Cover abstract',
109
108
  },
110
109
  'Please input cover abstract': {
111
- id: `${scope}.Please_input_cover_abstract`,
110
+ id: 'creatives.containersV2.Create.Please_input_cover_abstract',
112
111
  defaultMessage: 'Please input cover abstract',
113
112
  },
114
113
  'Content': {
115
- id: `${scope}.Content`,
114
+ id: 'creatives.containersV2.Create.Content',
116
115
  defaultMessage: 'Content',
117
116
  },
118
117
  'Please input content': {
119
- id: `${scope}.Please_input_content`,
118
+ id: 'creatives.containersV2.Create.Please_input_content',
120
119
  defaultMessage: 'Please input content',
121
120
  },
122
121
  'Show cover picture': {
123
- id: `${scope}.Show_cover_picture`,
122
+ id: 'creatives.containersV2.Create.Show_cover_picture',
124
123
  defaultMessage: 'Show cover picture',
125
124
  },
126
125
  'Who can post comments on this content': {
127
- id: `${scope}.Who_can_post_comments_on_this_content`,
126
+ id: 'creatives.containersV2.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: `${scope}.No_one`,
130
+ id: 'creatives.containersV2.Create.No_one',
132
131
  defaultMessage: 'No one',
133
132
  },
134
133
  'Anyone': {
135
- id: `${scope}.Anyone`,
134
+ id: 'creatives.containersV2.Create.Anyone',
136
135
  defaultMessage: 'Anyone',
137
136
  },
138
137
  'Only followers': {
139
- id: `${scope}.Only_followers`,
138
+ id: 'creatives.containersV2.Create.Only_followers',
140
139
  defaultMessage: 'Only followers',
141
140
  },
142
141
  'visibility': {
143
- id: `${scope}.visibility`,
142
+ id: 'creatives.containersV2.Create.visibility',
144
143
  defaultMessage: 'visibility',
145
144
  },
146
145
  'delete': {
147
- id: `${scope}.delete`,
146
+ id: 'creatives.containersV2.Create.delete',
148
147
  defaultMessage: 'delete',
149
148
  },
150
149
  'This field is required!': {
151
- id: `${scope}.requiredField`,
150
+ id: 'creatives.containersV2.Create.requiredField',
152
151
  defaultMessage: 'This field is required!',
153
152
  },
154
153
  "Write a brief headline to draw customer's attention": {
155
- id: `${scope}.titleInductiveText`,
154
+ id: 'creatives.containersV2.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: `${scope}.authorInductiveText`,
158
+ id: 'creatives.containersV2.Create.authorInductiveText',
160
159
  defaultMessage: "Brand/name that your customer will recognise",
161
160
  },
162
161
  'Resolution 360 x 200': {
163
- id: `${scope}.resolutionText`,
162
+ id: 'creatives.containersV2.Create.resolutionText',
164
163
  defaultMessage: 'Resolution 360 x 200',
165
164
  },
166
165
  'The relevant image that complements title.': {
167
- id: `${scope}.coverImageTitle`,
166
+ id: 'creatives.containersV2.Create.coverImageTitle',
168
167
  defaultMessage: 'The relevant image that complements title.',
169
168
  },
170
169
  'Upload Image': {
171
- id: `${scope}.uploadImage`,
170
+ id: 'creatives.containersV2.Create.uploadImage',
172
171
  defaultMessage: 'Upload Image',
173
172
  },
174
173
  'A short description help customers learn more': {
175
- id: `${scope}.coverAbstractInductive`,
174
+ id: 'creatives.containersV2.Create.coverAbstractInductive',
176
175
  defaultMessage: 'A short description help customers learn more',
177
176
  },
178
177
  'Article content': {
179
- id: `${scope}.articleContent`,
178
+ id: 'creatives.containersV2.Create.articleContent',
180
179
  defaultMessage: 'Article content',
181
180
  },
182
181
  'Insert Image': {
183
- id: `${scope}.insertImage`,
182
+ id: 'creatives.containersV2.Create.insertImage',
184
183
  defaultMessage: 'Insert Image',
185
184
  },
186
185
  'Read more link': {
187
- id: `${scope}.readMoreLink`,
186
+ id: 'creatives.containersV2.Create.readMoreLink',
188
187
  defaultMessage: 'Read more link',
189
188
  },
190
189
  'Link to help customers discover more about the brand.': {
191
- id: `${scope}.linkInductiveText`,
190
+ id: 'creatives.containersV2.Create.linkInductiveText',
192
191
  defaultMessage: 'Link to help customers discover more about the brand.',
193
192
  },
194
- 'somethingWentWrong': {
195
- id: `${scope}.somethingWentWrong`,
196
- defaultMessage: 'Something went wrong!!',
197
- },
198
- 'Template with the same name exists. Please try another template name.': {
199
- id: `${scope}.templateNameExists`,
200
- defaultMessage: 'Template with the same name exists. Please try another template name.',
201
- },
202
- 'Template name already exists': {
203
- id: 'creatives.containersV2.richMedia.create.templateNameAlreadyExists',
204
- defaultMessage: 'Template name already exists',
205
- },
206
- 'Template name cannot be blank!': {
207
- id: `${scope}.templateNameBlank`,
208
- defaultMessage: 'Template name cannot be blank',
209
- },
210
- 'Template name contains only whitespaces': {
211
- id: `${scope}.templateNameContainsWS`,
212
- defaultMessage: 'Template name contains only whitespaces',
213
- },
214
- 'Please provide payload to the wechat template': {
215
- id: `${scope}.payloadMissing`,
216
- defaultMessage: 'Please provide payload to create wechat template',
217
- },
218
- 'Please provide source account identifier': {
219
- id: `${scope}.sourceIdentMissing`,
220
- defaultMessage: 'Please provide source account identifier',
221
- },
222
- 'Please provide sufficient parameters to generate richmedia message payload': {
223
- id: `${scope}.sufficientPayload`,
224
- defaultMessage: 'Please provide sufficient parameters to generate richmedia message payload',
225
- },
226
- 'Please provide sufficient params to create richmedia wechat template': {
227
- id: `${scope}.sufficientParam`,
228
- defaultMessage: 'Please provide sufficient params to create richmedia wechat template',
229
- },
230
- 'Upload has failed': {
231
- id: `${scope}.uploadFailed`,
232
- defaultMessage: 'Upload has failed',
233
- },
234
- 'Template with the same name exists': {
235
- id: `${scope}.sameTemplateExists`,
236
- defaultMessage: 'Template with the same name exists',
237
- },
238
- 'Failed to get File content': {
239
- id: `${scope}.fileContentFailed`,
240
- defaultMessage: 'Failed to get File content',
241
- },
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
193
  });
@@ -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
  }