@capillarytech/creatives-library 7.17.21-alpha.2 → 7.17.21

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.
@@ -3134,7 +3134,7 @@ FREE GIFTS-
3134
3134
  key=".0"
3135
3135
  size="regular"
3136
3136
  suffix={
3137
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
3137
+ <Connect(UserIsAuthenticated(Connect(TagList)))
3138
3138
  hidePopover={false}
3139
3139
  injectedTags={Object {}}
3140
3140
  location={
@@ -3173,7 +3173,7 @@ FREE GIFTS-
3173
3173
  />
3174
3174
  </CapHeading>
3175
3175
  </div>
3176
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
3176
+ <Connect(UserIsAuthenticated(Connect(TagList)))
3177
3177
  hidePopover={false}
3178
3178
  injectedTags={Object {}}
3179
3179
  location={
@@ -3190,7 +3190,7 @@ FREE GIFTS-
3190
3190
  onTagSelect={[Function]}
3191
3191
  tags={Array []}
3192
3192
  >
3193
- <UserIsAuthenticated(Connect(InjectIntl(TagList)))
3193
+ <UserIsAuthenticated(Connect(TagList))
3194
3194
  authData={
3195
3195
  Object {
3196
3196
  "app": Object {},
@@ -3233,7 +3233,7 @@ FREE GIFTS-
3233
3233
  redirect={[Function]}
3234
3234
  tags={Array []}
3235
3235
  />
3236
- </Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
3236
+ </Connect(UserIsAuthenticated(Connect(TagList)))>
3237
3237
  </div>
3238
3238
  </CapHeader__Flex>
3239
3239
  </CapHeader>
@@ -10463,7 +10463,7 @@ FREE GIFTS-
10463
10463
  key=".0"
10464
10464
  size="regular"
10465
10465
  suffix={
10466
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
10466
+ <Connect(UserIsAuthenticated(Connect(TagList)))
10467
10467
  hidePopover={false}
10468
10468
  injectedTags={Object {}}
10469
10469
  location={
@@ -10502,7 +10502,7 @@ FREE GIFTS-
10502
10502
  />
10503
10503
  </CapHeading>
10504
10504
  </div>
10505
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
10505
+ <Connect(UserIsAuthenticated(Connect(TagList)))
10506
10506
  hidePopover={false}
10507
10507
  injectedTags={Object {}}
10508
10508
  location={
@@ -10519,7 +10519,7 @@ FREE GIFTS-
10519
10519
  onTagSelect={[Function]}
10520
10520
  tags={Array []}
10521
10521
  >
10522
- <UserIsAuthenticated(Connect(InjectIntl(TagList)))
10522
+ <UserIsAuthenticated(Connect(TagList))
10523
10523
  authData={
10524
10524
  Object {
10525
10525
  "app": Object {},
@@ -10562,7 +10562,7 @@ FREE GIFTS-
10562
10562
  redirect={[Function]}
10563
10563
  tags={Array []}
10564
10564
  />
10565
- </Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
10565
+ </Connect(UserIsAuthenticated(Connect(TagList)))>
10566
10566
  </div>
10567
10567
  </CapHeader__Flex>
10568
10568
  </CapHeader>
@@ -18212,7 +18212,7 @@ FREE GIFTS-
18212
18212
  key=".0"
18213
18213
  size="regular"
18214
18214
  suffix={
18215
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
18215
+ <Connect(UserIsAuthenticated(Connect(TagList)))
18216
18216
  hidePopover={false}
18217
18217
  injectedTags={Object {}}
18218
18218
  location={
@@ -18251,7 +18251,7 @@ FREE GIFTS-
18251
18251
  />
18252
18252
  </CapHeading>
18253
18253
  </div>
18254
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
18254
+ <Connect(UserIsAuthenticated(Connect(TagList)))
18255
18255
  hidePopover={false}
18256
18256
  injectedTags={Object {}}
18257
18257
  location={
@@ -18268,7 +18268,7 @@ FREE GIFTS-
18268
18268
  onTagSelect={[Function]}
18269
18269
  tags={Array []}
18270
18270
  >
18271
- <UserIsAuthenticated(Connect(InjectIntl(TagList)))
18271
+ <UserIsAuthenticated(Connect(TagList))
18272
18272
  authData={
18273
18273
  Object {
18274
18274
  "app": Object {},
@@ -18311,7 +18311,7 @@ FREE GIFTS-
18311
18311
  redirect={[Function]}
18312
18312
  tags={Array []}
18313
18313
  />
18314
- </Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
18314
+ </Connect(UserIsAuthenticated(Connect(TagList)))>
18315
18315
  </div>
18316
18316
  </CapHeader__Flex>
18317
18317
  </CapHeader>
@@ -26070,7 +26070,7 @@ FREE GIFTS-
26070
26070
  key=".0"
26071
26071
  size="regular"
26072
26072
  suffix={
26073
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
26073
+ <Connect(UserIsAuthenticated(Connect(TagList)))
26074
26074
  hidePopover={false}
26075
26075
  injectedTags={Object {}}
26076
26076
  location={
@@ -26109,7 +26109,7 @@ FREE GIFTS-
26109
26109
  />
26110
26110
  </CapHeading>
26111
26111
  </div>
26112
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
26112
+ <Connect(UserIsAuthenticated(Connect(TagList)))
26113
26113
  hidePopover={false}
26114
26114
  injectedTags={Object {}}
26115
26115
  location={
@@ -26126,7 +26126,7 @@ FREE GIFTS-
26126
26126
  onTagSelect={[Function]}
26127
26127
  tags={Array []}
26128
26128
  >
26129
- <UserIsAuthenticated(Connect(InjectIntl(TagList)))
26129
+ <UserIsAuthenticated(Connect(TagList))
26130
26130
  authData={
26131
26131
  Object {
26132
26132
  "app": Object {},
@@ -26169,7 +26169,7 @@ FREE GIFTS-
26169
26169
  redirect={[Function]}
26170
26170
  tags={Array []}
26171
26171
  />
26172
- </Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
26172
+ </Connect(UserIsAuthenticated(Connect(TagList)))>
26173
26173
  </div>
26174
26174
  </CapHeader__Flex>
26175
26175
  </CapHeader>
@@ -21,16 +21,12 @@ import CapTagList from '../../v2Components/CapTagList';
21
21
  import './_tagList.scss';
22
22
  import { selectCurrentOrgDetails } from '../Cap/selectors';
23
23
  const TreeNode = Tree.TreeNode;
24
- import { injectIntl } from 'react-intl';
25
- import { scope } from './messages';
26
- import { handleInjectedData } from '../../utils/common';
27
24
 
28
25
  export class TagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
29
26
  constructor(props) {
30
27
  super(props);
31
28
  this.state = {
32
29
  loading: false,
33
- tags: []
34
30
  };
35
31
  this.renderTags = this.renderTags.bind(this);
36
32
  this.populateTags = this.populateTags.bind(this);
@@ -43,34 +39,6 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
43
39
 
44
40
  }
45
41
 
46
- componentDidUpdate(prevProps) {
47
- if (this.props.tags !== prevProps.tags || this.props.injectedTags !== prevProps.injectedTags || this.props.selectedOfferDetails !== prevProps.selectedOfferDetails) {
48
- this.setState({
49
- tags: this.generateTags(this.props),
50
- });
51
- }
52
- }
53
-
54
- generateTags(props) {
55
- let tags = {};
56
- let injectedTags = {};
57
- if (props.injectedTags && !_.isEmpty(props.injectedTags)) {
58
- const formattedInjectedTags = handleInjectedData(
59
- props.injectedTags,
60
- scope
61
- );
62
- injectedTags = this.transformInjectedTags(formattedInjectedTags);
63
- }
64
- if (props.tags && props.tags.length > 0) {
65
- tags = this.populateTags(props.tags);
66
- console.log('populating tags', Object.keys(tags || {}).length);
67
- }
68
- if (props.selectedOfferDetails && !_.isEmpty(props.selectedOfferDetails) && (tags && tags.coupon)) {
69
- this.transformCouponTags(props.selectedOfferDetails, tags);
70
- }
71
- return _.merge( {}, tags, injectedTags);
72
- }
73
-
74
42
  componentWillReceiveProps(nextProps) {
75
43
  if (_.isEmpty(this.props.injectedTags) && _.isEmpty(this.props.tags)) {
76
44
  this.setState({loading: true});
@@ -83,7 +51,6 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
83
51
 
84
52
  this.setState({loading: false});
85
53
  }
86
-
87
54
  }
88
55
 
89
56
  onSelect = (selectedKeys) => {
@@ -106,11 +73,11 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
106
73
  //Form tags object with tag headers
107
74
  _.forEach(tagsList, (temp) => {
108
75
  const tag = temp.definition;
109
- const { locale : userLocale } = this.props.intl;
76
+ const { userLocale } = this.props;
110
77
  if (!tag['tag-header']) {
111
78
  mainTags[tag.value] = {
112
- "name": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
113
- "desc": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
79
+ name: tag.label[userLocale] ? tag.label[userLocale] : tag.label.en,
80
+ desc: tag.label[userLocale] ? tag.label[userLocale] : tag.label.en,
114
81
  };
115
82
  } else if (tag['tag-header'] && mainTags[tag.value]) {
116
83
  mainTags[tag.value].subtags = _.concat(mainTags[tag.value].subtags, tag.subtags);
@@ -118,8 +85,8 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
118
85
  //
119
86
  mainTags[tag.value] = {
120
87
  'tag-header': true,
121
- "name": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
122
- "desc": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
88
+ "name": tag.label[userLocale] ? tag.label[userLocale] : tag.label.en,
89
+ "desc": tag.label[userLocale] ? tag.label[userLocale] : tag.label.en,
123
90
  "subtags": tag.subtags,
124
91
  };
125
92
  }
@@ -255,11 +222,26 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
255
222
  }
256
223
 
257
224
  render() {
225
+ let tags = {};
226
+ let injectedTags = {};
227
+ if (this.props.injectedTags && !_.isEmpty(this.props.injectedTags)) {
228
+ injectedTags = this.transformInjectedTags(this.props.injectedTags);
229
+
230
+ }
231
+ if (this.props.tags && this.props.tags.length > 0) {
232
+ tags = this.populateTags(this.props.tags);
233
+ console.log('populating tags', Object.keys(tags || {}).length);
234
+ }
235
+ if (this.props.selectedOfferDetails && !_.isEmpty(this.props.selectedOfferDetails) && (tags && tags.coupon)) {
236
+ this.transformCouponTags(this.props.selectedOfferDetails, tags);
237
+ }
238
+ tags = _.merge( {}, tags, injectedTags);
239
+ console.log('merged tags', Object.keys(tags || {}).length);
258
240
  return (
259
241
  <div className={this.props.className ? this.props.className : ''}>
260
242
  <CapTagList
261
243
  loading={this.state.loading}
262
- tags={this.state.tags}
244
+ tags={tags}
263
245
  onSelect={this.onSelect}
264
246
  label={this.props.label}
265
247
  visibleTaglist={this.props.visibleTaglist}
@@ -309,4 +291,4 @@ function mapDispatchToProps(dispatch) {
309
291
  };
310
292
  }
311
293
 
312
- export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(TagList)));
294
+ export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(TagList));
@@ -4,11 +4,10 @@
4
4
  * This contains all the text for the TagList component.
5
5
  */
6
6
  import { defineMessages } from 'react-intl';
7
- export const scope = `creatives.containersV2.TagList`;
8
7
 
9
8
  export default defineMessages({
10
9
  header: {
11
- id: `${scope}.header`,
10
+ id: 'creatives.containersV2.TagList.header',
12
11
  defaultMessage: 'This is TagList container !',
13
12
  },
14
13
  });
@@ -120064,7 +120064,7 @@ Click {{3}} to unsubscribe'",
120064
120064
  key=".0"
120065
120065
  size="large"
120066
120066
  suffix={
120067
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
120067
+ <Connect(UserIsAuthenticated(Connect(TagList)))
120068
120068
  injectedTags={Object {}}
120069
120069
  location={
120070
120070
  Object {
@@ -120116,7 +120116,7 @@ Click {{3}} to unsubscribe'",
120116
120116
  </div>
120117
120117
  </CapHeading>
120118
120118
  </div>
120119
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
120119
+ <Connect(UserIsAuthenticated(Connect(TagList)))
120120
120120
  injectedTags={Object {}}
120121
120121
  location={
120122
120122
  Object {
@@ -120132,7 +120132,7 @@ Click {{3}} to unsubscribe'",
120132
120132
  onTagSelect={[Function]}
120133
120133
  tags={Array []}
120134
120134
  >
120135
- <UserIsAuthenticated(Connect(InjectIntl(TagList)))
120135
+ <UserIsAuthenticated(Connect(TagList))
120136
120136
  authData={
120137
120137
  Object {
120138
120138
  "app": Object {},
@@ -120174,7 +120174,7 @@ Click {{3}} to unsubscribe'",
120174
120174
  redirect={[Function]}
120175
120175
  tags={Array []}
120176
120176
  />
120177
- </Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
120177
+ </Connect(UserIsAuthenticated(Connect(TagList)))>
120178
120178
  </div>
120179
120179
  </CapHeader__Flex>
120180
120180
  </CapHeader>
@@ -154586,7 +154586,7 @@ Click {{3}} to unsubscribe'",
154586
154586
  key=".0"
154587
154587
  size="large"
154588
154588
  suffix={
154589
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
154589
+ <Connect(UserIsAuthenticated(Connect(TagList)))
154590
154590
  injectedTags={Object {}}
154591
154591
  location={
154592
154592
  Object {
@@ -154638,7 +154638,7 @@ Click {{3}} to unsubscribe'",
154638
154638
  </div>
154639
154639
  </CapHeading>
154640
154640
  </div>
154641
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
154641
+ <Connect(UserIsAuthenticated(Connect(TagList)))
154642
154642
  injectedTags={Object {}}
154643
154643
  location={
154644
154644
  Object {
@@ -154654,7 +154654,7 @@ Click {{3}} to unsubscribe'",
154654
154654
  onTagSelect={[Function]}
154655
154655
  tags={Array []}
154656
154656
  >
154657
- <UserIsAuthenticated(Connect(InjectIntl(TagList)))
154657
+ <UserIsAuthenticated(Connect(TagList))
154658
154658
  authData={
154659
154659
  Object {
154660
154660
  "app": Object {},
@@ -154696,7 +154696,7 @@ Click {{3}} to unsubscribe'",
154696
154696
  redirect={[Function]}
154697
154697
  tags={Array []}
154698
154698
  />
154699
- </Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
154699
+ </Connect(UserIsAuthenticated(Connect(TagList)))>
154700
154700
  </div>
154701
154701
  </CapHeader__Flex>
154702
154702
  </CapHeader>
@@ -171659,7 +171659,7 @@ Click {{unsubscribe}} to unsubscribe",
171659
171659
  key=".0"
171660
171660
  size="large"
171661
171661
  suffix={
171662
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
171662
+ <Connect(UserIsAuthenticated(Connect(TagList)))
171663
171663
  injectedTags={Object {}}
171664
171664
  location={
171665
171665
  Object {
@@ -171711,7 +171711,7 @@ Click {{unsubscribe}} to unsubscribe",
171711
171711
  </div>
171712
171712
  </CapHeading>
171713
171713
  </div>
171714
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
171714
+ <Connect(UserIsAuthenticated(Connect(TagList)))
171715
171715
  injectedTags={Object {}}
171716
171716
  location={
171717
171717
  Object {
@@ -171727,7 +171727,7 @@ Click {{unsubscribe}} to unsubscribe",
171727
171727
  onTagSelect={[Function]}
171728
171728
  tags={Array []}
171729
171729
  >
171730
- <UserIsAuthenticated(Connect(InjectIntl(TagList)))
171730
+ <UserIsAuthenticated(Connect(TagList))
171731
171731
  authData={
171732
171732
  Object {
171733
171733
  "app": Object {},
@@ -171769,7 +171769,7 @@ Click {{unsubscribe}} to unsubscribe",
171769
171769
  redirect={[Function]}
171770
171770
  tags={Array []}
171771
171771
  />
171772
- </Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
171772
+ </Connect(UserIsAuthenticated(Connect(TagList)))>
171773
171773
  </div>
171774
171774
  </CapHeader__Flex>
171775
171775
  </CapHeader>
@@ -183805,7 +183805,7 @@ new message content.",
183805
183805
  key=".0"
183806
183806
  size="large"
183807
183807
  suffix={
183808
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
183808
+ <Connect(UserIsAuthenticated(Connect(TagList)))
183809
183809
  injectedTags={Object {}}
183810
183810
  location={
183811
183811
  Object {
@@ -183857,7 +183857,7 @@ new message content.",
183857
183857
  </div>
183858
183858
  </CapHeading>
183859
183859
  </div>
183860
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
183860
+ <Connect(UserIsAuthenticated(Connect(TagList)))
183861
183861
  injectedTags={Object {}}
183862
183862
  location={
183863
183863
  Object {
@@ -183873,7 +183873,7 @@ new message content.",
183873
183873
  onTagSelect={[Function]}
183874
183874
  tags={Array []}
183875
183875
  >
183876
- <UserIsAuthenticated(Connect(InjectIntl(TagList)))
183876
+ <UserIsAuthenticated(Connect(TagList))
183877
183877
  authData={
183878
183878
  Object {
183879
183879
  "app": Object {},
@@ -183915,7 +183915,7 @@ new message content.",
183915
183915
  redirect={[Function]}
183916
183916
  tags={Array []}
183917
183917
  />
183918
- </Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
183918
+ </Connect(UserIsAuthenticated(Connect(TagList)))>
183919
183919
  </div>
183920
183920
  </CapHeader__Flex>
183921
183921
  </CapHeader>
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { FormattedMessage } from 'react-intl';
3
-
4
- export const apiMessageFormatHandler = (id, fallback) => (
5
- <FormattedMessage id={id} defaultMessage={fallback} />
6
- );
@@ -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,8 +0,0 @@
1
- /*
2
- *
3
- * ChannelTemplates constants
4
- *
5
- */
6
-
7
- export const DEFAULT_ACTION = 'app/ChannelTemplates/DEFAULT_ACTION';
8
-
@@ -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
- };