@capillarytech/creatives-library 8.0.229 → 8.0.230

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.229",
4
+ "version": "8.0.230",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -0,0 +1,31 @@
1
+ import PropTypes from 'prop-types';
2
+ import { CapLabel, CapRow, CapSpin } from "@capillarytech/cap-ui-library";
3
+ import React from "react";
4
+ import { injectIntl } from "react-intl";
5
+ import messages from './messages';
6
+ import "./index.scss";
7
+
8
+ export const CapPageSpinner = (props) => {
9
+
10
+ return (
11
+ <CapRow className="cap-custom-page-spinner">
12
+ <CapSpin spinning={props.spinning}>
13
+ {props.children}
14
+ </CapSpin>
15
+ {props.spinning && <CapLabel className="cap-custom-page-spinner-text">{props.intl.formatMessage(messages.text)}</CapLabel>}
16
+ </CapRow>
17
+ );
18
+ };
19
+
20
+ CapPageSpinner.propTypes = {
21
+ spinning: PropTypes.bool,
22
+ children: PropTypes.node,
23
+ intl: PropTypes.object.isRequired,
24
+ };
25
+
26
+ CapPageSpinner.defaultProps = {
27
+ spinning: false,
28
+ children: null,
29
+ };
30
+
31
+ export default injectIntl(CapPageSpinner);
@@ -0,0 +1,23 @@
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
2
+
3
+ .cap-custom-page-spinner {
4
+ display: flex;
5
+ flex-direction: row;
6
+ align-items: center;
7
+ justify-content: center;
8
+ width: 100%;
9
+ padding-top: 1.25rem;
10
+ text-align: center;
11
+ gap: 0.5rem;
12
+
13
+ .cap-custom-page-spinner-text {
14
+ color: $FONT_COLOR_02;
15
+ font-size: $FONT_SIZE_L;
16
+ }
17
+
18
+ .ant-spin.ant-spin-spinning {
19
+ height: 1.5rem;
20
+ width: 1.5rem;
21
+ position: relative;
22
+ }
23
+ }
@@ -0,0 +1,13 @@
1
+ /*
2
+ * CapPageSpinner Messages
3
+ *
4
+ * This contains all the text for the CapPageSpinner component.
5
+ */
6
+ import { defineMessages } from 'react-intl';
7
+
8
+ export default defineMessages({
9
+ text: {
10
+ id: 'creatives.componentsV2.CapPageSpinner.text',
11
+ defaultMessage: 'Loading More Templates',
12
+ },
13
+ });
@@ -38,7 +38,7 @@ class CardGrid extends React.Component { // eslint-disable-line react/prefer-sta
38
38
  <div className={this.props.className}>
39
39
  <div style={{ marginBottom: '16px' }}>{this.props.filterContent}</div>
40
40
  <CapSpin spinning={this.props.isLoading} tip={this.props.loadingTip}>
41
- <div className={this.props.enablePagination ? 'pagination-container' : ''}>
41
+ <div className={this.props.enablePagination ? 'v2-pagination-container' : ''}>
42
42
  <CapRow gutter={this.props.gutterSize}>
43
43
  { this.props.listItem.length > 0 ? this.props.listItem.map( (item) => (
44
44
  <CapColumn style={{ width: `${100 / this.props.colNumber}%`, paddingBottom: '16px'}} key={item.id} span={parseInt(24 / this.props.colNumber, 10)}>
@@ -40,7 +40,7 @@ function CmsTemplatesComponent(props) {
40
40
  }, []);
41
41
 
42
42
  return (<CapSpin spinning={props.cmsTemplatesLoader}>
43
- <div className="pagination-container">
43
+ <div className="v2-pagination-container">
44
44
  <CapCustomCardList cardList={cardDataList} type="Email" />
45
45
  </div>
46
46
  </CapSpin>);
@@ -1,5 +1,5 @@
1
- .pagination-container{
2
- height: calc(100vh - 182px);
1
+ .v2-pagination-container{
2
+ height: calc(100vh - 25rem);
3
3
  overflow-y: auto;
4
4
  overflow-x: hidden;
5
5
  }
@@ -34,8 +34,6 @@ Pagination.propTypes = {
34
34
  templateInProgress: PropTypes.bool,
35
35
  };
36
36
 
37
- Pagination.defaultProps = {
38
- paginationContainer: "pagination-container",
39
- };
37
+ Pagination.defaultProps = {};
40
38
 
41
39
  export default Pagination;
@@ -31,6 +31,7 @@ import injectReducer from '../../../utils/injectReducer';
31
31
  import { v2GallerySagas } from './sagas';
32
32
  import v2GalleryReducer from './reducer';
33
33
  import { GALLERY_ALLOWED_EXTENSION } from './constants';
34
+ import CapPageSpinner from '../../../v2Components/CapPageSpinner';
34
35
 
35
36
  const {CapCustomCardList} = CapCustomCard;
36
37
  export class Gallery extends React.Component { // eslint-disable-line react/prefer-stateless-function
@@ -323,7 +324,7 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
323
324
  deleteAsset(asset) {
324
325
  this.props.actions.deleteAssetById(asset._id, asset.type);
325
326
  }
326
- getTemplateDataForGrid = ({templates, handlers, filterContent, isLoading, loadingTip}) => {
327
+ getTemplateDataForGrid = ({templates, handlers, filterContent, isLoading, loadingTip, isInitialLoading}) => {
327
328
  const currentChannel = 'gallery';
328
329
  const { searchLoader, searchText } = this.state;
329
330
  const cardDataList = templates?.length ? _.map(templates, (template) => {
@@ -369,9 +370,8 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
369
370
  }) : [];
370
371
  return (<div>
371
372
  {filterContent}
372
- <CapCustomSkeleton loader={isLoading}>
373
- {!isLoading && <div>
374
- {!_.isEmpty(templates) || !_.isEmpty(searchText) ? <div className={`pagination-container ${this.props.isLineAsset ? 'gallery-upload' : ''}`}>
373
+ {!(isInitialLoading && isLoading) && <div>
374
+ {!_.isEmpty(templates) || !_.isEmpty(searchText) ? <div className={`v2-pagination-container ${this.props.isLineAsset ? 'gallery-upload' : ''}`}>
375
375
  <CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={'Email'} />
376
376
  {!_.isEmpty(searchText) && _.isEmpty(templates) && (
377
377
  <div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
@@ -386,7 +386,8 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
386
386
  )}
387
387
  </div>
388
388
  }
389
- </CapCustomSkeleton>
389
+ {<CapCustomSkeleton loader={isInitialLoading && isLoading} />}
390
+ {<CapPageSpinner spinning={!isInitialLoading && isLoading} />}
390
391
 
391
392
  </div>);
392
393
  }
@@ -498,7 +499,7 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
498
499
  </div>
499
500
  </div>
500
501
  </div> :
501
- <Pagination onPageChange={() => { this.getAllAssets({getNextPage: true}); }} paginationSelector="pagination-container">
502
+ <Pagination onPageChange={() => { this.getAllAssets({getNextPage: true}); }}>
502
503
  {/* <CardGrid
503
504
  listItem={this.prepareData()}
504
505
  filterContent={filterContent}
@@ -506,7 +507,7 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
506
507
  onItemClick={this.handleOnHoverItem}
507
508
  enablePagination
508
509
  /> */}
509
- {this.getTemplateDataForGrid({isLoading, loadingTip, channel: this.state.channel, templates: assetList, filterContent, handlers: {selectAsset: this.selectAsset}})}
510
+ {this.getTemplateDataForGrid({isLoading, loadingTip, channel: this.state.channel, templates: assetList, filterContent, handlers: {selectAsset: this.selectAsset}, isInitialLoading: this.state.page === 1 && isLoading})}
510
511
 
511
512
  </Pagination>
512
513
  }
@@ -2616,7 +2616,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2616
2616
  }) : [];
2617
2617
  return (<div>
2618
2618
  <CapSpin spinning={isLoading} tip={loadingTip}>
2619
- {!_.isEmpty(templates) && <div className="pagination-container">
2619
+ {!_.isEmpty(templates) && <div className="v2-pagination-container">
2620
2620
  <CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={'Email'} />
2621
2621
  </div>}
2622
2622
  </CapSpin>
@@ -2734,7 +2734,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2734
2734
  return (
2735
2735
  <div key="creatives-email-add-image-container">
2736
2736
  {this.getFilterContent()}
2737
- <Pagination onPageChange={() => { this.fetchAllAssets({getNextPage: true}); }} paginationSelector="pagination-container">
2737
+ <Pagination onPageChange={() => { this.fetchAllAssets({getNextPage: true}); }}>
2738
2738
  {(!fetchingAllAssets && (!fetchAllAssetSuccess || (fetchAllAssetSuccess && !assetList.length))) ? (
2739
2739
  <FormattedMessage {...messages.noImgInGallery}/>
2740
2740
  ) : this.getTemplateDataForGrid({
@@ -95,7 +95,7 @@ export const LineDrawer = ({
95
95
  onChange={(e) => searchTemplate(e.target.value)}
96
96
  onClear={() => searchTemplate('')}
97
97
  />
98
- <Pagination onPageChange={() => { getAllLineTemplate({getNextPage: true}); }} paginationSelector="pagination-container">
98
+ <Pagination onPageChange={() => { getAllLineTemplate({getNextPage: true}); }}>
99
99
  {
100
100
  !cardDataList.length
101
101
  ? (
@@ -105,7 +105,7 @@ export const LineDrawer = ({
105
105
  )
106
106
  : null
107
107
  }
108
- <div className="pagination-container">
108
+ <div className="v2-pagination-container">
109
109
  <CapCustomCardList
110
110
  key={'LINE-card-list'}
111
111
  cardList={cardDataList}
@@ -18,7 +18,7 @@
18
18
  .knSUjl .component-wrapper .cap-tab-v2.ant-tabs-line {
19
19
  height: auto;
20
20
  }
21
- .pagination-container {
21
+ .v2-pagination-container {
22
22
  .LINE {
23
23
  .ant-card-body {
24
24
  background-color: $CAP_G09;
@@ -75,7 +75,7 @@
75
75
  margin-bottom: $CAP_SPACE_12;
76
76
  }
77
77
 
78
- .pagination-container.gallery-upload {
78
+ .v2-pagination-container.gallery-upload {
79
79
  height: calc(100vh - 60px);
80
80
 
81
81
  .cap-custom-card-list-col {
@@ -9,9 +9,8 @@
9
9
 
10
10
  @media screen and (max-width: 1172px) {
11
11
  .creatives-templates-list.full-mode{
12
- .pagination-container {
12
+ .v2-pagination-container {
13
13
  .cap-custom-card-list-row {
14
- padding-bottom: 10rem;
15
14
  .cap-custom-card-list-col{
16
15
  &:nth-child(3n+3) { //every 4th child
17
16
  margin-right: unset;
@@ -24,9 +23,8 @@
24
23
 
25
24
  @media screen and (min-width: 1172px) {
26
25
  .creatives-templates-list.full-mode{
27
- .pagination-container {
26
+ .v2-pagination-container {
28
27
  .cap-custom-card-list-row {
29
- padding-bottom: 10rem;
30
28
  .cap-custom-card-list-col{
31
29
  &:nth-child(4n+4) { //every 4th child
32
30
  margin-right: unset;
@@ -57,10 +55,7 @@
57
55
  }
58
56
  }
59
57
 
60
- .pagination-container {
61
- .cap-custom-card-list-row {
62
- padding-bottom: 10rem;
63
- }
58
+ .v2-pagination-container {
64
59
  .FACEBOOK {
65
60
  .ant-card-body {
66
61
  background-color: $CAP_G09;
@@ -663,8 +658,8 @@
663
658
  background-image: url("https://s3.amazonaws.com/test_files_cache_bkp/intouch_creative_assets/1720b7f7e78860c1f905.svg");
664
659
  }
665
660
  }
666
- .pagination-container{
667
- height: calc(100vh - 182px);
661
+ .v2-pagination-container-half{
662
+ height: calc(100vh - 22rem);
668
663
  overflow-y: auto;
669
664
  overflow-x: hidden;
670
665
  }
@@ -155,6 +155,7 @@ import { makeSelectRcs } from '../Rcs/selectors';
155
155
  import { getRcsStatusType } from '../Rcs/utils';
156
156
  import { v2MobilePushSagas } from '../MobilePushNew/sagas';
157
157
  import { AUTO_CAROUSEL, BIG_PICTURE, FILMSTRIP_CAROUSEL, MANUAL_CAROUSEL } from '../MobilePushNew/constants';
158
+ import CapPageSpinner from '../../v2Components/CapPageSpinner';
158
159
  const withMobilePushNewSaga = injectSaga({ key: 'mobilePushNew', saga: v2MobilePushSagas, mode: DAEMON });
159
160
 
160
161
  const { timeTracker } = GA;
@@ -1190,7 +1191,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1190
1191
  ) : <>{children}</>
1191
1192
  };
1192
1193
 
1193
- getTemplateDataForGrid = ({templates = [], handlers, filterContent, channel, isLoading, loadingTip, previewTemplateId }) => {
1194
+ getTemplateDataForGrid = ({templates = [], handlers, filterContent, channel, isLoading, isInitialLoading, loadingTip, previewTemplateId }) => {
1194
1195
  const currentChannel = channel.toUpperCase();
1195
1196
  const {channel: stateChannel} = this.state;
1196
1197
  const channelLowerCase = stateChannel.toLowerCase();
@@ -1742,21 +1743,19 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1742
1743
  const getAllTemplatesInProgress = get(this.props, 'Templates.getAllTemplatesInProgress');
1743
1744
 
1744
1745
  const noWhatsappZaloTemplates = this.isFullMode() && isEmpty(templates) || !this.state.hostName;
1745
-
1746
1746
  const noApprovedWhatsappZaloTemplates = filteredEmptyAndFullModeAs(false) && !isEmpty(this.state?.hostName);
1747
1747
  const showWhatsappIllustration = accountWithNoHostWhatsapp(WHATSAPP_LOWERCASE);
1748
1748
  const showZaloIllustration = accountWithNoHostZalo(ZALO_LOWERCASE)
1749
1749
 
1750
1750
  const noLoaderAndSearchText = isEmpty(this.state.searchText) && !isLoading;
1751
1751
 
1752
- return (<div>
1752
+ return (<div>
1753
1753
  {[WECHAT, MOBILE_PUSH, INAPP, WHATSAPP, ZALO].includes(currentChannel) && this.showAccountName()}
1754
1754
  {filterContent}
1755
1755
  {[WHATSAPP, ZALO].includes(currentChannel) && this.selectedFilters()}
1756
- <CapCustomSkeleton loader={isLoading || getAllTemplatesInProgress}>
1757
1756
  {<div>
1758
1757
  {!isEmpty(filteredTemplates) || !isEmpty(this.state.searchText) || !isEmpty(this.props.Templates.templateError) ? (
1759
- <div className={!isEmpty(this.state.searchText) && isEmpty(cardDataList) ? '' : "pagination-container"}>
1758
+ <div className={!isEmpty(this.state.searchText) && isEmpty(cardDataList) ? '' : this.isFullMode() ? "v2-pagination-container" : "v2-pagination-container-half"}>
1760
1759
  <CapCustomCardList
1761
1760
  key={`${currentChannel}-card-list`}
1762
1761
  cardList={cardDataList}
@@ -1825,9 +1824,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1825
1824
  <ChannelTypeIllustration isFullMode={this.props.isFullMode} createTemplate={this.createTemplate} currentChannel={currentChannel}/>
1826
1825
  </div>
1827
1826
  }
1827
+ {<CapCustomSkeleton loader={isInitialLoading && (isLoading || getAllTemplatesInProgress)} />}
1828
+ {<CapPageSpinner spinning={!isInitialLoading && (isLoading || getAllTemplatesInProgress)} />}
1828
1829
  </div>
1829
1830
  }
1830
- </CapCustomSkeleton>
1831
1831
  </div>);
1832
1832
  }
1833
1833
  filterLineTemplates = (templates) => {
@@ -2900,6 +2900,15 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2900
2900
  (rcsLoader !== undefined ? rcsLoader : false);
2901
2901
  return isLoading;
2902
2902
  }
2903
+
2904
+ getInitialLoading = () => {
2905
+ const isLoadingValue = this.isLoading();
2906
+ const templates = this.props.TemplatesList || [];
2907
+ const hasTemplates = !isEmpty(templates) || this.state.templatesCount > 0;
2908
+ const isInitialLoading = isLoadingValue && this.state.page === 1 && !hasTemplates;
2909
+
2910
+ return isInitialLoading;
2911
+ }
2903
2912
 
2904
2913
  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')))
2905
2914
  renderEmailPreviewModal() {
@@ -3244,6 +3253,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
3244
3253
  const pageHeader = "";
3245
3254
  const pageHeaderDvs = "";
3246
3255
  const isLoading = this.isLoading();
3256
+ const isInitialLoading = this.getInitialLoading();
3247
3257
  let previewHeader = this.props.intl.formatMessage(messages.preview);
3248
3258
  // const previewHeader = (this.state.channel.toLowerCase() === 'email' ? <h3>{this.props.intl.formatMessage(messages.emailPreview)}</h3> : <h3>{this.props.intl.formatMessage(messages.ebillPreview)}</h3>);
3249
3259
  if (this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill') {
@@ -3533,11 +3543,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
3533
3543
  onPageChange={
3534
3544
  templates.length ? this.onPaginationChange : () => {}
3535
3545
  }
3536
- paginationSelector="pagination-container"
3537
3546
  >
3538
3547
  {this.getTemplateDataForGrid({
3539
3548
  previewTemplateId: this.state.zaloPreviewItemId,
3540
3549
  isLoading,
3550
+ isInitialLoading,
3541
3551
  loadingTip,
3542
3552
  channel: this.state.channel,
3543
3553
  templates: this.state.searchingZaloTemplate