@capillarytech/creatives-library 3.4.3 → 3.4.5

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.
@@ -21,7 +21,6 @@ import messages from './messages';
21
21
  import * as actions from './actions';
22
22
  import Templates from '../Templates';
23
23
  import CallTask from '../CallTask';
24
- import Facebook from '../Facebook';
25
24
  import Gallery from '../Assets/Gallery';
26
25
  import withStyles from '../../hoc/withStyles';
27
26
  import styles, { CapTabStyle } from './TemplatesV2.style';
@@ -34,44 +33,32 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
34
33
  constructor(props) {
35
34
  super(props);
36
35
  let defaultChannel = get(this, 'props.channel') || get(this, 'props.params.channel') || 'sms';
37
- const {
38
- intl,
39
- channelsToHide = [],
40
- channelsToDisable = [],
41
- isFullMode,
42
- onChannelChange,
43
- } = props;
44
-
45
36
  const defaultPanes = {
46
- sms: {content: <div></div>, tab: intl.formatMessage(messages.sms), key: 'sms'},
47
- email: {content: <div></div>, tab: intl.formatMessage(messages.email), key: 'email'},
48
- weChat: {content: <div></div>, tab: intl.formatMessage(messages.wechat), key: 'wechat'},
37
+ sms: {content: <div></div>, tab: props.intl.formatMessage(messages.sms), key: 'sms'},
38
+ email: {content: <div></div>, tab: props.intl.formatMessage(messages.email), key: 'email'},
39
+ weChat: {content: <div></div>, tab: props.intl.formatMessage(messages.wechat), key: 'wechat'},
49
40
  //'wechat': {content: this.getTemplatesComponent('wechat'), tab: 'Wechat', key: 'wechat'},
50
- mPush: {content: <div></div>, tab: intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
41
+ mPush: {content: <div></div>, tab: props.intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
51
42
  };
43
+ const channelsToHide = this.props.channelsToHide || [];
44
+ const channelsToDisable = this.props.channelsToDisable || [];
52
45
  let filteredPanes = Object.keys(defaultPanes)
53
46
  .filter((key) => !channelsToHide.includes(key)).reduce((obj = [], key) => {
54
47
  obj.push(defaultPanes[key]);
55
48
  return obj;
56
49
  }, []);
57
50
 
58
- if (isFullMode ) {
59
- filteredPanes.push({content: <div></div>, tab: intl.formatMessage(messages.gallery), key: 'assets'});
60
- } else {
61
- if (!channelsToHide.includes('callTask')) {
62
- filteredPanes.push({content: <div></div>, tab: intl.formatMessage(messages.callTask), key: 'call_task'});
63
- }
64
- if (!channelsToHide.includes('facebook')) {
65
- filteredPanes.push({content: <div></div>, tab: intl.formatMessage(messages.facebook), key: 'facebook'});
66
- }
51
+ if (props.isFullMode ) {
52
+ filteredPanes.push({content: <div></div>, tab: props.intl.formatMessage(messages.gallery), key: 'assets'});
53
+ } else if (!channelsToHide.includes('callTask')) {
54
+ filteredPanes.push({content: <div></div>, tab: props.intl.formatMessage(messages.callTask), key: 'call_task'});
67
55
  }
68
56
 
69
57
  filteredPanes = filteredPanes.map( (pane) => {
70
58
  if (channelsToDisable.includes(pane.key)) {
71
- // eslint-disable-next-line no-param-reassign
72
59
  pane.disabled = true;
73
60
  }
74
- return pane;
61
+ return pane;
75
62
  });
76
63
 
77
64
  const channel = ['sms', 'email', 'mobilepush', 'call_task'];
@@ -91,9 +78,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
91
78
  selectedChannel: defaultChannel,
92
79
  panes,
93
80
  };
94
- if (!isFullMode) {
95
- onChannelChange(defaultChannel);
96
- }
81
+ !props.isFullMode && this.props.onChannelChange(defaultChannel);
97
82
  }
98
83
  componentWillReceiveProps(nextProps) {
99
84
  if (this.props.channel !== nextProps.channel) {
@@ -137,17 +122,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
137
122
  />
138
123
  );
139
124
 
140
- getFacebookComponent = () => {
141
- const { messageDetails, cap, onFacebookSubmit } = this.props;
142
- return (
143
- <Facebook
144
- messageDetails={messageDetails}
145
- cap={cap}
146
- onFacebookSubmit={onFacebookSubmit}
147
- />
148
- );
149
- }
150
-
151
125
  getTemplatesComponent(channel) {
152
126
  // const templates = this.props.Templates[`${channel}Templates`];
153
127
  let query = {};
@@ -160,8 +134,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
160
134
  return this.getCallTaskComponent();
161
135
  case 'assets':
162
136
  return this.getGalleryComponent(location);
163
- case 'facebook':
164
- return this.getFacebookComponent();
165
137
  default:
166
138
  return (<Templates
167
139
  key={channel}
@@ -210,16 +182,16 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
210
182
  { name: 'description', content: this.props.intl.formatMessage(messages.creativesDesc) },
211
183
  ]}
212
184
  />}
213
- <div className="component-wrapper">
214
- {isFullMode && <CapHeader title={<FormattedMessage {...messages.creatives}/>} description={<FormattedMessage {...messages.creativesDesc}/>}/>}
215
- <StyledCapTab
216
- panes={this.state.panes}
217
- onChange={this.channelChange}
218
- activeKey={this.state.selectedChannel}
219
- defaultActiveKey={this.state.selectedChannel}
220
- isFullMode={isFullMode}
221
- />
222
- </div>
185
+ <div className="component-wrapper">
186
+ {isFullMode && <CapHeader title={<FormattedMessage {...messages.creatives}/>} description={<FormattedMessage {...messages.creativesDesc}/>}/>}
187
+ <StyledCapTab
188
+ panes={this.state.panes}
189
+ onChange={this.channelChange}
190
+ activeKey={this.state.selectedChannel}
191
+ defaultActiveKey={this.state.selectedChannel}
192
+ isFullMode={isFullMode}
193
+ />
194
+ </div>
223
195
  </div>
224
196
 
225
197
  );
@@ -241,9 +213,6 @@ TemplatesV2.propTypes = {
241
213
  channelsToHide: PropTypes.array,
242
214
  className: PropTypes.string.isRequired,
243
215
  channelsToDisable: PropTypes.array,
244
- onFacebookSubmit: PropTypes.func,
245
- messageDetails: PropTypes.object,
246
- cap: PropTypes.object,
247
216
  };
248
217
 
249
218
  TemplatesV2.defaultProps = {
@@ -42,10 +42,6 @@ export default defineMessages({
42
42
  id: 'creatives.containersV2.TemplatesV2.callTask',
43
43
  defaultMessage: 'Call Task',
44
44
  },
45
- facebook: {
46
- id: 'creatives.containersV2.TemplatesV2.facebook',
47
- defaultMessage: 'Facebook',
48
- },
49
45
  gallery: {
50
46
  id: 'creatives.containersV2.TemplatesV2.gallery',
51
47
  defaultMessage: 'Gallery',
@@ -1,73 +0,0 @@
1
- import { css } from 'styled-components';
2
- import {
3
- CAP_SPACE_16,
4
- CAP_PRIMARY,
5
- CAP_G06,
6
- } from '@capillarytech/cap-ui-library/styled/variables';
7
-
8
- export default css`
9
- .ant-radio-group.cap-radioCard-v2 {
10
- .ant-radio-button-wrapper {
11
- margin-left: 0;
12
- margin-right: 0;
13
- }
14
-
15
- .icon-container {
16
- background-color: transparent;
17
-
18
- .anticon {
19
- color: ${CAP_G06};
20
- }
21
-
22
- &.green-color {
23
- background-color: transparent;
24
-
25
- .anticon {
26
- color: ${CAP_PRIMARY.base};
27
- }
28
- }
29
- }
30
- }
31
-
32
- .radio-group-heading {
33
- margin-top: ${CAP_SPACE_16};
34
- }
35
-
36
- .submit-button-section {
37
- margin-top: ${CAP_SPACE_16};
38
- }
39
-
40
- .ant-radio-button-wrapper-checked {
41
- &:not(.ant-radio-button-wrapper-disabled) {
42
- box-shadow: none;
43
- }
44
- }
45
-
46
- .ant-radio-group.cap-radioCard-v2 {
47
- .ant-radio-button-wrapper-checked .radio-card-checked {
48
- display: none;
49
- }
50
- }
51
-
52
- .non-selected-radio-group {
53
- .ant-radio-button-wrapper {
54
- &:last-child {
55
- display: none;
56
- }
57
- }
58
- }
59
-
60
- .selected-radio-group {
61
- .ant-radio-button-wrapper-checked {
62
- &:not(.ant-radio-button-wrapper-disabled) {
63
- box-shadow: -1px 0 0 0 ${CAP_PRIMARY.base};
64
- }
65
- }
66
-
67
- .ant-radio-group.cap-radioCard-v2 {
68
- .ant-radio-button-wrapper-checked .radio-card-checked {
69
- display: block;
70
- }
71
- }
72
- }
73
- `;
@@ -1,107 +0,0 @@
1
- import React, { useEffect, useState } from "react";
2
- import PropTypes from 'prop-types';
3
- import { injectIntl, FormattedMessage } from "react-intl";
4
- import {
5
- CapHeading,
6
- CapRadioCard,
7
- CapLabel,
8
- CapButton,
9
- CapSpin,
10
- } from '@capillarytech/cap-ui-library';
11
- import messages from './messages';
12
- import styles from './MarketingObjective.style';
13
- import withStyles from '../../hoc/withStyles';
14
-
15
- const renderMarketingObjectiveList = ({
16
- onMarketingObjectiveChange,
17
- marketingObjectiveSelectedOption,
18
- defaultmarketingObjective,
19
- marketingObjectiveList = [],
20
- }) => {
21
- const marketingList = (marketingObjective) => {
22
- const { label, panes = [] } = marketingObjective;
23
- const selectedPaneExists = panes.some((item) => item.value === marketingObjectiveSelectedOption);
24
- const modifiedPanes = !selectedPaneExists
25
- ? [...panes, {
26
- value: marketingObjectiveSelectedOption,
27
- }]
28
- : panes;
29
- return (
30
- <div key={label} className={selectedPaneExists ? 'selected-radio-group' : 'non-selected-radio-group'}>
31
- <CapHeading type="h4" className="radio-group-heading">{label}</CapHeading>
32
- <CapRadioCard
33
- onChange={({ target: { value } }) => onMarketingObjectiveChange(value)}
34
- panes={modifiedPanes}
35
- cardWidth="324px"
36
- cardHeight="auto"
37
- selected={marketingObjectiveSelectedOption}
38
- defaultValue={defaultmarketingObjective}
39
- />
40
- </div>
41
- );
42
- };
43
-
44
- return marketingObjectiveList.map((marketinObjective) => marketingList(marketinObjective));
45
- };
46
-
47
- const MarketingObjective = ({
48
- onMarketingObjectiveSelect,
49
- selectedMarketingObjective,
50
- defaultmarketingObjective,
51
- onSubmit,
52
- className,
53
- marketingObjectiveList,
54
- }) => {
55
- const [marketingObjectiveSelectedOption, onMarketingObjectiveChange] = useState(selectedMarketingObjective || defaultmarketingObjective);
56
-
57
- useEffect(() => {
58
- [...document.querySelectorAll('.non-selected-radio-group .ant-radio-group')].forEach((node) => {
59
- const paneToSelect = node.lastChild;
60
- paneToSelect.click();
61
- });
62
- }, [marketingObjectiveSelectedOption]);
63
-
64
- const onSubmitAction = () => {
65
- onMarketingObjectiveSelect(marketingObjectiveSelectedOption);
66
- onSubmit(false);
67
- };
68
-
69
- return (
70
- <div className={className}>
71
- <>
72
- <CapHeading type="h3">
73
- <FormattedMessage {...messages.fbMarketingObjectiveTitle} />
74
- </CapHeading>
75
- <CapLabel type="label1">
76
- <FormattedMessage {...messages.fbMarketingObjectiveDescription} />
77
- </CapLabel>
78
- </>
79
- <CapSpin spinning={!marketingObjectiveList.length}>
80
- {renderMarketingObjectiveList({
81
- onMarketingObjectiveChange,
82
- marketingObjectiveSelectedOption,
83
- defaultmarketingObjective,
84
- marketingObjectiveList,
85
- })}
86
- </CapSpin>
87
- <CapButton
88
- type="primary"
89
- className="submit-button-section"
90
- onClick={() => onSubmitAction(false)}
91
- >
92
- <FormattedMessage {...messages.fbMarketingObjectiveDone} />
93
- </CapButton>
94
- </div>
95
- );
96
- };
97
-
98
- MarketingObjective.propTypes = {
99
- onMarketingObjectiveSelect: PropTypes.func,
100
- selectedMarketingObjective: PropTypes.string,
101
- defaultmarketingObjective: PropTypes.string,
102
- onSubmit: PropTypes.func,
103
- className: PropTypes.string,
104
- marketingObjectiveList: PropTypes.arrayOf(PropTypes.object),
105
- };
106
-
107
- export default injectIntl(withStyles(MarketingObjective, styles));
@@ -1,23 +0,0 @@
1
- /*
2
- * Marketing Objective Messages
3
- *
4
- * This contains all the text for the Facebook component.
5
- */
6
- import { defineMessages } from 'react-intl';
7
-
8
- const messagePrefix = 'creatives.containersV2.FacebookMarketingObjective';
9
-
10
- export default defineMessages({
11
- fbMarketingObjectiveTitle: {
12
- id: `${messagePrefix}.fbMarketingObjectiveTitle`,
13
- defaultMessage: 'Facebook Marketing Objective',
14
- },
15
- fbMarketingObjectiveDescription: {
16
- id: `${messagePrefix}.fbMarketingObjectiveDescription`,
17
- defaultMessage: 'Objectives help break reporting into a more granular level',
18
- },
19
- fbMarketingObjectiveDone: {
20
- id: `${messagePrefix}.fbMarketingObjectiveDone`,
21
- defaultMessage: 'Done',
22
- },
23
- });
@@ -1,75 +0,0 @@
1
- import { css } from 'styled-components';
2
- import {
3
- CAP_SPACE_44,
4
- CAP_SPACE_28,
5
- CAP_SPACE_20,
6
- CAP_SPACE_12,
7
- CAP_SPACE_08,
8
- CAP_G07,
9
- CAP_G12,
10
- CAP_G06,
11
- FONT_COLOR_05,
12
- } from '@capillarytech/cap-ui-library/styled/variables';
13
-
14
- export default css`
15
- margin-left: ${CAP_SPACE_44};
16
-
17
- .is-scrollable-section {
18
- height: calc(100vh - 220px);
19
- overflow-y: auto;
20
- }
21
-
22
- .account-details-wrapper {
23
- border-bottom: 1px solid ${CAP_G12};
24
- margin-bottom: ${CAP_SPACE_20};
25
- }
26
-
27
- .account-name-section {
28
- margin-bottom: ${CAP_SPACE_28};
29
- }
30
-
31
- .account-section-container {
32
- margin-bottom: ${CAP_SPACE_20};
33
- max-width: 564px;
34
- }
35
-
36
- .ad-section {
37
- margin-bottom: ${CAP_SPACE_44};
38
- }
39
-
40
- .dynamic-content-section {
41
- max-width: 140px;
42
-
43
- .facebook-dynamic-content {
44
- color: ${CAP_G06};
45
- }
46
- }
47
-
48
- .parameter-list {
49
- padding: ${CAP_SPACE_08} ${CAP_SPACE_28};
50
-
51
- .parameter-list-item {
52
- list-style: none;
53
- margin-bottom: ${CAP_SPACE_28};
54
-
55
- .parameter-index {
56
- float: left;
57
- margin-right: ${CAP_SPACE_12};
58
- background: ${CAP_G07};
59
- padding: 6px 10px;
60
- border-radius: 50%;
61
- }
62
- }
63
- }
64
-
65
- .cap-button-v2 {
66
- &.marketingObjective-change-button {
67
- color: ${FONT_COLOR_05};
68
- height: ${CAP_SPACE_20};
69
- }
70
- }
71
- `;
72
-
73
- export const CampaignDetailCapColumn = css`
74
- margin-bottom: ${CAP_SPACE_20};
75
- `;
@@ -1,13 +0,0 @@
1
- /*
2
- *
3
- * Facebook actions
4
- *
5
- */
6
-
7
- import {
8
- GET_MARKETING_OBJECTIVES,
9
- } from './constants';
10
-
11
- export const getMarketingObjectives = () => ({
12
- type: GET_MARKETING_OBJECTIVES,
13
- });
@@ -1,25 +0,0 @@
1
- /*
2
- *
3
- * Facebook constants
4
- *
5
- */
6
-
7
- const prefix = 'app/Facebook';
8
-
9
- export const GET_MARKETING_OBJECTIVES = `${prefix}/GET_MARKETING_OBJECTIVES`;
10
- export const SET_MARKETING_OBJECTIVES_SUCCESS = `${prefix}/SET_MARKETING_OBJECTIVES_SUCCESS`;
11
- export const SET_MARKETING_OBJECTIVES_FAILURE = `${prefix}/SET_MARKETING_OBJECTIVES_FAILURE`;
12
-
13
- // marketing objectives constants
14
-
15
- export const VALUE_APP_INSTALLS = 'VALUE_APP_INSTALLS';
16
- export const VALUE_BRAND_AWARENESS = 'VALUE_BRAND_AWARENESS';
17
- export const VALUE_CONVERSIONS = 'VALUE_CONVERSIONS';
18
- export const VALUE_LEAD_GENERATION = 'VALUE_LEAD_GENERATION';
19
- export const VALUE_LOCAL_AWARENESS = 'VALUE_LOCAL_AWARENESS';
20
- export const VALUE_MESSAGES = 'VALUE_MESSAGES';
21
- export const VALUE_PRODUCT_CATALOG_SALES = 'VALUE_PRODUCT_CATALOG_SALES';
22
- export const VALUE_REACH = 'VALUE_REACH';
23
- export const VALUE_VIDEO_VIEWS = 'VALUE_VIDEO_VIEWS';
24
- export const VALUE_LINK_CLICKS = 'VALUE_LINK_CLICKS';
25
- export const VALUE_POST_ENGAGEMENT = 'VALUE_POST_ENGAGEMENT';