@capillarytech/creatives-library 7.12.50 → 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/config/app.js +0 -1
- 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/Cap/tests/index.test.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxContent.js +8 -8
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +28 -36
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +165 -344
- 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 +28 -40
- 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 +5 -1
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +63597 -0
- package/v2Containers/Line/Container/tests/index.test.js +105 -0
- package/v2Containers/Line/Container/tests/mockData.js +1334 -0
- 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 +210 -555
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { browserHistory } from 'react-router';
|
|
3
|
+
import { Provider } from 'react-redux';
|
|
4
|
+
import configureStore from '../../../../../store';
|
|
5
|
+
import { mountWithIntl } from '../../../../../helpers/intl-enzym-test-helpers';
|
|
6
|
+
import { LineWrapper } from '../index';
|
|
7
|
+
import { mockData } from './mockData';
|
|
8
|
+
|
|
9
|
+
let store;
|
|
10
|
+
beforeAll(() => {
|
|
11
|
+
store = configureStore({}, browserHistory);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
jest.mock('../../ImageCarousel/Content', () => ({
|
|
15
|
+
__esModule: true,
|
|
16
|
+
default: (props) => (
|
|
17
|
+
<div className="LineImageCarouselContent-mock" {...props}>
|
|
18
|
+
LineImageCarouselContent
|
|
19
|
+
</div>
|
|
20
|
+
),
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
describe('line wrapper test/>', () => {
|
|
24
|
+
let renderedComponent;
|
|
25
|
+
const deleteWrapper = jest.fn();
|
|
26
|
+
const shiftUp = jest.fn();
|
|
27
|
+
const shiftDown = jest.fn();
|
|
28
|
+
const formatMessage = jest.fn();
|
|
29
|
+
const fetchSchemaForEntity = jest.fn();
|
|
30
|
+
const renderHelper = (selectedType) => {
|
|
31
|
+
renderedComponent = mountWithIntl(
|
|
32
|
+
<Provider store={store}>
|
|
33
|
+
<LineWrapper
|
|
34
|
+
index={0}
|
|
35
|
+
intl={{ formatMessage }}
|
|
36
|
+
deleteWrapper={deleteWrapper}
|
|
37
|
+
shiftUp={shiftUp}
|
|
38
|
+
shiftDown={shiftDown}
|
|
39
|
+
selectedType={selectedType}
|
|
40
|
+
lineWrappers={1}
|
|
41
|
+
Templates={mockData.Templates}
|
|
42
|
+
content={mockData.content}
|
|
43
|
+
location={mockData.location}
|
|
44
|
+
isFullMode={true}
|
|
45
|
+
globalActions={{ fetchSchemaForEntity }}
|
|
46
|
+
Line={mockData.Line}
|
|
47
|
+
/>
|
|
48
|
+
</Provider>,
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
it('should render create mode', () => {
|
|
53
|
+
renderHelper('text');
|
|
54
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
55
|
+
renderHelper('template');
|
|
56
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
export const mockData = {
|
|
2
|
+
Templates: {
|
|
3
|
+
fetchingUserList: false,
|
|
4
|
+
userList: {
|
|
5
|
+
orgUsers: [
|
|
6
|
+
{
|
|
7
|
+
userId: 15107846,
|
|
8
|
+
firstName: 'SUPER USER',
|
|
9
|
+
lastName: '',
|
|
10
|
+
loginName: '',
|
|
11
|
+
email: '',
|
|
12
|
+
mobile: '',
|
|
13
|
+
isMobileValidated: 0,
|
|
14
|
+
isEmailValidated: 0,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
capUsers: [
|
|
18
|
+
{
|
|
19
|
+
userId: 4,
|
|
20
|
+
firstName: 'Krishna',
|
|
21
|
+
lastName: 'Mehra',
|
|
22
|
+
loginName: 'kmehra@capillary.co.in',
|
|
23
|
+
email: 'kmehra@capillary.co.in',
|
|
24
|
+
mobile: '918227337383',
|
|
25
|
+
isMobileValidated: 1,
|
|
26
|
+
isEmailValidated: 1,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
userListFetchError: false,
|
|
31
|
+
getAllTemplatesInProgress: false,
|
|
32
|
+
templateError: {},
|
|
33
|
+
templates: [
|
|
34
|
+
{
|
|
35
|
+
_id: '629f7ecf134738019b2e332e',
|
|
36
|
+
name: 'ggg1',
|
|
37
|
+
type: 'LINE',
|
|
38
|
+
versions: {
|
|
39
|
+
$init: true,
|
|
40
|
+
history: [],
|
|
41
|
+
base: {
|
|
42
|
+
content: {
|
|
43
|
+
to: '{{line_id}}',
|
|
44
|
+
messages: [
|
|
45
|
+
{
|
|
46
|
+
type: 'flex',
|
|
47
|
+
altText: 'ggg',
|
|
48
|
+
contents: {
|
|
49
|
+
contents: [
|
|
50
|
+
{
|
|
51
|
+
type: 'bubble',
|
|
52
|
+
hero: {
|
|
53
|
+
type: 'image',
|
|
54
|
+
url: 'https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/b9f2aa7a-3f1a-4a20-a737-8d50841.jpeg',
|
|
55
|
+
size: 'full',
|
|
56
|
+
aspectRatio: '1:1',
|
|
57
|
+
aspectMode: 'cover',
|
|
58
|
+
},
|
|
59
|
+
footer: {
|
|
60
|
+
type: 'box',
|
|
61
|
+
layout: 'vertical',
|
|
62
|
+
spacing: 'xs',
|
|
63
|
+
contents: [
|
|
64
|
+
{
|
|
65
|
+
type: 'button',
|
|
66
|
+
style: 'link',
|
|
67
|
+
height: 'sm',
|
|
68
|
+
action: {
|
|
69
|
+
type: 'message',
|
|
70
|
+
label: 'ggg',
|
|
71
|
+
text: 'ggg',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
type: 'carousel',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
isActive: true,
|
|
86
|
+
orgId: 1604,
|
|
87
|
+
createdBy: '15000449',
|
|
88
|
+
updatedBy: '15000449',
|
|
89
|
+
createdAt: '2022-06-07T16:37:35.447Z',
|
|
90
|
+
updatedAt: '2022-06-07T16:42:02.243Z',
|
|
91
|
+
definition: {
|
|
92
|
+
mode: 'template',
|
|
93
|
+
},
|
|
94
|
+
totalCount: 51,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
_id: '62a810e4d4715c768d6ee9cf',
|
|
98
|
+
name: 'Demo Old Template 2(Multiple images)',
|
|
99
|
+
type: 'LINE',
|
|
100
|
+
versions: {
|
|
101
|
+
$init: true,
|
|
102
|
+
history: [],
|
|
103
|
+
base: {
|
|
104
|
+
content: {
|
|
105
|
+
messages: [
|
|
106
|
+
{
|
|
107
|
+
altText: 'Demo Old Template 2(Multiple images)',
|
|
108
|
+
template: {
|
|
109
|
+
type: 'image_carousel',
|
|
110
|
+
columns: [
|
|
111
|
+
{
|
|
112
|
+
action: {
|
|
113
|
+
uri: 'https://www.demo.com',
|
|
114
|
+
label: 'Demo Old 2',
|
|
115
|
+
type: 'uri',
|
|
116
|
+
},
|
|
117
|
+
imageUrl:
|
|
118
|
+
'https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/f374edfe-1fd4-4b15-a6f7-74d5d86.jpeg',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
action: {
|
|
122
|
+
text: 'Demo Old Template 2(Multiple images)',
|
|
123
|
+
label: 'Demo Old 2',
|
|
124
|
+
type: 'message',
|
|
125
|
+
},
|
|
126
|
+
imageUrl:
|
|
127
|
+
'https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2e32a468-2879-410d-91a5-8dbdcea.jpeg',
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
type: 'template',
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
to: '{{line_id}}',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
isActive: true,
|
|
139
|
+
orgId: 1604,
|
|
140
|
+
createdBy: '15000449',
|
|
141
|
+
updatedBy: '15000449',
|
|
142
|
+
createdAt: '2022-06-14T04:39:00.665Z',
|
|
143
|
+
updatedAt: '2022-06-14T04:39:00.665Z',
|
|
144
|
+
definition: {
|
|
145
|
+
mode: 'template',
|
|
146
|
+
},
|
|
147
|
+
totalCount: 51,
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
isSearch: false,
|
|
151
|
+
weCRMtemplates: [],
|
|
152
|
+
},
|
|
153
|
+
content: {
|
|
154
|
+
type: 'text',
|
|
155
|
+
isError: true,
|
|
156
|
+
isInit: true,
|
|
157
|
+
},
|
|
158
|
+
Line: {
|
|
159
|
+
createTemplateInProgress: false,
|
|
160
|
+
response: {},
|
|
161
|
+
uploadedAssetData: {},
|
|
162
|
+
},
|
|
163
|
+
location: {
|
|
164
|
+
pathname: '/line',
|
|
165
|
+
query: {
|
|
166
|
+
type: false,
|
|
167
|
+
module: 'default',
|
|
168
|
+
},
|
|
169
|
+
search: '',
|
|
170
|
+
},
|
|
171
|
+
};
|
|
@@ -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,
|
|
@@ -393,6 +395,7 @@ export const LineContainer = ({
|
|
|
393
395
|
videoWidth,
|
|
394
396
|
} = {}] = lineWrapperContents;
|
|
395
397
|
let messageData = { type };
|
|
398
|
+
//for type template and not flow
|
|
396
399
|
if (messageType && messageContent) messageData[messageType] = messageContent;
|
|
397
400
|
if (previewImageUrl) {
|
|
398
401
|
messageData.previewImageUrl = previewImageUrl;
|
|
@@ -572,7 +575,7 @@ export const LineContainer = ({
|
|
|
572
575
|
});
|
|
573
576
|
contentsLocal.contents = imageContents;
|
|
574
577
|
contentsLocal.type = "carousel";
|
|
575
|
-
messageData.
|
|
578
|
+
messageData.contents = contentsLocal;
|
|
576
579
|
messageData.altText = altText;
|
|
577
580
|
}
|
|
578
581
|
if (videoSrc) {
|
|
@@ -655,6 +658,7 @@ export const LineContainer = ({
|
|
|
655
658
|
const getPreviewSection = () => {
|
|
656
659
|
const accountName = get(lineData, 'selectedLineAccount.name', '');
|
|
657
660
|
const templateContent = lineWrapperContents.map(({ messageContent, type, previewImageUrl, selectedSticker, baseUrl, template, videoSrc, actionUrl }) => {
|
|
661
|
+
//template.type is image_carousel, for flex only contents will be there
|
|
658
662
|
const isNewLineFormat = template && isEmpty(template.columns) && !isEmpty(template.contents);
|
|
659
663
|
let imageCarousel = [];
|
|
660
664
|
if (isNewLineFormat) {
|