@capillarytech/creatives-library 7.12.50 → 7.12.51
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 +0 -1
- package/package.json +1 -1
- package/v2Containers/Cap/tests/index.test.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +8 -7
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +28 -36
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +160 -337
- package/v2Containers/CreativesContainer/tests/index.test.js +0 -3
- package/v2Containers/Line/Container/ImageCarousel/Content.js +15 -29
- package/v2Containers/Line/Container/ImageCarousel/constants.js +3 -0
- package/v2Containers/Line/Container/ImageCarousel/index.js +24 -35
- package/v2Containers/Line/Container/ImageCarousel/messages.js +2 -2
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +9851 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +21113 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/content.test.js +71 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/index.test.js +58 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/mockData.js +1322 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/utils.test.js +13 -0
- package/v2Containers/Line/Container/ImageCarousel/utils.js +12 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +84451 -0
- package/v2Containers/Line/Container/Wrapper/tests/index.test.js +58 -0
- package/v2Containers/Line/Container/Wrapper/tests/mockData.js +171 -0
- package/v2Containers/Line/Container/index.js +2 -0
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +59589 -0
- package/v2Containers/Line/Container/tests/index.test.js +105 -0
- package/v2Containers/Line/Container/tests/mockData.js +1334 -0
- package/v2Containers/mockdata.js +60 -156
package/config/app.js
CHANGED
|
@@ -17,7 +17,6 @@ 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',
|
|
21
20
|
campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
|
|
22
21
|
campaigns_api_org_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/org/campaign',
|
|
23
22
|
auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
|
package/package.json
CHANGED
|
@@ -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,7 +6,6 @@ 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';
|
|
10
9
|
// import SmsEdit from '../Sms/Edit';
|
|
11
10
|
import Email from '../Email';
|
|
12
11
|
import EmailWrapper from '../EmailWrapper';
|
|
@@ -240,9 +239,10 @@ export function SlideBoxContent(props) {
|
|
|
240
239
|
baseUrl,
|
|
241
240
|
video,
|
|
242
241
|
template,
|
|
243
|
-
contents,
|
|
242
|
+
contents = {},
|
|
243
|
+
type = '',
|
|
244
244
|
}) => {
|
|
245
|
-
const isNewLineFormat =
|
|
245
|
+
const isNewLineFormat = type === 'flex';
|
|
246
246
|
const {
|
|
247
247
|
originalContentUrl,
|
|
248
248
|
externalLink: {
|
|
@@ -262,10 +262,11 @@ export function SlideBoxContent(props) {
|
|
|
262
262
|
previewContent.video = originalContentUrl;
|
|
263
263
|
previewContent.actionUrl = linkUri;
|
|
264
264
|
if (isNewLineFormat) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
const { contents: flexContent = [] } = contents;
|
|
266
|
+
previewContent.imageCarousel = flexContent.map((data) => ({
|
|
267
|
+
imageUrl: get(data, "hero.url", ""),
|
|
268
|
+
actionLabel: get(data, "footer.contents[0].action.label", ""),
|
|
269
|
+
}));
|
|
269
270
|
} else {
|
|
270
271
|
previewContent.imageCarousel = get(template, 'columns', [{}]).map(({ imageUrl, action: { label: actionLabel } = {} }) => ({ imageUrl, actionLabel }) );
|
|
271
272
|
}
|
|
@@ -4,11 +4,22 @@ 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
|
-
|
|
7
|
+
const {
|
|
8
|
+
whatsappEditTemplateData,
|
|
9
|
+
whatsappPreviewTemplateData,
|
|
10
|
+
rcsEditTemplateData,
|
|
11
|
+
rcsPreviewTemplateData,
|
|
12
|
+
linePreviewTemplateData1,
|
|
13
|
+
linePreviewTemplateData2,
|
|
14
|
+
} = mockdata;
|
|
15
|
+
|
|
16
|
+
jest.mock('../../../v2Components/FormBuilder', () => ({
|
|
10
17
|
__esModule: true,
|
|
11
|
-
default: (props) =>
|
|
18
|
+
default: (props) => (
|
|
19
|
+
<div className="FormBuilder-mock" {...props}>
|
|
20
|
+
FormBuilder
|
|
21
|
+
</div>
|
|
22
|
+
),
|
|
12
23
|
}));
|
|
13
24
|
|
|
14
25
|
describe('Test SlideBoxContent container', () => {
|
|
@@ -22,76 +33,57 @@ describe('Test SlideBoxContent container', () => {
|
|
|
22
33
|
currentChannel={channel}
|
|
23
34
|
templateData={templateData}
|
|
24
35
|
onCreateComplete={onCreateComplete}
|
|
25
|
-
|
|
36
|
+
/>,
|
|
26
37
|
);
|
|
27
38
|
};
|
|
28
39
|
|
|
29
40
|
it('Should render correct component for whatsapp channel create mode', () => {
|
|
30
|
-
renderFunction(
|
|
41
|
+
renderFunction('WHATSAPP', 'createTemplate', { mode: 'create' });
|
|
31
42
|
expect(renderedComponent).toMatchSnapshot();
|
|
32
43
|
});
|
|
33
44
|
|
|
34
45
|
it('Should render correct component for whatsapp channel edit mode', () => {
|
|
35
|
-
renderFunction(
|
|
46
|
+
renderFunction('WHATSAPP', 'editTemplate', whatsappEditTemplateData);
|
|
36
47
|
expect(renderedComponent).toMatchSnapshot();
|
|
37
48
|
});
|
|
38
49
|
|
|
39
50
|
it('Should render correct component for whatsapp channel preview mode', () => {
|
|
40
|
-
renderFunction(
|
|
51
|
+
renderFunction('WHATSAPP', 'preview', whatsappPreviewTemplateData);
|
|
41
52
|
expect(renderedComponent).toMatchSnapshot();
|
|
42
53
|
});
|
|
43
54
|
|
|
44
55
|
it('Should render correct component for whatsapp channel templates mode', () => {
|
|
45
|
-
renderFunction(
|
|
56
|
+
renderFunction('WHATSAPP', 'templates');
|
|
46
57
|
expect(renderedComponent).toMatchSnapshot();
|
|
47
58
|
});
|
|
48
59
|
|
|
49
60
|
it('Should render correct component for rcs channel create mode', () => {
|
|
50
|
-
renderFunction(
|
|
61
|
+
renderFunction('RCS', 'createTemplate', { mode: 'create' });
|
|
51
62
|
expect(renderedComponent).toMatchSnapshot();
|
|
52
63
|
});
|
|
53
64
|
|
|
54
65
|
it('Should render correct component for rcs channel edit mode', () => {
|
|
55
|
-
renderFunction(
|
|
66
|
+
renderFunction('RCs', 'editTemplate', rcsEditTemplateData);
|
|
56
67
|
expect(renderedComponent).toMatchSnapshot();
|
|
57
68
|
});
|
|
58
69
|
|
|
59
70
|
it('Should render correct component for rcs channel preview mode', () => {
|
|
60
|
-
renderFunction(
|
|
71
|
+
renderFunction('RCS', 'preview', rcsPreviewTemplateData);
|
|
61
72
|
expect(renderedComponent).toMatchSnapshot();
|
|
62
73
|
});
|
|
63
74
|
|
|
64
75
|
it('Should render correct component for rcs channel templates mode', () => {
|
|
65
|
-
renderFunction(
|
|
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);
|
|
76
|
+
renderFunction('RCS', 'templates');
|
|
76
77
|
expect(renderedComponent).toMatchSnapshot();
|
|
77
78
|
});
|
|
78
79
|
|
|
79
80
|
it('Should render correct component for line channel preview mode', () => {
|
|
80
|
-
renderFunction(
|
|
81
|
+
renderFunction('LINE', 'preview', linePreviewTemplateData1);
|
|
81
82
|
expect(renderedComponent).toMatchSnapshot();
|
|
82
|
-
renderFunction(
|
|
83
|
+
renderFunction('LINE', 'preview', linePreviewTemplateData2);
|
|
83
84
|
expect(renderedComponent).toMatchSnapshot();
|
|
84
|
-
|
|
85
|
-
|
|
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);
|
|
85
|
+
delete linePreviewTemplateData2.versions.base.content.messages[0].contents;
|
|
86
|
+
renderFunction('LINE', 'preview', linePreviewTemplateData2);
|
|
94
87
|
expect(renderedComponent).toMatchSnapshot();
|
|
95
88
|
});
|
|
96
|
-
|
|
97
89
|
});
|