@capillarytech/creatives-library 7.6.11 → 7.6.13

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 (55) hide show
  1. package/app.js +5 -0
  2. package/index.html +2 -2
  3. package/package.json +2 -2
  4. package/services/api.js +2 -0
  5. package/utils/gtmTrackers/gtmEvents/creativeDetails.js +41 -0
  6. package/utils/gtmTrackers/index.js +17 -0
  7. package/v2Components/TemplatePreview/assets/images/mobile.svg +24 -0
  8. package/v2Components/TemplatePreview/index.js +1 -0
  9. package/v2Containers/App/constants.js +11 -0
  10. package/v2Containers/Cap/index.js +23 -29
  11. package/v2Containers/CapFacebookPreview/index.js +5 -3
  12. package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -7
  13. package/v2Containers/CreativesContainer/index.js +9 -9
  14. package/v2Containers/Email/index.js +14 -3
  15. package/v2Containers/EmailWrapper/index.js +10 -3
  16. package/v2Containers/Facebook/Advertisement/index.js +4 -4
  17. package/v2Containers/Facebook/Advertisement/index.scss +1 -1
  18. package/v2Containers/Facebook/index.js +6 -6
  19. package/v2Containers/Line/Container/index.js +32 -4
  20. package/v2Containers/Line/Create/_lineCreate.scss +64 -0
  21. package/v2Containers/Line/Create/actions.js +94 -0
  22. package/v2Containers/Line/Create/constants.js +43 -0
  23. package/v2Containers/Line/Create/index.js +1132 -0
  24. package/v2Containers/Line/Create/initialSchema.js +378 -0
  25. package/v2Containers/Line/Create/messages.js +229 -0
  26. package/v2Containers/Line/Create/reducer.js +99 -0
  27. package/v2Containers/Line/Create/sagas.js +113 -0
  28. package/v2Containers/Line/Create/selectors.js +30 -0
  29. package/v2Containers/Line/CreateWrapper/constants.js +2 -0
  30. package/v2Containers/Line/CreateWrapper/index.js +117 -0
  31. package/v2Containers/Line/CreateWrapper/messages.js +55 -0
  32. package/v2Containers/Line/Edit/_lineEdit.scss +23 -0
  33. package/v2Containers/Line/Edit/actions.js +79 -0
  34. package/v2Containers/Line/Edit/constants.js +27 -0
  35. package/v2Containers/Line/Edit/index.js +1051 -0
  36. package/v2Containers/Line/Edit/messages.js +173 -0
  37. package/v2Containers/Line/Edit/reducer.js +83 -0
  38. package/v2Containers/Line/Edit/sagas.js +81 -0
  39. package/v2Containers/Line/Edit/selectors.js +29 -0
  40. package/v2Containers/Line/Edit/tests/actions.test.js +18 -0
  41. package/v2Containers/Line/Edit/tests/index.test.js +10 -0
  42. package/v2Containers/Line/Edit/tests/reducer.test.js +9 -0
  43. package/v2Containers/Line/Edit/tests/sagas.test.js +15 -0
  44. package/v2Containers/Line/Edit/tests/selectors.test.js +10 -0
  45. package/v2Containers/MobilePush/Create/index.js +25 -4
  46. package/v2Containers/MobilePush/Edit/index.js +27 -5
  47. package/v2Containers/MobilePush/Edit/sagas.js +1 -1
  48. package/v2Containers/MobilePush/commonMethods.js +19 -1
  49. package/v2Containers/Sms/Create/index.js +14 -2
  50. package/v2Containers/Sms/Edit/index.js +15 -2
  51. package/v2Containers/Templates/index.js +19 -17
  52. package/v2Containers/TemplatesV2/index.js +4 -4
  53. package/v2Containers/Viber/index.js +19 -3
  54. package/v2Containers/WeChat/MapTemplates/index.js +12 -3
  55. package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +11 -2
@@ -62,6 +62,8 @@ import {
62
62
  } from '../App/constants';
63
63
  import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK } from '../CreativesContainer/constants';
64
64
 
65
+ import {CREATIVE} from '../Facebook/constants';
66
+
65
67
  import emailIllustration from '../Assets/images/emailIllustration.svg';
66
68
  import smsIllustration from '../Assets/images/smsIllustration.svg';
67
69
  import pushIllustration from '../Assets/images/pushIllustration.svg';
@@ -321,7 +323,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
321
323
  }
322
324
  const fbSetting = get(nextProps.Templates, 'campaignSettings.accountSettings.socialAccountSettings.facebookAccountSettings', []);
323
325
  const { accountName = "",
324
- orgUnitFacebookPageSettingsMap = {},
326
+ orgUnitFacebookPageSettingsMap = {},
325
327
  } = fbSetting[0] || {};
326
328
  let pageAccessToken = false;
327
329
  if (!isEmpty(orgUnitFacebookPageSettingsMap)) {
@@ -454,7 +456,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
454
456
  this.setState({previewTemplate: nextProps.Templates.templateDetails});
455
457
  }
456
458
 
457
- if (nextProps.Templates.weCrmAccounts !== undefined && nextProps.Templates.weCrmAccounts.length === 1 && this.state.defaultAccount && (['wechat', 'mobilepush'].indexOf(this.state.channel.toLowerCase()) > -1)) {
459
+ if (nextProps.Templates.weCrmAccounts !== undefined && nextProps.Templates.weCrmAccounts.length === 1 && this.state.defaultAccount && (['wechat'].indexOf(this.state.channel.toLowerCase()) > -1)) {
458
460
  const paramsDefault = {
459
461
  name: this.state.searchText,
460
462
  sortBy: this.state.sortBy,
@@ -464,9 +466,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
464
466
  paramsDefault.wecrmToken = nextProps.Templates.weCrmAccounts[0].configs.wecrm_token;
465
467
  paramsDefault.originalId = nextProps.Templates.weCrmAccounts[0].sourceAccountIdentifier;
466
468
  nextProps.actions.setWeChatAccount(nextProps.Templates.weCrmAccounts[0]);
467
- } else if (this.state.channel.toLowerCase() === 'mobilepush') {
468
- nextProps.actions.setWeChatAccount(nextProps.Templates.weCrmAccounts[0]);
469
- paramsDefault.accountId = nextProps.Templates.weCrmAccounts[0].id;
470
469
  }
471
470
  this.setState({defaultAccount: false, activeMode: TEMPLATES_MODE, selectedAccount: nextProps.Templates.weCrmAccounts[0].name });
472
471
  this.getAllTemplates({params: paramsDefault}, true);
@@ -1139,11 +1138,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1139
1138
  const channel = this.state.channel.toLowerCase();
1140
1139
  //const keyType = ev.key && ev.key.toLowerCase() !== undefined ? ev.state.toLowerCase() : '';
1141
1140
  let routeParams = {};
1142
- const {fbAdManger} = this.props;
1143
- timeTracker.startTimer(CHANNEL_CREATE_TRACK_MAPPING[channel]);
1144
- if (this.isEnabledInLibraryModule("callCreateFromProps")) {
1145
- if (this.props.fbAdManger === "CREATIVE") {
1146
- this.props.createNew(fbAdManger);
1141
+ const {fbAdManager} = this.props;
1142
+ const isLibraryMode = this.isEnabledInLibraryModule("callCreateFromProps");
1143
+ if (!isLibraryMode) {
1144
+ timeTracker.startTimer(CHANNEL_CREATE_TRACK_MAPPING[channel]);
1145
+ }
1146
+ if (isLibraryMode) {
1147
+ if (this.props.fbAdManager === CREATIVE) {
1148
+ this.props.createNew(fbAdManager);
1147
1149
  } else {
1148
1150
  this.props.createNew();
1149
1151
  }
@@ -1364,7 +1366,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1364
1366
  };
1365
1367
 
1366
1368
  handleEditClick(e, template, modeType, path, options) {
1367
- timeTracker.startTimer(CHANNEL_EDIT_TRACK_MAPPING[this.state.channel.toLowerCase()]);
1368
1369
  if (modeType && modeType !== undefined) {
1369
1370
  this.setState({modeType});
1370
1371
  }
@@ -1417,8 +1418,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1417
1418
  }
1418
1419
  }
1419
1420
  if (this.isEnabledInLibraryModule("callSelectFromProps")) {
1420
- this.props.onSelectTemplate(this.selectTemplate(id), this.props.fbAdManger);
1421
+ this.props.onSelectTemplate(this.selectTemplate(id), this.props.fbAdManager);
1421
1422
  } else {
1423
+ timeTracker.startTimer(CHANNEL_EDIT_TRACK_MAPPING[this.state.channel.toLowerCase()]);
1422
1424
  if (this.state.channel.toLowerCase() === 'ebill') {
1423
1425
  pathName = `/ebill/edit/${id}`;
1424
1426
  }
@@ -1952,11 +1954,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1952
1954
  render() {
1953
1955
  const isFullMode = this.isFullMode();
1954
1956
  const { activeMode, channel, wechatFilter, lineFilter } = this.state;
1955
- let showForFacebook = false;
1957
+ let showFbAds = false;
1956
1958
  if (channel.toLowerCase() === FACEBOOK_CHANNEL) {
1957
1959
  const campaignSettings = this.props.Templates.campaignSettings;
1958
1960
  if (campaignSettings && isEmpty(campaignSettings?.accountSettings)) {
1959
- showForFacebook = true;
1961
+ showFbAds = true;
1960
1962
  } else if (!isEmpty(campaignSettings?.accountSettings)) {
1961
1963
  const fbSetting = get(this.props.Templates, 'campaignSettings.accountSettings.socialAccountSettings.facebookAccountSettings', []);
1962
1964
  const { orgUnitFacebookPageSettingsMap = {} } = fbSetting[0] || {};
@@ -1968,17 +1970,17 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1968
1970
  }
1969
1971
  });
1970
1972
  if (!pageAccessToken) {
1971
- showForFacebook = true;
1973
+ showFbAds = true;
1972
1974
  }
1973
1975
  } else {
1974
- showForFacebook = true;
1976
+ showFbAds = true;
1975
1977
  }
1976
1978
  }
1977
1979
  }
1978
1980
 
1979
1981
  const showForViber = (![VIBER_CHANNEL, FACEBOOK_CHANNEL].includes(channel.toLowerCase()) ||
1980
1982
  (channel.toLowerCase() === VIBER_CHANNEL && !this.props.isFullMode && isEmpty(get(this.props, 'Templates.selectedViberAccount', {}))) ||
1981
- (channel.toLowerCase() === FACEBOOK_CHANNEL && showForFacebook)
1983
+ (channel.toLowerCase() === FACEBOOK_CHANNEL && showFbAds)
1982
1984
  );
1983
1985
 
1984
1986
 
@@ -45,7 +45,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
45
45
  channelsToDisable = [],
46
46
  isFullMode,
47
47
  onChannelChange,
48
- showDisableInfoForFacebook,
48
+ showDisabledFBInfo,
49
49
  } = props;
50
50
 
51
51
  const defaultPanes = {
@@ -81,7 +81,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
81
81
  if (channelsToDisable.includes(pane.key)) {
82
82
  // eslint-disable-next-line no-param-reassign
83
83
  pane.disabled = true;
84
- if (pane.key === 'facebook' && showDisableInfoForFacebook) {
84
+ if (pane.key === 'facebook' && showDisabledFBInfo) {
85
85
  pane.tab = (<CapTooltip
86
86
  title={
87
87
  intl.formatMessage(messages.facebookDisableinfo)
@@ -158,7 +158,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
158
158
  );
159
159
 
160
160
  getFacebookComponent = () => {
161
- const { messageDetails, cap, onFacebookSubmit, messageStrategy, showDisableInfoForFacebook, orgUnitId } = this.props;
161
+ const { messageDetails, cap, onFacebookSubmit, messageStrategy, showDisabledFBInfo, orgUnitId } = this.props;
162
162
  return (
163
163
  <Facebook
164
164
  {...this.props}
@@ -166,7 +166,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
166
166
  cap={cap}
167
167
  onFacebookSubmit={onFacebookSubmit}
168
168
  messageStrategy={messageStrategy}
169
- showDisableInfoForFacebook={showDisableInfoForFacebook}
169
+ showDisabledFBInfo={showDisabledFBInfo}
170
170
  orgUnitId={orgUnitId}
171
171
  />
172
172
  );
@@ -49,6 +49,10 @@ import {
49
49
  VIBER_IMG_SIZE,
50
50
  charLimit,
51
51
  } from './constants';
52
+ import { GA } from '@capillarytech/cap-ui-utils';
53
+ import { CREATE, EDIT, TRACK_CREATE_VIBER, TRACK_EDIT_VIBER } from '../App/constants';
54
+ import { gtmPush } from '../../utils/gtmTrackers';
55
+ import { VIBER } from '../CreativesContainer/constants';
52
56
  const { CapHeadingSpan } = CapHeading;
53
57
  const { TextArea } = CapInput;
54
58
 
@@ -562,7 +566,7 @@ const Viber = (props) => {
562
566
  };
563
567
  };
564
568
 
565
- const createCallback = (errorMessage, isEdit) => {
569
+ const createCallback = ({errorMessage, resp}, isEdit) => {
566
570
  if (!errorMessage) {
567
571
  CapNotification.success({
568
572
  message: isEdit ? formatMessage(messages.viberEditNotification) : formatMessage(messages.viberCreateNotification),
@@ -572,6 +576,18 @@ const Viber = (props) => {
572
576
  } else {
573
577
  actions.clearCreateResponse();
574
578
  }
579
+ const timeTaken = GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_VIBER : TRACK_CREATE_VIBER, {
580
+ category: 'Creatives',
581
+ action: isEdit ? TRACK_EDIT_VIBER : TRACK_CREATE_VIBER,
582
+ });
583
+ gtmPush('creativeDetails', {
584
+ id: resp.templateId._id || resp.templateId,
585
+ name: messageTitle,
586
+ channel: VIBER,
587
+ timeTaken,
588
+ content: messageContent,
589
+ mode: isEdit ? EDIT : CREATE
590
+ });
575
591
  } else {
576
592
  CapNotification.error({
577
593
  message: errorMessage,
@@ -583,7 +599,7 @@ const Viber = (props) => {
583
599
  actions.createTemplate(
584
600
  formatSubmitPayload(),
585
601
  (resp, errorMessage) => {
586
- createCallback(errorMessage);
602
+ createCallback({resp, errorMessage});
587
603
  onCreateComplete();
588
604
  }
589
605
  );
@@ -596,7 +612,7 @@ const Viber = (props) => {
596
612
  _id: params.id,
597
613
  },
598
614
  (resp, errorMessage) => {
599
- createCallback(errorMessage, true);
615
+ createCallback({resp, errorMessage}, true);
600
616
  onCreateComplete();
601
617
  });
602
618
  };
@@ -30,7 +30,9 @@ import * as templateActions from '../../Templates/actions';
30
30
  import './_mapTemplates.scss';
31
31
  import withCreatives from '../../../hoc/withCreatives';
32
32
  import { GA } from '@capillarytech/cap-ui-utils';
33
- import { TRACK_CREATE_WECHAT, TRACK_EDIT_WECHAT } from '../../App/constants';
33
+ import { CREATE, EDIT, TRACK_CREATE_WECHAT, TRACK_EDIT_WECHAT } from '../../App/constants';
34
+ import { gtmPush } from '../../../utils/gtmTrackers';
35
+ import { WECHAT } from '../../CreativesContainer/constants';
34
36
 
35
37
  const SELECT_TEMPLATE_MODE = "selectTemplate";
36
38
  const MAP_TEMPLATE_MODE = "mapTemplateMode";
@@ -1172,12 +1174,19 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
1172
1174
  getFormData(this.getFormData(obj));
1173
1175
  }, 0);
1174
1176
  }
1175
- GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_WECHAT : TRACK_CREATE_WECHAT, {
1177
+ const timeTaken = GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_WECHAT : TRACK_CREATE_WECHAT, {
1176
1178
  category: 'Creatives',
1177
1179
  action: isEdit ? TRACK_EDIT_WECHAT : TRACK_CREATE_WECHAT,
1178
1180
  label : 'MapTemplates',
1179
1181
  });
1180
-
1182
+ gtmPush('creativeDetails', {
1183
+ id: response.templateId._id || response.templateId,
1184
+ name: obj?.versions?.base?.Title,
1185
+ channel: `${WECHAT} Maptemplate`,
1186
+ timeTaken,
1187
+ content: this.state.formData?.base?.['sms-editor'],
1188
+ mode: isEdit ? EDIT : CREATE
1189
+ });
1181
1190
  });
1182
1191
  }
1183
1192
 
@@ -29,7 +29,9 @@ import noImage from '../../../../assets/noImage.png';
29
29
  import Pagination from '../../../../v2Components/Pagination';
30
30
  import { CAP_SPACE_08, CAP_SPACE_12, CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
31
31
  import { GA } from '@capillarytech/cap-ui-utils';
32
- import { TRACK_CREATE_WECHAT, TRACK_EDIT_WECHAT } from '../../../App/constants';
32
+ import { CREATE, EDIT, TRACK_CREATE_WECHAT, TRACK_EDIT_WECHAT } from '../../../App/constants';
33
+ import { gtmPush } from '../../../../utils/gtmTrackers';
34
+ import { WECHAT } from '../../../CreativesContainer/constants';
33
35
  export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
34
36
  constructor(props) {
35
37
  super(props);
@@ -556,11 +558,18 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
556
558
  // CapNotification.success({
557
559
  // message: this.props.intl.formatMessage(messages.saveSuccess),
558
560
  // });
559
- GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_WECHAT : TRACK_CREATE_WECHAT, {
561
+ const timeTaken = GA.timeTracker.stopTimer(isEdit ? TRACK_EDIT_WECHAT : TRACK_CREATE_WECHAT, {
560
562
  category: 'Creatives',
561
563
  action: isEdit ? TRACK_EDIT_WECHAT : TRACK_CREATE_WECHAT,
562
564
  label: 'RichMedia',
563
565
  });
566
+ gtmPush('creativeDetails', {
567
+ id: response.templateId._id || response.templateId,
568
+ name: saveObj?.name,
569
+ channel: `${WECHAT} Richmedia`,
570
+ timeTaken,
571
+ mode: isEdit ? EDIT : CREATE
572
+ });
564
573
  if (getFormData) {
565
574
  getFormData(this.getFormData({
566
575
  mediaId: response.mediaId,