@capillarytech/creatives-library 7.10.46 → 7.10.47

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.
@@ -660,11 +660,13 @@ class Creatives extends React.Component {
660
660
  });
661
661
  }
662
662
  handleCloseSlideBox = () => {
663
+ const { currentChannel = '', slidBoxContent = '' } = this.state;
664
+ const reloadTemplates = currentChannel === constants.WHATSAPP && slidBoxContent === 'editTemplate';
663
665
  this.setState((prevState) => ({
664
666
  ...prevState,
665
667
  templateData: undefined,
666
668
  showSlideBox: false,
667
- }), this.props.handleCloseCreatives);
669
+ }), () => this.props.handleCloseCreatives(reloadTemplates));
668
670
  };
669
671
  saveMessage = () => {
670
672
  this.setState({ isGetFormData: true });
@@ -77,7 +77,7 @@ import emailIllustration from '../Assets/images/emailIllustration.svg';
77
77
  import smsIllustration from '../Assets/images/smsIllustration.svg';
78
78
  import pushIllustration from '../Assets/images/pushIllustration.svg';
79
79
  import whatsappIllustration from '../Assets/images/whatsappIllustration.png';
80
- import { CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
80
+ import { CAP_SPACE_16, CAP_SPACE_44 } from '@capillarytech/cap-ui-library/styled/variables';
81
81
  import { GA } from '@capillarytech/cap-ui-utils';
82
82
  const { timeTracker } = GA;
83
83
  const {CapCustomCardList} = CapCustomCard;
@@ -568,9 +568,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
568
568
  this.getAllTemplates({getNextPage: true});
569
569
  }
570
570
  onCreateComplete = (isReloadTemplates) => {
571
- const isWhatsappEdit = this.state.routeParams?.pathname?.includes(`${WHATSAPP_LOWERCASE}/edit`);
572
571
  this.setState({routeParams: null, previewOpen: false}, () => {
573
- if (this.isFullMode() && (isReloadTemplates || isWhatsappEdit)) {
572
+ if (this.isFullMode() && isReloadTemplates) {
574
573
  this.getAllTemplates({params: {}}, true);
575
574
  }
576
575
  });
@@ -706,16 +705,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
706
705
  }
707
706
 
708
707
  isStatusMatching = (status, selectedWhatsappStatus) => {
709
- if(this.props.isFullMode && selectedWhatsappStatus) {
710
- if ( [WHATSAPP_STATUSES.unsubmitted, WHATSAPP_STATUSES.pending].includes(status) ) {
711
- return selectedWhatsappStatus === WHATSAPP_STATUSES.awaitingApproval;
712
- }
713
- return selectedWhatsappStatus === status;
714
- }
715
- else if (!this.props.isFullMode){
716
- return status === WHATSAPP_STATUSES.approved;
708
+ if ( [WHATSAPP_STATUSES.unsubmitted, WHATSAPP_STATUSES.pending].includes(status) ) {
709
+ return selectedWhatsappStatus === WHATSAPP_STATUSES.awaitingApproval;
717
710
  }
718
- return true;
711
+ return selectedWhatsappStatus === status;
719
712
  }
720
713
 
721
714
  filterWhatsappTemplates = (templates) => {
@@ -725,7 +718,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
725
718
 
726
719
  // if status or category filter is applied, filter templates which match these filters
727
720
  return (
728
- this.isStatusMatching(status, selectedWhatsappStatus)
721
+ selectedWhatsappStatus
722
+ ? this.isStatusMatching(status, selectedWhatsappStatus)
723
+ : true
729
724
  ) && (
730
725
  selectedWhatsappCategory
731
726
  ? category === selectedWhatsappCategory
@@ -755,7 +750,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
755
750
  const channelLowerCase = stateChannel.toLowerCase();
756
751
  let filteredTemplates = templates;
757
752
  let isTraiDltFeature = false;
758
- console.log("getTemplateDataForGrid", currentChannel);
759
753
  switch (currentChannel) {
760
754
  case WECHAT:
761
755
  filteredTemplates = this.filterWechatTemplates(templates);
@@ -1006,11 +1000,22 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1006
1000
  </CapHeading>
1007
1001
  </div> : (
1008
1002
  [WHATSAPP_LOWERCASE].includes(this.state.channel.toLowerCase()) &&
1009
- isEmpty(filteredTemplates) &&
1010
1003
  isEmpty(this.state.searchText) &&
1011
1004
  !isLoading &&
1012
- <div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto'} : {}}>
1013
- <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />
1005
+ <div style={this.isFullMode() ? { height: "calc(100vh - 325px)", overflow: 'auto' } : {}}>
1006
+ {isEmpty(templates) && <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />}
1007
+ {!isEmpty(templates) && isEmpty(filteredTemplates) && <CapHeader
1008
+ title={
1009
+ <CapHeading type="h3" style={{ textAlign: "center", marginTop: CAP_SPACE_44 }}>
1010
+ {this.props.intl.formatMessage(messages.noFilteredWhatsappTemplatesTitle)}
1011
+ </CapHeading>
1012
+ }
1013
+ description={
1014
+ <CapLabel style={{ textAlign: "center" }}>
1015
+ {this.props.intl.formatMessage(messages.noFilteredWhatsappTemplatesDesc)}
1016
+ </CapLabel>
1017
+ }
1018
+ />}
1014
1019
  </div>
1015
1020
  )
1016
1021
  }
@@ -2300,9 +2305,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2300
2305
  type={"primary"}
2301
2306
  disabled={this.isCreateDisabled()}
2302
2307
  style={{marginLeft: '8px', marginBottom: '12px'}}
2303
- onClick={this.createTemplate}
2304
- target={channelLowerCase === WHATSAPP_LOWERCASE && !this.props.isFullMode ? "_blank" : null}
2305
- >
2308
+ onClick={this.createTemplate} >
2306
2309
  { this.props.intl.formatMessage((isTraiDltFeature && channel.toUpperCase() === SMS ) ? messages.uploadTemplate : messages.createNewActionButton) }
2307
2310
  </CapButton>);
2308
2311
 
@@ -2336,19 +2339,16 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2336
2339
  {
2337
2340
  channel.toUpperCase() === WHATSAPP && (
2338
2341
  <div className="whatsapp-filters">
2339
- {
2340
- this.props.isFullMode ? (
2341
- <CapSelectFilter
2342
- placement="bottomLeft"
2343
- data={STATUS_OPTIONS}
2344
- onSelect={this.setWhatsappStatus}
2345
- selectedValue={this.state.selectedWhatsappStatus}
2346
- placeholder="Status"
2347
- showBadge={true}
2348
- width="90px"
2349
- />
2350
- ) : null
2351
- }
2342
+ <CapSelectFilter
2343
+ placement="bottomLeft"
2344
+ data={STATUS_OPTIONS}
2345
+ onSelect={this.setWhatsappStatus}
2346
+ selectedValue={this.state.selectedWhatsappStatus}
2347
+ placeholder="Status"
2348
+ showBadge={true}
2349
+ width="90px"
2350
+ overlayStyle={{ overflowY: "hidden" }}
2351
+ />
2352
2352
  <CapSelectFilter
2353
2353
  placement="bottomLeft"
2354
2354
  data={CATEGORY_OPTIONS}
@@ -2357,6 +2357,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2357
2357
  placeholder="Category"
2358
2358
  showBadge={true}
2359
2359
  width="105px"
2360
+ overlayStyle={{ overflowY: "hidden" }}
2360
2361
  />
2361
2362
  </div>
2362
2363
 
@@ -2480,21 +2481,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2480
2481
 
2481
2482
  <CapRow>
2482
2483
  <Pagination onPageChange={templates.length ? this.onPaginationChange : () => {}} paginationSelector="pagination-container">
2483
-
2484
- {
2485
- channel.toLowerCase() === WHATSAPP_LOWERCASE ? (
2486
- <CapAlert message={whatsappCountExceedText} type="info" />
2487
- ) : null
2488
- }
2489
2484
  {this.getTemplateDataForGrid({isLoading, loadingTip, channel: this.state.channel, templates: this.props.TemplatesList, filterContent, handlers: {handlePreviewClick: this.handlePreviewClick, handleEditClick: this.handleEditClick}})}
2490
2485
  </Pagination>
2491
2486
  {(((this.state.selectedAccount !== '' && !isEmpty(this.props.Templates.selectedWeChatAccount) && this.state.channel.toLowerCase() === 'wechat') || this.state.channel.toLowerCase() !== 'wechat') && isEmpty(this.props.TemplatesList)) && !this.props.Templates.getAllTemplatesInProgress && !isEmpty(this.state.searchText) &&
2492
2487
  <div style={{ height: '65vh', textAlign: 'center', lineHeight: '65vh'}}>
2493
- {
2494
- channel.toLowerCase() === WHATSAPP_LOWERCASE ? (
2495
- <CapAlert message={whatsappCountExceedText} type="info" />
2496
- ) : null
2497
- }
2498
2488
  <CapHeading type="h6">{this.props.intl.formatMessage(messages.noTemplatesFound)}</CapHeading>
2499
2489
  </div>}
2500
2490
  </CapRow>
@@ -342,6 +342,14 @@ export default defineMessages({
342
342
  id: `${scope}.whatsappDescIllustration`,
343
343
  defaultMessage: 'These templates can be reused when creating a\nnew message content.',
344
344
  },
345
+ "noFilteredWhatsappTemplatesTitle": {
346
+ id: `${scope}.noFilteredWhatsappTemplatesTitle`,
347
+ defaultMessage: 'Sorry, we couldn’t find any matches',
348
+ },
349
+ "noFilteredWhatsappTemplatesDesc": {
350
+ id: `${scope}.noFilteredWhatsappTemplatesDesc`,
351
+ defaultMessage: 'Please try searching with another term or apply different filter',
352
+ },
345
353
  "smsTitleIllustartion": {
346
354
  id: `${scope}.smsTitleIllustartion`,
347
355
  defaultMessage: 'Create an SMS {template}',
@@ -91,9 +91,7 @@ export const Whatsapp = (props) => {
91
91
  //for edit only
92
92
  const [isEditFlow, setEditFlow] = useState(false);
93
93
  const [templateDate, setTemplateDate] = useState('');
94
- const [templateStatus, setTemplateStatus] = useState(
95
- WHATSAPP_STATUSES.unsubmitted,
96
- );
94
+ const [templateStatus, setTemplateStatus] = useState();
97
95
  const [templateRejectionReason, setTemplateRejectionReason] = useState(null);
98
96
  const [tempMsgArray, updateTempMsgArray] = useState([]);
99
97
  const [updatedSmsEditor, setUpdatedSmsEditor] = useState([]);
@@ -110,8 +108,7 @@ export const Whatsapp = (props) => {
110
108
  width: 100%;
111
109
  margin-left: -32px;
112
110
  padding: ${CAP_SPACE_32} ${CAP_SPACE_24};
113
- z-index: 1;
114
-
111
+
115
112
  .ant-btn {
116
113
  margin-right: ${CAP_SPACE_16};
117
114
  }
@@ -778,10 +775,12 @@ export const Whatsapp = (props) => {
778
775
 
779
776
  const editModeContent = (
780
777
  <>
781
- <CapAlert
782
- message={getTemplateStatusMessage()}
783
- type={getTemplateStatusType()}
784
- />
778
+ {templateStatus && (
779
+ <CapAlert
780
+ message={getTemplateStatusMessage()}
781
+ type={getTemplateStatusType()}
782
+ />
783
+ )}
785
784
  <CapRow className="whatsapp-render-heading">
786
785
  <CapHeader
787
786
  title={