@capillarytech/creatives-library 8.0.205 → 8.0.206-alpha.1

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.
@@ -37,7 +37,6 @@ import {
37
37
  CapLink,
38
38
  CapHeading,
39
39
  CapNotification,
40
- CapIllustration,
41
40
  CapHeader,
42
41
  CapLabel,
43
42
  CapRadio,
@@ -97,6 +96,7 @@ import CreativesContainer from '../CreativesContainer';
97
96
  import WhatsappStatusContainer from '../../v2Components/WhatsappStatusContainer';
98
97
  import WechatRichmediaTemplatePreview from '../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
99
98
  import CapCustomSkeleton from '../../v2Components/CapCustomSkeleton';
99
+ import ChannelTypeIllustration from './ChannelTypeIllustration';
100
100
  import {
101
101
  CHANNEL_CREATE_TRACK_MAPPING,
102
102
  CHANNEL_EDIT_TRACK_MAPPING,
@@ -139,14 +139,6 @@ import { MOBILE_PUSH, WECHAT, SMS, EMAIL, EBILL, LINE, VIBER, FACEBOOK, WHATSAPP
139
139
 
140
140
  import {CREATIVE} from '../Facebook/constants';
141
141
  import videoPlay from '../../assets/videoPlay.svg';
142
- import emailIllustration from '../Assets/images/emailIllustration.svg';
143
- import smsIllustration from '../Assets/images/smsIllustration.svg';
144
- import pushIllustration from '../Assets/images/pushIllustration.svg';
145
- import whatsappIllustration from '../Assets/images/whatsappIllustration.png';
146
- import whatsappOrZaloAccountIllustration from '../Assets/images/whatsappOrZaloAccountIllustration.svg';
147
- import rcsIllustration from '../Assets/images/rcsIllustration.png';
148
- import zaloillustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
149
- import inAppIllustration from '@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg';
150
142
  import whatsappImageEmptyPreview from '../../v2Components/TemplatePreview/assets/images/empty_image_preview.svg';
151
143
  import whatsappVideoEmptyPreview from '../../v2Components/TemplatePreview/assets/images/empty_video_preview.svg';
152
144
  import { CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
@@ -1164,7 +1156,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1164
1156
  }
1165
1157
  />
1166
1158
 
1167
- getSmsEmailIllustration = () =>
1159
+ getSmsEmailIllustration = () => {
1168
1160
  this.props.isDltFromRcs ? (
1169
1161
  <CapHeader
1170
1162
  title={
@@ -1179,13 +1171,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1179
1171
  }
1180
1172
  />
1181
1173
  ) : (
1182
- <CapIllustration
1183
- buttonClassName={`create-new-${this.state.channel.toLowerCase()}`}
1184
- {...this.getChannelTypeIllustrationInfo(
1185
- this.state.channel.toUpperCase(),
1186
- )}
1187
- />
1174
+ <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={this.state.channel} hostName={this.state?.hostName}/>
1188
1175
  );
1176
+ }
1189
1177
 
1190
1178
  getHoverComponent = (children) => {
1191
1179
  return this.state.channel.toLowerCase() === ZALO_LOWERCASE ? (
@@ -1778,14 +1766,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1778
1766
  isEmpty(filteredTemplates) &&
1779
1767
  isEmpty(this.state.searchText) &&
1780
1768
  <div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto'} : {}}>
1781
- <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel, this.state?.hostName)} />
1769
+ <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel} hostName={this.state?.hostName}/>
1782
1770
  </div>
1783
1771
  )
1784
1772
  }
1785
1773
  {(showWhatsappIllustration || showZaloIllustration) && (
1786
1774
  noLoaderAndSearchText &&
1787
1775
  <div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto' } : {}}>
1788
- {noWhatsappZaloTemplates && <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel, isEmpty(this.state?.hostName))} />}
1776
+ {noWhatsappZaloTemplates && <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel} hostName={this.state?.hostName}/>}
1789
1777
  {noFilteredWhatsappZaloTemplates && this.state?.hostName && this.whatsappZaloIllustrationText('noFilteredWhatsappZaloTemplatesTitle', 'noFilteredWhatsappZaloTemplatesDesc')}
1790
1778
  {noApprovedWhatsappZaloTemplates && this.whatsappZaloIllustrationText('noApprovedWhatsappZaloTemplatesTitle', showWhatsappIllustration ? 'noApprovedWhatsappTemplatesDesc' : 'zaloDescIllustration')}
1791
1779
  </div>
@@ -1795,7 +1783,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1795
1783
  (
1796
1784
  noLoaderAndSearchText &&
1797
1785
  <div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto' } : {}}>
1798
- <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />
1786
+ <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel}/>
1799
1787
  {noApprovedRcsTemplates && this.whatsappZaloIllustrationText('noApprovedRcsTemplatesTitle', 'noApprovedRcsTemplatesDesc')}
1800
1788
  </div>
1801
1789
  )
@@ -1804,7 +1792,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1804
1792
  (
1805
1793
  noLoaderAndSearchText &&
1806
1794
  <div className={`${this.isFullMode() ? 'inapp-illustration-parent' : ''}`}>
1807
- <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />
1795
+ <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel}/>
1808
1796
  </div>
1809
1797
  )
1810
1798
  }
@@ -2883,99 +2871,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2883
2871
  (rcsLoader !== undefined ? rcsLoader : false);
2884
2872
  return isLoading;
2885
2873
  }
2886
- getChannelTypeIllustrationInfo = (type, hostNameNotFound) => {
2887
- const { isFullMode, intl } = this.props;
2888
- const templateIntlMsg = intl.formatMessage(messages.template);
2889
- const templateText = isFullMode ? templateIntlMsg : '';
2890
- switch (type) {
2891
- case 'SMS':
2892
- return {
2893
- buttonLabel: <FormattedMessage {...messages.newSMSTemplate} values={{ template: templateText }} />,
2894
- onClick: this.createTemplate,
2895
- illustrationImage: smsIllustration,
2896
- title: <FormattedMessage {...messages.smsTitleIllustartion} values={{ template: templateText }} />,
2897
- };
2898
- case 'EMAIL':
2899
- return {
2900
- buttonLabel: <FormattedMessage {...messages.newEmailTemplate} values={{ template: templateText }} />,
2901
- onClick: this.createTemplate,
2902
- illustrationImage: emailIllustration,
2903
- title: <FormattedMessage {...messages.emailTitleIllustartion} values={{ template: templateText }} />,
2904
- };
2905
- case 'MOBILEPUSH':
2906
- return {
2907
- buttonLabel: <FormattedMessage {...messages.newNotificationTemplate} values={{ template: templateText }} />,
2908
- onClick: this.createTemplate,
2909
- illustrationImage: pushIllustration,
2910
- title: <FormattedMessage {...messages.pushTitleIllustartion} values={{ template: templateText }} />,
2911
- };
2912
- case WHATSAPP: {
2913
- if (hostNameNotFound) {
2914
- return {
2915
- illustrationImage: whatsappOrZaloAccountIllustration,
2916
- title: <FormattedMessage {...messages.whatsappAccountNotConfiguredTitle} />,
2917
- description: <FormattedMessage {...messages.accountNotConfiguredDescription} />,
2918
- descriptionPosition: 'bottom',
2919
- descriptionClassName: 'illustration-desc zalo-illustration',
2920
- buttonClassName: "zalo-illustration-button",
2921
- };
2922
- } else {
2923
- return {
2924
- buttonLabel: <FormattedMessage {...messages.newWhatsappTemplate} values={{ template: templateText }} />,
2925
- onClick: this.createTemplate,
2926
- illustrationImage: whatsappIllustration,
2927
- title: <FormattedMessage {...messages.whatsappTitleIllustration} values={{ template: templateText }} />,
2928
- description: <FormattedMessage {...messages.whatsappDescIllustration} />,
2929
- descriptionPosition: 'bottom',
2930
- descriptionClassName: 'illustration-desc',
2931
-
2932
- };
2933
- }
2934
- }
2935
- case RCS:
2936
- return {
2937
- buttonLabel: <FormattedMessage {...messages.newRCSTemplate} values={{ template: templateText }} />,
2938
- onClick: this.createTemplate,
2939
- illustrationImage: rcsIllustration,
2940
- title: <FormattedMessage {...messages.rcsTitleIllustartion} values={{ template: templateText }} />,
2941
- description: <FormattedMessage {...messages.rcsDescIllustartion} />,
2942
- descriptionPosition: 'bottom',
2943
- descriptionClassName: 'illustration-desc rcs-illustration',
2944
- };
2945
- case ZALO:{
2946
- if (hostNameNotFound) {
2947
- return {
2948
- illustrationImage: whatsappOrZaloAccountIllustration,
2949
- title: <FormattedMessage {...messages.zaloAccountNotConfiguredTitle} />,
2950
- description: <FormattedMessage {...messages.accountNotConfiguredDescription} />,
2951
- descriptionPosition: 'bottom',
2952
- descriptionClassName: 'illustration-desc zalo-illustration',
2953
- buttonClassName: "zalo-illustration-button",
2954
- };
2955
- } else {
2956
- return {
2957
- illustrationImage: zaloillustration,
2958
- title: <FormattedMessage {...messages.zaloTitleIllustration} />,
2959
- description: <FormattedMessage {...messages.zaloDescIllustration} />,
2960
- descriptionPosition: 'bottom',
2961
- descriptionClassName: 'illustration-desc zalo-illustration',
2962
- buttonClassName: "zalo-illustration-button",
2963
- };
2964
- }
2965
- }
2966
- case INAPP:
2967
- return {
2968
- illustrationImage: inAppIllustration,
2969
- title: <FormattedMessage {...messages.inAppTitleIllustration} />,
2970
- description: <FormattedMessage {...messages.inAppDescIllustration} />,
2971
- descriptionPosition: 'bottom',
2972
- descriptionClassName: 'illustration-desc inapp-illustration',
2973
- buttonClassName: "inapp-illustration-button",
2974
- }
2975
- default:
2976
- return {};
2977
- }
2978
- }
2874
+
2979
2875
  checkSearchDisabled = () => (this.props.route.name === "mobilepush" && !(this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier && this.props.Templates.selectedWeChatAccount.configs && (this.props.Templates.selectedWeChatAccount.configs.ios === '1' || this.props.Templates.selectedWeChatAccount.configs.android === '1')))
2980
2876
  renderEmailPreviewModal() {
2981
2877
  const slideboxContent = (
@@ -326,6 +326,18 @@ export default defineMessages({
326
326
  id: `${scope}.newEmailTemplate`,
327
327
  defaultMessage: 'New email {template}',
328
328
  },
329
+ "newViberTemplate": {
330
+ id: `${scope}.newViberTemplate`,
331
+ defaultMessage: 'New Viber {template}',
332
+ },
333
+ "newLineTemplate": {
334
+ id: `${scope}.newLineTemplate`,
335
+ defaultMessage: 'New Line {template}',
336
+ },
337
+ "newFacebookTemplate": {
338
+ id: `${scope}.newFacebookTemplate`,
339
+ defaultMessage: 'New Facebook {template}',
340
+ },
329
341
  "newWhatsappTemplate": {
330
342
  id: `${scope}.newWhatsappTemplate`,
331
343
  defaultMessage: 'Add new Whatsapp {template}',
@@ -346,6 +358,18 @@ export default defineMessages({
346
358
  id: `${scope}.emailTitleIllustartion`,
347
359
  defaultMessage: 'Create an email {template}',
348
360
  },
361
+ "viberTitleIllustartion": {
362
+ id: `${scope}.viberTitleIllustartion`,
363
+ defaultMessage: 'Create a viber {template}',
364
+ },
365
+ "lineTitleIllustartion": {
366
+ id: `${scope}.lineTitleIllustartion`,
367
+ defaultMessage: 'Create a line {template}',
368
+ },
369
+ "facebookTitleIllustartion": {
370
+ id: `${scope}.facebookTitleIllustartion`,
371
+ defaultMessage: 'Create a facebook {template}',
372
+ },
349
373
  "whatsappTitleIllustration": {
350
374
  id: `${scope}.whatsappTitleIllustration`,
351
375
  defaultMessage: 'Add a new Whatsapp creative {template}',
@@ -0,0 +1,323 @@
1
+ // Mock the CapIllustration component
2
+ jest.mock('@capillarytech/cap-ui-library', () => ({
3
+ CapIllustration: ({ children, ...props }) => <div data-testid="cap-illustration" {...props}>{children}</div>
4
+ }));
5
+
6
+ // Mock all image imports
7
+ jest.mock('../../Assets/images/emailIllustration.svg', () => 'test-file-stub');
8
+ jest.mock('../../Assets/images/smsIllustration.svg', () => 'test-file-stub');
9
+ jest.mock('../../Assets/images/pushIllustration.svg', () => 'test-file-stub');
10
+ jest.mock('../../Assets/images/whatsappIllustration.png', () => 'test-file-stub');
11
+ jest.mock('../../Assets/images/whatsappOrZaloAccountIllustration.svg', () => 'test-file-stub');
12
+ jest.mock('../../Assets/images/rcsIllustration.png', () => 'test-file-stub');
13
+ jest.mock('@capillarytech/cap-ui-library/assets/images/featureUiNotEnabledIllustration.svg', () => 'test-file-stub');
14
+
15
+
16
+ import React from 'react';
17
+ import { shallow, configure } from 'enzyme';
18
+ import Adapter from '@cfaester/enzyme-adapter-react-18';
19
+ import ChannelTypeIllustration from '../ChannelTypeIllustration';
20
+ import { MOBILE_PUSH, SMS, EMAIL, LINE, VIBER, FACEBOOK, WHATSAPP, RCS, ZALO, INAPP } from '../../CreativesContainer/constants';
21
+
22
+ configure({ adapter: new Adapter() });
23
+
24
+ describe('ChannelTypeIllustration', () => {
25
+ const mockCreateTemplate = jest.fn();
26
+ const mockIntl = {
27
+ formatMessage: jest.fn(() => 'some text')
28
+ };
29
+
30
+ beforeEach(() => {
31
+ jest.clearAllMocks();
32
+ mockIntl.formatMessage.mockClear();
33
+ });
34
+
35
+ const defaultProps = {
36
+ isFullMode: false,
37
+ intl: mockIntl,
38
+ createTemplate: mockCreateTemplate,
39
+ currentChannel: SMS,
40
+ hostName: false
41
+ };
42
+
43
+ beforeEach(() => {
44
+ jest.clearAllMocks();
45
+ mockIntl.formatMessage.mockClear();
46
+ });
47
+
48
+ const renderComponent = (props = {}) => {
49
+ return shallow(
50
+ <ChannelTypeIllustration {...defaultProps} {...props} intl={mockIntl} />
51
+ );
52
+ };
53
+
54
+ describe('Component Rendering', () => {
55
+ it('should render CapIllustration component', () => {
56
+ const component = renderComponent();
57
+ expect(component.find('CapIllustration')).toHaveLength(1);
58
+ });
59
+
60
+ it('should pass correct buttonClassName based on currentChannel', () => {
61
+ const component = renderComponent({ currentChannel: 'SMS' });
62
+ const capIllustration = component.find('CapIllustration');
63
+ expect(capIllustration.prop('buttonClassName')).toBe('create-new-sms');
64
+ });
65
+
66
+ it('should handle undefined currentChannel gracefully', () => {
67
+ const component = renderComponent({ currentChannel: undefined });
68
+ const capIllustration = component.find('CapIllustration');
69
+ expect(capIllustration.prop('buttonClassName')).toBe('unknown-illustration-button');
70
+ });
71
+ });
72
+
73
+ describe('SMS Channel', () => {
74
+ it('should return correct illustration info for SMS channel', () => {
75
+ const component = renderComponent({ currentChannel: SMS });
76
+ const capIllustration = component.find('CapIllustration');
77
+
78
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
79
+ expect(capIllustration.prop('onClick')).toBe(mockCreateTemplate);
80
+ expect(capIllustration.prop('buttonLabel')).toBeDefined();
81
+ expect(capIllustration.prop('title')).toBeDefined();
82
+ });
83
+
84
+ it('should include template text in full mode for SMS', () => {
85
+ const component = renderComponent({
86
+ currentChannel: SMS,
87
+ isFullMode: true
88
+ });
89
+ const capIllustration = component.find('CapIllustration');
90
+ expect(capIllustration.prop('buttonLabel')).toBeDefined();
91
+ expect(capIllustration.prop('title')).toBeDefined();
92
+ });
93
+ });
94
+
95
+ describe('EMAIL Channel', () => {
96
+ it('should return correct illustration info for EMAIL channel', () => {
97
+ const component = renderComponent({ currentChannel: EMAIL });
98
+ const capIllustration = component.find('CapIllustration');
99
+
100
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
101
+ expect(capIllustration.prop('onClick')).toBe(mockCreateTemplate);
102
+ expect(capIllustration.prop('buttonLabel')).toBeDefined();
103
+ expect(capIllustration.prop('title')).toBeDefined();
104
+ });
105
+ });
106
+
107
+ describe('MOBILE_PUSH Channel', () => {
108
+ it('should return correct illustration info for MOBILE_PUSH channel', () => {
109
+ const component = renderComponent({ currentChannel: MOBILE_PUSH });
110
+ const capIllustration = component.find('CapIllustration');
111
+
112
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
113
+ expect(capIllustration.prop('onClick')).toBe(mockCreateTemplate);
114
+ expect(capIllustration.prop('buttonLabel')).toBeDefined();
115
+ expect(capIllustration.prop('title')).toBeDefined();
116
+ });
117
+ });
118
+
119
+ describe('WHATSAPP Channel', () => {
120
+ it('should return correct illustration info for WHATSAPP channel when hostName is available', () => {
121
+ const component = renderComponent({
122
+ currentChannel: WHATSAPP,
123
+ hostName: true
124
+ });
125
+ const capIllustration = component.find('CapIllustration');
126
+
127
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
128
+ expect(capIllustration.prop('onClick')).toBe(mockCreateTemplate);
129
+ expect(capIllustration.prop('buttonLabel')).toBeDefined();
130
+ expect(capIllustration.prop('title')).toBeDefined();
131
+ expect(capIllustration.prop('description')).toBeDefined();
132
+ expect(capIllustration.prop('descriptionPosition')).toBe('bottom');
133
+ expect(capIllustration.prop('descriptionClassName')).toBe('illustration-desc');
134
+ });
135
+
136
+ it('should return account not configured info for WHATSAPP when hostName is not available', () => {
137
+ const component = renderComponent({
138
+ currentChannel: WHATSAPP,
139
+ hostName: false
140
+ });
141
+ const capIllustration = component.find('CapIllustration');
142
+
143
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
144
+ expect(capIllustration.prop('title')).toBeDefined();
145
+ expect(capIllustration.prop('description')).toBeDefined();
146
+ expect(capIllustration.prop('descriptionPosition')).toBe('bottom');
147
+ expect(capIllustration.prop('descriptionClassName')).toBe('illustration-desc zalo-illustration');
148
+ expect(capIllustration.prop('buttonClassName')).toBe('zalo-illustration-button');
149
+ expect(capIllustration.prop('onClick')).toBeUndefined();
150
+ expect(capIllustration.prop('buttonLabel')).toBeUndefined();
151
+ });
152
+ });
153
+
154
+ describe('RCS Channel', () => {
155
+ it('should return correct illustration info for RCS channel', () => {
156
+ const component = renderComponent({ currentChannel: RCS });
157
+ const capIllustration = component.find('CapIllustration');
158
+
159
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
160
+ expect(capIllustration.prop('onClick')).toBe(mockCreateTemplate);
161
+ expect(capIllustration.prop('buttonLabel')).toBeDefined();
162
+ expect(capIllustration.prop('title')).toBeDefined();
163
+ expect(capIllustration.prop('description')).toBeDefined();
164
+ expect(capIllustration.prop('descriptionPosition')).toBe('bottom');
165
+ expect(capIllustration.prop('descriptionClassName')).toBe('illustration-desc rcs-illustration');
166
+ });
167
+ });
168
+
169
+ describe('ZALO Channel', () => {
170
+ it('should return correct illustration info for ZALO channel when hostName is available', () => {
171
+ const component = renderComponent({
172
+ currentChannel: ZALO,
173
+ hostName: true
174
+ });
175
+ const capIllustration = component.find('CapIllustration');
176
+
177
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
178
+ expect(capIllustration.prop('title')).toBeDefined();
179
+ expect(capIllustration.prop('description')).toBeDefined();
180
+ expect(capIllustration.prop('descriptionPosition')).toBe('bottom');
181
+ expect(capIllustration.prop('descriptionClassName')).toBe('illustration-desc zalo-illustration');
182
+ expect(capIllustration.prop('buttonClassName')).toBe('zalo-illustration-button');
183
+ expect(capIllustration.prop('onClick')).toBeUndefined();
184
+ expect(capIllustration.prop('buttonLabel')).toBeUndefined();
185
+ });
186
+
187
+ it('should return account not configured info for ZALO when hostName is not available', () => {
188
+ const component = renderComponent({
189
+ currentChannel: ZALO,
190
+ hostName: false
191
+ });
192
+ const capIllustration = component.find('CapIllustration');
193
+
194
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
195
+ expect(capIllustration.prop('title')).toBeDefined();
196
+ expect(capIllustration.prop('description')).toBeDefined();
197
+ expect(capIllustration.prop('descriptionPosition')).toBe('bottom');
198
+ expect(capIllustration.prop('descriptionClassName')).toBe('illustration-desc zalo-illustration');
199
+ expect(capIllustration.prop('buttonClassName')).toBe('zalo-illustration-button');
200
+ expect(capIllustration.prop('onClick')).toBeUndefined();
201
+ expect(capIllustration.prop('buttonLabel')).toBeUndefined();
202
+ });
203
+ });
204
+
205
+ describe('INAPP Channel', () => {
206
+ it('should return correct illustration info for INAPP channel', () => {
207
+ const component = renderComponent({ currentChannel: INAPP });
208
+ const capIllustration = component.find('CapIllustration');
209
+
210
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
211
+ expect(capIllustration.prop('title')).toBeDefined();
212
+ expect(capIllustration.prop('description')).toBeDefined();
213
+ expect(capIllustration.prop('descriptionPosition')).toBe('bottom');
214
+ expect(capIllustration.prop('descriptionClassName')).toBe('illustration-desc inapp-illustration');
215
+ expect(capIllustration.prop('buttonClassName')).toBe('inapp-illustration-button');
216
+ expect(capIllustration.prop('onClick')).toBeUndefined();
217
+ expect(capIllustration.prop('buttonLabel')).toBeUndefined();
218
+ });
219
+ });
220
+
221
+ describe('VIBER Channel', () => {
222
+ it('should return correct illustration info for VIBER channel', () => {
223
+ const component = renderComponent({ currentChannel: VIBER });
224
+ const capIllustration = component.find('CapIllustration');
225
+
226
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
227
+ expect(capIllustration.prop('onClick')).toBe(mockCreateTemplate);
228
+ expect(capIllustration.prop('buttonLabel')).toBeDefined();
229
+ expect(capIllustration.prop('title')).toBeDefined();
230
+ });
231
+ });
232
+
233
+ describe('LINE Channel', () => {
234
+ it('should return correct illustration info for LINE channel', () => {
235
+ const component = renderComponent({ currentChannel: LINE });
236
+ const capIllustration = component.find('CapIllustration');
237
+
238
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
239
+ expect(capIllustration.prop('onClick')).toBe(mockCreateTemplate);
240
+ expect(capIllustration.prop('buttonLabel')).toBeDefined();
241
+ expect(capIllustration.prop('title')).toBeDefined();
242
+ });
243
+ });
244
+
245
+ describe('FACEBOOK Channel', () => {
246
+ it('should return correct illustration info for FACEBOOK channel', () => {
247
+ const component = renderComponent({ currentChannel: FACEBOOK });
248
+ const capIllustration = component.find('CapIllustration');
249
+
250
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
251
+ expect(capIllustration.prop('onClick')).toBe(mockCreateTemplate);
252
+ expect(capIllustration.prop('buttonLabel')).toBeDefined();
253
+ expect(capIllustration.prop('title')).toBeDefined();
254
+ });
255
+ });
256
+
257
+ describe('Edge Cases', () => {
258
+ it('should return default illustration for unknown channel type', () => {
259
+ const component = renderComponent({ currentChannel: 'UNKNOWN_CHANNEL' });
260
+ const capIllustration = component.find('CapIllustration');
261
+
262
+ expect(capIllustration.prop('illustrationImage')).toBe('test-file-stub');
263
+ expect(capIllustration.prop('onClick')).toBeUndefined();
264
+ expect(capIllustration.prop('buttonLabel')).toBeDefined();;
265
+ expect(capIllustration.prop('title')).toBe('');
266
+ });
267
+
268
+ it('should handle null currentChannel', () => {
269
+ const component = renderComponent({ currentChannel: null });
270
+ const capIllustration = component.find('CapIllustration');
271
+
272
+ expect(capIllustration.prop('buttonClassName')).toBe('unknown-illustration-button');
273
+ });
274
+
275
+ it('should handle empty string currentChannel', () => {
276
+ const component = renderComponent({ currentChannel: '' });
277
+ const capIllustration = component.find('CapIllustration');
278
+
279
+ expect(capIllustration.prop('buttonClassName')).toBe('unknown-illustration-button');
280
+ });
281
+ });
282
+
283
+ describe('isFullMode Behavior', () => {
284
+ it('should render FormattedMessage components when isFullMode is true', () => {
285
+ const component = renderComponent({
286
+ currentChannel: SMS,
287
+ isFullMode: true
288
+ });
289
+ const capIllustration = component.find('CapIllustration');
290
+ expect(capIllustration.prop('buttonLabel')).toBeDefined();
291
+ expect(capIllustration.prop('title')).toBeDefined();
292
+ });
293
+
294
+ it('should render FormattedMessage components when isFullMode is false', () => {
295
+ const component = renderComponent({
296
+ currentChannel: SMS,
297
+ isFullMode: false
298
+ });
299
+ const capIllustration = component.find('CapIllustration');
300
+ expect(capIllustration.prop('buttonLabel')).toBeDefined();
301
+ expect(capIllustration.prop('title')).toBeDefined();
302
+ });
303
+ });
304
+
305
+ describe('PropTypes Validation', () => {
306
+ it('should handle missing optional props gracefully', () => {
307
+ const minimalProps = {
308
+ intl: mockIntl,
309
+ createTemplate: mockCreateTemplate
310
+ };
311
+
312
+ expect(() => {
313
+ renderComponent(minimalProps);
314
+ }).not.toThrow();
315
+ });
316
+
317
+ it('should handle all required props', () => {
318
+ expect(() => {
319
+ renderComponent(defaultProps);
320
+ }).not.toThrow();
321
+ });
322
+ });
323
+ });