@capillarytech/creatives-library 3.1.40 → 3.1.42

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.
@@ -1344,7 +1344,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1344
1344
  className="search-text"
1345
1345
  style={{width: '210px'}}
1346
1346
  placeholder={this.props.intl.formatMessage(messages.searchText)}
1347
- prefix={<i className="material-icons" style={{ margin: '0', fontSize: '16px'}}>{this.props.intl.formatMessage(messages.search)}</i>}
1347
+ prefix={<i className="material-icons" style={{ margin: '0', fontSize: '16px'}}>search</i>}
1348
1348
  value={this.state.searchText}
1349
1349
  onChange={(e) => this.searchTemplate(e.target.value)}
1350
1350
  />
@@ -118,10 +118,6 @@ export default defineMessages({
118
118
  id: 'creatives.containers.Templates.useEditor',
119
119
  defaultMessage: "Use Editor",
120
120
  },
121
- "search": {
122
- id: 'creatives.containers.Templates.search',
123
- defaultMessage: "Search",
124
- },
125
121
  "blankTemplate": {
126
122
  id: 'creatives.containers.Templates.blankTemplate',
127
123
  defaultMessage: "Blank template",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "3.1.40",
4
+ "version": "3.1.42",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -88,7 +88,7 @@ export function updateCharCount(content, isUnicodeEnabled) {
88
88
  break;
89
89
  }
90
90
  }
91
- chars_used = showOptoutCount ? (chars_used + (((optoutUrl && optoutUrl.length) || 0) * noOfOptout) - (optoutTagLength * noOfOptout)) : chars_used;
91
+ chars_used = showOptoutCount && optoutUrl && optoutUrl.length ? (chars_used + (((optoutUrl && optoutUrl.length) || 0) * noOfOptout) - (optoutTagLength * noOfOptout)) : chars_used;
92
92
  if (coding == '7bit') {
93
93
  if (chars_used > 160) {
94
94
  var parts = Math.ceil(chars_used / 153);
@@ -230,6 +230,7 @@ function SlideBoxContent(props) {
230
230
  showTemplateName={showTemplateName}
231
231
  onValidationFail={onValidationFail}
232
232
  forwardedTags={forwardedTags}
233
+ selectedOfferDetails={selectedOfferDetails}
233
234
  />
234
235
  )}
235
236
  {(isEditEmailWithId || isEmailEditWithContent) && (
@@ -252,6 +253,7 @@ function SlideBoxContent(props) {
252
253
  showTemplateName={showTemplateName}
253
254
  onValidationFail={onValidationFail}
254
255
  forwardedTags={forwardedTags}
256
+ selectedOfferDetails={selectedOfferDetails}
255
257
  />
256
258
  )}
257
259
  {isEditMPush &&
@@ -467,6 +467,7 @@ class Creatives extends React.Component {
467
467
  const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
468
468
  const {isFullMode, creativesMode, cap, isUploading, channelsToHide, selectedWeChatAccount, forwardedTags, channelsToDisable, selectedOfferDetails} = this.props;
469
469
  const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
470
+ /* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
470
471
  return (
471
472
  <SlideBoxWrapper className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'} ${mapTemplateCreate ? 'map-template-create' : ''}`)}>
472
473
  <CapSlideBox
@@ -2562,6 +2562,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2562
2562
  const previewHeader = (<h3>Email Preview</h3>);
2563
2563
  const imagePreviewHeader = (<h3>Image Selection</h3>);
2564
2564
  const imagePreviewContent = this.getImagePreviewContent();
2565
+ const { selectedOfferDetails } = this.props;
2565
2566
  if (!this.props.currentOrgDetails || !this.props.currentOrgDetails.basic_details) {
2566
2567
  return (<div>Loading...</div>);
2567
2568
  }
@@ -2617,6 +2618,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2617
2618
  getValidationData={this.saveValidationData}
2618
2619
  saveForm={this.state.saveForm}
2619
2620
  stopValidation={this.stopValidation}
2621
+ selectedOfferDetails={selectedOfferDetails}
2620
2622
  /> : ''}
2621
2623
  </Col>
2622
2624
  </Row>
@@ -2669,6 +2671,7 @@ Email.propTypes = {
2669
2671
  defaultData: PropTypes.object,
2670
2672
  showTemplateName: PropTypes.func,
2671
2673
  onValidationFail: PropTypes.func,
2674
+ selectedOfferDetails: PropTypes.array,
2672
2675
  };
2673
2676
 
2674
2677
  const mapStateToProps = (state, props) => createStructuredSelector({
@@ -173,6 +173,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
173
173
  setIsLoadingContent,
174
174
  onValidationFail,
175
175
  forwardedTags,
176
+ selectedOfferDetails,
176
177
  } = this.props;
177
178
  const {
178
179
  templateName,
@@ -232,6 +233,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
232
233
  showTemplateName={showTemplateName}
233
234
  onValidationFail={onValidationFail}
234
235
  forwardedTags={forwardedTags}
236
+ selectedOfferDetails={selectedOfferDetails}
235
237
  />}
236
238
  {CmsTemplates && !isShowEmailCreate && <CmsTemplatesComponent cmsTemplates={CmsTemplates} handleEdmDefaultTemplateSelection={this.useEditor} />}
237
239
  </div>
@@ -263,6 +265,7 @@ EmailWrapper.propTypes = {
263
265
  showTemplateName: PropTypes.func,
264
266
  onValidationFail: PropTypes.func,
265
267
  forwardedTags: PropTypes.object,
268
+ selectedOfferDetails: PropTypes.array,
266
269
  };
267
270
 
268
271
  const mapStateToProps = createStructuredSelector({
@@ -141,15 +141,25 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
141
141
 
142
142
  transformCouponTags(offerDetails, allTags) {
143
143
  const couponTags = {};
144
+ const couponTagsKeys = Object.keys(_.get(allTags, 'coupon.subtags', []));
145
+ const withCouponId = (obj, id) => {
146
+ const tempObj = {};
147
+ if (obj.subtags) {
148
+ tempObj.subtags = _.mapValues(obj.subtags, (tag) => ({
149
+ ...withCouponId(tag, id),
150
+ }));
151
+ }
152
+ return {
153
+ ...obj,
154
+ ...tempObj,
155
+ couponSeriesId: id,
156
+ };
157
+ };
144
158
  offerDetails.forEach((offer) => {
145
159
  const { id, couponName } = offer;
146
- const couponTagsKeys = (allTags.coupon && allTags.coupon.subtags && Object.keys(allTags.coupon.subtags)) || [];
147
160
  const couponSubTags = {};
148
161
  couponTagsKeys.forEach((couponTagKey) => {
149
- const couponSubTagsObj = {
150
- ...allTags.coupon.subtags[couponTagKey],
151
- couponSeriesId: id,
152
- };
162
+ const couponSubTagsObj = withCouponId(allTags.coupon.subtags[couponTagKey], id);
153
163
  couponSubTags[couponTagKey] = couponSubTagsObj;
154
164
  });
155
165
  const key = couponName || id;
@@ -1,63 +0,0 @@
1
- import { defineMessages } from 'react-intl';
2
- export default defineMessages({
3
- "sms": {
4
- id: 'reon.components.Cap.sms',
5
- defaultMessage: 'SMS',
6
- },
7
- "wechat": {
8
- id: 'reon.components.Cap.wechat',
9
- defaultMessage: 'WeChat',
10
- },
11
- "gallery": {
12
- id: 'reon.components.Cap.gallery',
13
- defaultMessage: 'Gallery',
14
- },
15
- "creativesDashboard": {
16
- id: 'reon.components.Cap.creativesDashboard',
17
- defaultMessage: 'Creatives',
18
- },
19
- "creatives": {
20
- id: 'reon.components.Cap.creatives',
21
- defaultMessage: 'Creatives',
22
- },
23
- "campaigns": {
24
- id: 'reon.components.Cap.campaigns',
25
- defaultMessage: 'Campaigns',
26
- },
27
- "loyalty": {
28
- id: 'reon.components.Cap.loyalty',
29
- defaultMessage: 'Loyalty',
30
- },
31
- "member care": {
32
- id: 'reon.components.Cap.memberCare',
33
- defaultMessage: 'Member Care',
34
- },
35
- "workbench": {
36
- id: 'reon.components.Cap.Workbench',
37
- defaultMessage: 'WorkBench',
38
- },
39
- "store care": {
40
- id: 'reon.components.Cap.storeCare',
41
- defaultMessage: 'Store Care',
42
- },
43
- "store performance": {
44
- id: 'reon.components.Cap.storePerformance',
45
- defaultMessage: 'Store Performance',
46
- },
47
- "email": {
48
- id: 'reon.components.Cap.email',
49
- defaultMessage: 'Email',
50
- },
51
- "ebill": {
52
- id: 'reon.components.Cap.ebill',
53
- defaultMessage: 'Ebill',
54
- },
55
- "campaignsDashboard": {
56
- id: 'reon.components.campaignsDashboard',
57
- defaultMessage: 'Campaigns',
58
- },
59
- "campaignsHome": {
60
- id: 'reon.components.campaignsHome',
61
- defaultMessage: "Campaigns Home",
62
- },
63
- });
@@ -1,46 +0,0 @@
1
- /**
2
- *
3
- * Header
4
- *
5
- */
6
-
7
- import PropTypes from 'prop-types';
8
-
9
- import React from 'react';
10
- // import styled from 'styled-components';
11
- import { FormattedMessage } from 'react-intl';
12
-
13
- import { CapRow, CapColumn, CapInput, CapButton } from '@capillarytech/cap-ui-library';
14
- import messages from './messages';
15
-
16
-
17
- function Header(props) {
18
- return (
19
- <div>
20
- <CapRow className="template-form-header">
21
- <CapColumn span={10}>
22
- <CapInput id="template-name" placeholder="Enter template name*" defaultValue={props.templateName} type="input" onChange={props.templateNameHandler}/>
23
- </CapColumn>
24
- <CapColumn span={2} offset={8}>
25
- <CapButton id="preview-button" type="cancel" onClick={props.previewHandler}> <FormattedMessage {...messages.preview} /> </CapButton>
26
- </CapColumn>
27
- <CapColumn span={2}>
28
- <CapButton id="cancel-button" type="cancel" onClick={props.cancelHandler}> <FormattedMessage {...messages.cancel} /> </CapButton>
29
- </CapColumn>
30
- <CapColumn span={2}>
31
- <CapButton id="save-button" type="primary" onClick={props.saveHandler}> <FormattedMessage {...messages.save} /> </CapButton>
32
- </CapColumn>
33
- </CapRow>
34
- </div>
35
- );
36
- }
37
-
38
- Header.propTypes = {
39
- templateNameHandler: PropTypes.func,
40
- previewHandler: PropTypes.func,
41
- cancelHandler: PropTypes.func,
42
- saveHandler: PropTypes.func,
43
- templateName: PropTypes.string,
44
- };
45
-
46
- export default Header;
@@ -1,10 +0,0 @@
1
- // import React from 'react';
2
- // import { shallow } from 'enzyme';
3
-
4
- // import Header from '../index';
5
-
6
- describe('<Header />', () => {
7
- it('Expect to have unit tests specified', () => {
8
- expect(true).toEqual(false);
9
- });
10
- });