@capillarytech/creatives-library 7.10.59 → 7.10.61
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.
- package/config/app.js +1 -0
- package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +2 -0
- package/containers/Email/index.js +3 -2
- package/index.js +6 -0
- package/package.json +1 -1
- package/routes.js +5 -0
- package/services/api.js +6 -1
- package/utils/v2common.js +13 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +24 -2
- package/v2Components/TemplatePreview/index.js +90 -8
- package/v2Components/TemplatePreview/messages.js +12 -0
- package/v2Containers/App/constants.js +4 -1
- package/v2Containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +2 -0
- package/v2Containers/Cap/messages.js +12 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +42 -7
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +55 -14
- package/v2Containers/CreativesContainer/constants.js +1 -0
- package/v2Containers/CreativesContainer/index.js +93 -4
- package/v2Containers/CreativesContainer/messages.js +8 -0
- package/v2Containers/Email/index.js +3 -1
- package/v2Containers/Line/Container/index.js +1 -1
- package/v2Containers/Templates/_templates.scss +64 -0
- package/v2Containers/Templates/actions.js +12 -10
- package/v2Containers/Templates/constants.js +3 -1
- package/v2Containers/Templates/index.js +431 -72
- package/v2Containers/Templates/messages.js +66 -2
- package/v2Containers/Templates/reducer.js +3 -1
- package/v2Containers/TemplatesV2/index.js +17 -0
- package/v2Containers/TemplatesV2/messages.js +4 -0
- package/v2Containers/Whatsapp/index.js +23 -21
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +16 -16
|
@@ -31,6 +31,7 @@ import { IMAGE as LINE_IMAGE, IMAGE_MAP, IMAGE_CAROUSEL, VIDEO as LINE_VIDEO, TE
|
|
|
31
31
|
import {IMAGE, VIDEO } from '../Facebook/Advertisement/constant';
|
|
32
32
|
import { CREATIVE } from '../Facebook/constants';
|
|
33
33
|
import { LOYALTY } from '../App/constants';
|
|
34
|
+
import { WHATSAPP_STATUSES } from '../Whatsapp/constants';
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
const classPrefix = 'add-creatives-section';
|
|
@@ -364,6 +365,42 @@ class Creatives extends React.Component {
|
|
|
364
365
|
};
|
|
365
366
|
break;
|
|
366
367
|
}
|
|
368
|
+
case constants.WHATSAPP: {
|
|
369
|
+
const {
|
|
370
|
+
templateConfigs: {
|
|
371
|
+
name,
|
|
372
|
+
template,
|
|
373
|
+
varMapped,
|
|
374
|
+
language,
|
|
375
|
+
category,
|
|
376
|
+
mediaType
|
|
377
|
+
}
|
|
378
|
+
} = templateData;
|
|
379
|
+
creativesTemplateData = {
|
|
380
|
+
type: constants.WHATSAPP,
|
|
381
|
+
edit: true,
|
|
382
|
+
name,
|
|
383
|
+
versions: {
|
|
384
|
+
base: {
|
|
385
|
+
content: {
|
|
386
|
+
whatsapp: {
|
|
387
|
+
status: WHATSAPP_STATUSES.approved,
|
|
388
|
+
category,
|
|
389
|
+
varMapped,
|
|
390
|
+
mediaType,
|
|
391
|
+
languages: [
|
|
392
|
+
{
|
|
393
|
+
language,
|
|
394
|
+
content: `$'${template}'`,
|
|
395
|
+
}
|
|
396
|
+
]
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
};
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
367
404
|
default:
|
|
368
405
|
break;
|
|
369
406
|
}
|
|
@@ -420,8 +457,8 @@ class Creatives extends React.Component {
|
|
|
420
457
|
if (get(template, "value.versions.base")) {
|
|
421
458
|
const mobilpushTemplate = template.value;
|
|
422
459
|
templateData.accountId = get(mobilpushTemplate, 'definition.accountId');
|
|
423
|
-
const type = (get(this.props,"messageDetails.type") || '').toLowerCase();
|
|
424
|
-
if(type === LOYALTY){
|
|
460
|
+
const type = (get(this.props, "messageDetails.type") || '').toLowerCase();
|
|
461
|
+
if (type === LOYALTY) {
|
|
425
462
|
templateData.licenseCode = get(mobilpushTemplate, 'definition.licenseCode');
|
|
426
463
|
}
|
|
427
464
|
const androidContent = get(mobilpushTemplate, 'versions.base.ANDROID');
|
|
@@ -495,6 +532,38 @@ class Creatives extends React.Component {
|
|
|
495
532
|
};
|
|
496
533
|
}
|
|
497
534
|
break;
|
|
535
|
+
case constants.WHATSAPP:
|
|
536
|
+
if (template.value) {
|
|
537
|
+
const { Templates, templateData: templateDataProps } = this.props;
|
|
538
|
+
const { accountDetails: selectedAccountDetails, accountId: selectedAccountId } = templateDataProps || {};
|
|
539
|
+
const selectedWhatsappAccount = Templates?.selectedWhatsappAccount;
|
|
540
|
+
const accountDetails = (selectedWhatsappAccount ? selectedWhatsappAccount : selectedAccountDetails);
|
|
541
|
+
const accountId = selectedAccountId || (selectedWhatsappAccount?.id || '');
|
|
542
|
+
const { versions } = template.value;
|
|
543
|
+
const {
|
|
544
|
+
languages,
|
|
545
|
+
mediaType,
|
|
546
|
+
category,
|
|
547
|
+
templateEditor,
|
|
548
|
+
varMapped
|
|
549
|
+
} = cloneDeep(versions.base.content.whatsapp);
|
|
550
|
+
templateData = {
|
|
551
|
+
channel,
|
|
552
|
+
accountId,
|
|
553
|
+
accountName: accountDetails.name,
|
|
554
|
+
messageBody: languages[0].content,
|
|
555
|
+
templateConfigs: {
|
|
556
|
+
id: template._id,
|
|
557
|
+
name: template?.value?.name,
|
|
558
|
+
template: templateEditor,
|
|
559
|
+
varMapped,
|
|
560
|
+
category,
|
|
561
|
+
language: languages[0].language,
|
|
562
|
+
mediaType,
|
|
563
|
+
},
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
break;
|
|
498
567
|
case constants.FACEBOOK: {
|
|
499
568
|
if (template.value) {
|
|
500
569
|
const FacebookAd = template?.value?.versions?.base?.content?.FacebookAd;
|
|
@@ -660,11 +729,13 @@ class Creatives extends React.Component {
|
|
|
660
729
|
});
|
|
661
730
|
}
|
|
662
731
|
handleCloseSlideBox = () => {
|
|
732
|
+
const { currentChannel = '', slidBoxContent = '' } = this.state;
|
|
733
|
+
const reloadTemplates = currentChannel === constants.WHATSAPP && slidBoxContent === 'editTemplate';
|
|
663
734
|
this.setState((prevState) => ({
|
|
664
735
|
...prevState,
|
|
665
736
|
templateData: undefined,
|
|
666
737
|
showSlideBox: false,
|
|
667
|
-
}), this.props.handleCloseCreatives);
|
|
738
|
+
}), () => this.props.handleCloseCreatives(reloadTemplates));
|
|
668
739
|
};
|
|
669
740
|
saveMessage = () => {
|
|
670
741
|
this.setState({ isGetFormData: true });
|
|
@@ -819,7 +890,24 @@ class Creatives extends React.Component {
|
|
|
819
890
|
}
|
|
820
891
|
render() {
|
|
821
892
|
const {slidBoxContent, isGetFormData, showSlideBox, templateData, currentChannel, emailCreateMode, templateStep, isLoadingContent, mobilePushCreateMode, isDiscardMessage, weChatTemplateType, weChatMaptemplateStep} = this.state;
|
|
822
|
-
const {
|
|
893
|
+
const {
|
|
894
|
+
isFullMode,
|
|
895
|
+
creativesMode,
|
|
896
|
+
cap,
|
|
897
|
+
isUploading,
|
|
898
|
+
channelsToHide,
|
|
899
|
+
selectedWeChatAccount,
|
|
900
|
+
forwardedTags,
|
|
901
|
+
channelsToDisable,
|
|
902
|
+
selectedOfferDetails,
|
|
903
|
+
onTestContentClicked,
|
|
904
|
+
onPreviewContentClicked,
|
|
905
|
+
getCreativesData,
|
|
906
|
+
fetchingCmsData,
|
|
907
|
+
editor,
|
|
908
|
+
smsRegister,
|
|
909
|
+
enableNewChannels,
|
|
910
|
+
} = this.props;
|
|
823
911
|
const mapTemplateCreate = slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
824
912
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
825
913
|
return (
|
|
@@ -900,6 +988,7 @@ class Creatives extends React.Component {
|
|
|
900
988
|
smsRegister={smsRegister}
|
|
901
989
|
messageStrategy={this.props.strategy}
|
|
902
990
|
orgUnitId={this.props.orgUnitId}
|
|
991
|
+
enableNewChannels={enableNewChannels}
|
|
903
992
|
/>
|
|
904
993
|
}
|
|
905
994
|
footer={this.shouldShowFooter() &&
|
|
@@ -306,4 +306,12 @@ export default defineMessages({
|
|
|
306
306
|
id: `${scope}.UploadSMStemplates`,
|
|
307
307
|
defaultMessage: `Upload SMS templates`,
|
|
308
308
|
},
|
|
309
|
+
"whatsappOverview": {
|
|
310
|
+
id: `${scope}.whatsappOverview`,
|
|
311
|
+
defaultMessage: `WhatsApp template overview`,
|
|
312
|
+
},
|
|
313
|
+
"whatsappTemplate": {
|
|
314
|
+
id: `${scope}.whatsappTemplate`,
|
|
315
|
+
defaultMessage: `WhatsApp template`,
|
|
316
|
+
},
|
|
309
317
|
});
|
|
@@ -2179,7 +2179,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2179
2179
|
} else {
|
|
2180
2180
|
this.setState({injectedTags: data.tags});
|
|
2181
2181
|
}
|
|
2182
|
-
|
|
2182
|
+
if (data.tags) {
|
|
2183
|
+
this.props.globalActions.setInjectedTags(data.tags);
|
|
2184
|
+
}
|
|
2183
2185
|
}
|
|
2184
2186
|
|
|
2185
2187
|
startLoading = (ifEdit) => {
|
|
@@ -83,7 +83,7 @@ export const LineContainer = ({
|
|
|
83
83
|
|
|
84
84
|
const onAccountSelect = (account) => {
|
|
85
85
|
const { value } = account.target;
|
|
86
|
-
templateActions.
|
|
86
|
+
templateActions.setChannelAccount(LINE, Templates.weCrmAccounts.find((item) => item.name === value));
|
|
87
87
|
updateSelectedAccount(value);
|
|
88
88
|
updateAccountSelectFlow(false);
|
|
89
89
|
createNew();
|
|
@@ -19,6 +19,25 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.creatives-templates-list {
|
|
22
|
+
|
|
23
|
+
.delete-template-confirm {
|
|
24
|
+
.ant-modal-footer {
|
|
25
|
+
padding: $CAP_SPACE_16 $CAP_SPACE_24 $CAP_SPACE_24 $CAP_SPACE_24;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ant-modal-header {
|
|
29
|
+
padding: $CAP_SPACE_24 $CAP_SPACE_24 $CAP_SPACE_08 $CAP_SPACE_24;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ant-modal-body {
|
|
33
|
+
padding: 0 $CAP_SPACE_24;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ant-modal-close-x {
|
|
37
|
+
padding: $CAP_SPACE_12;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
22
41
|
.pagination-container {
|
|
23
42
|
.FACEBOOK {
|
|
24
43
|
.ant-card-body {
|
|
@@ -132,6 +151,20 @@
|
|
|
132
151
|
|
|
133
152
|
}
|
|
134
153
|
}
|
|
154
|
+
|
|
155
|
+
.create-new-link{
|
|
156
|
+
.ant-anchor-link {
|
|
157
|
+
display: flex;
|
|
158
|
+
|
|
159
|
+
.ant-anchor-link-title {
|
|
160
|
+
margin: 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.cap-link-v2-suffix {
|
|
164
|
+
margin-top: -2px;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
135
168
|
}
|
|
136
169
|
|
|
137
170
|
.card-title {
|
|
@@ -499,3 +532,34 @@
|
|
|
499
532
|
box-shadow: none;
|
|
500
533
|
}
|
|
501
534
|
}
|
|
535
|
+
|
|
536
|
+
.whatsapp-filters {
|
|
537
|
+
display: flex;
|
|
538
|
+
width: 100%;
|
|
539
|
+
padding-left: 8px;
|
|
540
|
+
padding-bottom: 16px;
|
|
541
|
+
.cap-select-filter-v2 {
|
|
542
|
+
margin: 0 8px;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.selected-whatsapp-filters {
|
|
547
|
+
margin-top: -16px;
|
|
548
|
+
|
|
549
|
+
.cap-tag-v2{
|
|
550
|
+
font-size: 12px;
|
|
551
|
+
color: $CAP_G04;
|
|
552
|
+
white-space: pre-wrap;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.ant-anchor-link-title {
|
|
556
|
+
font-size: 12px;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.whatsapp-illustration-desc {
|
|
561
|
+
font-size: 14px;
|
|
562
|
+
color: rgba(0, 0, 0, 0.87);
|
|
563
|
+
margin: 8px 0;
|
|
564
|
+
white-space: pre-wrap;
|
|
565
|
+
}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as types from './constants';
|
|
8
|
+
import { LINE, WHATSAPP } from '../CreativesContainer/constants';
|
|
8
9
|
|
|
9
10
|
export function getAllTemplates(channel, queryParams) {
|
|
10
|
-
//
|
|
11
11
|
return {
|
|
12
12
|
type: types.GET_ALL_TEMPLATES_REQUEST, channel, queryParams,
|
|
13
13
|
};
|
|
@@ -26,7 +26,6 @@ export function resetAccount() {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export function deleteTemplate(channel, id) {
|
|
29
|
-
|
|
30
29
|
return {
|
|
31
30
|
type: types.DELETE_TEMPLATE_REQUEST, channel, id,
|
|
32
31
|
};
|
|
@@ -51,18 +50,23 @@ export function getAccountsSettings() {
|
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
export function setWeChatAccount(weChatAccount) {
|
|
54
|
-
|
|
55
53
|
return {
|
|
56
54
|
type: types.SET_WECHAT_ACCOUNT,
|
|
57
55
|
weChatAccount,
|
|
58
56
|
};
|
|
59
57
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
lineAccount,
|
|
58
|
+
export function setChannelAccount(channel, account) {
|
|
59
|
+
const channelTypeMapping = {
|
|
60
|
+
LINE: types.SET_LINE_ACCOUNT,
|
|
61
|
+
WHATSAPP: types.SET_WHATSAPP_ACCOUNT,
|
|
65
62
|
};
|
|
63
|
+
if (channelTypeMapping[channel]) {
|
|
64
|
+
return {
|
|
65
|
+
type: channelTypeMapping[channel],
|
|
66
|
+
account,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return {};
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
export function setViberAccount(viberAccount) {
|
|
@@ -114,7 +118,6 @@ export function setBEETemplate(template) {
|
|
|
114
118
|
};
|
|
115
119
|
}
|
|
116
120
|
export function getTemplateDetails(id, channel) {
|
|
117
|
-
|
|
118
121
|
return {
|
|
119
122
|
type: types.GET_TEMPLATE_DETAILS_REQUEST,
|
|
120
123
|
id,
|
|
@@ -129,7 +132,6 @@ export function resetTemplateData() {
|
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
export function resetUploadData() {
|
|
132
|
-
|
|
133
135
|
return {
|
|
134
136
|
type: types.RESET_UPLOAD_DATA,
|
|
135
137
|
};
|
|
@@ -45,7 +45,7 @@ export const CLEAR_TEMPLATE_STORE_DATA = "app/v2Containers/Templates/CLEAR_TEMPL
|
|
|
45
45
|
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
49
|
|
|
50
50
|
export const GET_DEAFULT_BEE_TEMPLATES_REQUEST = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_REQUEST';
|
|
51
51
|
export const GET_DEAFULT_BEE_TEMPLATES_SUCCESS = 'app/v2Containers/Templates/GET_DEAFULT_BEE_TEMPLATES_SUCCESS';
|
|
@@ -57,3 +57,5 @@ export const GET_ORG_LEVEL_CAMPAIGN_SETTINGS_SUCCESS =
|
|
|
57
57
|
'app/v2Containers/Templates/GET_ORG_LEVEL_CAMPAIGN_SETTINGS_SUCCESS';
|
|
58
58
|
export const GET_ORG_LEVEL_CAMPAIGN_SETTINGS_FAILURE =
|
|
59
59
|
'app/v2Containers/Templates/GET_ORG_LEVEL_CAMPAIGN_SETTINGS_FAILURE';
|
|
60
|
+
|
|
61
|
+
export const MAX_WHATSAPP_TEMPLATES = 250;
|