@capillarytech/creatives-library 7.11.14 → 7.12.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 (59) hide show
  1. package/config/app.js +0 -1
  2. package/index.js +0 -6
  3. package/package.json +1 -1
  4. package/routes.js +2 -7
  5. package/services/api.js +2 -8
  6. package/v2Components/CapImageUpload/index.js +11 -24
  7. package/v2Components/CapImageUpload/index.scss +27 -12
  8. package/v2Components/CapImageUpload/messages.js +5 -10
  9. package/v2Components/TemplatePreview/_templatePreview.scss +1 -13
  10. package/v2Components/TemplatePreview/index.js +2 -41
  11. package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +1 -33
  12. package/v2Components/TemplatePreview/tests/index.test.js +7 -7
  13. package/v2Containers/App/constants.js +1 -2
  14. package/v2Containers/Cap/messages.js +1 -20
  15. package/v2Containers/CreativesContainer/SlideBoxContent.js +11 -57
  16. package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -5
  17. package/v2Containers/CreativesContainer/constants.js +0 -1
  18. package/v2Containers/CreativesContainer/messages.js +0 -4
  19. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +4 -24
  20. package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +4 -23
  21. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +2 -147
  22. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +1 -99
  23. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -71
  24. package/v2Containers/CreativesContainer/tests/index.test.js +9 -21
  25. package/v2Containers/Facebook/Advertisement/index.js +2 -4
  26. package/v2Containers/MobilePush/Edit/index.js +34 -21
  27. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -4
  28. package/v2Containers/Templates/_templates.scss +1 -9
  29. package/v2Containers/Templates/actions.js +1 -2
  30. package/v2Containers/Templates/constants.js +0 -1
  31. package/v2Containers/Templates/index.js +174 -235
  32. package/v2Containers/Templates/messages.js +0 -20
  33. package/v2Containers/Templates/reducer.js +0 -2
  34. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +80 -520
  35. package/v2Containers/TemplatesV2/index.js +1 -2
  36. package/v2Containers/TemplatesV2/messages.js +0 -4
  37. package/v2Containers/Whatsapp/constants.js +0 -287
  38. package/v2Containers/Whatsapp/index.js +22 -34
  39. package/v2Containers/Whatsapp/index.scss +2 -3
  40. package/v2Containers/Whatsapp/messages.js +13 -284
  41. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +1700 -35583
  42. package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +26 -32
  43. package/v2Containers/Whatsapp/tests/index.test.js +0 -13
  44. package/v2Containers/Whatsapp/tests/utils.test.js +8 -15
  45. package/v2Containers/mockdata.js +2181 -1190
  46. package/v2Containers/Assets/images/addCreativesIllustration.svg +0 -30
  47. package/v2Containers/Assets/images/rcsIllustration.png +0 -0
  48. package/v2Containers/Rcs/actions.js +0 -57
  49. package/v2Containers/Rcs/constants.js +0 -51
  50. package/v2Containers/Rcs/index.js +0 -1064
  51. package/v2Containers/Rcs/index.scss +0 -72
  52. package/v2Containers/Rcs/messages.js +0 -122
  53. package/v2Containers/Rcs/reducer.js +0 -107
  54. package/v2Containers/Rcs/sagas.js +0 -141
  55. package/v2Containers/Rcs/selectors.js +0 -8
  56. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -145080
  57. package/v2Containers/Rcs/tests/index.test.js +0 -226
  58. package/v2Containers/Rcs/tests/mockData.js +0 -169
  59. package/v2Containers/Rcs/utils.js +0 -40
@@ -60,6 +60,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
60
60
  this.getLinkTypeFields = getLinkTypeFields.bind(this);
61
61
  }
62
62
  componentWillMount() {
63
+
63
64
  this.props.actions.getWeCrmAccounts("mobilepush");
64
65
  if (!this.props.Templates.selectedWeChatAccount && this.props.location.query.type !== 'embedded') {
65
66
  const type = this.props.location.query.type;
@@ -75,6 +76,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
75
76
  version: "v2",
76
77
  };
77
78
  this.props.globalActions.fetchSchemaForEntity(query);
79
+
78
80
  }
79
81
  }
80
82
  componentDidMount() {
@@ -104,9 +106,10 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
104
106
  } else if (nextProps.isGetFormData && this.props.isGetFormData !== nextProps.isGetFormData && this.props.isFullMode && !this.props.Create.createTemplateInProgress) {
105
107
  this.startValidation();
106
108
  }
107
- const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount :
109
+ const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount :
108
110
  (!_.isEmpty(this.props.Edit.selectedWeChatAccount) ? this.props.Edit.selectedWeChatAccount : nextProps.Edit.selectedWeChatAccount));
109
111
  if (this.props.location.query.type === 'embedded' && !nextProps.Edit.fetchingWeCrmAccounts && !_.isEqual(this.props.Edit.weCrmAccounts, nextProps.Edit.weCrmAccounts) && (!selectedWeChatAccount || _.isEmpty(selectedWeChatAccount))) {
112
+
110
113
  this.setMobilePushAccountOptions(nextProps.Edit.weCrmAccounts, get(this.props, "templateData.definition.accountId"));
111
114
  }
112
115
  if (!_.isEmpty(nextProps.Edit.selectedWeChatAccount) && !_.isEqual(this.props.Edit.selectedWeChatAccount, nextProps.Edit.selectedWeChatAccount) && (this.props.location.query.type === 'embedded') && this.props.location.query.module === "loyalty") {
@@ -172,6 +175,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
172
175
  });
173
176
  };
174
177
  onFormDataChange = (formData, tabCount, currentTab, inputField) => {
178
+
175
179
  const newFormData = _.cloneDeep(formData);
176
180
  const {templateCta} = this.state;
177
181
  if (!_.isEmpty(templateCta) && this.state.currentTab === 2) {
@@ -237,10 +241,12 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
237
241
  };
238
242
 
239
243
  onTabChange = (data) => {
244
+
240
245
  this.setState({currentTab: data});
241
246
  };
242
247
 
243
248
  onTagSelect = (data, currentTab, srcComp) => {
249
+
244
250
  const editorId = srcComp.target;
245
251
  this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
246
252
  document.getElementById(editorId).focus();
@@ -253,10 +259,10 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
253
259
  onUpdateTemplateComplete = (response) => {
254
260
  const obj = this.getTransformedData(this.state.formData);
255
261
  const content = getContent(obj);
256
- const {
262
+ const {
257
263
  definition: {
258
- mode: definitionMode,
259
- },
264
+ mode: definitionMode
265
+ }
260
266
  } = obj || {};
261
267
  const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
262
268
  const timeTaken = GA.timeTracker.stopTimer(TRACK_EDIT_MPUSH, {
@@ -272,12 +278,12 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
272
278
  timeTaken,
273
279
  content,
274
280
  mode: EDIT,
275
- imageAdded: definitionMode === 'image',
276
- });
277
- } catch (e) {
281
+ imageAdded: definitionMode === 'image'
282
+ })
283
+ } catch(e) {
278
284
  console.log(e);
279
285
  }
280
-
286
+
281
287
  this.resetSchema();
282
288
  this.setState({
283
289
  formData: {},
@@ -529,8 +535,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
529
535
  delete cta.ioscdeepLinkName;
530
536
  }
531
537
  obj.versions.base.IOS.expandableDetails.ctas.push(cta);
532
- obj.versions.base.IOS.expandableDetails.categoryId = get(this.state, "templateCta.id") || get(this.state.editData, 'versions.base.IOS.expandableDetails.categoryId');
533
-
538
+ obj.versions.base.IOS.expandableDetails.categoryId = get(this.state, "templateCta.id");
534
539
  if (obj.versions.base.IOS.expandableDetails.ctas[obj.versions.base.IOS.expandableDetails.ctas.length - 1].type === "DEEP_LINK") {
535
540
  const params = _.map(ios, (field, key) => {
536
541
  let actionLink;
@@ -598,12 +603,13 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
598
603
  getMappedEvent = (id, event) => {
599
604
  const map = this.state.eventsMap;
600
605
  if (!map[id] || !map[id][event]) {
601
-
606
+
602
607
  }
603
608
  return map[id][event];
604
609
  };
605
610
 
606
611
  getCurrentWindow = (e) => {
612
+
607
613
  const response = {
608
614
  action: e.action,
609
615
  value: 'edit',
@@ -613,12 +619,13 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
613
619
  };
614
620
 
615
621
  getFormData = (e) => {
622
+
616
623
  const response = {
617
624
  action: "getFormData",
618
625
  value: this.getTransformedData(this.state.formData),
619
626
  validity: this.state.isFormValid,
620
627
  };
621
-
628
+
622
629
  this.setState({checkValidation: true}, this.showError);
623
630
  if (e) {
624
631
  e.source.postMessage(JSON.stringify(response), e.origin);
@@ -628,6 +635,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
628
635
 
629
636
 
630
637
  setEditState(data, schema) {
638
+
631
639
  const tabCount = Object.keys(data.versions.base).length;
632
640
  const formData = {};
633
641
  if (this.props.location.query.type === 'embedded' && this.props.location.query.module === "loyalty") {
@@ -767,7 +775,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
767
775
  formData[0].base = true;
768
776
  // formData[0].tabKey = '1';
769
777
  // formData[1].tabKey = '2';
770
-
778
+
771
779
  this.setState({templateCta}, () => {
772
780
  this.getSchemaForFormData(formData, schema);
773
781
  this.setState({tabCount, formData, editData: data, currentTab: 1}, () => {
@@ -1353,6 +1361,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1353
1361
 
1354
1362
 
1355
1363
  startTemplateCreation = (data) => {
1364
+
1356
1365
  if (!this.state.isContentEditLoaded && this.state.fullSchema && this.props.Edit.weCrmAccounts) {
1357
1366
  const schema = JSON.stringify(data).indexOf("BIG_PICTURE") > -1 ? this.state.fullSchema.imageSchema : this.state.fullSchema.textSchema;
1358
1367
  this.setMobilePushAccountOptions(this.props.Edit.weCrmAccounts, data.content.accId);
@@ -1368,6 +1377,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1368
1377
  }
1369
1378
  };
1370
1379
  discardValues = () => {
1380
+
1371
1381
  this.resetSchema();
1372
1382
  this.setState({
1373
1383
  formData: {},
@@ -1393,6 +1403,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1393
1403
 
1394
1404
  };
1395
1405
  moveToTemplates = () => {
1406
+
1396
1407
  const modalContent = {
1397
1408
  title: this.props.intl.formatMessage(messages.alertMessage),
1398
1409
  body: this.props.intl.formatMessage(messages.goBackTemporaryChangesLost),
@@ -1467,16 +1478,17 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1467
1478
  };
1468
1479
 
1469
1480
  saveFormData = (formData) => {
1481
+
1470
1482
  const obj = this.getTransformedData(formData);
1471
-
1483
+
1472
1484
  this.props.actions.editTemplate(obj, this.onUpdateTemplateComplete);
1473
1485
  };
1474
1486
  handleFrameTasks = (e) => {
1475
- //
1487
+ //
1476
1488
  const type = e.data;
1477
-
1489
+
1478
1490
  if (typeof type === 'object') {
1479
- //
1491
+ //
1480
1492
  const action = type.action;
1481
1493
  switch (action) {
1482
1494
  case "startTemplateCreation":
@@ -1497,15 +1509,15 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1497
1509
  this.getFormData(e);
1498
1510
  break;
1499
1511
  case "startTemplateCreation":
1500
-
1512
+
1501
1513
  //this.getFormData(e);
1502
1514
  break;
1503
1515
  case "moveToTemplates":
1504
-
1516
+
1505
1517
  this.moveToTemplates();
1506
1518
  break;
1507
1519
  case "validateContent":
1508
-
1520
+
1509
1521
  this.validateContent(e);
1510
1522
  break;
1511
1523
  default:
@@ -1714,7 +1726,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1714
1726
  tempContainer = this.injectContainer(tempContainer);
1715
1727
  return tempContainer;
1716
1728
  });
1717
-
1729
+
1718
1730
  this.setState({schema, loadingContentEdit: false}, () => {
1719
1731
  this.removeStandAlone();
1720
1732
  });
@@ -1735,6 +1747,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1735
1747
  this.setState({ schema });
1736
1748
  };
1737
1749
  handleOnTagsContextChange = (data) => {
1750
+
1738
1751
  const query = {
1739
1752
  layout: 'mobilepush',
1740
1753
  type: 'TAG',
@@ -6071,7 +6071,7 @@ FREE GIFTS-
6071
6071
  />
6072
6072
  </CapImage>
6073
6073
  <div
6074
- className="msg-container sms"
6074
+ className="msgContainer sms"
6075
6075
  >
6076
6076
  <div
6077
6077
  className="message-pop sms"
@@ -12754,7 +12754,7 @@ FREE GIFTS-
12754
12754
  />
12755
12755
  </CapImage>
12756
12756
  <div
12757
- className="msg-container sms"
12757
+ className="msgContainer sms"
12758
12758
  >
12759
12759
  <div
12760
12760
  className="message-pop sms"
@@ -19857,7 +19857,7 @@ FREE GIFTS-
19857
19857
  />
19858
19858
  </CapImage>
19859
19859
  <div
19860
- className="msg-container sms"
19860
+ className="msgContainer sms"
19861
19861
  >
19862
19862
  <div
19863
19863
  className="message-pop sms"
@@ -27069,7 +27069,7 @@ FREE GIFTS-
27069
27069
  />
27070
27070
  </CapImage>
27071
27071
  <div
27072
- className="msg-container sms"
27072
+ className="msgContainer sms"
27073
27073
  >
27074
27074
  <div
27075
27075
  className="message-pop sms"
@@ -574,17 +574,9 @@
574
574
  }
575
575
  }
576
576
 
577
- .illustration-desc {
577
+ .whatsapp-illustration-desc {
578
578
  font-size: 14px;
579
579
  color: rgba(0, 0, 0, 0.87);
580
580
  margin: 8px 0;
581
581
  white-space: pre-wrap;
582
582
  }
583
- .rcs-illustration{
584
- width: 25%;
585
- text-align: center;
586
- }
587
- .channel-specific-illustration-text{
588
- text-align: center;
589
- margin-top: $CAP_SPACE_44;
590
- }
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import * as types from './constants';
8
- import { LINE, WHATSAPP, RCS } from '../CreativesContainer/constants';
8
+ import { LINE, WHATSAPP } from '../CreativesContainer/constants';
9
9
 
10
10
  export function getAllTemplates(channel, queryParams) {
11
11
  return {
@@ -59,7 +59,6 @@ export function setChannelAccount(channel, account) {
59
59
  const channelTypeMapping = {
60
60
  [LINE]: types.SET_LINE_ACCOUNT,
61
61
  [WHATSAPP]: types.SET_WHATSAPP_ACCOUNT,
62
- [RCS]: types.SET_RCS_ACCOUNT,
63
62
  };
64
63
  if (channelTypeMapping[channel]) {
65
64
  return {
@@ -46,7 +46,6 @@ export const SET_LINE_ACCOUNT = "app/v2Containers/Templates/SET_LINE_ACCOUNT";
46
46
  export const SET_VIBER_ACCOUNT = "app/v2Containers/Templates/SET_VIBER_ACCOUNT";
47
47
  export const SET_FACEBOOK_ACCOUNT = "app/v2Containers/Templates/SET_FACEBOOK_ACCOUNT";
48
48
  export const SET_WHATSAPP_ACCOUNT = "app/v2Containers/Templates/SET_WHATSAPP_ACCOUNT";
49
- export const SET_RCS_ACCOUNT = "app/v2Containers/Templates/SET_RCS_ACCOUNT";
50
49
 
51
50
  export const GET_DEAFULT_BEE_TEMPLATES_REQUEST = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_REQUEST';
52
51
  export const GET_DEAFULT_BEE_TEMPLATES_SUCCESS = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_SUCCESS';