@capillarytech/creatives-library 8.0.87-alpha.2 → 8.0.87-alpha.20
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/initialState.js +1 -0
- package/package.json +1 -1
- package/services/api.js +9 -10
- package/utils/transformerUtils.js +509 -0
- package/v2Components/CapWhatsappCTA/messages.js +0 -4
- package/v2Components/FormBuilder/index.js +7 -3
- package/v2Components/TemplatePreview/_templatePreview.scss +0 -9
- package/v2Components/TemplatePreview/index.js +104 -169
- package/v2Containers/Cap/actions.js +8 -0
- package/v2Containers/Cap/constants.js +4 -0
- package/v2Containers/Cap/reducer.js +6 -0
- package/v2Containers/Cap/sagas.js +23 -0
- package/v2Containers/Cap/selectors.js +6 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +1 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +11 -1
- package/v2Containers/CreativesContainer/constants.js +3 -0
- package/v2Containers/CreativesContainer/index.js +77 -88
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +25 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +2 -0
- package/v2Containers/Email/index.js +1 -0
- package/v2Containers/EmailWrapper/index.js +2 -0
- package/v2Containers/MobilePush/Create/index.js +1 -0
- package/v2Containers/MobilePush/Edit/index.js +1 -0
- package/v2Containers/MobilepushWrapper/index.js +2 -1
- package/v2Containers/Sms/Create/index.js +1 -0
- package/v2Containers/Sms/Edit/index.js +1 -0
- package/v2Containers/SmsWrapper/index.js +2 -0
- package/v2Containers/Templates/_templates.scss +0 -35
- package/v2Containers/Templates/index.js +5 -64
- package/v2Containers/TemplatesV2/index.js +7 -0
- package/v2Containers/Whatsapp/constants.js +1 -83
- package/v2Containers/Whatsapp/index.js +182 -709
- package/v2Containers/Whatsapp/index.scss +1 -52
- package/v2Containers/Whatsapp/messages.js +2 -38
- package/v2Containers/Whatsapp/utils.js +0 -34
- package/v2Containers/mockdata.js +3 -0
- package/v2Components/CapWhatsappCarouselButton/constant.js +0 -51
- package/v2Components/CapWhatsappCarouselButton/index.js +0 -446
- package/v2Components/CapWhatsappCarouselButton/index.scss +0 -39
- package/v2Components/TemplatePreview/assets/images/empty_image_preview.svg +0 -4
- package/v2Components/TemplatePreview/assets/images/empty_video_preview.svg +0 -4
|
@@ -58,7 +58,11 @@ import {
|
|
|
58
58
|
CAP_SPACE_32, CAP_SPACE_56, CAP_SPACE_64,
|
|
59
59
|
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
60
60
|
import { DAEMON } from '@capillarytech/vulcan-react-sdk/utils/sagaInjectorTypes';
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
import {
|
|
63
|
+
transformChannelPayload,
|
|
64
|
+
// getTemplateDiffState
|
|
65
|
+
} from "../../utils/transformerUtils";
|
|
62
66
|
|
|
63
67
|
const classPrefix = 'add-creatives-section';
|
|
64
68
|
const CREATIVES_CONTAINER = 'creativesContainer';
|
|
@@ -230,39 +234,6 @@ export class Creatives extends React.Component {
|
|
|
230
234
|
this.setState({ isGetFormData: false });
|
|
231
235
|
};
|
|
232
236
|
|
|
233
|
-
mapCarouselDataToCreatives = (cards) => {
|
|
234
|
-
return cards.map((card) => {
|
|
235
|
-
const { cardVarMapped, cardTemplate, media, buttons, mediaType } = card || {};
|
|
236
|
-
const buttonData = buttons?.map((button) => {
|
|
237
|
-
const { type, text, phoneNumber, url, dynamicUrlPayload } = button;
|
|
238
|
-
const buttonObj = { type, text };
|
|
239
|
-
if (type === "PHONE_NUMBER") {
|
|
240
|
-
buttonObj.phone_number = phoneNumber;
|
|
241
|
-
}
|
|
242
|
-
if (type === "URL") {
|
|
243
|
-
buttonObj.url = url;
|
|
244
|
-
if (dynamicUrlPayload) {
|
|
245
|
-
buttonObj.urlType = DYNAMIC_URL;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return buttonObj;
|
|
249
|
-
});
|
|
250
|
-
return {
|
|
251
|
-
bodyText: cardTemplate,
|
|
252
|
-
varMap: cardVarMapped,
|
|
253
|
-
...(mediaType === "IMAGE" && {
|
|
254
|
-
imageUrl: media?.url,
|
|
255
|
-
}),
|
|
256
|
-
...(mediaType === "VIDEO" && {
|
|
257
|
-
videoUrl: media?.url,
|
|
258
|
-
videoPreviewImg: media?.previewUrl,
|
|
259
|
-
}),
|
|
260
|
-
buttons: buttonData,
|
|
261
|
-
mediaType: mediaType?.toLowerCase(),
|
|
262
|
-
};
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
|
|
266
237
|
getTemplateData = (templateData) => { //from consumers to creatives
|
|
267
238
|
const { isFullMode, messageDetails = {}, smsRegister } = this.props;
|
|
268
239
|
const { additionalProperties = {} } = messageDetails;
|
|
@@ -490,7 +461,8 @@ export class Creatives extends React.Component {
|
|
|
490
461
|
};
|
|
491
462
|
break;
|
|
492
463
|
}
|
|
493
|
-
case constants.WHATSAPP:
|
|
464
|
+
case constants.WHATSAPP:
|
|
465
|
+
case constants.WHATSAPP?.toLowerCase(): {
|
|
494
466
|
const {
|
|
495
467
|
messageBody = '',
|
|
496
468
|
templateConfigs: {
|
|
@@ -504,7 +476,6 @@ export class Creatives extends React.Component {
|
|
|
504
476
|
mediaType = 'TEXT',
|
|
505
477
|
whatsappMedia = {},
|
|
506
478
|
isPreviewUrl = false,
|
|
507
|
-
cards = [],
|
|
508
479
|
} = {},
|
|
509
480
|
} = templateData;
|
|
510
481
|
const mediaParams = {};
|
|
@@ -571,7 +542,6 @@ export class Creatives extends React.Component {
|
|
|
571
542
|
},
|
|
572
543
|
],
|
|
573
544
|
isPreviewUrl,
|
|
574
|
-
carouselData: this.mapCarouselDataToCreatives(cards),
|
|
575
545
|
},
|
|
576
546
|
},
|
|
577
547
|
},
|
|
@@ -618,47 +588,6 @@ export class Creatives extends React.Component {
|
|
|
618
588
|
return templateData || null;
|
|
619
589
|
}
|
|
620
590
|
|
|
621
|
-
getCarouselMappedData = (carouselData = []) => {
|
|
622
|
-
return carouselData.map((carousel) => {
|
|
623
|
-
const { bodyText, imageUrl, videoUrl, videoPreviewImg, buttons, mediaType, cardVarMapped, cardTemplate } = carousel || {};
|
|
624
|
-
const buttonData = buttons.map((button, index) => {
|
|
625
|
-
const { type, text, phone_number, urlType, url } = button;
|
|
626
|
-
const buttonObj = {
|
|
627
|
-
type,
|
|
628
|
-
text,
|
|
629
|
-
index,
|
|
630
|
-
};
|
|
631
|
-
if (type === 'PHONE_NUMBER') {
|
|
632
|
-
buttonObj.phoneNumber = phone_number;
|
|
633
|
-
}
|
|
634
|
-
if (type === 'URL') {
|
|
635
|
-
buttonObj.url = url;
|
|
636
|
-
if (urlType === "DYNAMIC_URL") {
|
|
637
|
-
const dynamicUrlPayload = url.match(/{{(.*?)}}/g);
|
|
638
|
-
buttonObj.dynamicUrlPayload = dynamicUrlPayload.length === 1 ? dynamicUrlPayload[0] : '';
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
return buttonObj;
|
|
642
|
-
});
|
|
643
|
-
return {
|
|
644
|
-
body: bodyText,
|
|
645
|
-
cardVarMapped,
|
|
646
|
-
cardTemplate,
|
|
647
|
-
media: {
|
|
648
|
-
...(mediaType === 'image' && {
|
|
649
|
-
url: imageUrl,
|
|
650
|
-
}),
|
|
651
|
-
...(mediaType === 'video' && {
|
|
652
|
-
url: videoUrl,
|
|
653
|
-
previewUrl: videoPreviewImg,
|
|
654
|
-
}),
|
|
655
|
-
},
|
|
656
|
-
buttons: buttonData,
|
|
657
|
-
mediaType: mediaType?.toUpperCase(),
|
|
658
|
-
};
|
|
659
|
-
});
|
|
660
|
-
};
|
|
661
|
-
|
|
662
591
|
getCreativesData = async (channel, template, templateRecords) => { //from creatives to consumers
|
|
663
592
|
let templateData = { channel };
|
|
664
593
|
switch (channel) {
|
|
@@ -831,7 +760,6 @@ export class Creatives extends React.Component {
|
|
|
831
760
|
headerTemplate = '',
|
|
832
761
|
} = {},
|
|
833
762
|
isPreviewUrl = false,
|
|
834
|
-
carouselData= [],
|
|
835
763
|
} = cloneDeep(versions.base.content.whatsapp);
|
|
836
764
|
|
|
837
765
|
const modifiedButtons = cloneDeep(buttons).map((btn) => {
|
|
@@ -898,15 +826,10 @@ export class Creatives extends React.Component {
|
|
|
898
826
|
varMapped,
|
|
899
827
|
category,
|
|
900
828
|
language: languages[0].language,
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
buttons: modifiedButtons,
|
|
904
|
-
whatsappMedia,
|
|
905
|
-
}),
|
|
906
|
-
...(mediaType === WHATSAPP_MEDIA_TYPES.CAROUSEL && {
|
|
907
|
-
cards: this.getCarouselMappedData(carouselData),
|
|
908
|
-
}),
|
|
829
|
+
buttonType,
|
|
830
|
+
buttons: modifiedButtons,
|
|
909
831
|
mediaType,
|
|
832
|
+
whatsappMedia,
|
|
910
833
|
isPreviewUrl,
|
|
911
834
|
},
|
|
912
835
|
};
|
|
@@ -1099,11 +1022,75 @@ export class Creatives extends React.Component {
|
|
|
1099
1022
|
const creativesData = this.getCreativesData(channel, template, templateData);// convers data to consumer understandable format
|
|
1100
1023
|
creativesData.then((data) => {
|
|
1101
1024
|
this.logGTMEvent(channel, data);
|
|
1102
|
-
this.
|
|
1025
|
+
this.processCentralCommsMetaId(channel, data);
|
|
1103
1026
|
});
|
|
1104
1027
|
},
|
|
1105
1028
|
);
|
|
1106
1029
|
}
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
processCentralCommsMetaId = (channel, creativesData) => {
|
|
1033
|
+
// Create the payload for the centralcommnsmetaId API call
|
|
1034
|
+
const { isLoyaltyModule, loyaltyMetaData } = this.props;
|
|
1035
|
+
const { actionName, setMetaData = () => {} } = this.props.loyaltyMetaData || {};
|
|
1036
|
+
const { formatMessage } = this.props.intl;
|
|
1037
|
+
|
|
1038
|
+
// const isTemplateModified = getTemplateDiffState(
|
|
1039
|
+
// channel,
|
|
1040
|
+
// loyaltyMetaData,
|
|
1041
|
+
// creativesData
|
|
1042
|
+
// );
|
|
1043
|
+
if (
|
|
1044
|
+
loyaltyMetaData
|
|
1045
|
+
&& isLoyaltyModule
|
|
1046
|
+
// && isTemplateModified
|
|
1047
|
+
&& actionName === constants.LOYALTY_SUPPORTED_ACTION
|
|
1048
|
+
) {
|
|
1049
|
+
const payload = transformChannelPayload(creativesData, {
|
|
1050
|
+
channel,
|
|
1051
|
+
loyaltyMetaData,
|
|
1052
|
+
});
|
|
1053
|
+
|
|
1054
|
+
// Callback function to handle API response
|
|
1055
|
+
const handleMetaIDResult = (result) => {
|
|
1056
|
+
if (result?.status?.code === 200) {
|
|
1057
|
+
setMetaData(result);
|
|
1058
|
+
this.props.getCreativesData(creativesData);
|
|
1059
|
+
} else {
|
|
1060
|
+
this.setState(
|
|
1061
|
+
(prevState) => ({
|
|
1062
|
+
liquidErrorMessage: {
|
|
1063
|
+
...prevState.liquidErrorMessage,
|
|
1064
|
+
STANDARD_ERROR_MSG:
|
|
1065
|
+
result?.errors?.length > 0
|
|
1066
|
+
? [
|
|
1067
|
+
...(prevState.liquidErrorMessage
|
|
1068
|
+
?.STANDARD_ERROR_MSG || []),
|
|
1069
|
+
formatMessage(messages.emailBodyEmptyError)
|
|
1070
|
+
]
|
|
1071
|
+
: prevState.liquidErrorMessage?.STANDARD_ERROR_MSG,
|
|
1072
|
+
LIQUID_ERROR_MSG: result?.errors?.map(
|
|
1073
|
+
(error) => error?.message
|
|
1074
|
+
) ?? [formatMessage(messages.somethingWentWrong)]
|
|
1075
|
+
}
|
|
1076
|
+
}),
|
|
1077
|
+
() => {
|
|
1078
|
+
this.showLiquidErrorInFooter(
|
|
1079
|
+
this.state.liquidErrorMessage
|
|
1080
|
+
);
|
|
1081
|
+
}
|
|
1082
|
+
);
|
|
1083
|
+
this.props.stopValidation();
|
|
1084
|
+
return;
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
|
|
1088
|
+
// Call the action to create central comms meta ID
|
|
1089
|
+
this.props.globalActions.createCentralCommsMetaId(payload, handleMetaIDResult);
|
|
1090
|
+
} else {
|
|
1091
|
+
// If not a loyalty module or different action, should work as usual
|
|
1092
|
+
this.props.getCreativesData(creativesData);
|
|
1093
|
+
}
|
|
1107
1094
|
};
|
|
1108
1095
|
|
|
1109
1096
|
setIsLoadingContent = (isLoadingContent) => {
|
|
@@ -1355,6 +1342,7 @@ export class Creatives extends React.Component {
|
|
|
1355
1342
|
enableNewChannels,
|
|
1356
1343
|
eventContextTags,
|
|
1357
1344
|
isLoyaltyModule,
|
|
1345
|
+
loyaltyMetaData = {},
|
|
1358
1346
|
} = this.props;
|
|
1359
1347
|
const mapTemplateCreate =
|
|
1360
1348
|
slidBoxContent === "createTemplate" &&
|
|
@@ -1460,6 +1448,7 @@ export class Creatives extends React.Component {
|
|
|
1460
1448
|
hostName={this.props?.hostName || ''}
|
|
1461
1449
|
eventContextTags={eventContextTags}
|
|
1462
1450
|
isLoyaltyModule={isLoyaltyModule}
|
|
1451
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
1463
1452
|
/>
|
|
1464
1453
|
)}
|
|
1465
1454
|
footer={this.shouldShowFooter() && (
|
|
@@ -15,6 +15,11 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
15
15
|
getFormData={[Function]}
|
|
16
16
|
handleClose={[Function]}
|
|
17
17
|
hostName=""
|
|
18
|
+
loyaltyMetaData={
|
|
19
|
+
Object {
|
|
20
|
+
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
21
|
+
}
|
|
22
|
+
}
|
|
18
23
|
onCallTaskSubmit={[Function]}
|
|
19
24
|
onChannelChange={[Function]}
|
|
20
25
|
onCreateComplete={[MockFunction]}
|
|
@@ -92,6 +97,11 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
92
97
|
getFormData={[Function]}
|
|
93
98
|
handleClose={[Function]}
|
|
94
99
|
hostName=""
|
|
100
|
+
loyaltyMetaData={
|
|
101
|
+
Object {
|
|
102
|
+
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
103
|
+
}
|
|
104
|
+
}
|
|
95
105
|
onCallTaskSubmit={[Function]}
|
|
96
106
|
onChannelChange={[Function]}
|
|
97
107
|
onCreateComplete={[MockFunction]}
|
|
@@ -169,6 +179,11 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
169
179
|
getFormData={[Function]}
|
|
170
180
|
handleClose={[Function]}
|
|
171
181
|
hostName=""
|
|
182
|
+
loyaltyMetaData={
|
|
183
|
+
Object {
|
|
184
|
+
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
185
|
+
}
|
|
186
|
+
}
|
|
172
187
|
onCallTaskSubmit={[Function]}
|
|
173
188
|
onChannelChange={[Function]}
|
|
174
189
|
onCreateComplete={[MockFunction]}
|
|
@@ -250,6 +265,11 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
250
265
|
getFormData={[Function]}
|
|
251
266
|
handleClose={[Function]}
|
|
252
267
|
hostName=""
|
|
268
|
+
loyaltyMetaData={
|
|
269
|
+
Object {
|
|
270
|
+
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
271
|
+
}
|
|
272
|
+
}
|
|
253
273
|
onCallTaskSubmit={[Function]}
|
|
254
274
|
onChannelChange={[Function]}
|
|
255
275
|
onCreateComplete={[MockFunction]}
|
|
@@ -331,6 +351,11 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
331
351
|
getFormData={[Function]}
|
|
332
352
|
handleClose={[Function]}
|
|
333
353
|
hostName=""
|
|
354
|
+
loyaltyMetaData={
|
|
355
|
+
Object {
|
|
356
|
+
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
357
|
+
}
|
|
358
|
+
}
|
|
334
359
|
onCallTaskSubmit={[Function]}
|
|
335
360
|
onChannelChange={[Function]}
|
|
336
361
|
onCreateComplete={[MockFunction]}
|
|
@@ -16,6 +16,7 @@ const {
|
|
|
16
16
|
smsTemplates,
|
|
17
17
|
emailEditTemplateData,
|
|
18
18
|
emailTemplates,
|
|
19
|
+
loyaltyMetaData,
|
|
19
20
|
} = mockdata;
|
|
20
21
|
|
|
21
22
|
jest.mock('../../../v2Components/FormBuilder', () => ({
|
|
@@ -40,6 +41,7 @@ describe('Test SlideBoxContent container', () => {
|
|
|
40
41
|
const renderFunction = (channel, mode, templates, templateData) => {
|
|
41
42
|
renderedComponent = shallowWithIntl(
|
|
42
43
|
<Creatives
|
|
44
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
43
45
|
Templates={templates}
|
|
44
46
|
channel={channel}
|
|
45
47
|
slidBoxContent={mode}
|
|
@@ -2747,6 +2747,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2747
2747
|
eventContextTags={this.props?.eventContextTags}
|
|
2748
2748
|
forwardedTags={this.props?.forwardedTags}
|
|
2749
2749
|
isLoyaltyModule={this.props?.isLoyaltyModule}
|
|
2750
|
+
messageDetails={this.props?.messageDetails}
|
|
2750
2751
|
/> : ''}
|
|
2751
2752
|
</Col>
|
|
2752
2753
|
</Row>
|
|
@@ -229,6 +229,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
229
229
|
eventContextTags,
|
|
230
230
|
// Flag to enable loyalty module specific features in the email editor
|
|
231
231
|
isLoyaltyModule,
|
|
232
|
+
messageDetails = {},
|
|
232
233
|
} = this.props;
|
|
233
234
|
const {
|
|
234
235
|
templateName,
|
|
@@ -303,6 +304,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
303
304
|
moduleType={moduleType}
|
|
304
305
|
eventContextTags={eventContextTags}
|
|
305
306
|
isLoyaltyModule={isLoyaltyModule}
|
|
307
|
+
messageDetails={messageDetails}
|
|
306
308
|
/>}
|
|
307
309
|
{!isShowEmailCreate && (
|
|
308
310
|
<CmsTemplatesComponent
|
|
@@ -1809,6 +1809,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1809
1809
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1810
1810
|
isFullMode={this.props.isFullMode}
|
|
1811
1811
|
eventContextTags={this.props?.eventContextTags}
|
|
1812
|
+
messageDetails={this.props?.messageDetails}
|
|
1812
1813
|
/>
|
|
1813
1814
|
</CapColumn>
|
|
1814
1815
|
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
@@ -1991,6 +1991,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1991
1991
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1992
1992
|
isFullMode={this.props.isFullMode}
|
|
1993
1993
|
eventContextTags={this.props?.eventContextTags}
|
|
1994
|
+
messageDetails={this.props?.messageDetails}
|
|
1994
1995
|
/>}
|
|
1995
1996
|
</CapColumn>
|
|
1996
1997
|
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
@@ -72,7 +72,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
render() {
|
|
75
|
-
const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = []} = this.props;
|
|
75
|
+
const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = [], messageDetails = {}} = this.props;
|
|
76
76
|
const {templateName} = this.state;
|
|
77
77
|
const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
|
|
78
78
|
return (
|
|
@@ -120,6 +120,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
120
120
|
templateData={templateData}
|
|
121
121
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
122
122
|
eventContextTags={eventContextTags}
|
|
123
|
+
messageDetails={messageDetails}
|
|
123
124
|
/>
|
|
124
125
|
|
|
125
126
|
|
|
@@ -994,6 +994,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
994
994
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
995
995
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
996
996
|
eventContextTags={this.props?.eventContextTags}
|
|
997
|
+
messageDetails={this.props?.messageDetails}
|
|
997
998
|
/>
|
|
998
999
|
</CapColumn>
|
|
999
1000
|
</CapRow>
|
|
@@ -992,6 +992,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
992
992
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
993
993
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
994
994
|
eventContextTags={this.props?.eventContextTags}
|
|
995
|
+
messageDetails={this.props?.messageDetails}
|
|
995
996
|
/>
|
|
996
997
|
</CapColumn>
|
|
997
998
|
</CapRow>
|
|
@@ -30,6 +30,7 @@ const SmsWrapper = (props) => {
|
|
|
30
30
|
smsRegister,
|
|
31
31
|
onShowTemplates,
|
|
32
32
|
eventContextTags,
|
|
33
|
+
messageDetails = {},
|
|
33
34
|
} = props;
|
|
34
35
|
|
|
35
36
|
const smsProps = {
|
|
@@ -46,6 +47,7 @@ const SmsWrapper = (props) => {
|
|
|
46
47
|
onPreviewContentClicked,
|
|
47
48
|
onTestContentClicked,
|
|
48
49
|
eventContextTags,
|
|
50
|
+
messageDetails,
|
|
49
51
|
};
|
|
50
52
|
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
51
53
|
return <>
|
|
@@ -172,41 +172,6 @@
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
.WHATSAPP {
|
|
177
|
-
.cap-custom-card {
|
|
178
|
-
.ant-card-body {
|
|
179
|
-
.ant-card-meta {
|
|
180
|
-
background-color: #f4f5f7;
|
|
181
|
-
padding: 0;
|
|
182
|
-
.ant-card-meta-description {
|
|
183
|
-
.whatsapp-container {
|
|
184
|
-
background-color: #FFFFFF;
|
|
185
|
-
padding: 0.857rem;
|
|
186
|
-
}
|
|
187
|
-
.whatsapp-carousel-container {
|
|
188
|
-
padding: 4px 0px 0.571rem;
|
|
189
|
-
border-radius: 6px;
|
|
190
|
-
background-color: rgb(255, 255, 255);
|
|
191
|
-
width: 80%;
|
|
192
|
-
flex-shrink: 0;
|
|
193
|
-
margin-right: 4px;
|
|
194
|
-
white-space: pre-wrap;
|
|
195
|
-
word-break: break-word;
|
|
196
|
-
overflow: auto;
|
|
197
|
-
text-align: left;
|
|
198
|
-
.whatsapp-carosuel-card {
|
|
199
|
-
margin: 2px 6px 1px 7px;
|
|
200
|
-
.whatsapp-carousel-body {
|
|
201
|
-
margin-bottom: 0.571rem;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
175
|
}
|
|
211
176
|
|
|
212
177
|
.create-new-link{
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
} from '../Whatsapp/constants';
|
|
117
117
|
import { INAPP_LAYOUT_DETAILS } from '../InApp/constants';
|
|
118
118
|
import { ZALO_STATUS_OPTIONS, ZALO_STATUSES } from '../Zalo/constants';
|
|
119
|
-
import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta, getWhatsappQuickReply, getWhatsappAutoFill
|
|
119
|
+
import { getWhatsappContent, getWhatsappStatus, getWhatsappCategory, getWhatsappCta, getWhatsappQuickReply, getWhatsappAutoFill } from '../Whatsapp/utils';
|
|
120
120
|
import { getRCSContent } from '../Rcs/utils';
|
|
121
121
|
import zaloMessages from '../Zalo/messages';
|
|
122
122
|
import globalMessages from '../../v2Containers/Cap/messages';
|
|
@@ -134,8 +134,7 @@ import whatsappOrZaloAccountIllustration from '../Assets/images/whatsappOrZaloAc
|
|
|
134
134
|
import rcsIllustration from '../Assets/images/rcsIllustration.png';
|
|
135
135
|
import zaloillustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
136
136
|
import inAppIllustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
|
|
137
|
-
|
|
138
|
-
import whatsappVideoEmptyPreview from '../../v2Components/TemplatePreview/assets/images/empty_video_preview.svg';
|
|
137
|
+
|
|
139
138
|
import { CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
140
139
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
141
140
|
import { MAPP_SDK } from '../InApp/constants';
|
|
@@ -1111,7 +1110,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1111
1110
|
? this.getCreativesEditText(channelLowerCase)
|
|
1112
1111
|
: messages.selectButton
|
|
1113
1112
|
);
|
|
1114
|
-
|
|
1113
|
+
|
|
1114
|
+
const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
|
|
1115
1115
|
const androidBodyType = get(template, 'versions.base.content.ANDROID.bodyType');
|
|
1116
1116
|
const iosBodyType = get(template, 'versions.base.content.IOS.bodyType');
|
|
1117
1117
|
const inappBodyType = androidBodyType || iosBodyType;
|
|
@@ -1366,7 +1366,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1366
1366
|
break;
|
|
1367
1367
|
}
|
|
1368
1368
|
case WHATSAPP: {
|
|
1369
|
-
const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoPreviewImg = '', templateHeaderPreview, templateFooterPreview
|
|
1369
|
+
const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoPreviewImg = '', templateHeaderPreview, templateFooterPreview} = getWhatsappContent(template);
|
|
1370
1370
|
templateData.title = (
|
|
1371
1371
|
<CapRow>
|
|
1372
1372
|
<CapLabel className="whatsapp-rcs-template-name">{template?.name}</CapLabel>
|
|
@@ -1375,7 +1375,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1375
1375
|
);
|
|
1376
1376
|
templateData.content = (
|
|
1377
1377
|
<>
|
|
1378
|
-
<div className='whatsapp-container'>
|
|
1379
1378
|
{whatsappImageSrc && (
|
|
1380
1379
|
<CapImage src={whatsappImageSrc} className="whatsapp-image" />
|
|
1381
1380
|
)}
|
|
@@ -1405,64 +1404,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1405
1404
|
{getWhatsappCta(template)}
|
|
1406
1405
|
{getWhatsappQuickReply(template)}
|
|
1407
1406
|
{getWhatsappAutoFill(template)}
|
|
1408
|
-
</div>
|
|
1409
|
-
<div
|
|
1410
|
-
style={{
|
|
1411
|
-
overflowX: "auto",
|
|
1412
|
-
display: "flex",
|
|
1413
|
-
paddingTop: "5px",
|
|
1414
|
-
paddingRight: "5px",
|
|
1415
|
-
whiteSpace: "nowrap",
|
|
1416
|
-
scrollbarWidth: "none", // Hide scrollbar in Firefox
|
|
1417
|
-
msOverflowStyle: "none", // Hide scrollbar in IE/Edge
|
|
1418
|
-
overflow: "hidden",
|
|
1419
|
-
}}
|
|
1420
|
-
className="scroll-container"
|
|
1421
|
-
>
|
|
1422
|
-
{carouselData.map((data, index) => {
|
|
1423
|
-
return (
|
|
1424
|
-
<div
|
|
1425
|
-
key={`carousel-${index}`}
|
|
1426
|
-
className="whatsapp-carousel-container"
|
|
1427
|
-
>
|
|
1428
|
-
<div className="whatsapp-carosuel-card">
|
|
1429
|
-
{data?.mediaType === "image" && (
|
|
1430
|
-
<CapImage
|
|
1431
|
-
src={data?.imageUrl ? data?.imageUrl : whatsappImageEmptyPreview}
|
|
1432
|
-
className="whatsapp-image"
|
|
1433
|
-
/>
|
|
1434
|
-
)}
|
|
1435
|
-
{data?.mediaType === "video" && (
|
|
1436
|
-
<div className="video-preview">
|
|
1437
|
-
<CapImage
|
|
1438
|
-
src={data?.videoPreviewImg ? data?.videoPreviewImg : whatsappVideoEmptyPreview}
|
|
1439
|
-
className="whatsapp-image"
|
|
1440
|
-
/>
|
|
1441
|
-
<div className="icon-position">
|
|
1442
|
-
<CapImage
|
|
1443
|
-
className="video-icon"
|
|
1444
|
-
src={videoPlay}
|
|
1445
|
-
/>
|
|
1446
|
-
</div>
|
|
1447
|
-
</div>
|
|
1448
|
-
)}
|
|
1449
|
-
<span
|
|
1450
|
-
className={`${
|
|
1451
|
-
(data?.imageUrl || data?.videoPreviewImg)
|
|
1452
|
-
? 'whatsapp-message-with-media'
|
|
1453
|
-
: 'whatsapp-message-without-media'
|
|
1454
|
-
}`}
|
|
1455
|
-
>
|
|
1456
|
-
<CapLabel type="label9" className='whatsapp-carousel-body'>
|
|
1457
|
-
{data?.bodyText}
|
|
1458
|
-
</CapLabel>
|
|
1459
|
-
</span>
|
|
1460
|
-
{getWhatsappCarouselButtonView(data?.buttons, false)}
|
|
1461
|
-
</div>
|
|
1462
|
-
</div>
|
|
1463
|
-
)
|
|
1464
|
-
})}
|
|
1465
|
-
</div>
|
|
1466
1407
|
</>
|
|
1467
1408
|
);
|
|
1468
1409
|
break;
|
|
@@ -56,6 +56,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
56
56
|
enableNewChannels = [],
|
|
57
57
|
currentOrgDetails = {},
|
|
58
58
|
cap = {},
|
|
59
|
+
loyaltyMetaData = {},
|
|
60
|
+
isLoyaltyModule = false,
|
|
59
61
|
} = props;
|
|
60
62
|
|
|
61
63
|
const defaultPanes = {
|
|
@@ -98,6 +100,11 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
98
100
|
}
|
|
99
101
|
const commonChannels = ['sms', 'email', 'wechat', 'mobilepush', 'line', 'viber', 'facebook', 'call_task', 'ftp', 'assets'];
|
|
100
102
|
|
|
103
|
+
const { actionName = ''} = loyaltyMetaData;
|
|
104
|
+
if (isLoyaltyModule && actionName === 'SEND_COMMUNICATION_ACTION') {
|
|
105
|
+
commonChannels.push('whatsapp', 'zalo');
|
|
106
|
+
}
|
|
107
|
+
|
|
101
108
|
// we only show channels which other than commonChannels
|
|
102
109
|
// if it is coming in enableNewChannels array
|
|
103
110
|
filteredPanes = filteredPanes.filter((item) => {
|