@capillarytech/creatives-library 8.0.38 → 8.0.39

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.38",
4
+ "version": "8.0.39",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -33,7 +33,7 @@ import styles, { CapTabStyle } from './TemplatesV2.style';
33
33
  import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP } from '../App/constants';
34
34
  import AccessForbidden from '../../v2Components/AccessForbidden';
35
35
  import { getObjFromQueryParams } from '../../utils/v2common';
36
- import { makeSelectAuthenticated, selectCurrentOrgDetails } from "../Cap/selectors";
36
+ import { makeSelectAuthenticated, selectCurrentOrgDetails } from "../../v2Containers/Cap/selectors";
37
37
  import injectSaga from '../../utils/injectSaga';
38
38
  import injectReducer from '../../utils/injectReducer';
39
39
 
@@ -67,12 +67,12 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
67
67
  email: {content: <></>, tab: intl.formatMessage(messages.email), key: 'email'},
68
68
  //'wechat': {content: this.getTemplatesComponent('wechat'), tab: 'Wechat', key: 'wechat'},
69
69
  mPush: {content: <></>, tab: intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
70
+ viber: {content: <></>, tab: intl.formatMessage(messages.viber), key: 'viber'},
70
71
  whatsapp: { content: <></>, tab: intl.formatMessage(messages.whatsapp), key: WHATSAPP },
71
72
  zalo: { content: <div></div>, tab: intl.formatMessage(messages.zalo), key: ZALO },
72
- viber: {content: <></>, tab: intl.formatMessage(messages.viber), key: 'viber'},
73
- inApp: { content: <div></div>, tab: intl.formatMessage(messages.inapp), key: INAPP },
74
73
  facebook: {content: <div></div>, tab: intl.formatMessage(messages.facebook), key: 'facebook'},
75
74
  rcs: { content: <></>, tab: intl.formatMessage(messages.rcs), key: RCS },
75
+ inApp: { content: <div></div>, tab: intl.formatMessage(messages.inapp), key: INAPP },
76
76
  line: {content: <></>, tab: intl.formatMessage(messages.line), key: 'line'},
77
77
  };
78
78
  //Hiding we chat for all orgs across UI for now and enabling it based on feature 'ENABLE_WECHAT'
@@ -120,12 +120,12 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
120
120
  pane.disabled = true;
121
121
  if (pane.key === 'facebook' && showDisabledFBInfo) {
122
122
  pane.tab = (<CapTooltip
123
- title={
124
- intl.formatMessage(messages.facebookDisableinfo)
125
- }
126
- >
127
- {intl.formatMessage(messages.facebook)}
128
- </CapTooltip>);
123
+ title={
124
+ intl.formatMessage(messages.facebookDisableinfo)
125
+ }
126
+ >
127
+ {intl.formatMessage(messages.facebook)}
128
+ </CapTooltip>);
129
129
  }
130
130
  }
131
131
  return pane;
@@ -178,16 +178,16 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
178
178
  this.setState({selectedChannel: nextProps.channel, panes });
179
179
  }
180
180
  }
181
- getTemplateDataForGrid = ({templates, handlers, filterContent, channel, isLoading, loadingTip}) => {
181
+ getTemplateDataForGrid = ({templates, handlers, filterContent, channel, isLoading, loadingTip}) => {
182
182
  const currentChannel = channel.toUpperCase();
183
183
  const cardDataList = templates.map((template) => {
184
184
  const templateData =
185
185
  {
186
- key: `${currentChannel}-card-${template.name}`,
187
- title: <span title={template.name} >{template.name}</span>,
188
- extra: [<CapIcon type="eye" onClick={() => { if (this.props.isFullMode) { handlers.handlePreviewClick(template); } else { this.props.handlePeviewTemplate(template); } }} />],
189
- hoverOption: <CapButton onClick={(e) => handlers.handleEditClick(e, template._id)}>{this.props.intl.formatMessage(this.props.isFullMode ? messages.edit : messages.select)}</CapButton>,
190
- };
186
+ key: `${currentChannel}-card-${template.name}`,
187
+ title: <span title={template.name} >{template.name}</span>,
188
+ extra: [<CapIcon type="eye" onClick={() => { if (this.props.isFullMode) { handlers.handlePreviewClick(template); } else { this.props.handlePeviewTemplate(template); } }} />],
189
+ hoverOption: <CapButton onClick={(e) => handlers.handleEditClick(e, template._id)}>{this.props.intl.formatMessage(this.props.isFullMode ? messages.edit : messages.select)}</CapButton>,
190
+ };
191
191
  if (currentChannel === "SMS") {
192
192
  templateData.content = template.versions.base['sms-editor'];
193
193
  } else if (currentChannel === "EMAIL") {
@@ -196,16 +196,16 @@ getTemplateDataForGrid = ({templates, handlers, filterContent, channel, isLoadin
196
196
  return templateData;
197
197
  });
198
198
  return (<div>
199
- {filterContent}
200
- <CapSpin spinning={isLoading} tip={loadingTip}>
201
- <div className="pagination-container">
202
- <CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={currentChannel} />
203
- </div>
204
- </CapSpin>
199
+ {filterContent}
200
+ <CapSpin spinning={isLoading} tip={loadingTip}>
201
+ <div className="pagination-container">
202
+ <CapCustomCardList key={`${currentChannel}-card-list`} cardList={cardDataList} type={currentChannel} />
203
+ </div>
204
+ </CapSpin>
205
205
 
206
- </div>);
206
+ </div>);
207
207
  }
208
- getGalleryComponent = (location) => <Gallery location={location} isFullMode={this.props.isFullMode}/>
208
+ getGalleryComponent = (location) => <Gallery location={location} isFullMode={this.props.isFullMode}/>
209
209
  getCallTaskComponent = () => (
210
210
  <CallTask
211
211
  onCreateNew={this.props.createNew}
@@ -243,8 +243,8 @@ getGalleryComponent = (location) => <Gallery location={location} isFullMode={thi
243
243
  <Line
244
244
  {...this.props}
245
245
  isCreateFlow
246
- />
247
- )
246
+ />
247
+ )
248
248
 
249
249
  getFTPComponent = () => (
250
250
  <FTP mode={this.props.FTPMode} {...this.props} />
@@ -276,19 +276,19 @@ getGalleryComponent = (location) => <Gallery location={location} isFullMode={thi
276
276
  return this.getGalleryComponent(location);
277
277
  default:
278
278
  return (<Templates
279
- key={channel}
280
- location={location}
281
- route={{name: channel}}
282
- router={this.props.router}
283
- isFullMode={this.props.isFullMode}
284
- createNew={this.props.createNew}
285
- onSelectTemplate={(id) => this.props.onSelectTemplate(this.selectTemplate(id))}
286
- renderNewCardGrid={this.getTemplateDataForGrid}
287
- handlePeviewTemplate={this.props.handlePeviewTemplate}
288
- messageStrategy={this.props.messageStrategy}
289
- smsRegister={smsRegister}
290
- hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
291
- />);
279
+ key={channel}
280
+ location={location}
281
+ route={{name: channel}}
282
+ router={this.props.router}
283
+ isFullMode={this.props.isFullMode}
284
+ createNew={this.props.createNew}
285
+ onSelectTemplate={(id) => this.props.onSelectTemplate(this.selectTemplate(id))}
286
+ renderNewCardGrid={this.getTemplateDataForGrid}
287
+ handlePeviewTemplate={this.props.handlePeviewTemplate}
288
+ messageStrategy={this.props.messageStrategy}
289
+ smsRegister={smsRegister}
290
+ hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
291
+ />);
292
292
  }
293
293
  }
294
294
 
@@ -316,8 +316,8 @@ getGalleryComponent = (location) => <Gallery location={location} isFullMode={thi
316
316
  return this.props.Templates.loadingTemplates;
317
317
  }
318
318
  render() {
319
- const { isFullMode, className, cap = {}, authData = {}} = this.props;
320
- const { accessiblePermissions = []} = cap.user || authData.user || {};
319
+ const { isFullMode, className, cap = {}, Global = {}} = this.props;
320
+ const { accessiblePermissions = []} = cap.user || Global.user || {};
321
321
  let isCreativeAccessible = true;
322
322
  if (!accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
323
323
  isCreativeAccessible = false;
@@ -377,7 +377,7 @@ TemplatesV2.defaultProps = {
377
377
  };
378
378
 
379
379
  const mapStateToProps = createStructuredSelector({
380
- cap: makeSelectAuthenticated(),
380
+ Global: makeSelectAuthenticated(),
381
381
  Templates: makeSelectTemplates(),
382
382
  TemplatesList: makeSelectTemplatesResponse(),
383
383
  currentOrgDetails: selectCurrentOrgDetails(),
@@ -55,6 +55,9 @@ describe("Test TemplatesV2", () => {
55
55
  setWeChatAccount: jest.fn(),
56
56
  };
57
57
  const props = {
58
+ cap: {
59
+ user:{ accessiblePermissions: ['CREATIVES_UI_VIEW']}
60
+ },
58
61
  actions: { defaultAction: jest.fn(), getTemplates: jest.fn() },
59
62
  Templates,
60
63
  TemplatesList: Templates?.templates,