@capillarytech/creatives-library 7.12.49 → 7.12.50
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/package.json +1 -1
- package/v2Components/TemplatePreview/index.js +1 -1
- package/v2Containers/Cap/tests/index.test.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -8
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +36 -28
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +337 -160
- package/v2Containers/CreativesContainer/tests/index.test.js +3 -0
- package/v2Containers/Line/Container/ImageCarousel/Content.js +29 -15
- package/v2Containers/Line/Container/ImageCarousel/constants.js +0 -3
- package/v2Containers/Line/Container/ImageCarousel/index.js +40 -28
- package/v2Containers/Line/Container/ImageCarousel/messages.js +2 -2
- package/v2Containers/Line/Container/index.js +1 -5
- package/v2Containers/Templates/constants.js +1 -1
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1 -381
- package/v2Containers/Templates/tests/index.test.js +1 -7
- package/v2Containers/mockdata.js +156 -60
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +0 -9851
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +0 -21113
- package/v2Containers/Line/Container/ImageCarousel/tests/content.test.js +0 -71
- package/v2Containers/Line/Container/ImageCarousel/tests/index.test.js +0 -58
- package/v2Containers/Line/Container/ImageCarousel/tests/mockData.js +0 -1322
- package/v2Containers/Line/Container/ImageCarousel/tests/utils.test.js +0 -13
- package/v2Containers/Line/Container/ImageCarousel/utils.js +0 -12
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +0 -84451
- package/v2Containers/Line/Container/Wrapper/tests/index.test.js +0 -58
- package/v2Containers/Line/Container/Wrapper/tests/mockData.js +0 -171
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +0 -63597
- package/v2Containers/Line/Container/tests/index.test.js +0 -105
- package/v2Containers/Line/Container/tests/mockData.js +0 -1334
package/config/app.js
CHANGED
|
@@ -17,6 +17,7 @@ const config = {
|
|
|
17
17
|
},
|
|
18
18
|
development: {
|
|
19
19
|
api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
|
|
20
|
+
//api_endpoint: 'http://localhost:2022/arya/api/v1/creatives',
|
|
20
21
|
campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
|
|
21
22
|
campaigns_api_org_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/org/campaign',
|
|
22
23
|
auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
|
package/package.json
CHANGED
|
@@ -616,7 +616,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
616
616
|
</div>
|
|
617
617
|
);
|
|
618
618
|
}
|
|
619
|
-
if ((type === IMAGE_CAROUSEL || type === TEMPLATE
|
|
619
|
+
if ((type === IMAGE_CAROUSEL || type === TEMPLATE) && imageCarousel) {
|
|
620
620
|
return (
|
|
621
621
|
<div
|
|
622
622
|
style={{
|
|
@@ -3,9 +3,9 @@ import { injectIntl } from 'react-intl';
|
|
|
3
3
|
|
|
4
4
|
import * as actions from '../actions';
|
|
5
5
|
import {Cap} from '../index';
|
|
6
|
-
import
|
|
6
|
+
import mockdata from '../../mockdata';
|
|
7
7
|
import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
8
|
-
const { match, location, capGlobal, language } =
|
|
8
|
+
const { match, location, capGlobal, language } = mockdata;
|
|
9
9
|
|
|
10
10
|
jest.mock('@capillarytech/cap-ui-utils', () => ({
|
|
11
11
|
GA: {
|
|
@@ -6,6 +6,7 @@ import cloneDeep from 'lodash/cloneDeep';
|
|
|
6
6
|
import TemplatesV2 from '../TemplatesV2';
|
|
7
7
|
import TemplatePreview from '../../v2Components/TemplatePreview';
|
|
8
8
|
import SmsWrapper from '../SmsWrapper';
|
|
9
|
+
import isEmpty from 'lodash/isEmpty';
|
|
9
10
|
// import SmsEdit from '../Sms/Edit';
|
|
10
11
|
import Email from '../Email';
|
|
11
12
|
import EmailWrapper from '../EmailWrapper';
|
|
@@ -239,10 +240,9 @@ export function SlideBoxContent(props) {
|
|
|
239
240
|
baseUrl,
|
|
240
241
|
video,
|
|
241
242
|
template,
|
|
242
|
-
contents
|
|
243
|
-
type = '',
|
|
243
|
+
contents,
|
|
244
244
|
}) => {
|
|
245
|
-
const isNewLineFormat =
|
|
245
|
+
const isNewLineFormat = isEmpty(template) && !isEmpty(contents);
|
|
246
246
|
const {
|
|
247
247
|
originalContentUrl,
|
|
248
248
|
externalLink: {
|
|
@@ -262,11 +262,10 @@ export function SlideBoxContent(props) {
|
|
|
262
262
|
previewContent.video = originalContentUrl;
|
|
263
263
|
previewContent.actionUrl = linkUri;
|
|
264
264
|
if (isNewLineFormat) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}));
|
|
265
|
+
previewContent.imageCarousel = get(contents, 'contents', [{}]).map(({
|
|
266
|
+
hero: { url = ''} = {},
|
|
267
|
+
footer: { contents: [{ action: { label = '' } = {} }] = [{}] } = {},
|
|
268
|
+
}) => ({ imageUrl: url, actionLabel: label }));
|
|
270
269
|
} else {
|
|
271
270
|
previewContent.imageCarousel = get(template, 'columns', [{}]).map(({ imageUrl, action: { label: actionLabel } = {} }) => ({ imageUrl, actionLabel }) );
|
|
272
271
|
}
|
|
@@ -4,22 +4,11 @@ import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
|
4
4
|
import { SlideBoxContent } from '../SlideBoxContent';
|
|
5
5
|
import mockdata from '../../mockdata';
|
|
6
6
|
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
rcsEditTemplateData,
|
|
11
|
-
rcsPreviewTemplateData,
|
|
12
|
-
linePreviewTemplateData1,
|
|
13
|
-
linePreviewTemplateData2,
|
|
14
|
-
} = mockdata;
|
|
15
|
-
|
|
16
|
-
jest.mock('../../../v2Components/FormBuilder', () => ({
|
|
7
|
+
const { whatsappEditTemplateData, whatsappPreviewTemplateData, rcsEditTemplateData, rcsPreviewTemplateData, lineEditTemplateData, linePreviewTemplateData1, linePreviewTemplateData2, linePreviewTemplateData3, linePreviewTemplateData4, linePreviewTemplateContent, viberPreviewTemplateData } = mockdata;
|
|
8
|
+
|
|
9
|
+
jest.mock("../../../v2Components/FormBuilder", () => ({
|
|
17
10
|
__esModule: true,
|
|
18
|
-
default: (props) =>
|
|
19
|
-
<div className="FormBuilder-mock" {...props}>
|
|
20
|
-
FormBuilder
|
|
21
|
-
</div>
|
|
22
|
-
),
|
|
11
|
+
default: (props) => <div className="FormBuilder-mock" {...props}>FormBuilder</div>,
|
|
23
12
|
}));
|
|
24
13
|
|
|
25
14
|
describe('Test SlideBoxContent container', () => {
|
|
@@ -33,57 +22,76 @@ describe('Test SlideBoxContent container', () => {
|
|
|
33
22
|
currentChannel={channel}
|
|
34
23
|
templateData={templateData}
|
|
35
24
|
onCreateComplete={onCreateComplete}
|
|
36
|
-
|
|
25
|
+
/>
|
|
37
26
|
);
|
|
38
27
|
};
|
|
39
28
|
|
|
40
29
|
it('Should render correct component for whatsapp channel create mode', () => {
|
|
41
|
-
renderFunction(
|
|
30
|
+
renderFunction("WHATSAPP", "createTemplate", { mode: "create" });
|
|
42
31
|
expect(renderedComponent).toMatchSnapshot();
|
|
43
32
|
});
|
|
44
33
|
|
|
45
34
|
it('Should render correct component for whatsapp channel edit mode', () => {
|
|
46
|
-
renderFunction(
|
|
35
|
+
renderFunction("WHATSAPP", "editTemplate", whatsappEditTemplateData);
|
|
47
36
|
expect(renderedComponent).toMatchSnapshot();
|
|
48
37
|
});
|
|
49
38
|
|
|
50
39
|
it('Should render correct component for whatsapp channel preview mode', () => {
|
|
51
|
-
renderFunction(
|
|
40
|
+
renderFunction("WHATSAPP", "preview", whatsappPreviewTemplateData);
|
|
52
41
|
expect(renderedComponent).toMatchSnapshot();
|
|
53
42
|
});
|
|
54
43
|
|
|
55
44
|
it('Should render correct component for whatsapp channel templates mode', () => {
|
|
56
|
-
renderFunction(
|
|
45
|
+
renderFunction("WHATSAPP", "templates");
|
|
57
46
|
expect(renderedComponent).toMatchSnapshot();
|
|
58
47
|
});
|
|
59
48
|
|
|
60
49
|
it('Should render correct component for rcs channel create mode', () => {
|
|
61
|
-
renderFunction(
|
|
50
|
+
renderFunction("RCS", "createTemplate", { mode: "create" });
|
|
62
51
|
expect(renderedComponent).toMatchSnapshot();
|
|
63
52
|
});
|
|
64
53
|
|
|
65
54
|
it('Should render correct component for rcs channel edit mode', () => {
|
|
66
|
-
renderFunction(
|
|
55
|
+
renderFunction("RCs", "editTemplate", rcsEditTemplateData);
|
|
67
56
|
expect(renderedComponent).toMatchSnapshot();
|
|
68
57
|
});
|
|
69
58
|
|
|
70
59
|
it('Should render correct component for rcs channel preview mode', () => {
|
|
71
|
-
renderFunction(
|
|
60
|
+
renderFunction("RCS", "preview", rcsPreviewTemplateData);
|
|
72
61
|
expect(renderedComponent).toMatchSnapshot();
|
|
73
62
|
});
|
|
74
63
|
|
|
75
64
|
it('Should render correct component for rcs channel templates mode', () => {
|
|
76
|
-
renderFunction(
|
|
65
|
+
renderFunction("RCS", "templates");
|
|
66
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('Should render correct component for line channel create mode', () => {
|
|
70
|
+
renderFunction("LINE", "createTemplate", { mode: "create" });
|
|
71
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('Should render correct component for line channel edit mode', () => {
|
|
75
|
+
renderFunction("LINE", "editTemplate", lineEditTemplateData);
|
|
77
76
|
expect(renderedComponent).toMatchSnapshot();
|
|
78
77
|
});
|
|
79
78
|
|
|
80
79
|
it('Should render correct component for line channel preview mode', () => {
|
|
81
|
-
renderFunction(
|
|
80
|
+
renderFunction("LINE", "preview", linePreviewTemplateData1);
|
|
82
81
|
expect(renderedComponent).toMatchSnapshot();
|
|
83
|
-
renderFunction(
|
|
82
|
+
renderFunction("LINE", "preview", linePreviewTemplateData2);
|
|
84
83
|
expect(renderedComponent).toMatchSnapshot();
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
renderFunction("LINE", "preview", linePreviewTemplateData3);
|
|
85
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
86
|
+
renderFunction("LINE", "preview", linePreviewTemplateData4);
|
|
87
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
88
|
+
renderFunction("LINE", "preview", linePreviewTemplateContent);
|
|
89
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('Should render correct component for viber channel preview mode', () => {
|
|
93
|
+
renderFunction("VIBER", "preview", viberPreviewTemplateData);
|
|
87
94
|
expect(renderedComponent).toMatchSnapshot();
|
|
88
95
|
});
|
|
96
|
+
|
|
89
97
|
});
|