@capillarytech/creatives-library 7.17.176 → 7.17.177

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": "7.17.176",
4
+ "version": "7.17.177",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/services/api.js CHANGED
@@ -525,8 +525,8 @@ export const getS3UrlFileSizes = (data) => {
525
525
  return request(url, getAPICallObject('POST', data));
526
526
  };
527
527
 
528
- export const getTemplateInfoById = ({id, username, oa_id, token, host}) => {
529
- const url = `${API_ENDPOINT}/templates/v1/${id}/Zalo?username=${username}&oa_id=${oa_id}&token=${token}&host=${host}`;
528
+ export const getTemplateInfoById = ({id, username, oa_id, token}) => {
529
+ const url = `${API_ENDPOINT}/templates/v1/${id}/Zalo?username=${username}&oa_id=${oa_id}&token=${token}`;
530
530
  const compressedTemplatesData = request(url, getAPICallObject('GET'));
531
531
  return compressedTemplatesData.then((data) => {
532
532
  const { response = '' } = data || {};
@@ -124,12 +124,10 @@ export class Creatives extends React.Component {
124
124
  sourceAccountIdentifier = "",
125
125
  configs: { token = "" } = {},
126
126
  } = get(this.props, "Templates.selectedZaloAccount", {});
127
- const { hostName = ''} = get(this.props, "Templates.senderDetails", {});
128
127
  this.props.zaloActions.getTemplateInfoById({
129
128
  username: name,
130
129
  oa_id: sourceAccountIdentifier,
131
130
  token,
132
- host: hostName,
133
131
  id: template?._id,
134
132
  preview: true,
135
133
  actionCallback: this.actionCallback,
@@ -305,10 +305,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
305
305
  channel = 'Zalo';
306
306
  activeMode = ACCOUNT_SELECTION_MODE;
307
307
  this.props.actions.getWeCrmAccounts(channel);
308
- this.props.actions.getSenderDetails({
309
- channel: ZALO,
310
- orgUnitId: -1,
311
- });
312
308
  break;
313
309
  default:
314
310
  channel = '';
@@ -623,19 +619,18 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
623
619
  wecrm_token
624
620
  } = configs || {};
625
621
  if (weCrmChannels.includes(selectedChannel)) {
626
- if ([WHATSAPP_LOWERCASE, ZALO_LOWERCASE].includes(selectedChannel)) {
622
+ if ([WHATSAPP_LOWERCASE].includes(selectedChannel)) {
627
623
  if (hostName === '') {
628
624
  return;
629
625
  }
630
626
 
631
627
  weCrmAccountsList[0].hostName = hostName;
632
628
  nextProps.actions.setChannelAccount(selectedChannel.toUpperCase(), weCrmAccountsList[0]);
633
- if (selectedChannel === ZALO_LOWERCASE) {
634
- paramsDefault.username = name;
635
- paramsDefault.oa_id = sourceAccountIdentifier;
636
- paramsDefault.token = token;
637
- paramsDefault.host = hostName;
638
- }
629
+ } else if ([ZALO_LOWERCASE].includes(selectedChannel)) {
630
+ nextProps.actions.setChannelAccount(selectedChannel.toUpperCase(), weCrmAccountsList[0]);
631
+ paramsDefault.username = name;
632
+ paramsDefault.oa_id = sourceAccountIdentifier;
633
+ paramsDefault.token = token;
639
634
  } else {
640
635
  paramsDefault.wecrmId = wecrm_app_id;
641
636
  paramsDefault.wecrmToken = wecrm_token;
@@ -646,7 +641,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
646
641
  }
647
642
 
648
643
  }
649
- this.setState({ defaultAccount: false, activeMode: TEMPLATES_MODE, selectedAccount: weCrmAccountsList[0].name, hostName: weCrmAccountsList[0].hostName });
644
+ this.setState({ defaultAccount: false, activeMode: TEMPLATES_MODE, selectedAccount: weCrmAccountsList[0].name, hostName });
650
645
  this.getAllTemplates({params: paramsDefault}, true);
651
646
  }
652
647
  const zaloPreviewUrl = get(nextProps, 'Zalo.zaloTemplatePreviewData.versions.base.content.zalo.previewUrl', '');
@@ -700,13 +695,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
700
695
  name = "",
701
696
  sourceAccountIdentifier = "",
702
697
  configs: { token = "" } = {},
703
- hostName = "",
704
698
  } = setAcc || {};
705
699
  params.username = name;
706
700
  params.oa_id = sourceAccountIdentifier;
707
701
  params.token = token;
708
702
  params.isAccountSelection = true;
709
- params.host = hostName || this.state.hostName;
710
703
  }
711
704
  }
712
705
 
@@ -806,8 +799,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
806
799
  if(this.state.channel.toLowerCase() !== ZALO_LOWERCASE) {
807
800
  queryParams.name = this.state.searchText;
808
801
  queryParams.sortBy = this.state.sortBy;
809
- } else {
810
- queryParams.host = this.props.Templates?.senderDetails?.hostName || this.props.Templates?.selectedZaloAccount?.hostName;
811
802
  }
812
803
  queryParams.page = this.state.page;
813
804
  queryParams.perPage = this.state.perPageLimit;
@@ -862,12 +853,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
862
853
  name = "",
863
854
  sourceAccountIdentifier = "",
864
855
  configs: { token = "" } = {},
865
- hostName = "",
866
856
  } = get(this.props, "Templates.selectedZaloAccount", {});
867
857
  queryParams.username = name;
868
858
  queryParams.oa_id = sourceAccountIdentifier;
869
859
  queryParams.token = token;
870
- queryParams.host = hostName || this.state.hostName;
871
860
  }
872
861
  this.setState({ page, templatesCount }, () => {
873
862
  queryParams.page = page;
@@ -2113,13 +2102,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2113
2102
  name = "",
2114
2103
  sourceAccountIdentifier = "",
2115
2104
  configs: { token = "" } = {},
2116
- hostName = "",
2117
2105
  } = get(this.props, "Templates.selectedZaloAccount", {});
2118
2106
  this.props.zaloActions.getTemplateInfoById({
2119
2107
  username: name,
2120
2108
  oa_id: sourceAccountIdentifier,
2121
2109
  token: token,
2122
- host: hostName || this.state.hostName,
2123
2110
  id: template?._id,
2124
2111
  preview: true,
2125
2112
  actionCallback: this.actionCallback,
@@ -1,4 +1,3 @@
1
- import get from 'lodash/get';
2
1
  import { call, put, takeLatest, take, cancel, select } from 'redux-saga/effects';
3
2
  import { LOCATION_CHANGE } from 'react-router-redux';
4
3
  // import { schema, normalize } from 'normalizr';
@@ -177,7 +176,7 @@ export function* getSenderDetails({
177
176
  if (!apiResponse?.errors?.length) {
178
177
  yield put({
179
178
  type: types.GET_SENDER_DETAILS_SUCCESS,
180
- payload: get(apiResponse, `entity.${channel}[0].domainProperties.hostName`, ''),
179
+ payload: apiResponse?.entity?.WHATSAPP[0]?.domainProperties?.hostName || '',
181
180
  });
182
181
  } else {
183
182
  yield put({
@@ -87,53 +87,380 @@ exports[`Test Templates container Should render illustration when no templates a
87
87
  `;
88
88
 
89
89
  exports[`Test Templates container Should render temlates when Zalo templates are passed in full mode 1`] = `
90
- <CapSpin
91
- spinning={false}
92
- >
90
+ <Fragment>
93
91
  <div
94
- style={
95
- Object {
96
- "overflowX": "auto",
97
- "paddingBottom": "1.142rem",
98
- }
99
- }
92
+ className="creatives-templates-list full-mode"
100
93
  >
101
- <CapHeader
102
- className="select-account-header"
103
- description="Choose the account to send content"
104
- descriptionClass=""
105
- inline={false}
106
- size="regular"
107
- title="Zalo account"
108
- titleClass=""
109
- />
110
- <CapRadioCard
111
- cardHeight="48px"
112
- cardWidth="276px"
113
- className="select-account"
114
- defaultValue=""
94
+ <input
95
+ accept=".zip, .html, .htm"
96
+ id="filename"
115
97
  onChange={[Function]}
116
- panes={
117
- Array [
118
- Object {
119
- "icon": <CapIconAvatar
120
- backgroundProps={Object {}}
121
- height="2rem"
122
- labelProps={Object {}}
123
- text="c"
124
- width="auto"
125
- />,
126
- "key": "fa66f53ca2bb4b93b02dfc5bd265e2fd",
127
- "title": "capillary_zns",
128
- "value": "capillary_zns",
129
- },
130
- ]
98
+ style={
99
+ Object {
100
+ "display": "none",
101
+ }
131
102
  }
132
- selected=""
133
- size="small"
103
+ type="file"
134
104
  />
105
+ <CapRow>
106
+ <Pagination
107
+ onPageChange={[Function]}
108
+ paginationContainer="pagination-container"
109
+ paginationSelector="pagination-container"
110
+ templateInProgress={false}
111
+ >
112
+ <div>
113
+ <div
114
+ className="action-container"
115
+ >
116
+ <_class
117
+ className="search-text"
118
+ disabled={false}
119
+ labelPosition="top"
120
+ onChange={[Function]}
121
+ onClear={[Function]}
122
+ onScroll={[Function]}
123
+ placeholder="Search"
124
+ style={
125
+ Object {
126
+ "width": "210px",
127
+ }
128
+ }
129
+ value=""
130
+ />
131
+ <div
132
+ className="zalo-filters"
133
+ >
134
+ <CapSelectFilter
135
+ data={
136
+ Array [
137
+ Object {
138
+ "key": "enable",
139
+ "label": <FormattedMessage
140
+ defaultMessage="Enable"
141
+ id="creatives.containersV2.zalo.ENABLE_STATUS"
142
+ values={Object {}}
143
+ />,
144
+ "value": "ENABLE",
145
+ },
146
+ Object {
147
+ "key": "reject",
148
+ "label": <FormattedMessage
149
+ defaultMessage="Reject"
150
+ id="creatives.containersV2.zalo.REJECT_STATUS"
151
+ values={Object {}}
152
+ />,
153
+ "value": "REJECT",
154
+ },
155
+ Object {
156
+ "key": "disable",
157
+ "label": <FormattedMessage
158
+ defaultMessage="Disable"
159
+ id="creatives.containersV2.zalo.DISABLE_STATUS"
160
+ values={Object {}}
161
+ />,
162
+ "value": "DISABLE",
163
+ },
164
+ Object {
165
+ "key": "reviewPending",
166
+ "label": <FormattedMessage
167
+ defaultMessage="Review Pending"
168
+ id="creatives.containersV2.zalo.PENDING_REVIEW_STATUS"
169
+ values={Object {}}
170
+ />,
171
+ "value": "PENDING_REVIEW",
172
+ },
173
+ ]
174
+ }
175
+ dropdownMaxHeight="320px"
176
+ dropdownWidth="228px"
177
+ onSelect={[Function]}
178
+ placeholder="Status"
179
+ placement="bottomLeft"
180
+ selectedValue=""
181
+ width="90px"
182
+ />
183
+ </div>
184
+ <Component />
185
+ <Component />
186
+ <div
187
+ style={
188
+ Object {
189
+ "alignItems": "center",
190
+ "display": "flex",
191
+ "justifyContent": "space-between",
192
+ }
193
+ }
194
+ />
195
+ </div>
196
+ <CapRow
197
+ align="middle"
198
+ className="selected-whatsapp-filters"
199
+ type="flex"
200
+ />
201
+ <CapSpin
202
+ spinning={false}
203
+ style={
204
+ Object {
205
+ "width": "100%",
206
+ }
207
+ }
208
+ tip="Getting all templates..."
209
+ >
210
+ <div>
211
+ <div
212
+ className="pagination-container"
213
+ >
214
+ <CapCustomCardList
215
+ cardList={
216
+ Array [
217
+ Object {
218
+ "content": <CapLabel
219
+ className="zalo-listing-content desc"
220
+ type="label19"
221
+ >
222
+ Test1
223
+ </CapLabel>,
224
+ "extra": Array [
225
+ <CapTooltip
226
+ title={
227
+ <div
228
+ className="zalo-view-tooltip"
229
+ >
230
+ Open preview in new tab
231
+ </div>
232
+ }
233
+ >
234
+ <CapIcon
235
+ className="view-zalo"
236
+ onClick={[Function]}
237
+ style={
238
+ Object {
239
+ "marginRight": "16px",
240
+ }
241
+ }
242
+ type="eye"
243
+ />
244
+ </CapTooltip>,
245
+ <CapDropdown
246
+ overlay={
247
+ <CapMenu>
248
+ <withItemHOC
249
+ className="duplicate-zalo"
250
+ onClick={[Function]}
251
+ >
252
+ <FormattedMessage
253
+ defaultMessage="Duplicate"
254
+ id="creatives.containersV2.Templates.duplicateButton"
255
+ values={Object {}}
256
+ />
257
+ </withItemHOC>
258
+ <withItemHOC
259
+ className="delete-zalo"
260
+ onClick={[Function]}
261
+ >
262
+ <FormattedMessage
263
+ defaultMessage="Delete"
264
+ id="creatives.containersV2.Templates.deleteButton"
265
+ values={Object {}}
266
+ />
267
+ </withItemHOC>
268
+ </CapMenu>
269
+ }
270
+ >
271
+ <React.Fragment />
272
+ </CapDropdown>,
273
+ ],
274
+ "hoverOption": <CapButton
275
+ className="edit-zalo"
276
+ isAddBtn={false}
277
+ onClick={[Function]}
278
+ type="primary"
279
+ >
280
+ Overview
281
+ </CapButton>,
282
+ "key": "ZALO-card-Test1",
283
+ "title": <CapRow>
284
+ <CapLabel
285
+ className="zalo-template-name"
286
+ type="label1"
287
+ >
288
+
289
+ </CapLabel>
290
+ <CapRow
291
+ align="middle"
292
+ className="zalo-status-container zalo-status-color"
293
+ type="flex"
294
+ >
295
+ <CapStatus
296
+ color=""
297
+ height="0.571rem"
298
+ labelType="label3"
299
+ text=""
300
+ type="pending"
301
+ width="0.571rem"
302
+ />
303
+ </CapRow>
304
+ </CapRow>,
305
+ },
306
+ Object {
307
+ "content": <CapLabel
308
+ className="zalo-listing-content desc"
309
+ type="label19"
310
+ >
311
+ Test2
312
+ </CapLabel>,
313
+ "extra": Array [
314
+ <CapTooltip
315
+ title={
316
+ <div
317
+ className="zalo-view-tooltip"
318
+ >
319
+ Open preview in new tab
320
+ </div>
321
+ }
322
+ >
323
+ <CapIcon
324
+ className="view-zalo"
325
+ onClick={[Function]}
326
+ style={
327
+ Object {
328
+ "marginRight": "16px",
329
+ }
330
+ }
331
+ type="eye"
332
+ />
333
+ </CapTooltip>,
334
+ <CapDropdown
335
+ overlay={
336
+ <CapMenu>
337
+ <withItemHOC
338
+ className="duplicate-zalo"
339
+ onClick={[Function]}
340
+ >
341
+ <FormattedMessage
342
+ defaultMessage="Duplicate"
343
+ id="creatives.containersV2.Templates.duplicateButton"
344
+ values={Object {}}
345
+ />
346
+ </withItemHOC>
347
+ <withItemHOC
348
+ className="delete-zalo"
349
+ onClick={[Function]}
350
+ >
351
+ <FormattedMessage
352
+ defaultMessage="Delete"
353
+ id="creatives.containersV2.Templates.deleteButton"
354
+ values={Object {}}
355
+ />
356
+ </withItemHOC>
357
+ </CapMenu>
358
+ }
359
+ >
360
+ <React.Fragment />
361
+ </CapDropdown>,
362
+ ],
363
+ "hoverOption": <CapButton
364
+ className="edit-zalo"
365
+ isAddBtn={false}
366
+ onClick={[Function]}
367
+ type="primary"
368
+ >
369
+ Overview
370
+ </CapButton>,
371
+ "key": "ZALO-card-Test2",
372
+ "title": <CapRow>
373
+ <CapLabel
374
+ className="zalo-template-name"
375
+ type="label1"
376
+ >
377
+
378
+ </CapLabel>
379
+ <CapRow
380
+ align="middle"
381
+ className="zalo-status-container zalo-status-color"
382
+ type="flex"
383
+ >
384
+ <CapStatus
385
+ color=""
386
+ height="0.571rem"
387
+ labelType="label3"
388
+ text=""
389
+ type="pending"
390
+ width="0.571rem"
391
+ />
392
+ </CapRow>
393
+ </CapRow>,
394
+ },
395
+ ]
396
+ }
397
+ fbType="list"
398
+ key="ZALO-card-list"
399
+ style={
400
+ Object {
401
+ "marginLeft": "16px",
402
+ }
403
+ }
404
+ type="ZALO"
405
+ />
406
+ </div>
407
+ <div
408
+ style={
409
+ Object {
410
+ "height": "calc(100vh - 325px)",
411
+ "overflow": "auto",
412
+ }
413
+ }
414
+ />
415
+ </div>
416
+ </CapSpin>
417
+ </div>
418
+ </Pagination>
419
+ </CapRow>
420
+ <CapRow />
421
+ <CapRow>
422
+ <CapSlideBox
423
+ closeIconPosition="right"
424
+ closeIconSize="m"
425
+ closeIconType="close"
426
+ content={
427
+ <CardGrid
428
+ className=""
429
+ colNumber={2}
430
+ gutterSize={16}
431
+ isLoading={false}
432
+ listItem={Array []}
433
+ onHoverItem={[Function]}
434
+ onItemClick={[Function]}
435
+ />
436
+ }
437
+ handleClose={[Function]}
438
+ header={
439
+ <h3>
440
+ Select layout
441
+ </h3>
442
+ }
443
+ loadingText="Loading EDM Templates"
444
+ position="right"
445
+ show={false}
446
+ size="size-r"
447
+ width={60}
448
+ />
449
+ <InjectIntl(Wrapper)
450
+ centered={true}
451
+ className="delete-template-confirm"
452
+ closeText="Cancel"
453
+ okText="Yes, delete"
454
+ onCancel={[Function]}
455
+ onOk={[Function]}
456
+ title="Confirm delete template"
457
+ visible={false}
458
+ >
459
+ Are you sure you wish to delete this template?
460
+ </InjectIntl(Wrapper)>
461
+ </CapRow>
135
462
  </div>
136
- </CapSpin>
463
+ </Fragment>
137
464
  `;
138
465
 
139
466
  exports[`Test Templates container Should render temlates when whatsapp templates are passed 1`] = `
@@ -671,53 +998,161 @@ exports[`Test Templates container Should render temlates when whatsapp templates
671
998
  `;
672
999
 
673
1000
  exports[`Test Templates container Should render temlates when zalo templates are passed 1`] = `
674
- <CapSpin
675
- spinning={false}
676
- >
1001
+ <Fragment>
677
1002
  <div
678
- style={
679
- Object {
680
- "overflowX": "auto",
681
- "paddingBottom": "1.142rem",
682
- }
683
- }
1003
+ className="creatives-templates-list library-mode"
684
1004
  >
685
- <CapHeader
686
- className="select-account-header"
687
- description="Choose the account to send content"
688
- descriptionClass=""
689
- inline={false}
690
- size="regular"
691
- title="Zalo account"
692
- titleClass=""
693
- />
694
- <CapRadioCard
695
- cardHeight="48px"
696
- cardWidth="276px"
697
- className="select-account"
698
- defaultValue=""
1005
+ <input
1006
+ accept=".zip, .html, .htm"
1007
+ id="filename"
699
1008
  onChange={[Function]}
700
- panes={
701
- Array [
702
- Object {
703
- "icon": <CapIconAvatar
704
- backgroundProps={Object {}}
705
- height="2rem"
706
- labelProps={Object {}}
707
- text="c"
708
- width="auto"
709
- />,
710
- "key": "fa66f53ca2bb4b93b02dfc5bd265e2fd",
711
- "title": "capillary_zns",
712
- "value": "capillary_zns",
713
- },
714
- ]
1009
+ style={
1010
+ Object {
1011
+ "display": "none",
1012
+ }
715
1013
  }
716
- selected=""
717
- size="small"
1014
+ type="file"
718
1015
  />
1016
+ <CapRow>
1017
+ <Pagination
1018
+ onPageChange={[Function]}
1019
+ paginationContainer="pagination-container"
1020
+ paginationSelector="pagination-container"
1021
+ templateInProgress={false}
1022
+ >
1023
+ <div>
1024
+ <div
1025
+ className="action-container"
1026
+ >
1027
+ <_class
1028
+ className="search-text"
1029
+ disabled={false}
1030
+ labelPosition="top"
1031
+ onChange={[Function]}
1032
+ onClear={[Function]}
1033
+ onScroll={[Function]}
1034
+ placeholder="Search"
1035
+ style={
1036
+ Object {
1037
+ "width": "210px",
1038
+ }
1039
+ }
1040
+ value=""
1041
+ />
1042
+ <div
1043
+ className="zalo-filters"
1044
+ />
1045
+ <Component />
1046
+ <Component />
1047
+ <div
1048
+ style={
1049
+ Object {
1050
+ "alignItems": "center",
1051
+ "display": "flex",
1052
+ "justifyContent": "space-between",
1053
+ }
1054
+ }
1055
+ />
1056
+ </div>
1057
+ <CapRow
1058
+ align="middle"
1059
+ className="selected-whatsapp-filters"
1060
+ type="flex"
1061
+ />
1062
+ <CapSpin
1063
+ spinning={false}
1064
+ style={
1065
+ Object {
1066
+ "width": "100%",
1067
+ }
1068
+ }
1069
+ tip="Getting all templates..."
1070
+ >
1071
+ <div>
1072
+ <div
1073
+ style={
1074
+ Object {
1075
+ "height": "calc(100vh - 325px)",
1076
+ "overflow": "auto",
1077
+ }
1078
+ }
1079
+ >
1080
+ <CapHeader
1081
+ description={
1082
+ <CapLabel
1083
+ style={
1084
+ Object {
1085
+ "textAlign": "center",
1086
+ }
1087
+ }
1088
+ type="label1"
1089
+ >
1090
+ Please try searching with another term or apply different filter
1091
+ </CapLabel>
1092
+ }
1093
+ descriptionClass=""
1094
+ inline={false}
1095
+ size="large"
1096
+ title={
1097
+ <CapHeading
1098
+ className="channel-specific-illustration-text"
1099
+ type="h3"
1100
+ >
1101
+ Sorry, we couldn’t find any matches
1102
+ </CapHeading>
1103
+ }
1104
+ titleClass=""
1105
+ />
1106
+ </div>
1107
+ </div>
1108
+ </CapSpin>
1109
+ </div>
1110
+ </Pagination>
1111
+ </CapRow>
1112
+ <CapRow />
1113
+ <CapRow>
1114
+ <CapSlideBox
1115
+ closeIconPosition="right"
1116
+ closeIconSize="m"
1117
+ closeIconType="close"
1118
+ content={
1119
+ <CardGrid
1120
+ className=""
1121
+ colNumber={2}
1122
+ gutterSize={16}
1123
+ isLoading={false}
1124
+ listItem={Array []}
1125
+ onHoverItem={[Function]}
1126
+ onItemClick={[Function]}
1127
+ />
1128
+ }
1129
+ handleClose={[Function]}
1130
+ header={
1131
+ <h3>
1132
+ Select layout
1133
+ </h3>
1134
+ }
1135
+ loadingText="Loading EDM Templates"
1136
+ position="right"
1137
+ show={false}
1138
+ size="size-r"
1139
+ width={60}
1140
+ />
1141
+ <InjectIntl(Wrapper)
1142
+ centered={true}
1143
+ className="delete-template-confirm"
1144
+ closeText="Cancel"
1145
+ okText="Yes, delete"
1146
+ onCancel={[Function]}
1147
+ onOk={[Function]}
1148
+ title="Confirm delete template"
1149
+ visible={false}
1150
+ >
1151
+ Are you sure you wish to delete this template?
1152
+ </InjectIntl(Wrapper)>
1153
+ </CapRow>
719
1154
  </div>
720
- </CapSpin>
1155
+ </Fragment>
721
1156
  `;
722
1157
 
723
1158
  exports[`Test Templates container Test max templates exceeded 1`] = `
@@ -69,7 +69,6 @@ describe('Test Templates container', () => {
69
69
  setChannelAccount,
70
70
  getAllTemplates,
71
71
  getUserList,
72
- getSenderDetails,
73
72
  }}
74
73
  location={{
75
74
  pathname: '/Zalo',
@@ -1,5 +1,5 @@
1
1
  import { expectSaga } from 'redux-saga-test-plan';
2
- import { take, call, takeLatest, takeEvery, put } from 'redux-saga/effects';
2
+ import { take, call, takeLatest, takeEvery } from 'redux-saga/effects';
3
3
  import * as matchers from 'redux-saga-test-plan/matchers';
4
4
  import * as api from '../../../services/api';
5
5
  import * as types from '../constants';
@@ -10,12 +10,9 @@ import {
10
10
  getAllTemplates,
11
11
  watchGetCdnTransformationConfig,
12
12
  watchGetAllTemplates,
13
- getSenderDetails,
14
13
  } from '../sagas';
15
14
 
16
15
  import * as mockData from './mockData';
17
- import { ZALO } from '../../CreativesContainer/constants';
18
- import { VIET_GUYS } from '../../Zalo/constants';
19
16
 
20
17
  describe('getCdnTransformationConfig saga', () => {
21
18
  it("handle valid response from api", () => {
@@ -137,53 +134,3 @@ describe('watchForTemplates saga', () => {
137
134
  );
138
135
  });
139
136
  });
140
-
141
- describe('getSenderDetails Saga', () => {
142
- const channel = 'someChannel';
143
- const orgUnitId = 'someOrgUnitId';
144
- const action = { channel, orgUnitId };
145
-
146
- it('should handle apiResponse with hostName', () => {
147
- const apiResponse = {
148
- entity: {
149
- [channel]: [
150
- {
151
- domainProperties: {
152
- hostName: 'example.com',
153
- },
154
- },
155
- ],
156
- },
157
- };
158
-
159
- const generator = getSenderDetails(action);
160
- expect(generator.next().value).toEqual(call(api.getSenderDetails, channel, orgUnitId));
161
- expect(generator.next(apiResponse).value).toEqual(
162
- put({
163
- type: types.GET_SENDER_DETAILS_SUCCESS,
164
- payload: 'example.com',
165
- })
166
- );
167
- });
168
-
169
- it('should handle apiResponse without hostName', () => {
170
- const apiResponse = {
171
- entity: {
172
- [channel]: [
173
- {
174
- domainProperties: {},
175
- },
176
- ],
177
- },
178
- };
179
-
180
- const generator = getSenderDetails(action);
181
- expect(generator.next().value).toEqual(call(api.getSenderDetails, channel, orgUnitId));
182
- expect(generator.next(apiResponse).value).toEqual(
183
- put({
184
- type: types.GET_SENDER_DETAILS_SUCCESS,
185
- payload: '',
186
- })
187
- );
188
- });
189
- });
@@ -56,7 +56,7 @@ export const Zalo = (props) => {
56
56
  isFullMode,
57
57
  templateData = {},
58
58
  editData = {},
59
- accountData: { selectedZaloAccount = {}, senderDetails = {} } = {},
59
+ accountData: { selectedZaloAccount = {} } = {},
60
60
  globalActions,
61
61
  location,
62
62
  getDefaultTags,
@@ -66,7 +66,6 @@ export const Zalo = (props) => {
66
66
  getFormData,
67
67
  selectedOfferDetails,
68
68
  } = props || {};
69
- const {hostName = ''} = senderDetails;
70
69
  const { formatMessage } = intl;
71
70
  const [oa_id, setOaId] = useState('');
72
71
  const [token, setToken] = useState('');
@@ -122,12 +121,11 @@ export const Zalo = (props) => {
122
121
 
123
122
  //gets template details
124
123
  useEffect(() => {
125
- if (zaloTempId && oa_id && token && username && hostName) {
124
+ if (zaloTempId && oa_id && token && username) {
126
125
  actions.getTemplateInfoById({
127
126
  username,
128
127
  oa_id,
129
128
  token,
130
- host: hostName,
131
129
  id: zaloTempId,
132
130
  actionCallback,
133
131
  });
@@ -136,10 +134,10 @@ export const Zalo = (props) => {
136
134
  return () => {
137
135
  actions.resetTemplateInfoData();
138
136
  };
139
- }, [zaloTempId, oa_id, token, username, hostName]);
137
+ }, [zaloTempId, oa_id, token, username]);
140
138
 
141
139
  const handleSetValues = (paramsData = []) =>
142
- paramsData?.map((paramData) => {
140
+ paramsData.map((paramData) => {
143
141
  for (const key in varMapped) {
144
142
  if (paramData?.name === key) {
145
143
  paramData.value = varMapped[key];
@@ -341,7 +339,7 @@ export const Zalo = (props) => {
341
339
 
342
340
  const isEditDoneDisabled = () => {
343
341
  let disableCheck = false;
344
- templateListParams?.forEach((listParams) => {
342
+ templateListParams.forEach((listParams) => {
345
343
  const { error, value } = listParams;
346
344
  const errorMessage = !error
347
345
  ? handleErrorValidation(value, listParams)
@@ -354,11 +352,10 @@ export const Zalo = (props) => {
354
352
  };
355
353
  const createPayload = () => {
356
354
  const varMap = {};
357
- templateListParams?.forEach((listParam) => {
358
- const { name = '', value = '' } = listParam;
355
+ templateListParams.forEach((listParam) => {
356
+ const { name, value } = listParam;
359
357
  varMap[name] = value;
360
- }
361
- );
358
+ });
362
359
  const payload = {
363
360
  channel: ZALO,
364
361
  accountId: oa_id,
@@ -9,4 +9,4 @@ const makeSelectZalo = () =>
9
9
  const makeSelectAccount = () =>
10
10
  createSelector(selectAccountDomain(), (substate) => substate && substate.toJS());
11
11
 
12
- export { makeSelectZalo, makeSelectAccount};
12
+ export { makeSelectZalo, makeSelectAccount };
@@ -11462,9 +11462,6 @@ export const accountData = {
11462
11462
  modifiedDate: '2023-10-16T00:00:00+05:30',
11463
11463
  },
11464
11464
  },
11465
- senderDetails: {
11466
- hostName: 'vietguyszalotrans',
11467
- },
11468
11465
  };
11469
11466
 
11470
11467
  export const templateData = {
@@ -11482,46 +11479,3 @@ export const templateConfigs = {
11482
11479
  ma_so1: '4',
11483
11480
  },
11484
11481
  };
11485
-
11486
- export const mockGapItTemplateData = [
11487
- {
11488
- _id: '354701',
11489
- versions: {
11490
- base: {
11491
- content: {
11492
- zalo: {
11493
- templateName: 'Test',
11494
- listParams: [
11495
- {
11496
- name: "Name",
11497
- type: "STRING",
11498
- require: true,
11499
- maxLength: 80,
11500
- minLength: 0,
11501
- acceptNull: false,
11502
- },
11503
- {
11504
- name: "So_dien_thoai",
11505
- type: "STRING",
11506
- require: true,
11507
- maxLength: 30,
11508
- minLength: 0,
11509
- acceptNull: false,
11510
- },
11511
- {
11512
- name: "so_du",
11513
- type: "STRING",
11514
- require: true,
11515
- maxLength: 30,
11516
- minLength: 0,
11517
- acceptNull: false,
11518
- },
11519
- ],
11520
- previewUrl: 'https://account.zalo.cloud/znspreview/h84m64E6ST_owPQVFzTilg==',
11521
- status: 'ENABLE',
11522
- },
11523
- },
11524
- },
11525
- },
11526
- },
11527
- ];
@@ -5,7 +5,7 @@ describe("makeSelectZalo", () => {
5
5
  it("returns the expected object with default values when substate is empty", () => {
6
6
  // Arrange
7
7
  const state = fromJS({ zalo: {} });
8
- const expected = {};
8
+ const expected = {}
9
9
  const selector = makeSelectZalo();
10
10
 
11
11
  // Act
@@ -17,7 +17,7 @@ describe("makeSelectZalo", () => {
17
17
  it("returns the expected object with default values when substate is empty for makeSelectAccount", () => {
18
18
  // Arrange
19
19
  const state = fromJS({ templates: {} });
20
- const expected = {};
20
+ const expected = {}
21
21
  const selector = makeSelectAccount();
22
22
 
23
23
  // Act
@@ -25,4 +25,4 @@ describe("makeSelectZalo", () => {
25
25
  // Assert
26
26
  expect(result).toEqual(expected);
27
27
  });
28
- });
28
+ });