@capillarytech/creatives-library 7.17.82-alpha.0 → 7.17.82-alpha.1
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/containers/Cap/sagas.js +7 -5
- package/containers/Cap/tests/saga.test.js +81 -1
- package/package.json +2 -2
- package/services/api.js +5 -0
- package/services/tests/api.test.js +9 -1
- package/v2Components/CapWhatsappQuickReply/index.js +96 -83
- package/v2Components/CapWhatsappQuickReply/index.scss +4 -1
- package/v2Components/CapWhatsappQuickReply/messages.js +4 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +23 -0
- package/v2Components/TemplatePreview/index.js +43 -23
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +0 -14
- package/v2Containers/CreativesContainer/index.js +22 -2
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +4 -4
- package/v2Containers/Templates/index.js +3 -3
- package/v2Containers/Whatsapp/actions.js +16 -0
- package/v2Containers/Whatsapp/constants.js +8 -1
- package/v2Containers/Whatsapp/index.js +347 -253
- package/v2Containers/Whatsapp/index.scss +12 -1
- package/v2Containers/Whatsapp/messages.js +10 -1
- package/v2Containers/Whatsapp/reducer.js +19 -0
- package/v2Containers/Whatsapp/sagas.js +40 -1
- package/v2Containers/Whatsapp/styles.scss +6 -3
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +12145 -51281
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +20 -20
- package/v2Containers/Whatsapp/tests/actions.test.js +21 -0
- package/v2Containers/Whatsapp/tests/index.test.js +8 -0
- package/v2Containers/Whatsapp/tests/mockData.js +6 -0
- package/v2Containers/Whatsapp/tests/reducer.test.js +67 -0
- package/v2Containers/Whatsapp/tests/saga.test.js +90 -0
- package/v2Containers/Whatsapp/utils.js +13 -13
- package/v2Containers/mockdata.js +8 -18
|
@@ -98,13 +98,6 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
98
98
|
>
|
|
99
99
|
<CapIcon
|
|
100
100
|
size="xs"
|
|
101
|
-
svgProps={
|
|
102
|
-
Object {
|
|
103
|
-
"style": Object {
|
|
104
|
-
"marginRight": "4px",
|
|
105
|
-
},
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
101
|
type="call"
|
|
109
102
|
/>
|
|
110
103
|
Call
|
|
@@ -115,13 +108,6 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
115
108
|
>
|
|
116
109
|
<CapIcon
|
|
117
110
|
size="xs"
|
|
118
|
-
svgProps={
|
|
119
|
-
Object {
|
|
120
|
-
"style": Object {
|
|
121
|
-
"marginRight": "4px",
|
|
122
|
-
},
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
111
|
type="launch"
|
|
126
112
|
/>
|
|
127
113
|
Visit
|
|
@@ -411,10 +411,11 @@ export class Creatives extends React.Component {
|
|
|
411
411
|
buttons = [],
|
|
412
412
|
mediaType = 'TEXT',
|
|
413
413
|
whatsappMedia = {},
|
|
414
|
+
isPreviewUrl = false,
|
|
414
415
|
} = {},
|
|
415
416
|
} = templateData;
|
|
416
417
|
const mediaParams = {};
|
|
417
|
-
const { url = '', previewUrl = '', docParams = {}} = whatsappMedia;
|
|
418
|
+
const { url = '', previewUrl = '', docParams = {}, footer = '', headerVarMapped = {}, headerTemplate = ''} = whatsappMedia;
|
|
418
419
|
switch (mediaType) {
|
|
419
420
|
case (WHATSAPP_MEDIA_TYPES.IMAGE):
|
|
420
421
|
mediaParams.imageUrl = url;
|
|
@@ -462,6 +463,11 @@ export class Creatives extends React.Component {
|
|
|
462
463
|
...mediaParams,
|
|
463
464
|
buttonType,
|
|
464
465
|
buttons: modifiedButtons,
|
|
466
|
+
whatsappMedia: {
|
|
467
|
+
header: headerTemplate,
|
|
468
|
+
footer,
|
|
469
|
+
headerVarMapped,
|
|
470
|
+
},
|
|
465
471
|
languages: [
|
|
466
472
|
{
|
|
467
473
|
language,
|
|
@@ -471,6 +477,7 @@ export class Creatives extends React.Component {
|
|
|
471
477
|
: template,
|
|
472
478
|
},
|
|
473
479
|
],
|
|
480
|
+
isPreviewUrl,
|
|
474
481
|
},
|
|
475
482
|
},
|
|
476
483
|
},
|
|
@@ -667,6 +674,13 @@ export class Creatives extends React.Component {
|
|
|
667
674
|
documentUrl = '',
|
|
668
675
|
videoPreviewImg = '',
|
|
669
676
|
whatsappDocParams = {},
|
|
677
|
+
whatsappMedia: {
|
|
678
|
+
header = '',
|
|
679
|
+
headerVarMapped = {},
|
|
680
|
+
footer = '',
|
|
681
|
+
headerTemplate = '',
|
|
682
|
+
} = {},
|
|
683
|
+
isPreviewUrl = false,
|
|
670
684
|
} = cloneDeep(versions.base.content.whatsapp);
|
|
671
685
|
|
|
672
686
|
const modifiedButtons = cloneDeep(buttons).map((btn) => {
|
|
@@ -691,7 +705,12 @@ export class Creatives extends React.Component {
|
|
|
691
705
|
varMapped[`{{${Object.keys(varMapped).length + 1}}}_unsubscribe`] =
|
|
692
706
|
"{{unsubscribe}}";
|
|
693
707
|
}
|
|
694
|
-
const whatsappMedia = {
|
|
708
|
+
const whatsappMedia = {
|
|
709
|
+
header,
|
|
710
|
+
footer,
|
|
711
|
+
headerVarMapped,
|
|
712
|
+
headerTemplate
|
|
713
|
+
};
|
|
695
714
|
const {
|
|
696
715
|
whatsappDocName = '', whatsappDocSize, whatsappDocPages, whatsappDocImg = ''
|
|
697
716
|
} = whatsappDocParams;
|
|
@@ -731,6 +750,7 @@ export class Creatives extends React.Component {
|
|
|
731
750
|
buttons: modifiedButtons,
|
|
732
751
|
mediaType,
|
|
733
752
|
whatsappMedia,
|
|
753
|
+
isPreviewUrl,
|
|
734
754
|
},
|
|
735
755
|
};
|
|
736
756
|
}
|
|
@@ -710,7 +710,8 @@ exports[`Test SlideBoxContent container Should render correct component for what
|
|
|
710
710
|
charCounterEnabled={false}
|
|
711
711
|
content={
|
|
712
712
|
Object {
|
|
713
|
-
"
|
|
713
|
+
"charCount": 151,
|
|
714
|
+
"ctaData": Array [
|
|
714
715
|
Object {
|
|
715
716
|
"index": 0,
|
|
716
717
|
"phone_number": "+919738752617",
|
|
@@ -724,9 +725,8 @@ exports[`Test SlideBoxContent container Should render correct component for what
|
|
|
724
725
|
"url": "https://docs.google.com/{{1}}",
|
|
725
726
|
},
|
|
726
727
|
],
|
|
727
|
-
"
|
|
728
|
-
"
|
|
729
|
-
"headerMsg": "",
|
|
728
|
+
"templateFooterPreview": "",
|
|
729
|
+
"templateHeaderPreview": "",
|
|
730
730
|
"templateMsg": <CapLabel
|
|
731
731
|
type="label5"
|
|
732
732
|
>
|
|
@@ -1174,7 +1174,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1174
1174
|
break;
|
|
1175
1175
|
}
|
|
1176
1176
|
case WHATSAPP: {
|
|
1177
|
-
const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoPreviewImg = '',
|
|
1177
|
+
const { whatsappImageSrc = '', templateMsg, docPreview, whatsappVideoPreviewImg = '', templateHeaderPreview, templateFooterPreview} = getWhatsappContent(template);
|
|
1178
1178
|
templateData.title = (
|
|
1179
1179
|
<CapRow>
|
|
1180
1180
|
<CapLabel className="whatsapp-rcs-template-name">{template?.name}</CapLabel>
|
|
@@ -1205,9 +1205,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1205
1205
|
: 'whatsapp-message-without-media'
|
|
1206
1206
|
}`}
|
|
1207
1207
|
>
|
|
1208
|
-
{
|
|
1208
|
+
{templateHeaderPreview}
|
|
1209
1209
|
{templateMsg}
|
|
1210
|
-
{
|
|
1210
|
+
{templateFooterPreview}
|
|
1211
1211
|
</span>
|
|
1212
1212
|
{getWhatsappCta(template)}
|
|
1213
1213
|
{getWhatsappQuickReply(template)}
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
WHATSAPP,
|
|
7
7
|
UPLOAD_WHATSAPP_ASSET_REQUEST,
|
|
8
8
|
CLEAR_WHATSAPP_ASSET,
|
|
9
|
+
URL_META_TAGS_REQUEST,
|
|
10
|
+
URL_META_TAGS_RESET,
|
|
9
11
|
} from './constants';
|
|
10
12
|
|
|
11
13
|
export function createWhatsappTemplate(payload, callback, gupshupMediaFile) {
|
|
@@ -55,3 +57,17 @@ export const clearWhatsappAsset = (templateType) => ({
|
|
|
55
57
|
type: CLEAR_WHATSAPP_ASSET,
|
|
56
58
|
templateType,
|
|
57
59
|
});
|
|
60
|
+
|
|
61
|
+
export function getMetaTags({previewUrl, callBack}) {
|
|
62
|
+
return {
|
|
63
|
+
type: URL_META_TAGS_REQUEST,
|
|
64
|
+
previewUrl,
|
|
65
|
+
callBack,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function resetMetaTags() {
|
|
70
|
+
return {
|
|
71
|
+
type: URL_META_TAGS_RESET,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -13,7 +13,7 @@ export const UNSUBSCRIBE_TEXT_LENGTH = 36;
|
|
|
13
13
|
export const TEMPLATE_MESSAGE_MAX_LENGTH = 1024;
|
|
14
14
|
export const WHATSAPP = 'WHATSAPP';
|
|
15
15
|
export const TEMPLATE_HEADER_MAX_LENGTH = 60;
|
|
16
|
-
export const
|
|
16
|
+
export const QUICK_REPLY_BUTTON_TEXT_MAX_LENGTH = 20;
|
|
17
17
|
|
|
18
18
|
const prefix = 'app/v2Containers/Whatsapp';
|
|
19
19
|
export const TEMPLATE_CREATE_REQUEST = `${prefix}/TEMPLATE_CREATE_REQUEST`;
|
|
@@ -31,6 +31,12 @@ export const UPLOAD_WHATSAPP_ASSET_SUCCESS = `${prefix}/UPLOAD_WHATSAPP_ASSET_SU
|
|
|
31
31
|
export const UPLOAD_WHATSAPP_ASSET_FAILURE = `${prefix}/UPLOAD_WHATSAPP_ASSET_FAILURE`;
|
|
32
32
|
export const CLEAR_WHATSAPP_ASSET = `${prefix}/CLEAR_WHATSAPP_ASSET`;
|
|
33
33
|
|
|
34
|
+
//For meta tags
|
|
35
|
+
export const URL_META_TAGS_REQUEST = `${prefix}/URL_META_TAGS_REQUEST`;
|
|
36
|
+
export const URL_META_TAGS_SUCCESS = `${prefix}/URL_META_TAGS_SUCCESS`;
|
|
37
|
+
export const URL_META_TAGS_FAILURE = `${prefix}/URL_META_TAGS_FAILURE`;
|
|
38
|
+
export const URL_META_TAGS_RESET = `${prefix}/URL_META_TAGS_RESET`;
|
|
39
|
+
|
|
34
40
|
export const STATUS = 'status';
|
|
35
41
|
export const CATEGORY = 'category';
|
|
36
42
|
|
|
@@ -183,6 +189,7 @@ export const QUICK_REPLY = 'QUICK_REPLY';
|
|
|
183
189
|
export const HEADER_TEXT = 'header';
|
|
184
190
|
export const FOOTER_TEXT = 'footer';
|
|
185
191
|
export const MESSAGE_TEXT = 'message';
|
|
192
|
+
export const BUTTON_TEXT = 'buttonText'
|
|
186
193
|
export const WHATSAPP_BUTTON_TYPES = {
|
|
187
194
|
NONE,
|
|
188
195
|
CTA,
|