@capillarytech/creatives-library 8.0.206-alpha.0 → 8.0.206

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.206-alpha.0",
4
+ "version": "8.0.206",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -37,6 +37,7 @@ import {
37
37
  CapLink,
38
38
  CapHeading,
39
39
  CapNotification,
40
+ CapIllustration,
40
41
  CapHeader,
41
42
  CapLabel,
42
43
  CapRadio,
@@ -96,7 +97,6 @@ import CreativesContainer from '../CreativesContainer';
96
97
  import WhatsappStatusContainer from '../../v2Components/WhatsappStatusContainer';
97
98
  import WechatRichmediaTemplatePreview from '../../v2Components/TemplatePreview/WechatRichmediaTemplatePreview';
98
99
  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,6 +139,14 @@ 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';
142
150
  import whatsappImageEmptyPreview from '../../v2Components/TemplatePreview/assets/images/empty_image_preview.svg';
143
151
  import whatsappVideoEmptyPreview from '../../v2Components/TemplatePreview/assets/images/empty_video_preview.svg';
144
152
  import { CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
@@ -1156,7 +1164,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1156
1164
  }
1157
1165
  />
1158
1166
 
1159
- getSmsEmailIllustration = () => {
1167
+ getSmsEmailIllustration = () =>
1160
1168
  this.props.isDltFromRcs ? (
1161
1169
  <CapHeader
1162
1170
  title={
@@ -1171,9 +1179,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1171
1179
  }
1172
1180
  />
1173
1181
  ) : (
1174
- <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={this.state.channel} hostName={this.state?.hostName}/>
1182
+ <CapIllustration
1183
+ buttonClassName={`create-new-${this.state.channel.toLowerCase()}`}
1184
+ {...this.getChannelTypeIllustrationInfo(
1185
+ this.state.channel.toUpperCase(),
1186
+ )}
1187
+ />
1175
1188
  );
1176
- }
1177
1189
 
1178
1190
  getHoverComponent = (children) => {
1179
1191
  return this.state.channel.toLowerCase() === ZALO_LOWERCASE ? (
@@ -1766,14 +1778,14 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1766
1778
  isEmpty(filteredTemplates) &&
1767
1779
  isEmpty(this.state.searchText) &&
1768
1780
  <div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto'} : {}}>
1769
- <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel} hostName={this.state?.hostName}/>
1781
+ <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel, this.state?.hostName)} />
1770
1782
  </div>
1771
1783
  )
1772
1784
  }
1773
1785
  {(showWhatsappIllustration || showZaloIllustration) && (
1774
1786
  noLoaderAndSearchText &&
1775
1787
  <div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto' } : {}}>
1776
- {noWhatsappZaloTemplates && <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel} hostName={this.state?.hostName}/>}
1788
+ {noWhatsappZaloTemplates && <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel, isEmpty(this.state?.hostName))} />}
1777
1789
  {noFilteredWhatsappZaloTemplates && this.state?.hostName && this.whatsappZaloIllustrationText('noFilteredWhatsappZaloTemplatesTitle', 'noFilteredWhatsappZaloTemplatesDesc')}
1778
1790
  {noApprovedWhatsappZaloTemplates && this.whatsappZaloIllustrationText('noApprovedWhatsappZaloTemplatesTitle', showWhatsappIllustration ? 'noApprovedWhatsappTemplatesDesc' : 'zaloDescIllustration')}
1779
1791
  </div>
@@ -1783,7 +1795,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1783
1795
  (
1784
1796
  noLoaderAndSearchText &&
1785
1797
  <div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto' } : {}}>
1786
- <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel}/>
1798
+ <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />
1787
1799
  {noApprovedRcsTemplates && this.whatsappZaloIllustrationText('noApprovedRcsTemplatesTitle', 'noApprovedRcsTemplatesDesc')}
1788
1800
  </div>
1789
1801
  )
@@ -1792,7 +1804,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1792
1804
  (
1793
1805
  noLoaderAndSearchText &&
1794
1806
  <div className={`${this.isFullMode() ? 'inapp-illustration-parent' : ''}`}>
1795
- <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel}/>
1807
+ <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />
1796
1808
  </div>
1797
1809
  )
1798
1810
  }
@@ -2871,7 +2883,99 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2871
2883
  (rcsLoader !== undefined ? rcsLoader : false);
2872
2884
  return isLoading;
2873
2885
  }
2874
-
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
+ }
2875
2979
  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')))
2876
2980
  renderEmailPreviewModal() {
2877
2981
  const slideboxContent = (
@@ -326,18 +326,6 @@ 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
- },
341
329
  "newWhatsappTemplate": {
342
330
  id: `${scope}.newWhatsappTemplate`,
343
331
  defaultMessage: 'Add new Whatsapp {template}',
@@ -358,18 +346,6 @@ export default defineMessages({
358
346
  id: `${scope}.emailTitleIllustartion`,
359
347
  defaultMessage: 'Create an email {template}',
360
348
  },
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
- },
373
349
  "whatsappTitleIllustration": {
374
350
  id: `${scope}.whatsappTitleIllustration`,
375
351
  defaultMessage: 'Add a new Whatsapp creative {template}',
@@ -184,136 +184,6 @@ exports[`Test Templates container Should render illustration when no templates a
184
184
  </CapSkeleton>
185
185
  `;
186
186
 
187
- exports[`Test Templates container Should render sms illustration when no templates are passed 1`] = `
188
- <Fragment>
189
- <div
190
- className="creatives-templates-list library-mode"
191
- >
192
- <input
193
- accept=".zip, .html, .htm"
194
- id="filename"
195
- onChange={[Function]}
196
- style={
197
- Object {
198
- "display": "none",
199
- }
200
- }
201
- type="file"
202
- />
203
- <CapRow>
204
- <Pagination
205
- onPageChange={[Function]}
206
- paginationContainer="pagination-container"
207
- paginationSelector="pagination-container"
208
- >
209
- <div>
210
- <div
211
- className="action-container"
212
- >
213
- <_Class
214
- className="search-text"
215
- disabled={false}
216
- labelPosition="top"
217
- onChange={[Function]}
218
- onClear={[Function]}
219
- onScroll={[Function]}
220
- placeholder="Search"
221
- style={
222
- Object {
223
- "width": "210px",
224
- }
225
- }
226
- value=""
227
- />
228
- <Component />
229
- <Component />
230
- <div
231
- style={
232
- Object {
233
- "alignItems": "center",
234
- "display": "flex",
235
- "justifyContent": "space-between",
236
- }
237
- }
238
- >
239
- <CapButton
240
- className="create-new-sms margin-l-8 margin-b-12"
241
- disabled={false}
242
- isAddBtn={false}
243
- onClick={[Function]}
244
- type="primary"
245
- >
246
- Create new
247
- </CapButton>
248
- </div>
249
- </div>
250
- <CapCustomSkeleton>
251
- <div>
252
- <div
253
- style={
254
- Object {
255
- "height": "calc(100vh - 325px)",
256
- "overflow": "auto",
257
- }
258
- }
259
- >
260
- <ChannelTypeIllustration
261
- createTemplate={[Function]}
262
- currentChannel="SMS"
263
- hostName=""
264
- />
265
- </div>
266
- </div>
267
- </CapCustomSkeleton>
268
- </div>
269
- </Pagination>
270
- </CapRow>
271
- <CapRow />
272
- <CapRow>
273
- <CapSlideBox
274
- closeIconPosition="right"
275
- closeIconSize="m"
276
- closeIconType="close"
277
- content={
278
- <CardGrid
279
- className=""
280
- colNumber={2}
281
- gutterSize={16}
282
- isLoading={false}
283
- listItem={Array []}
284
- onHoverItem={[Function]}
285
- onItemClick={[Function]}
286
- />
287
- }
288
- handleClose={[Function]}
289
- header={
290
- <h3>
291
- Select layout
292
- </h3>
293
- }
294
- loadingText="Loading EDM Templates"
295
- position="right"
296
- show={false}
297
- size="size-r"
298
- width={60}
299
- />
300
- <InjectIntl(Wrapper)
301
- centered={true}
302
- className="delete-template-confirm"
303
- closeText="Cancel"
304
- okText="Yes, delete"
305
- onCancel={[Function]}
306
- onOk={[Function]}
307
- title="Confirm delete template"
308
- visible={false}
309
- >
310
- Are you sure you wish to delete this template?
311
- </InjectIntl(Wrapper)>
312
- </CapRow>
313
- </div>
314
- </Fragment>
315
- `;
316
-
317
187
  exports[`Test Templates container Should render temlates when Zalo templates are passed in full mode 1`] = `
318
188
  <CapSkeleton
319
189
  active={true}
@@ -28,26 +28,13 @@ describe('Test Templates container', () => {
28
28
  jest.clearAllMocks();
29
29
  });
30
30
 
31
- const getTemplateProps =(channel)=>{
32
- switch(channel){
33
- case 'whatsapp':
34
- return TemplatesProp;
35
- case 'zalo':
36
- return ZaloTemplateProp;
37
- case 'rcs':
38
- return rcsTemplates;
39
- default:
40
- return TemplatesProp;
41
- }
42
- }
43
-
44
- const RenderFunctionFor = (channel, isFullMode) => {
31
+ const renderFunction = (isFullMode) => {
45
32
  renderedComponent = shallowWithIntl(
46
33
  <Templates
47
34
  route={{
48
- name: channel,
35
+ name: 'whatsapp',
49
36
  }}
50
- Templates={getTemplateProps(channel)}
37
+ Templates={TemplatesProp}
51
38
  actions={{
52
39
  getWeCrmAccounts,
53
40
  setChannelAccount,
@@ -56,7 +43,67 @@ describe('Test Templates container', () => {
56
43
  getSenderDetails,
57
44
  }}
58
45
  location={{
59
- pathname: `/${channel}`,
46
+ pathname: '/whatsapp',
47
+ query: {},
48
+ search: '',
49
+ }}
50
+ EmailCreate={{
51
+ duplicateTemplateInProgress: false,
52
+ }}
53
+ isFullMode={isFullMode}
54
+ intl={{
55
+ formatMessage: () => {},
56
+ }}
57
+ />,
58
+ );
59
+ };
60
+
61
+ const renderZaloFunction = (isFullMode) => {
62
+ renderedComponent = shallowWithIntl(
63
+ <Templates
64
+ route={{
65
+ name: 'Zalo',
66
+ }}
67
+ Templates={ZaloTemplateProp}
68
+ actions={{
69
+ getWeCrmAccounts,
70
+ setChannelAccount,
71
+ getAllTemplates,
72
+ getUserList,
73
+ getSenderDetails,
74
+ }}
75
+ location={{
76
+ pathname: '/Zalo',
77
+ query: {},
78
+ search: '',
79
+ }}
80
+ EmailCreate={{
81
+ duplicateTemplateInProgress: false,
82
+ }}
83
+ isFullMode={isFullMode}
84
+ intl={{
85
+ formatMessage: () => {},
86
+ }}
87
+ />,
88
+ );
89
+ };
90
+
91
+ const renderRcsFunction = (isFullMode) => {
92
+ renderedComponent = shallowWithIntl(
93
+ <Templates
94
+ route={{
95
+ name: 'RCS',
96
+ }}
97
+ Templates={rcsTemplates}
98
+ actions={{
99
+ getWeCrmAccounts,
100
+ setChannelAccount,
101
+ getAllTemplates,
102
+ getUserList,
103
+ getSenderDetails,
104
+ }}
105
+ location={{
106
+ pathname: '/rcs',
60
107
  query: {},
61
108
  search: '',
62
109
  }}
@@ -72,7 +119,7 @@ describe('Test Templates container', () => {
72
119
  };
73
120
 
74
121
  it('Should render correct component for whatsapp channel', () => {
75
- RenderFunctionFor('whatsapp');
122
+ renderFunction();
76
123
  expect(renderedComponent).toMatchSnapshot();
77
124
  expect(getSenderDetails).toHaveBeenCalledTimes(1);
78
125
  expect(getSenderDetails).toHaveBeenCalledWith({
@@ -82,22 +129,13 @@ describe('Test Templates container', () => {
82
129
  });
83
130
 
84
131
  it('Should render temlates when whatsapp templates are passed', () => {
85
- RenderFunctionFor('whatsapp');
132
+ renderFunction();
86
133
  renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
87
134
  expect(renderedComponent).toMatchSnapshot();
88
135
  });
89
136
 
90
137
  it('Should render illustration when no templates are passed', () => {
91
- RenderFunctionFor('whatsapp');
92
- renderedComponent.setProps({
93
- TemplatesList: [],
94
- Templates: {},
95
- });
96
- expect(renderedComponent).toMatchSnapshot();
97
- });
98
-
99
- it('Should render sms illustration when no templates are passed', () => {
100
- RenderFunctionFor('sms');
138
+ renderFunction();
101
139
  renderedComponent.setProps({
102
140
  TemplatesList: [],
103
141
  Templates: {},
@@ -106,14 +144,14 @@ describe('Test Templates container', () => {
106
144
  });
107
145
 
108
146
  it('Should render temlates when whatsapp templates are passed in full mode', () => {
109
- RenderFunctionFor('whatsapp',true);
147
+ renderFunction(true);
110
148
  renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
111
149
  renderedComponent.setState({ selectedWhatsappStatus: 'approved' });
112
150
  expect(renderedComponent).toMatchSnapshot();
113
151
  });
114
152
 
115
153
  it('Test getCreatives params in edit mode', () => {
116
- RenderFunctionFor('whatsapp');
154
+ renderFunction();
117
155
  renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
118
156
  renderedComponent.setState({ routeParams: { pathname: '/edit' } });
119
157
  expect(renderedComponent.instance().getCreativesParams()).toEqual(
@@ -121,21 +159,21 @@ describe('Test Templates container', () => {
121
159
  );
122
160
  });
123
161
  it('Should render correct component for zalo channel', () => {
124
- RenderFunctionFor('zalo');
162
+ renderZaloFunction();
125
163
  expect(renderedComponent).toMatchSnapshot();
126
164
  });
127
165
  it('Should render temlates when zalo templates are passed', () => {
128
- RenderFunctionFor('zalo');
166
+ renderZaloFunction();
129
167
  renderedComponent.setProps({ TemplatesList: ZaloTemplateProp.templates });
130
168
  expect(renderedComponent).toMatchSnapshot();
131
169
  });
132
170
  it('Should render temlates when Zalo templates are passed in full mode', () => {
133
- RenderFunctionFor('zalo',true);
171
+ renderZaloFunction(true);
134
172
  renderedComponent.setProps({ TemplatesList: ZaloTemplateProp.templates });
135
173
  expect(renderedComponent).toMatchSnapshot();
136
174
  });
137
175
  it('Should render illustration when no templates are passed', () => {
138
- RenderFunctionFor('zalo');
176
+ renderZaloFunction();
139
177
  renderedComponent.setProps({
140
178
  TemplatesList: [],
141
179
  Templates: {},
@@ -149,7 +187,7 @@ describe('Test Templates container', () => {
149
187
  return shallowWithIntl(<FilterContainer />);
150
188
  };
151
189
  it('Test removing single filter', () => {
152
- RenderFunctionFor('whatsapp');
190
+ renderFunction();
153
191
  renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
154
192
  renderedComponent.setState({ selectedWhatsappStatus: 'approved' });
155
193
  getFilterContainer().find('CapTag').props().onClose();
@@ -157,7 +195,7 @@ describe('Test Templates container', () => {
157
195
  });
158
196
 
159
197
  it('Test removing all whatsapp filterss', () => {
160
- RenderFunctionFor('whatsapp');
198
+ renderFunction();
161
199
  renderedComponent.setProps({ TemplatesList: TemplatesProp.templates });
162
200
 
163
201
  renderedComponent.setState({ selectedWhatsappStatus: 'approved' });
@@ -170,7 +208,7 @@ describe('Test Templates container', () => {
170
208
  });
171
209
 
172
210
  it('Test max templates not exceeded', () => {
173
- RenderFunctionFor('whatsapp',true);
211
+ renderFunction(true);
174
212
  renderedComponent.setProps({
175
213
  TemplatesList: [{ ...TemplatesProp.templates[0], totalCount: 260 }],
176
214
  });
@@ -178,7 +216,7 @@ describe('Test Templates container', () => {
178
216
  });
179
217
 
180
218
  it('Test max templates exceeded', () => {
181
- RenderFunctionFor('whatsapp',true);
219
+ renderFunction(true);
182
220
  renderedComponent.setProps({
183
221
  TemplatesList: [{ ...TemplatesProp.templates[0], totalCount: 1510 }],
184
222
  });
@@ -186,7 +224,7 @@ describe('Test Templates container', () => {
186
224
  });
187
225
 
188
226
  it('Test max templates warning', () => {
189
- RenderFunctionFor('whatsapp',true);
227
+ renderFunction(true);
190
228
  renderedComponent.setProps({
191
229
  TemplatesList: [{ ...TemplatesProp.templates[0], totalCount: 248 }],
192
230
  });
@@ -194,7 +232,7 @@ describe('Test Templates container', () => {
194
232
  });
195
233
 
196
234
  it('Should render correct component for RCS channel', () => {
197
- RenderFunctionFor('rcs');
235
+ renderRcsFunction();
198
236
  expect(renderedComponent).toMatchSnapshot();
199
237
  expect(getSenderDetails).toHaveBeenCalledTimes(1);
200
238
  expect(getSenderDetails).toHaveBeenCalledWith({
@@ -204,13 +242,13 @@ describe('Test Templates container', () => {
204
242
  });
205
243
 
206
244
  it('Should render templates when RCS templates are passed', () => {
207
- RenderFunctionFor('rcs');
245
+ renderRcsFunction();
208
246
  renderedComponent.setProps({ TemplatesList: rcsTemplates.templates });
209
247
  expect(renderedComponent).toMatchSnapshot();
210
248
  });
211
249
 
212
250
  it('Should render illustration when no RCS templates are passed', () => {
213
- RenderFunctionFor('rcs');
251
+ renderRcsFunction();
214
252
  renderedComponent.setProps({
215
253
  TemplatesList: [],
216
254
  Templates: {},
@@ -219,14 +257,14 @@ describe('Test Templates container', () => {
219
257
  });
220
258
 
221
259
  it('Should render templates when RCS templates are passed in full mode', () => {
222
- RenderFunctionFor('rcs',true);
260
+ renderRcsFunction(true);
223
261
  renderedComponent.setProps({ TemplatesList: rcsTemplates.templates });
224
262
  renderedComponent.setState({ selectedRcsStatus: 'approved' });
225
263
  expect(renderedComponent).toMatchSnapshot();
226
264
  });
227
265
 
228
266
  it('Test getCreatives params in edit mode for RCS', () => {
229
- RenderFunctionFor('rcs');
267
+ renderRcsFunction();
230
268
  renderedComponent.setProps({ TemplatesList: rcsTemplates.templates });
231
269
  renderedComponent.setState({ routeParams: { pathname: '/edit' } });
232
270
  const getCreativesParamsOutputRcs = {
@@ -101,7 +101,8 @@ import {
101
101
  IMAGE,
102
102
  VIDEO,
103
103
  URL,
104
- REQUEST
104
+ REQUEST,
105
+ HOST_KARIX
105
106
  } from './constants';
106
107
  import { transformAssetData, transformToVendorFormat, VENDOR_TYPES } from '../../utils/vendorDataTransformers';
107
108
  import { DATE_DISPLAY_FORMAT, TIME_DISPLAY_FORMAT } from '../App/constants';
@@ -1313,6 +1314,9 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
1313
1314
  } else {
1314
1315
  setKarixFileHandle('');
1315
1316
  }
1317
+ if(host === HOST_KARIX) {
1318
+ setSecurityWarningReqd(true);
1319
+ }
1316
1320
  };
1317
1321
 
1318
1322
  const onTemplateCategoryChange = (value) => {
@@ -1754,6 +1758,10 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
1754
1758
  //if button type is cta and there are no buttons saved
1755
1759
  return true;
1756
1760
  }
1761
+ //karix expiry minutes validation
1762
+ if(host === HOST_KARIX && (expiryMinutes <=0 || expiryMinutes > 90)){
1763
+ return true;
1764
+ }
1757
1765
 
1758
1766
  if(isAuthenticationTemplate && securityWarningReqd && !expiryMinutes){
1759
1767
  return true;