@capillarytech/creatives-library 7.12.44 → 7.12.45

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.
Files changed (25) hide show
  1. package/config/app.js +0 -1
  2. package/package.json +1 -1
  3. package/v2Containers/Cap/tests/index.test.js +2 -2
  4. package/v2Containers/CreativesContainer/SlideBoxContent.js +8 -7
  5. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +30 -20
  6. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +303 -12
  7. package/v2Containers/Line/Container/ImageCarousel/Content.js +15 -29
  8. package/v2Containers/Line/Container/ImageCarousel/constants.js +3 -0
  9. package/v2Containers/Line/Container/ImageCarousel/index.js +24 -35
  10. package/v2Containers/Line/Container/ImageCarousel/messages.js +4 -0
  11. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +9851 -0
  12. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +21113 -0
  13. package/v2Containers/Line/Container/ImageCarousel/tests/content.test.js +71 -0
  14. package/v2Containers/Line/Container/ImageCarousel/tests/index.test.js +58 -0
  15. package/v2Containers/Line/Container/ImageCarousel/tests/mockData.js +1322 -0
  16. package/v2Containers/Line/Container/ImageCarousel/tests/utils.test.js +13 -0
  17. package/v2Containers/Line/Container/ImageCarousel/utils.js +12 -0
  18. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +84451 -0
  19. package/v2Containers/Line/Container/Wrapper/tests/index.test.js +58 -0
  20. package/v2Containers/Line/Container/Wrapper/tests/mockData.js +171 -0
  21. package/v2Containers/Line/Container/index.js +2 -0
  22. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +59589 -0
  23. package/v2Containers/Line/Container/tests/index.test.js +105 -0
  24. package/v2Containers/Line/Container/tests/mockData.js +1334 -0
  25. package/v2Containers/mockdata.js +68 -11
@@ -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
+ };
@@ -393,6 +393,7 @@ export const LineContainer = ({
393
393
  videoWidth,
394
394
  } = {}] = lineWrapperContents;
395
395
  let messageData = { type };
396
+ //for type template and not flow
396
397
  if (messageType && messageContent) messageData[messageType] = messageContent;
397
398
  if (previewImageUrl) {
398
399
  messageData.previewImageUrl = previewImageUrl;
@@ -655,6 +656,7 @@ export const LineContainer = ({
655
656
  const getPreviewSection = () => {
656
657
  const accountName = get(lineData, 'selectedLineAccount.name', '');
657
658
  const templateContent = lineWrapperContents.map(({ messageContent, type, previewImageUrl, selectedSticker, baseUrl, template, videoSrc, actionUrl }) => {
659
+ //template.type is image_carousel, for flex only contents will be there
658
660
  const isNewLineFormat = template && isEmpty(template.columns) && !isEmpty(template.contents);
659
661
  let imageCarousel = [];
660
662
  if (isNewLineFormat) {