@capillarytech/creatives-library 8.0.35 → 8.0.37
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/app.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"version": "8.0.
|
|
4
|
+
"version": "8.0.37",
|
|
5
5
|
"description": "Capillary creatives ui",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.es.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@bugsnag/js": "^7.2.1",
|
|
18
18
|
"@bugsnag/plugin-react": "7.2.1",
|
|
19
19
|
"@capillarytech/cap-ui-utils": "3.0.4",
|
|
20
|
-
"@capillarytech/vulcan-react-sdk": "^2.
|
|
20
|
+
"@capillarytech/vulcan-react-sdk": "^2.3.5",
|
|
21
21
|
"@mailupinc/bee-plugin": "^1.2.0",
|
|
22
22
|
"babel-cli": "^6.26.0",
|
|
23
23
|
"chalk": "^2.4.2",
|
|
@@ -5,7 +5,7 @@ import * as types from './constants';
|
|
|
5
5
|
export function* getAllAssets(assetType, queryParams) {
|
|
6
6
|
try {
|
|
7
7
|
const result = yield call(Api.getAllAssets, assetType, queryParams);
|
|
8
|
-
yield put({ type: types.GET_ALL_ASSETS_SUCCESS, data: result?.response, isReset: queryParams.page === 1 });
|
|
8
|
+
yield put({ type: types.GET_ALL_ASSETS_SUCCESS, data: result?.response, isReset: assetType.queryParams.page === 1 });
|
|
9
9
|
} catch (error) {
|
|
10
10
|
yield put({ type: types.GET_ALL_ASSETS_FAILURE, error });
|
|
11
11
|
}
|
|
@@ -56,11 +56,10 @@ export function* getTemplateDetails(id) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
export function* getAllAssets({assetType, queryParams}) {
|
|
59
|
+
export function* getAllAssets(assetType, queryParams) {
|
|
61
60
|
try {
|
|
62
61
|
const result = yield call(Api.getAllAssets, assetType, queryParams);
|
|
63
|
-
yield put({ type: types.GET_ALL_ASSETS_SUCCESS, data: result?.response, isReset: queryParams.page === 1 });
|
|
62
|
+
yield put({ type: types.GET_ALL_ASSETS_SUCCESS, data: result?.response, isReset: assetType.queryParams.page === 1 });
|
|
64
63
|
} catch (error) {
|
|
65
64
|
yield put({ type: types.GET_ALL_ASSETS_FAILURE, error });
|
|
66
65
|
}
|
|
@@ -6,14 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import { all } from 'redux-saga/effects';
|
|
10
9
|
import { connect } from 'react-redux';
|
|
11
10
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
12
11
|
import { createStructuredSelector } from 'reselect';
|
|
13
12
|
import { bindActionCreators, compose } from 'redux';
|
|
14
|
-
import {
|
|
15
|
-
CapTab, CapCustomCard, CapButton, CapHeader, CapSpin, CapIcon, CapTooltip,
|
|
16
|
-
} from '@capillarytech/cap-ui-library';
|
|
13
|
+
import { CapTab, CapCustomCard, CapButton, CapHeader, CapSpin, CapIcon, CapTooltip } from '@capillarytech/cap-ui-library';
|
|
17
14
|
import { find, get } from 'lodash';
|
|
18
15
|
import isEmpty from 'lodash/isEmpty';
|
|
19
16
|
import Helmet from 'react-helmet';
|
|
@@ -33,9 +30,7 @@ import FTP from '../FTP';
|
|
|
33
30
|
import Gallery from '../Assets/Gallery';
|
|
34
31
|
import withStyles from '../../hoc/withStyles';
|
|
35
32
|
import styles, { CapTabStyle } from './TemplatesV2.style';
|
|
36
|
-
import {
|
|
37
|
-
CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP,
|
|
38
|
-
} from '../App/constants';
|
|
33
|
+
import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP } from '../App/constants';
|
|
39
34
|
import AccessForbidden from '../../v2Components/AccessForbidden';
|
|
40
35
|
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
41
36
|
import { makeSelectAuthenticated, selectCurrentOrgDetails } from "../Cap/selectors";
|
|
@@ -124,15 +119,13 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
124
119
|
// eslint-disable-next-line no-param-reassign
|
|
125
120
|
pane.disabled = true;
|
|
126
121
|
if (pane.key === 'facebook' && showDisabledFBInfo) {
|
|
127
|
-
pane.tab = (
|
|
128
|
-
<CapTooltip
|
|
122
|
+
pane.tab = (<CapTooltip
|
|
129
123
|
title={
|
|
130
124
|
intl.formatMessage(messages.facebookDisableinfo)
|
|
131
125
|
}
|
|
132
126
|
>
|
|
133
127
|
{intl.formatMessage(messages.facebook)}
|
|
134
|
-
</CapTooltip>
|
|
135
|
-
);
|
|
128
|
+
</CapTooltip>);
|
|
136
129
|
}
|
|
137
130
|
}
|
|
138
131
|
return pane;
|
|
@@ -185,15 +178,13 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
185
178
|
this.setState({selectedChannel: nextProps.channel, panes });
|
|
186
179
|
}
|
|
187
180
|
}
|
|
188
|
-
|
|
189
|
-
getTemplateDataForGrid = ({
|
|
190
|
-
templates, handlers, filterContent, channel, isLoading, loadingTip,
|
|
191
|
-
}) => {
|
|
181
|
+
getTemplateDataForGrid = ({templates, handlers, filterContent, channel, isLoading, loadingTip}) => {
|
|
192
182
|
const currentChannel = channel.toUpperCase();
|
|
193
183
|
const cardDataList = templates.map((template) => {
|
|
194
|
-
const templateData =
|
|
184
|
+
const templateData =
|
|
185
|
+
{
|
|
195
186
|
key: `${currentChannel}-card-${template.name}`,
|
|
196
|
-
title: <span title={template.name}>{template.name}</span>,
|
|
187
|
+
title: <span title={template.name} >{template.name}</span>,
|
|
197
188
|
extra: [<CapIcon type="eye" onClick={() => { if (this.props.isFullMode) { handlers.handlePreviewClick(template); } else { this.props.handlePeviewTemplate(template); } }} />],
|
|
198
189
|
hoverOption: <CapButton onClick={(e) => handlers.handleEditClick(e, template._id)}>{this.props.intl.formatMessage(this.props.isFullMode ? messages.edit : messages.select)}</CapButton>,
|
|
199
190
|
};
|
|
@@ -204,8 +195,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
204
195
|
}
|
|
205
196
|
return templateData;
|
|
206
197
|
});
|
|
207
|
-
return (
|
|
208
|
-
<div>
|
|
198
|
+
return (<div>
|
|
209
199
|
{filterContent}
|
|
210
200
|
<CapSpin spinning={isLoading} tip={loadingTip}>
|
|
211
201
|
<div className="pagination-container">
|
|
@@ -213,12 +203,9 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
213
203
|
</div>
|
|
214
204
|
</CapSpin>
|
|
215
205
|
|
|
216
|
-
</div>
|
|
217
|
-
);
|
|
206
|
+
</div>);
|
|
218
207
|
}
|
|
219
|
-
|
|
220
|
-
getGalleryComponent = (location) => <Gallery location={location} isFullMode={this.props.isFullMode} />
|
|
221
|
-
|
|
208
|
+
getGalleryComponent = (location) => <Gallery location={location} isFullMode={this.props.isFullMode}/>
|
|
222
209
|
getCallTaskComponent = () => (
|
|
223
210
|
<CallTask
|
|
224
211
|
onCreateNew={this.props.createNew}
|
|
@@ -228,13 +215,11 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
228
215
|
);
|
|
229
216
|
|
|
230
217
|
getFacebookComponent = () => {
|
|
231
|
-
const {
|
|
232
|
-
messageDetails, cap, onFacebookSubmit,
|
|
218
|
+
const { messageDetails, cap, onFacebookSubmit,
|
|
233
219
|
messageStrategy,
|
|
234
220
|
showDisabledFBInfo,
|
|
235
221
|
orgUnitId,
|
|
236
|
-
onSelectTemplate
|
|
237
|
-
} = this.props;
|
|
222
|
+
onSelectTemplate } = this.props;
|
|
238
223
|
return (
|
|
239
224
|
<Facebook
|
|
240
225
|
{...this.props}
|
|
@@ -248,15 +233,12 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
248
233
|
/>
|
|
249
234
|
);
|
|
250
235
|
}
|
|
251
|
-
|
|
252
236
|
getViberComponent =() => (
|
|
253
237
|
<Viber
|
|
254
238
|
{...this.props}
|
|
255
239
|
isCreateFlow
|
|
256
|
-
>
|
|
257
|
-
</Viber>
|
|
240
|
+
></Viber>
|
|
258
241
|
)
|
|
259
|
-
|
|
260
242
|
getLineComponent = () => (
|
|
261
243
|
<Line
|
|
262
244
|
{...this.props}
|
|
@@ -293,8 +275,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
293
275
|
case 'assets':
|
|
294
276
|
return this.getGalleryComponent(location);
|
|
295
277
|
default:
|
|
296
|
-
return (
|
|
297
|
-
<Templates
|
|
278
|
+
return (<Templates
|
|
298
279
|
key={channel}
|
|
299
280
|
location={location}
|
|
300
281
|
route={{name: channel}}
|
|
@@ -307,8 +288,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
307
288
|
messageStrategy={this.props.messageStrategy}
|
|
308
289
|
smsRegister={smsRegister}
|
|
309
290
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
310
|
-
/>
|
|
311
|
-
);
|
|
291
|
+
/>);
|
|
312
292
|
}
|
|
313
293
|
}
|
|
314
294
|
|
|
@@ -330,17 +310,13 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
330
310
|
const panes = this.setChannelContent(selectedChannel, this.state.panes);
|
|
331
311
|
this.setState({panes, selectedChannel}, () => { if (!this.props.isFullMode) this.props.onChannelChange(selectedChannel); });
|
|
332
312
|
}
|
|
333
|
-
|
|
334
313
|
selectTemplate = (id) => find(this.props.TemplatesList, {_id: id})
|
|
335
314
|
|
|
336
315
|
isLoading() {
|
|
337
316
|
return this.props.Templates.loadingTemplates;
|
|
338
317
|
}
|
|
339
|
-
|
|
340
318
|
render() {
|
|
341
|
-
const {
|
|
342
|
-
isFullMode, className, cap = {}, authData = {},
|
|
343
|
-
} = this.props;
|
|
319
|
+
const { isFullMode, className, cap = {}, authData = {}} = this.props;
|
|
344
320
|
const { accessiblePermissions = []} = cap.user || authData.user || {};
|
|
345
321
|
let isCreativeAccessible = true;
|
|
346
322
|
if (!accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
|
|
@@ -349,16 +325,14 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
349
325
|
return (
|
|
350
326
|
!isCreativeAccessible ? <AccessForbidden /> : (
|
|
351
327
|
<div className={`${className} creatives-templates-container ${isFullMode ? 'fullmode' : 'library-mode'}`} data-testid="cap-wrapper">
|
|
352
|
-
{isFullMode &&
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
/>
|
|
359
|
-
)}
|
|
328
|
+
{isFullMode && <Helmet
|
|
329
|
+
title={this.props.intl.formatMessage(messages.creatives)}
|
|
330
|
+
meta={[
|
|
331
|
+
{ name: 'description', content: this.props.intl.formatMessage(messages.creativesDesc) },
|
|
332
|
+
]}
|
|
333
|
+
/>}
|
|
360
334
|
<div className="component-wrapper">
|
|
361
|
-
{isFullMode && <CapHeader title={<FormattedMessage {...messages.creatives}
|
|
335
|
+
{isFullMode && <CapHeader title={<FormattedMessage {...messages.creatives}/>} description={<FormattedMessage {...messages.creativesDesc}/>}/>}
|
|
362
336
|
<StyledCapTab
|
|
363
337
|
panes={this.state.panes}
|
|
364
338
|
onChange={this.channelChange}
|
|
@@ -403,7 +377,7 @@ TemplatesV2.defaultProps = {
|
|
|
403
377
|
};
|
|
404
378
|
|
|
405
379
|
const mapStateToProps = createStructuredSelector({
|
|
406
|
-
|
|
380
|
+
cap: makeSelectAuthenticated(),
|
|
407
381
|
Templates: makeSelectTemplates(),
|
|
408
382
|
TemplatesList: makeSelectTemplatesResponse(),
|
|
409
383
|
currentOrgDetails: selectCurrentOrgDetails(),
|