@capillarytech/creatives-library 3.0.5 → 3.0.7

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 (73) hide show
  1. package/components/FormBuilder/index.js +15 -15
  2. package/containers/Dashboard/index.js +5 -0
  3. package/containers/Email/index.js +5 -4
  4. package/containers/Line/Create/index.js +3 -3
  5. package/containers/MobilePush/Edit/index.js +2 -2
  6. package/containers/WeChat/MapTemplates/index.js +64 -58
  7. package/containers/WeChat/RichmediaTemplates/Create/index.js +3 -3
  8. package/index.html +3 -0
  9. package/package.json +1 -1
  10. package/routes.js +1 -3
  11. package/v2Components/FormBuilder/index.js +12 -18
  12. package/v2Components/NavigationBar/index.js +7 -4
  13. package/v2Components/NavigationBar/messages.js +6 -2
  14. package/v2Containers/Cap/index.js +2 -1
  15. package/v2Containers/CreativesContainer/SlideBoxContent.js +9 -2
  16. package/v2Containers/CreativesContainer/index.js +4 -1
  17. package/v2Containers/Email/index.js +27 -42
  18. package/v2Containers/Email/initialSchema.js +2 -58
  19. package/v2Containers/Email/messages.js +4 -0
  20. package/v2Containers/Email/sagas.js +0 -2
  21. package/v2Containers/MobilePush/Create/actions.js +2 -2
  22. package/v2Containers/MobilePush/Create/index.js +17 -16
  23. package/v2Containers/MobilePush/Create/messages.js +1 -1
  24. package/v2Containers/MobilePush/Create/sagas.js +3 -0
  25. package/v2Containers/MobilePush/Edit/index.js +13 -7
  26. package/v2Containers/MobilePush/initialSchema.js +3 -0
  27. package/v2Containers/MobilepushWrapper/index.js +3 -1
  28. package/v2Containers/Templates/index.js +14 -11
  29. package/v2Containers/TemplatesV2/index.js +21 -12
  30. package/assets/android-message-gui-2.svg +0 -55
  31. package/components/CallTaskPreview/_callTaskPreview.scss +0 -17
  32. package/components/CallTaskPreview/images/Footer.png +0 -0
  33. package/components/CallTaskPreview/images/Header.png +0 -0
  34. package/components/CallTaskPreview/index.js +0 -37
  35. package/components/CallTaskPreview/messages.js +0 -13
  36. package/components/CallTaskPreview/tests/index.test.js +0 -15
  37. package/components/CmsTemplatesComponent/index.js +0 -33
  38. package/components/CmsTemplatesComponent/messages.js +0 -17
  39. package/components/CmsTemplatesComponent/tests/index.test.js +0 -10
  40. package/components/EmailMobilePreview/index.js +0 -129
  41. package/components/EmailMobilePreview/index.scss +0 -55
  42. package/components/EmailPreviewV2/_emailPreviewV2.scss +0 -69
  43. package/components/EmailPreviewV2/index.js +0 -132
  44. package/components/EmailPreviewV2/messages.js +0 -41
  45. package/components/EmailPreviewV2/tests/index.test.js +0 -10
  46. package/components/MobilePushPreviewV2/index.js +0 -120
  47. package/components/MobilePushPreviewV2/messages.js +0 -13
  48. package/components/MobilePushPreviewV2/tests/index.test.js +0 -10
  49. package/components/NewCallTask/_newCallTask.scss +0 -9
  50. package/components/NewCallTask/index.js +0 -152
  51. package/components/NewCallTask/messages.js +0 -29
  52. package/components/NewCallTask/tests/index.test.js +0 -10
  53. package/components/SmsPreviewV2/_smsPreviewV2.scss +0 -353
  54. package/components/SmsPreviewV2/index.js +0 -69
  55. package/components/SmsPreviewV2/messages.js +0 -13
  56. package/components/SmsPreviewV2/tests/index.test.js +0 -10
  57. package/v2Components/DateFilter/index.js +0 -349
  58. package/v2Components/DateFilter/messages.js +0 -17
  59. package/v2Components/DateFilter/tests/index.test.js +0 -15
  60. package/v2Components/DateRange/index.js +0 -113
  61. package/v2Components/DateRange/messages.js +0 -13
  62. package/v2Components/DateRange/tests/index.test.js +0 -10
  63. package/v2Components/PageHeader/_pageHeader.scss +0 -22
  64. package/v2Components/PageHeader/index.js +0 -37
  65. package/v2Components/PageHeader/messages.js +0 -13
  66. package/v2Components/PageHeader/tests/index.test.js +0 -10
  67. package/v2Components/Sidebar/_sidebar.scss +0 -115
  68. package/v2Components/Sidebar/index.js +0 -208
  69. package/v2Components/Sidebar/messages.js +0 -21
  70. package/v2Components/Sidebar/tests/index.test.js +0 -10
  71. package/v2Components/SmsEditor/index.js +0 -55
  72. package/v2Components/SmsEditor/tests/index.test.js +0 -10
  73. package/v2Components/TopBar/_topbar.scss +0 -46
@@ -1,41 +0,0 @@
1
- /*
2
- * EmailPreviewV2 Messages
3
- *
4
- * This contains all the text for the EmailPreviewV2 component.
5
- */
6
- import { defineMessages } from 'react-intl';
7
-
8
- export default defineMessages({
9
- header: {
10
- id: 'app.components.EmailPreviewV2.header',
11
- defaultMessage: 'This is the EmailPreviewV2 component !',
12
- },
13
- desktop: {
14
- id: 'app.components.EmailPreviewV2.desktop',
15
- defaultMessage: 'Desktop',
16
- },
17
- tablet: {
18
- id: 'app.components.EmailPreviewV2.tablet',
19
- defaultMessage: 'Tablet',
20
- },
21
- mobile: {
22
- id: 'app.components.EmailPreviewV2.mobile',
23
- defaultMessage: 'Mobile',
24
- },
25
- noIframeSupport: {
26
- id: 'app.components.EmailPreviewV2.noIframeSupport',
27
- defaultMessage: 'Your browser does not support iframes.',
28
- },
29
- showAllDevices: {
30
- id: 'app.components.EmailPreviewV2.showAllDevices',
31
- defaultMessage: 'Show all devices',
32
- },
33
- lastModified: {
34
- id: 'app.components.PreviewSideBar.lastModified',
35
- defaultMessage: 'Last Modified On',
36
- },
37
- uploadedBy: {
38
- id: 'app.components.PreviewSideBar.uploadedBy',
39
- defaultMessage: 'Last Modified By',
40
- },
41
- });
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import EmailPreviewV2 from '../index';
4
-
5
- describe('<EmailPreviewV2 />', () => {
6
- it('<EmailPreviewV2 /> without the templateData', () => {
7
- const compoent = shallow(<EmailPreviewV2 templateData={{_id: 'test'}}/>);
8
- expect(compoent).toMatchSnapshot();
9
- });
10
- });
@@ -1,120 +0,0 @@
1
- /**
2
- *
3
- * PreviewSideBar
4
- *
5
- */
6
-
7
- import PropTypes from 'prop-types';
8
-
9
- import React from 'react';
10
- import { CapButton } from '@capillarytech/cap-ui-library';
11
- // import styled from 'styled-components';
12
-
13
- import { FormattedMessage } from 'react-intl';
14
- import { Button } from 'antd';
15
- import { get, map, isEmpty} from 'lodash';
16
- import TemplatePreview from '../TemplatePreview';
17
- import '../PreviewSideBar/_previewsidebar.scss';
18
- import messages from './messages';
19
- const ButtonGroup = Button.Group;
20
-
21
- class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
22
- constructor(props) {
23
- super(props);
24
- this.goToEdit = this.goToEdit.bind(this);
25
- this.goToDuplicate = this.goToDuplicate.bind(this);
26
- this.changeDevice = this.changeDevice.bind(this);
27
- const hasAndroid = get(props, 'templateData.versions.base.ANDROID') || get(props, 'templateData.androidContent');
28
- const hasIos = get(props, 'templateData.versions.base.IOS') || get(props, 'templateData.iosContent');
29
- let device = "android";
30
- if (hasAndroid) {
31
- device = 'android';
32
- } else if (hasIos) {
33
- device = 'ios';
34
- }
35
- this.state = {
36
- device,
37
- content: this.setContent(props.templateData, device),
38
- };
39
- }
40
-
41
- setContent = (templateData, device) => {
42
- const androidContent = get(templateData, 'versions.base.ANDROID') || get(templateData, 'androidContent');
43
- const iosContent = get(templateData, 'versions.base.IOS') || get(templateData, 'iosContent');
44
-
45
- const data = device === "android" ? androidContent : iosContent;
46
- const content = {
47
- header: data.title,
48
- bodyText: data.message,
49
- bodyImage: data.expandableDetails && data.expandableDetails.image,
50
- actions: [],
51
- appName: templateData.appName,
52
- };
53
- if (data.expandableDetails && data.expandableDetails.ctas && data.expandableDetails.ctas.length) {
54
- if (device === "android" ) {
55
- content.actions = map(data.expandableDetails.ctas, (cta) => ({label: cta.actionText}));
56
- } else {
57
- content.actions = [{label: data.expandableDetails.ctas[0].actionLabel}, {label: data.expandableDetails.ctas[0].actionLabel2}];
58
- }
59
- }
60
- return content;
61
- }
62
- goToDuplicate() {
63
- this.props.onDuplicateClick(this.props.templateData);
64
- this.props.handleClose();
65
- }
66
- changeDevice(ev) {
67
- const device = ev.target.value;
68
- const content = this.setContent(this.props.templateData, device);
69
- this.setState({device, content });
70
- }
71
- goToEdit(e, path) {
72
- this.props.onEditClick(e, this.props.templateData._id, this.props.templateData.modeType, path);
73
- }
74
- render() {
75
- const {templateData, channel} = this.props;
76
-
77
- const hasAndroid = get(templateData, 'versions.base.ANDROID') || get(templateData, 'androidContent');
78
- const hasIos = get(templateData, 'versions.base.IOS') || get(templateData, 'iosContent');
79
-
80
- const {device, content} = this.state;
81
-
82
- return (
83
-
84
- <div>
85
- <div className="devices">
86
- {!isEmpty(templateData) && hasAndroid && hasIos &&
87
- <ButtonGroup onClick={this.changeDevice}>
88
- <CapButton type={device === "android" ? "primary" : "secondary"} value={"android"}>Android</CapButton>
89
- <CapButton type={device === "iphone" ? "primary" : "secondary"} value={"iphone"}>IOS</CapButton>
90
- </ButtonGroup>}
91
- </div>
92
- <TemplatePreview
93
- device={device === "android" ? "android" : "iphone"}
94
- channel={channel}
95
- content={content || ''}
96
- templateData={templateData}
97
- >
98
- </TemplatePreview>
99
-
100
-
101
- </div>
102
-
103
-
104
- );
105
- }
106
-
107
- }
108
-
109
- MobilePushPreviewV2.propTypes = {
110
- templateData: PropTypes.object.isRequired,
111
- channel: PropTypes.string.isRequired,
112
- showPreview: PropTypes.bool,
113
- handleClose: PropTypes.func,
114
- onEditClick: PropTypes.func,
115
- onDuplicateClick: PropTypes.func,
116
- location: PropTypes.object,
117
- embedded: PropTypes.bool,
118
- };
119
-
120
- export default MobilePushPreviewV2;
@@ -1,13 +0,0 @@
1
- /*
2
- * MobilePushPreviewV2 Messages
3
- *
4
- * This contains all the text for the MobilePushPreviewV2 component.
5
- */
6
- import { defineMessages } from 'react-intl';
7
-
8
- export default defineMessages({
9
- header: {
10
- id: 'app.components.MobilePushPreviewV2.header',
11
- defaultMessage: 'This is the MobilePushPreviewV2 component !',
12
- },
13
- });
@@ -1,10 +0,0 @@
1
- // import React from 'react';
2
- // import { shallow } from 'enzyme';
3
-
4
- // import MobilePushPreviewV2 from '../index';
5
-
6
- describe('<MobilePushPreviewV2 />', () => {
7
- it('Expect to have unit tests specified', () => {
8
- expect(true).toEqual(false);
9
- });
10
- });
@@ -1,9 +0,0 @@
1
- .new-call-task-done-button {
2
- margin-top: 24px;
3
- }
4
-
5
- .new-call-task-tagList {
6
- position: absolute;
7
- right: 0;
8
- top: -10px;
9
- }
@@ -1,152 +0,0 @@
1
- /**
2
- *
3
- * NewCallTask
4
- *
5
- */
6
-
7
- import React from 'react';
8
- import PropTypes from 'prop-types';
9
- import { CapRow, CapColumn, CapInput, CapButton, CapSpin } from '@capillarytech/cap-ui-library';
10
- import { injectIntl, intlShape } from 'react-intl';
11
- import TagList from '../../containers/TagList';
12
- import CallTaskPreview from '../CallTaskPreview';
13
- import messages from './messages';
14
- import './_newCallTask.scss';
15
-
16
- class NewCallTask extends React.Component { // eslint-disable-line react/prefer-stateless-function
17
- constructor(props) {
18
- super(props);
19
- this.state = this.getInitialState();
20
- }
21
-
22
- getInitialState = () => {
23
- const { templateData } = this.props;
24
- return {
25
- subject: templateData && templateData.subject ? templateData.subject : '',
26
- messageBody: templateData && templateData.messageBody ? templateData.messageBody : '',
27
- description: templateData && templateData.description ? templateData.description : '',
28
- };
29
- }
30
-
31
- onTagSelect = (data) => {
32
- this.insertAtCursor(`{{${data}}}`);
33
- }
34
-
35
- setInputRef = (textarea) => {
36
- this.textArea = textarea;
37
- }
38
-
39
- insertAtCursor = (myValue) => {
40
- this.textArea.focus();
41
- const textAreaRef = this.textArea.textAreaRef;
42
- let pos = textAreaRef.selectionEnd + myValue.length;
43
- //IE support
44
- let newMessage = textAreaRef.value + myValue;
45
- if (document.selection) {
46
- this.textArea.focus();
47
- const sel = document.selection.createRange();
48
- sel.text = myValue;
49
- } else if (textAreaRef.selectionStart || textAreaRef.selectionStart === '0') { //MOZILLA and others
50
- const startPos = textAreaRef.selectionStart;
51
- const endPos = textAreaRef.selectionEnd;
52
- newMessage = textAreaRef.value.substring(0, startPos) + myValue + textAreaRef.value.substring(endPos, textAreaRef.value.length);
53
- pos = startPos + myValue.length;
54
- }
55
- this.setState({
56
- messageBody: newMessage,
57
- }, () => {
58
- textAreaRef.selectionStart = pos;
59
- textAreaRef.selectionEnd = pos;
60
- });
61
- };
62
-
63
- updateSubject = (e) => {
64
- this.setState({
65
- subject: e.target.value,
66
- });
67
- }
68
-
69
- updateMessageBody = (e) => {
70
- this.setState({
71
- messageBody: e.target.value,
72
- });
73
- }
74
-
75
- updateDescription = (e) => {
76
- this.setState({
77
- description: e.target.value,
78
- });
79
- }
80
-
81
- submitForm = () => {
82
- this.props.onCallTaskSubmit(this.state);
83
- }
84
-
85
- render() {
86
- const { intl, isLoading, metaEntities } = this.props;
87
- const { formatMessage } = intl;
88
- const { subject, messageBody, description } = this.state;
89
- const tags = metaEntities && metaEntities.tags ? metaEntities.tags.standard : [];
90
- return (
91
- <CapSpin spinning={isLoading}>
92
- <CapRow gutter={16}>
93
- <CapColumn span={12}>
94
- <div style={{ height: 'calc(100vh - 187px)', overflowY: 'auto', paddingRight: "8px" }}>
95
- <div style={{ marginBottom: '34px' }}>
96
- <CapInput
97
- label={formatMessage(messages.callTaskTitle)}
98
- onChange={this.updateSubject}
99
- value={subject}
100
- isRequired
101
- />
102
- </div>
103
- <div style={{ position: 'relative', marginBottom: '34px' }}>
104
- <TagList
105
- className="new-call-task-tagList"
106
- label={formatMessage(messages.personalisationTags)}
107
- tags={tags}
108
- onTagSelect={this.onTagSelect}
109
- />
110
- <CapInput.TextArea
111
- setInputRef={this.setInputRef}
112
- label={formatMessage(messages.messageHeader)}
113
- onChange={this.updateMessageBody}
114
- value={messageBody}
115
- isRequired
116
- />
117
- </div>
118
- <CapInput.TextArea
119
- label={formatMessage(messages.description)}
120
- onChange={this.updateDescription}
121
- value={description}
122
- isRequired
123
- />
124
- </div>
125
- <CapButton
126
- disabled={!subject || !messageBody || !description}
127
- className="new-call-task-done-button"
128
- onClick={this.submitForm}>
129
- {formatMessage(messages.done)}
130
- </CapButton>
131
- </CapColumn>
132
- <CapColumn span={12}>
133
- <CallTaskPreview
134
- subject={subject}
135
- messageBody={messageBody}
136
- />
137
- </CapColumn>
138
- </CapRow>
139
- </CapSpin>
140
- );
141
- }
142
- }
143
-
144
- NewCallTask.propTypes = {
145
- intl: intlShape.isRequired,
146
- onCallTaskSubmit: PropTypes.func,
147
- templateData: PropTypes.object,
148
- isLoading: PropTypes.bool,
149
- metaEntities: PropTypes.object,
150
- };
151
-
152
- export default injectIntl(NewCallTask);
@@ -1,29 +0,0 @@
1
- /*
2
- * NewCallTask Messages
3
- *
4
- * This contains all the text for the NewCallTask component.
5
- */
6
- import { defineMessages } from 'react-intl';
7
-
8
- export default defineMessages({
9
- callTaskTitle: {
10
- id: 'app.components.NewCallTask.callTaskTitle',
11
- defaultMessage: 'Call Task title',
12
- },
13
- messageHeader: {
14
- id: 'app.components.NewCallTask.messageHeader',
15
- defaultMessage: 'Message',
16
- },
17
- description: {
18
- id: 'app.components.NewCallTask.description',
19
- defaultMessage: 'Description',
20
- },
21
- done: {
22
- id: 'app.components.NewCallTask.done',
23
- defaultMessage: 'Done',
24
- },
25
- personalisationTags: {
26
- id: 'app.components.NewCallTask.personalisationTags',
27
- defaultMessage: 'Personalisation tags',
28
- },
29
- });
@@ -1,10 +0,0 @@
1
- // import React from 'react';
2
- // import { shallow } from 'enzyme';
3
-
4
- // import NewCallTask from '../index';
5
-
6
- describe('<NewCallTask />', () => {
7
- it('Expect to have unit tests specified', () => {
8
- expect(false).toEqual(false);
9
- });
10
- });