@capillarytech/creatives-library 2.0.78 → 2.0.80
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/components/CardGrid/index.js +1 -0
- package/components/FormBuilder/index.js +2 -2
- package/containers/Line/Create/index.js +1 -1
- package/containers/MobilePush/Create/selectors.js +1 -1
- package/containers/MobilePush/Edit/selectors.js +1 -1
- package/containers/Templates/index.js +18 -14
- package/containers/WeChat/actions.js +0 -6
- package/containers/WeChat/index.js +13 -31
- package/index.js +4 -3
- package/package.json +1 -1
- package/routes.js +4 -4
- package/v2Containers/MobilePush/Create/_mobilePushCreate.scss +10 -1
- package/v2Containers/MobilePush/Create/index.js +6 -4
- package/v2Containers/MobilePush/Create/messages.js +8 -0
- package/v2Containers/MobilePush/Create/selectors.js +2 -1
- package/v2Containers/MobilePush/Edit/_mobilePushCreate.scss +10 -0
- package/v2Containers/MobilePush/Edit/selectors.js +2 -1
- package/v2Containers/MobilePush/initialSchema.js +146 -132
- package/v2Containers/Templates/index.js +3 -1
- package/v2Containers/WeChat/MapTemplates/index.js +5 -5
- package/components/FormBuilder/test +0 -1845
- package/containers/CallTask/_callTask.scss +0 -5
- package/containers/CallTask/actions.js +0 -15
- package/containers/CallTask/constants.js +0 -7
- package/containers/CallTask/index.js +0 -141
- package/containers/CallTask/messages.js +0 -21
- package/containers/CallTask/reducer.js +0 -23
- package/containers/CallTask/sagas.js +0 -11
- package/containers/CallTask/selectors.js +0 -25
- package/containers/CallTask/tests/actions.test.js +0 -18
- package/containers/CallTask/tests/index.test.js +0 -10
- package/containers/CallTask/tests/reducer.test.js +0 -9
- package/containers/CallTask/tests/sagas.test.js +0 -15
- package/containers/CallTask/tests/selectors.test.js +0 -10
- package/containers/ChannelTemplates/actions.js +0 -20
- package/containers/ChannelTemplates/constants.js +0 -8
- package/containers/ChannelTemplates/index.js +0 -48
- package/containers/ChannelTemplates/messages.js +0 -13
- package/containers/ChannelTemplates/reducer.js +0 -34
- package/containers/ChannelTemplates/sagas.js +0 -32
- package/containers/ChannelTemplates/selectors.js +0 -25
- package/containers/ChannelTemplates/tests/actions.test.js +0 -18
- package/containers/ChannelTemplates/tests/index.test.js +0 -10
- package/containers/ChannelTemplates/tests/reducer.test.js +0 -9
- package/containers/ChannelTemplates/tests/sagas.test.js +0 -15
- package/containers/ChannelTemplates/tests/selectors.test.js +0 -10
- package/containers/CreativesContainer/SlideBoxContent.js +0 -248
- package/containers/CreativesContainer/SlideBoxFooter.js +0 -38
- package/containers/CreativesContainer/SlideBoxHeader.js +0 -65
- package/containers/CreativesContainer/actions.js +0 -27
- package/containers/CreativesContainer/constants.js +0 -13
- package/containers/CreativesContainer/index.js +0 -418
- package/containers/CreativesContainer/index.scss +0 -27
- package/containers/CreativesContainer/messages.js +0 -17
- package/containers/CreativesContainer/reducer.js +0 -29
- package/containers/CreativesContainer/sagas.js +0 -11
- package/containers/CreativesContainer/selectors.js +0 -30
- package/containers/CreativesContainer/tests/actions.test.js +0 -18
- package/containers/CreativesContainer/tests/index.test.js +0 -10
- package/containers/CreativesContainer/tests/reducer.test.js +0 -9
- package/containers/CreativesContainer/tests/sagas.test.js +0 -15
- package/containers/CreativesContainer/tests/selectors.test.js +0 -10
- package/containers/EmailWrapper/actions.js +0 -15
- package/containers/EmailWrapper/constants.js +0 -7
- package/containers/EmailWrapper/index.js +0 -238
- package/containers/EmailWrapper/messages.js +0 -57
- package/containers/EmailWrapper/reducer.js +0 -23
- package/containers/EmailWrapper/sagas.js +0 -11
- package/containers/EmailWrapper/selectors.js +0 -25
- package/containers/EmailWrapper/tests/actions.test.js +0 -18
- package/containers/EmailWrapper/tests/index.test.js +0 -10
- package/containers/EmailWrapper/tests/reducer.test.js +0 -9
- package/containers/EmailWrapper/tests/sagas.test.js +0 -15
- package/containers/EmailWrapper/tests/selectors.test.js +0 -10
- package/containers/MobilePush/commonMethods.js +0 -249
- package/containers/MobilePush/eventsMap.js +0 -127
- package/containers/MobilePush/initialSchema.js +0 -1739
- package/containers/MobilepushWrapper/_mobilepushWrapper.scss +0 -18
- package/containers/MobilepushWrapper/index.js +0 -97
- package/containers/MobilepushWrapper/messages.js +0 -25
- package/containers/MobilepushWrapper/tests/index.test.js +0 -10
- package/containers/TemplatesV2/_templatesV2.scss +0 -5
- package/containers/TemplatesV2/actions.js +0 -16
- package/containers/TemplatesV2/constants.js +0 -10
- package/containers/TemplatesV2/index.js +0 -207
- package/containers/TemplatesV2/messages.js +0 -29
- package/containers/TemplatesV2/selectors.js +0 -25
- package/containers/TemplatesV2/tests/actions.test.js +0 -18
- package/containers/TemplatesV2/tests/index.test.js +0 -10
- package/containers/TemplatesV2/tests/reducer.test.js +0 -9
- package/containers/TemplatesV2/tests/sagas.test.js +0 -15
- package/containers/TemplatesV2/tests/selectors.test.js +0 -10
- package/containers/WeChat/RichmediaTemplates/Create/testschema.js +0 -379
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* CallTask
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { bindActionCreators } from "redux";
|
|
9
|
-
import { connect } from 'react-redux';
|
|
10
|
-
import {
|
|
11
|
-
//CapSlideBox,
|
|
12
|
-
CapButton,
|
|
13
|
-
//CapIcon,
|
|
14
|
-
//CapHeader,
|
|
15
|
-
CapLabel,
|
|
16
|
-
} from '@capillarytech/cap-ui-library';
|
|
17
|
-
import { injectIntl, intlShape } from 'react-intl';
|
|
18
|
-
import { createStructuredSelector } from 'reselect';
|
|
19
|
-
import { makeSelectMetaEntities, isLoadingMetaEntities } from '../Cap/selectors';
|
|
20
|
-
import * as globalActions from '../../containers/Cap/actions';
|
|
21
|
-
import * as actions from "./actions";
|
|
22
|
-
import makeSelectCallTask from './selectors';
|
|
23
|
-
import NewCallTask from '../../components/NewCallTask';
|
|
24
|
-
import messages from './messages';
|
|
25
|
-
import './_callTask.scss';
|
|
26
|
-
|
|
27
|
-
export class CallTask extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
28
|
-
constructor(props) {
|
|
29
|
-
super(props);
|
|
30
|
-
this.state = {
|
|
31
|
-
showCallTaskSlidebox: false,
|
|
32
|
-
mode: props.mode || '', // supported modes are create | edit
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
componentDidMount() {
|
|
37
|
-
const query = {
|
|
38
|
-
layout: 'SMS',
|
|
39
|
-
type: 'TAG',
|
|
40
|
-
context: 'outbound',
|
|
41
|
-
embedded: 'embedded',
|
|
42
|
-
};
|
|
43
|
-
this.props.globalActions.fetchSchemaForEntity(query);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
showNewCallTask = () => {
|
|
47
|
-
this.setState({
|
|
48
|
-
showCallTaskSlidebox: true,
|
|
49
|
-
mode: 'create',
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
closeSlideBox = () => {
|
|
54
|
-
this.setState({
|
|
55
|
-
showCallTaskSlidebox: false,
|
|
56
|
-
mode: '',
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
render() {
|
|
61
|
-
const { intl, onCallTaskSubmit, templateData, loadingMetaEntities, metaEntities, showContentInSlidebox, onCreateNew } = this.props;
|
|
62
|
-
const { formatMessage } = intl;
|
|
63
|
-
const { mode } = this.state;
|
|
64
|
-
return (
|
|
65
|
-
<div>
|
|
66
|
-
{mode ?
|
|
67
|
-
<NewCallTask
|
|
68
|
-
metaEntities={metaEntities}
|
|
69
|
-
isLoading={loadingMetaEntities}
|
|
70
|
-
mode={mode}
|
|
71
|
-
templateData={templateData}
|
|
72
|
-
onCallTaskSubmit={onCallTaskSubmit}
|
|
73
|
-
/>
|
|
74
|
-
:
|
|
75
|
-
<div>
|
|
76
|
-
<CapLabel type="label1">
|
|
77
|
-
{formatMessage(messages.callTaskInfo)}
|
|
78
|
-
</CapLabel>
|
|
79
|
-
<div className="call-task-action-button">
|
|
80
|
-
<CapButton onClick={showContentInSlidebox ? this.showNewCallTask : onCreateNew}>
|
|
81
|
-
{formatMessage(messages.addNewCallTask)}
|
|
82
|
-
</CapButton>
|
|
83
|
-
</div>
|
|
84
|
-
{/* {
|
|
85
|
-
showCallTaskSlidebox && showContentInSlidebox &&
|
|
86
|
-
<CapSlideBox
|
|
87
|
-
header={
|
|
88
|
-
<CapHeader
|
|
89
|
-
title={formatMessage(messages.newMessage)}
|
|
90
|
-
prefix={
|
|
91
|
-
<CapIcon style={{ marginRight: '16px' }} type={"back"} onClick={this.closeSlideBox} />
|
|
92
|
-
} />
|
|
93
|
-
}
|
|
94
|
-
show={showCallTaskSlidebox}
|
|
95
|
-
size="size-l"
|
|
96
|
-
handleClose={this.closeSlideBox}
|
|
97
|
-
content={
|
|
98
|
-
<NewCallTask
|
|
99
|
-
metaEntities={metaEntities}
|
|
100
|
-
isLoading={loadingMetaEntities}
|
|
101
|
-
mode={mode}
|
|
102
|
-
onCallTaskSubmit={onCallTaskSubmit}
|
|
103
|
-
/>
|
|
104
|
-
}
|
|
105
|
-
/>
|
|
106
|
-
} */}
|
|
107
|
-
</div>
|
|
108
|
-
}
|
|
109
|
-
</div>
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
CallTask.propTypes = {
|
|
115
|
-
intl: intlShape.isRequired,
|
|
116
|
-
onCallTaskSubmit: PropTypes.func,
|
|
117
|
-
mode: PropTypes.string,
|
|
118
|
-
templateData: PropTypes.object,
|
|
119
|
-
globalActions: PropTypes.object,
|
|
120
|
-
metaEntities: PropTypes.object,
|
|
121
|
-
loadingMetaEntities: PropTypes.bool,
|
|
122
|
-
showContentInSlidebox: PropTypes.bool,
|
|
123
|
-
onCreateNew: PropTypes.func,
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const mapStateToProps = createStructuredSelector({
|
|
128
|
-
CallTask: makeSelectCallTask(),
|
|
129
|
-
metaEntities: makeSelectMetaEntities(),
|
|
130
|
-
loadingMetaEntities: isLoadingMetaEntities(),
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
function mapDispatchToProps(dispatch) {
|
|
134
|
-
return {
|
|
135
|
-
globalActions: bindActionCreators(globalActions, dispatch),
|
|
136
|
-
actions: bindActionCreators(actions, dispatch),
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(CallTask));
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* CallTask Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the CallTask component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
addNewCallTask: {
|
|
10
|
-
id: 'app.containers.CallTask.addNewCallTask',
|
|
11
|
-
defaultMessage: 'Add New Call Task',
|
|
12
|
-
},
|
|
13
|
-
newMessage: {
|
|
14
|
-
id: 'app.containers.CallTask.newMessage',
|
|
15
|
-
defaultMessage: 'New Message',
|
|
16
|
-
},
|
|
17
|
-
callTaskInfo: {
|
|
18
|
-
id: 'app.containers.CallTask.callTaskInfo',
|
|
19
|
-
defaultMessage: 'Call Tasks are message sent to store staff. The messages are displayed on the Point of Sale (POS) machines for store staff to take action.',
|
|
20
|
-
},
|
|
21
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* CallTask reducer
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { fromJS } from 'immutable';
|
|
8
|
-
import {
|
|
9
|
-
DEFAULT_ACTION,
|
|
10
|
-
} from './constants';
|
|
11
|
-
|
|
12
|
-
const initialState = fromJS({});
|
|
13
|
-
|
|
14
|
-
function callTaskReducer(state = initialState, action) {
|
|
15
|
-
switch (action.type) {
|
|
16
|
-
case DEFAULT_ACTION:
|
|
17
|
-
return state;
|
|
18
|
-
default:
|
|
19
|
-
return state;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default callTaskReducer;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// import { take, call, put, select } from 'redux-saga/effects';
|
|
2
|
-
|
|
3
|
-
// Individual exports for testing
|
|
4
|
-
export function* defaultSaga() {
|
|
5
|
-
// See example in containers/HomePage/sagas.js
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// All sagas to be loaded
|
|
9
|
-
export default [
|
|
10
|
-
defaultSaga,
|
|
11
|
-
];
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createSelector } from 'reselect';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Direct selector to the callTask state domain
|
|
5
|
-
*/
|
|
6
|
-
const selectCallTaskDomain = () => (state) => state.get('callTask');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Other specific selectors
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Default selector used by CallTask
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const makeSelectCallTask = () => createSelector(
|
|
18
|
-
selectCallTaskDomain(),
|
|
19
|
-
(substate) => substate.toJS()
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export default makeSelectCallTask;
|
|
23
|
-
export {
|
|
24
|
-
selectCallTaskDomain,
|
|
25
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
defaultAction,
|
|
4
|
-
} from '../actions';
|
|
5
|
-
import {
|
|
6
|
-
DEFAULT_ACTION,
|
|
7
|
-
} from '../constants';
|
|
8
|
-
|
|
9
|
-
describe('CallTask actions', () => {
|
|
10
|
-
describe('Default Action', () => {
|
|
11
|
-
it('has a type of DEFAULT_ACTION', () => {
|
|
12
|
-
const expected = {
|
|
13
|
-
type: DEFAULT_ACTION,
|
|
14
|
-
};
|
|
15
|
-
expect(defaultAction()).toEqual(expected);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test sagas
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* eslint-disable redux-saga/yield-effects */
|
|
6
|
-
// import { take, call, put, select } from 'redux-saga/effects';
|
|
7
|
-
// import { defaultSaga } from '../sagas';
|
|
8
|
-
|
|
9
|
-
// const generator = defaultSaga();
|
|
10
|
-
|
|
11
|
-
describe('defaultSaga Saga', () => {
|
|
12
|
-
it('Expect to have unit tests specified', () => {
|
|
13
|
-
expect(false).toEqual(false);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// import { fromJS } from 'immutable';
|
|
2
|
-
// import { makeSelectCallTaskDomain } from '../selectors';
|
|
3
|
-
|
|
4
|
-
// const selector = makeSelectCallTaskDomain();
|
|
5
|
-
|
|
6
|
-
describe('makeSelectCallTaskDomain', () => {
|
|
7
|
-
it('Expect to have unit tests specified', () => {
|
|
8
|
-
expect(false).toEqual(false);
|
|
9
|
-
});
|
|
10
|
-
});
|
|
@@ -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,48 +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
|
-
debugger;
|
|
22
|
-
this.props.actions.getTemplates(this.props.channel);
|
|
23
|
-
}
|
|
24
|
-
render() {
|
|
25
|
-
return (
|
|
26
|
-
<CardGrid
|
|
27
|
-
cardDataList={[]}
|
|
28
|
-
/>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
ChannelTemplates.propTypes = {
|
|
34
|
-
actions: PropTypes.object.isRequired,
|
|
35
|
-
channel: PropTypes.string,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const mapStateToProps = createStructuredSelector({
|
|
39
|
-
ChannelTemplates: makeSelectChannelTemplates(),
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
function mapDispatchToProps(dispatch) {
|
|
43
|
-
return {
|
|
44
|
-
actions: bindActionCreators(actions, dispatch),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
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: 'app.containers.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 containers/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
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
defaultAction,
|
|
4
|
-
} from '../actions';
|
|
5
|
-
import {
|
|
6
|
-
DEFAULT_ACTION,
|
|
7
|
-
} from '../constants';
|
|
8
|
-
|
|
9
|
-
describe('ChannelTemplates actions', () => {
|
|
10
|
-
describe('Default Action', () => {
|
|
11
|
-
it('has a type of DEFAULT_ACTION', () => {
|
|
12
|
-
const expected = {
|
|
13
|
-
type: DEFAULT_ACTION,
|
|
14
|
-
};
|
|
15
|
-
expect(defaultAction()).toEqual(expected);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// import React from 'react';
|
|
2
|
-
// import { shallow } from 'enzyme';
|
|
3
|
-
|
|
4
|
-
// import { ChannelTemplates } from '../index';
|
|
5
|
-
|
|
6
|
-
describe('<ChannelTemplates />', () => {
|
|
7
|
-
it('Expect to have unit tests specified', () => {
|
|
8
|
-
expect(true).toEqual(false);
|
|
9
|
-
});
|
|
10
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test sagas
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* eslint-disable redux-saga/yield-effects */
|
|
6
|
-
// import { take, call, put, select } from 'redux-saga/effects';
|
|
7
|
-
// import { defaultSaga } from '../sagas';
|
|
8
|
-
|
|
9
|
-
// const generator = defaultSaga();
|
|
10
|
-
|
|
11
|
-
describe('defaultSaga Saga', () => {
|
|
12
|
-
it('Expect to have unit tests specified', () => {
|
|
13
|
-
expect(true).toEqual(false);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// import { fromJS } from 'immutable';
|
|
2
|
-
// import { makeSelectChannelTemplatesDomain } from '../selectors';
|
|
3
|
-
|
|
4
|
-
// const selector = makeSelectChannelTemplatesDomain();
|
|
5
|
-
|
|
6
|
-
describe('makeSelectChannelTemplatesDomain', () => {
|
|
7
|
-
it('Expect to have unit tests specified', () => {
|
|
8
|
-
expect(true).toEqual(false);
|
|
9
|
-
});
|
|
10
|
-
});
|