@capillarytech/creatives-library 7.17.182 → 7.17.183-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.
package/config/app.js CHANGED
@@ -16,7 +16,7 @@ const config = {
16
16
  accountConfig: (strs, accountId) => `${window.location.origin}/org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
17
17
  },
18
18
  development: {
19
- api_endpoint: 'http://localhost:2022/arya/api/v1/creatives',
19
+ api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
20
20
  campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
21
21
  campaigns_api_org_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/org/campaign',
22
22
  auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.182",
4
+ "version": "7.17.183-alpha.1",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -607,7 +607,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
607
607
  const { weCrmAccounts: weCrmAccountsList = [], senderDetails: { hostName = '' } = {} } = get(nextProps, 'Templates', {});
608
608
  const weCrmChannels = ['wechat', WHATSAPP_LOWERCASE, ZALO_LOWERCASE];
609
609
 
610
- if (weCrmAccountsList.length === 1 && this.state.defaultAccount && (weCrmChannels.indexOf(selectedChannel) > -1)) {
610
+ if (weCrmAccountsList.length === 1 && this.state.defaultAccount && (weCrmChannels.indexOf(selectedChannel) > -1) && !isEmpty(hostName)) {
611
611
  let paramsDefault = {};
612
612
  if (this.state.channel.toLowerCase() !== ZALO_LOWERCASE) {
613
613
  paramsDefault = {
@@ -624,7 +624,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
624
624
  } = configs || {};
625
625
  if (weCrmChannels.includes(selectedChannel)) {
626
626
  if ([WHATSAPP_LOWERCASE, ZALO_LOWERCASE].includes(selectedChannel)) {
627
- if (hostName === '' && selectedChannel === WHATSAPP_LOWERCASE) {
627
+ if (hostName === '') {
628
628
  return;
629
629
  }
630
630
 
@@ -634,7 +634,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
634
634
  paramsDefault.username = name;
635
635
  paramsDefault.oa_id = sourceAccountIdentifier;
636
636
  paramsDefault.token = token;
637
- paramsDefault.host = hostName || this.state.hostName || this.props.Templates?.senderDetails?.hostName || this.props.Templates?.selectedZaloAccount?.hostName;
637
+ paramsDefault.host = hostName || this.props.Templates?.senderDetails?.hostName || this.props.Templates?.selectedZaloAccount?.hostName || this.state.hostName;
638
638
  }
639
639
  } else {
640
640
  paramsDefault.wecrmId = wecrm_app_id;
@@ -705,7 +705,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
705
705
  params.oa_id = sourceAccountIdentifier;
706
706
  params.token = token;
707
707
  params.isAccountSelection = true;
708
- params.host = this.props.Templates?.senderDetails?.hostName || this.props.Templates?.selectedZaloAccount?.hostName;
708
+ params.host = this.props.Templates?.senderDetails?.hostName || this.props.Templates?.selectedZaloAccount?.hostName || this.state.hostName;
709
709
  }
710
710
  }
711
711
 
@@ -805,8 +805,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
805
805
  if(this.state.channel.toLowerCase() !== ZALO_LOWERCASE) {
806
806
  queryParams.name = this.state.searchText;
807
807
  queryParams.sortBy = this.state.sortBy;
808
- } else {
809
- queryParams.host = this.props.Templates?.senderDetails?.hostName || this.props.Templates?.selectedZaloAccount?.hostName;
810
808
  }
811
809
  queryParams.page = this.state.page;
812
810
  queryParams.perPage = this.state.perPageLimit;
@@ -855,7 +853,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
855
853
  if (
856
854
  this.state.channel.toLowerCase() === ZALO_LOWERCASE &&
857
855
  !isEmpty(this.props.Templates?.selectedZaloAccount) &&
858
- !params?.isAccountSelection
856
+ !params?.isAccountSelection && !isEmpty(this.props.Templates?.selectedZaloAccount?.hostName)
859
857
  ) {
860
858
  const {
861
859
  name = "",
@@ -866,7 +864,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
866
864
  queryParams.username = name;
867
865
  queryParams.oa_id = sourceAccountIdentifier;
868
866
  queryParams.token = token;
869
- queryParams.host = hostName || this.state.hostName || this.props.Templates?.senderDetails?.hostName;
867
+ queryParams.host = hostName || this.props.Templates?.senderDetails?.hostName ||this.state.hostName;
870
868
  }
871
869
  this.setState({ page, templatesCount }, () => {
872
870
  queryParams.page = page;
@@ -87,380 +87,53 @@ 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
- <Fragment>
91
- <div
92
- className="creatives-templates-list full-mode"
93
- >
94
- <input
95
- accept=".zip, .html, .htm"
96
- id="filename"
97
- onChange={[Function]}
98
- style={
99
- Object {
100
- "display": "none",
101
- }
102
- }
103
- type="file"
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>
90
+ <CapSpin
91
+ spinning={false}
92
+ >
93
+ <div
94
+ style={
95
+ Object {
96
+ "overflowX": "auto",
97
+ "paddingBottom": "1.142rem",
98
+ }
99
+ }
100
+ >
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=""
115
+ 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
+ ]
131
+ }
132
+ selected=""
133
+ size="small"
134
+ />
462
135
  </div>
463
- </Fragment>
136
+ </CapSpin>
464
137
  `;
465
138
 
466
139
  exports[`Test Templates container Should render temlates when whatsapp templates are passed 1`] = `
@@ -998,161 +671,53 @@ exports[`Test Templates container Should render temlates when whatsapp templates
998
671
  `;
999
672
 
1000
673
  exports[`Test Templates container Should render temlates when zalo templates are passed 1`] = `
1001
- <Fragment>
674
+ <CapSpin
675
+ spinning={false}
676
+ >
1002
677
  <div
1003
- className="creatives-templates-list library-mode"
678
+ style={
679
+ Object {
680
+ "overflowX": "auto",
681
+ "paddingBottom": "1.142rem",
682
+ }
683
+ }
1004
684
  >
1005
- <input
1006
- accept=".zip, .html, .htm"
1007
- id="filename"
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=""
1008
699
  onChange={[Function]}
1009
- style={
1010
- Object {
1011
- "display": "none",
1012
- }
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
+ ]
1013
715
  }
1014
- type="file"
716
+ selected=""
717
+ size="small"
1015
718
  />
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>
1154
719
  </div>
1155
- </Fragment>
720
+ </CapSpin>
1156
721
  `;
1157
722
 
1158
723
  exports[`Test Templates container Test max templates exceeded 1`] = `