@capillarytech/creatives-library 7.12.51 → 7.12.53
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/package.json +1 -1
- package/services/api.js +15 -2
- package/v2Components/CapImageUpload/index.js +33 -17
- package/v2Components/CapImageUpload/messages.js +11 -3
- package/v2Components/CapWhatsappCTA/constants.js +12 -1
- package/v2Components/CapWhatsappCTA/index.js +88 -29
- package/v2Components/CapWhatsappCTA/index.scss +4 -6
- package/v2Components/CapWhatsappCTA/messages.js +24 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +9 -8
- package/v2Components/TemplatePreview/index.js +8 -6
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +3 -19
- package/v2Components/TemplatePreview/tests/index.test.js +0 -2
- package/v2Components/WhatsappStatusContainer/index.js +42 -52
- package/v2Containers/CreativesContainer/SlideBoxContent.js +0 -1
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +5 -7
- package/v2Containers/Line/Container/ImageCarousel/index.js +6 -7
- package/v2Containers/Line/Container/index.js +3 -1
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +4660 -652
- package/v2Containers/Templates/_templates.scss +5 -0
- package/v2Containers/Templates/actions.js +7 -0
- package/v2Containers/Templates/constants.js +9 -1
- package/v2Containers/Templates/index.js +45 -30
- package/v2Containers/Templates/messages.js +1 -1
- package/v2Containers/Templates/reducer.js +15 -0
- package/v2Containers/Templates/sagas.js +32 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1774 -1881
- package/v2Containers/Templates/tests/index.test.js +14 -3
- package/v2Containers/Whatsapp/actions.js +22 -0
- package/v2Containers/Whatsapp/constants.js +56 -23
- package/v2Containers/Whatsapp/index.js +204 -66
- package/v2Containers/Whatsapp/index.scss +18 -2
- package/v2Containers/Whatsapp/messages.js +35 -7
- package/v2Containers/Whatsapp/reducer.js +35 -1
- package/v2Containers/Whatsapp/sagas.js +30 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +44349 -32926
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +15 -21
- package/v2Containers/Whatsapp/utils.js +16 -9
- package/v2Containers/mockdata.js +150 -399
|
@@ -1,58 +1,48 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { WHATSAPP } from '../../v2Containers/CreativesContainer/constants';
|
|
2
|
+
import { get } from 'lodash';
|
|
4
3
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
CapRow,
|
|
5
|
+
CapStatus,
|
|
6
|
+
CapColoredTag,
|
|
7
|
+
} from '@capillarytech/cap-ui-library';
|
|
8
|
+
import {
|
|
9
|
+
getWhatsappCategory,
|
|
10
|
+
getWhatsappStatus,
|
|
11
|
+
} from '../../v2Containers/Whatsapp/utils';
|
|
9
12
|
import './_whatsappStatusContainer.scss';
|
|
10
13
|
|
|
11
14
|
export const WhatsappStatusContainer = (props) => {
|
|
15
|
+
const {
|
|
16
|
+
status = '',
|
|
17
|
+
category = '',
|
|
18
|
+
hostName = '',
|
|
19
|
+
} = get(props, 'template.versions.base.content.whatsapp', {});
|
|
20
|
+
const categoryObj = getWhatsappCategory(category, hostName) || {};
|
|
21
|
+
const {
|
|
22
|
+
label: categoryLabel,
|
|
23
|
+
tagColor: categoryTagColor,
|
|
24
|
+
tagTextColor: categoryTextColor,
|
|
25
|
+
} = categoryObj;
|
|
26
|
+
return (
|
|
27
|
+
<CapRow type="flex" align="middle" className="whatsapp-status-container">
|
|
28
|
+
<CapStatus
|
|
29
|
+
type={status}
|
|
30
|
+
text={getWhatsappStatus(status)?.label}
|
|
31
|
+
labelType="label3"
|
|
32
|
+
/>
|
|
33
|
+
{categoryLabel ? (
|
|
34
|
+
<CapColoredTag
|
|
35
|
+
tagColor={categoryTagColor}
|
|
36
|
+
tagTextColor={categoryTextColor}
|
|
37
|
+
tagHeight="20px"
|
|
38
|
+
tagFontSize="12px"
|
|
39
|
+
className="whatsapp-category-tag"
|
|
40
|
+
>
|
|
41
|
+
{categoryLabel}
|
|
42
|
+
</CapColoredTag>
|
|
43
|
+
) : null}
|
|
44
|
+
</CapRow>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
12
47
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const {
|
|
16
|
-
versions: {
|
|
17
|
-
base: {
|
|
18
|
-
content: {
|
|
19
|
-
[WHATSAPP.toLowerCase()]: {
|
|
20
|
-
[WHATSAPP_STATUS]: status,
|
|
21
|
-
[WHATSAPP_CATEGORY]: category,
|
|
22
|
-
} = {},
|
|
23
|
-
} = {},
|
|
24
|
-
} = {},
|
|
25
|
-
} = {},
|
|
26
|
-
} = template;
|
|
27
|
-
|
|
28
|
-
const categoryObj = getWhatsappCategory(category) || {};
|
|
29
|
-
const {
|
|
30
|
-
label: categoryLabel,
|
|
31
|
-
tagColor: categoryTagColor,
|
|
32
|
-
tagTextColor: categoryTextColor,
|
|
33
|
-
} = categoryObj;
|
|
34
|
-
return (
|
|
35
|
-
<CapRow type="flex" align="middle" className="whatsapp-status-container">
|
|
36
|
-
<CapStatus
|
|
37
|
-
type={status}
|
|
38
|
-
text={getWhatsappStatus(status)?.label}
|
|
39
|
-
labelType="label3"
|
|
40
|
-
/>
|
|
41
|
-
{
|
|
42
|
-
categoryLabel ? (
|
|
43
|
-
<CapColoredTag
|
|
44
|
-
tagColor={categoryTagColor}
|
|
45
|
-
tagTextColor={categoryTextColor}
|
|
46
|
-
tagHeight="20px"
|
|
47
|
-
tagFontSize="12px"
|
|
48
|
-
className="whatsapp-category-tag"
|
|
49
|
-
>
|
|
50
|
-
{categoryLabel}
|
|
51
|
-
</CapColoredTag>
|
|
52
|
-
) : null
|
|
53
|
-
}
|
|
54
|
-
</CapRow>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export default WhatsappStatusContainer;
|
|
48
|
+
export default WhatsappStatusContainer;
|
|
@@ -414,7 +414,6 @@ export function SlideBoxContent(props) {
|
|
|
414
414
|
content={getChannelPreviewContent(templateData)}
|
|
415
415
|
viberBrandName={selectedAccount || ""}
|
|
416
416
|
viberAccountName={(selectedAccount || "")[0]}
|
|
417
|
-
whatsappAccountName={selectedAccount}
|
|
418
417
|
unicodeEnabled={get(templateData, `versions.base['unicode-validity']`)}
|
|
419
418
|
channel={(templateData.type || '').toLowerCase()}
|
|
420
419
|
charCounterEnabled={channel === constants.SMS}
|
|
@@ -725,14 +725,12 @@ exports[`Test SlideBoxContent container Should render correct component for what
|
|
|
725
725
|
"url": "https://fast.com/",
|
|
726
726
|
},
|
|
727
727
|
],
|
|
728
|
-
"templateMsg": <
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
1234567890
|
|
728
|
+
"templateMsg": <CapLabel
|
|
729
|
+
type="label5"
|
|
730
|
+
>
|
|
731
|
+
1234567890
|
|
733
732
|
Click {{unsubscribe}} to unsubscribe
|
|
734
|
-
|
|
735
|
-
</React.Fragment>,
|
|
733
|
+
</CapLabel>,
|
|
736
734
|
}
|
|
737
735
|
}
|
|
738
736
|
showCount={true}
|
|
@@ -72,21 +72,20 @@ export const LineImageCarousel = (props) => {
|
|
|
72
72
|
const [errorTitle, updateErrorTitle] = useState(false);
|
|
73
73
|
|
|
74
74
|
useEffect(() => {
|
|
75
|
-
const { messageTitle = '', type, template, altText } = content;
|
|
75
|
+
const { messageTitle = '', type, template, altText, contents } = content;
|
|
76
76
|
if ([TEMPLATE, FLEX].includes(type)) {
|
|
77
|
-
updateCreateNew(!isFullMode ? !!template : true);
|
|
77
|
+
updateCreateNew(!isFullMode ? !!(template || contents) : true);
|
|
78
78
|
if (messageTitle) {
|
|
79
79
|
updateTextMessageTitle(messageTitle);
|
|
80
80
|
}
|
|
81
81
|
if (altText) {
|
|
82
82
|
updateTitle(altText);
|
|
83
83
|
}
|
|
84
|
-
if (template) {
|
|
84
|
+
if (template || contents) {
|
|
85
85
|
const validCarouselImages = [];
|
|
86
|
-
if (template?.type === CAROUSEL) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const {
|
|
86
|
+
if (template?.type === CAROUSEL || contents?.type === CAROUSEL ) {
|
|
87
|
+
const { contents: innerContents = [] } = contents || template || [];
|
|
88
|
+
innerContents.forEach((content = {}, index) => { const {
|
|
90
89
|
footer: {
|
|
91
90
|
contents: [{
|
|
92
91
|
action: {
|
|
@@ -172,6 +172,7 @@ export const LineContainer = ({
|
|
|
172
172
|
assetType,
|
|
173
173
|
selectedTemplate,
|
|
174
174
|
template,
|
|
175
|
+
contents,
|
|
175
176
|
altText,
|
|
176
177
|
video,
|
|
177
178
|
videoName,
|
|
@@ -189,6 +190,7 @@ export const LineContainer = ({
|
|
|
189
190
|
assetType,
|
|
190
191
|
selectedTemplate,
|
|
191
192
|
template,
|
|
193
|
+
contents,
|
|
192
194
|
altText,
|
|
193
195
|
video,
|
|
194
196
|
videoName,
|
|
@@ -573,7 +575,7 @@ export const LineContainer = ({
|
|
|
573
575
|
});
|
|
574
576
|
contentsLocal.contents = imageContents;
|
|
575
577
|
contentsLocal.type = "carousel";
|
|
576
|
-
messageData.
|
|
578
|
+
messageData.contents = contentsLocal;
|
|
577
579
|
messageData.altText = altText;
|
|
578
580
|
}
|
|
579
581
|
if (videoSrc) {
|