@capillarytech/creatives-library 7.17.57 → 7.17.59
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 +1 -1
- package/v2Components/FormBuilder/constants.js +1 -0
- package/v2Components/FormBuilder/index.js +5 -4
- package/v2Containers/ChannelTemplates/actions.js +0 -20
- package/v2Containers/ChannelTemplates/constants.js +0 -8
- package/v2Containers/ChannelTemplates/index.js +0 -47
- package/v2Containers/ChannelTemplates/messages.js +0 -13
- package/v2Containers/ChannelTemplates/reducer.js +0 -34
- package/v2Containers/ChannelTemplates/sagas.js +0 -32
- package/v2Containers/ChannelTemplates/selectors.js +0 -25
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@ import CapUploader from '@capillarytech/cap-ui-library/CapUploader';
|
|
|
29
29
|
import CapHeading from '@capillarytech/cap-ui-library/CapHeading';
|
|
30
30
|
import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
31
31
|
import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
|
|
32
|
-
import
|
|
32
|
+
import CapAskAira from '@capillarytech/cap-ui-library/CapAskAira';
|
|
33
33
|
|
|
34
34
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
35
35
|
import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
|
|
@@ -51,7 +51,7 @@ import { SMS, MOBILE_PUSH, LINE, ENABLE_AI_SUGGESTIONS } from '../../v2Container
|
|
|
51
51
|
import { validateIfTagClosed } from '../../utils/tagValidations';
|
|
52
52
|
import globalMessages from '../../v2Containers/Cap/messages';
|
|
53
53
|
import { convert } from 'html-to-text';
|
|
54
|
-
import { AI_SUGGESTION_API_URL } from './constants';
|
|
54
|
+
import { AI_SUGGESTION_API_URL, CONTENT_RECOMMENDATION_BOT } from './constants';
|
|
55
55
|
import { GET_TRANSLATION_MAPPED } from '../../containers/TagList/constants';
|
|
56
56
|
import moment from 'moment';
|
|
57
57
|
import { CUSTOMER_BARCODE_TAG , COPY_OF} from '../../containers/App/constants';
|
|
@@ -2316,7 +2316,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2316
2316
|
const hasAiSuggestionsEnabled = accessibleFeatures.includes(
|
|
2317
2317
|
ENABLE_AI_SUGGESTIONS
|
|
2318
2318
|
);
|
|
2319
|
-
|
|
2319
|
+
|
|
2320
2320
|
let errorMessageText = false;
|
|
2321
2321
|
switch (errorType) {
|
|
2322
2322
|
case MISSING_TAG_ERROR:
|
|
@@ -2356,11 +2356,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2356
2356
|
&& hasAiSuggestionsEnabled
|
|
2357
2357
|
&& this.props.isFullMode
|
|
2358
2358
|
&& (
|
|
2359
|
-
<
|
|
2359
|
+
<CapAskAira
|
|
2360
2360
|
text={messageContent || ""}
|
|
2361
2361
|
setText={(x) => {
|
|
2362
2362
|
this.updateFormData(x, val);
|
|
2363
2363
|
}}
|
|
2364
|
+
botType={CONTENT_RECOMMENDATION_BOT}
|
|
2364
2365
|
websocketUrl={AI_SUGGESTION_API_URL}
|
|
2365
2366
|
/>
|
|
2366
2367
|
)}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* ChannelTemplates actions
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import * as types from './constants';
|
|
8
|
-
|
|
9
|
-
export function defaultAction() {
|
|
10
|
-
return {
|
|
11
|
-
type: types.DEFAULT_ACTION,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function getTemplates(channel) {
|
|
16
|
-
return {
|
|
17
|
-
type: types.GET_TEMPLATES_REQUEST,
|
|
18
|
-
channel,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* ChannelTemplates
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
|
-
import { FormattedMessage } from 'react-intl';
|
|
12
|
-
import { bindActionCreators } from 'redux';
|
|
13
|
-
import { createStructuredSelector } from 'reselect';
|
|
14
|
-
import makeSelectChannelTemplates from './selectors';
|
|
15
|
-
import * as actions from './actions';
|
|
16
|
-
import messages from './messages';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export class ChannelTemplates extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
20
|
-
componentDidMount() {
|
|
21
|
-
this.props.actions.getTemplates(this.props.channel);
|
|
22
|
-
}
|
|
23
|
-
render() {
|
|
24
|
-
return (
|
|
25
|
-
<CardGrid
|
|
26
|
-
cardDataList={[]}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
ChannelTemplates.propTypes = {
|
|
33
|
-
actions: PropTypes.object.isRequired,
|
|
34
|
-
channel: PropTypes.string,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const mapStateToProps = createStructuredSelector({
|
|
38
|
-
ChannelTemplates: makeSelectChannelTemplates(),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
function mapDispatchToProps(dispatch) {
|
|
42
|
-
return {
|
|
43
|
-
actions: bindActionCreators(actions, dispatch),
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default connect(mapStateToProps, mapDispatchToProps)(ChannelTemplates);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ChannelTemplates Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the ChannelTemplates component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'creatives.containersV2.ChannelTemplates.header',
|
|
11
|
-
defaultMessage: 'This is ChannelTemplates container !',
|
|
12
|
-
},
|
|
13
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* ChannelTemplates reducer
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { fromJS } from 'immutable';
|
|
8
|
-
import * as types from './constants';
|
|
9
|
-
|
|
10
|
-
const initialState = fromJS({
|
|
11
|
-
loadingTemplates: true,
|
|
12
|
-
smsTemplates: [],
|
|
13
|
-
emailTemplates: [],
|
|
14
|
-
wechatTemplates: [],
|
|
15
|
-
mobilepushTemplates: [],
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
function channelTemplatesReducer(state = initialState, action) {
|
|
19
|
-
const channelTemplates = `${action.channel}Templates`;
|
|
20
|
-
switch (action.type) {
|
|
21
|
-
case types.DEFAULT_ACTION:
|
|
22
|
-
return state;
|
|
23
|
-
case types.GET_TEMPLATES_REQUEST:
|
|
24
|
-
return state.set('loadingTemplates', true);
|
|
25
|
-
case types.GET_TEMPLATES_SUCESS:
|
|
26
|
-
return state.set('loadingTemplates', false).set(channelTemplates, action.templates);
|
|
27
|
-
case types.GET_TEMPLATES_FAILURE:
|
|
28
|
-
return state.set('loadingTemplates', false).set('error', action.error);
|
|
29
|
-
default:
|
|
30
|
-
return state;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default channelTemplatesReducer;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { take, takeLatest, call, put, cancel } from 'redux-saga/effects';
|
|
2
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
|
-
import * as Api from '../../services/api';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import * as types from './constants';
|
|
7
|
-
// Individual exports for testing
|
|
8
|
-
export function* defaultSaga() {
|
|
9
|
-
// See example in v2Containers/HomePage/sagas.js
|
|
10
|
-
}
|
|
11
|
-
function* getTemplates(action) {
|
|
12
|
-
try {
|
|
13
|
-
const req = {
|
|
14
|
-
channel: action.channel,
|
|
15
|
-
queryParams: action.query,
|
|
16
|
-
};
|
|
17
|
-
const res = call(Api.getAllTemplates, req);
|
|
18
|
-
put({type: types.GET_TEMPLATES_SUCESS, templates: res.response, channel: action.channel});
|
|
19
|
-
} catch (error) {
|
|
20
|
-
put({type: types.GET_TEMPLATES_FAILURE, error});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function* getTemplatesWatcher() {
|
|
24
|
-
const watcher = yield takeLatest(types.GET_TEMPLATES_REQUEST, getTemplates);
|
|
25
|
-
yield take(LOCATION_CHANGE);
|
|
26
|
-
yield cancel(watcher);
|
|
27
|
-
}
|
|
28
|
-
// All sagas to be loaded
|
|
29
|
-
export default [
|
|
30
|
-
defaultSaga,
|
|
31
|
-
getTemplatesWatcher,
|
|
32
|
-
];
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createSelector } from 'reselect';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Direct selector to the channelTemplates state domain
|
|
5
|
-
*/
|
|
6
|
-
const selectChannelTemplatesDomain = () => (state) => state.get('templates');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Other specific selectors
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Default selector used by ChannelTemplates
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const makeSelectChannelTemplates = () => createSelector(
|
|
18
|
-
selectChannelTemplatesDomain(),
|
|
19
|
-
(substate) => substate.toJS()
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export default makeSelectChannelTemplates;
|
|
23
|
-
export {
|
|
24
|
-
selectChannelTemplatesDomain,
|
|
25
|
-
};
|