@capillarytech/creatives-library 8.0.24 → 8.0.25
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/utils/tagValidations.js +11 -3
- package/utils/tests/tagValidations.test.js +14 -3
- package/v2Components/FormBuilder/index.js +13 -1
- package/v2Containers/BeeEditor/index.js +3 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +47 -26
- package/v2Containers/CreativesContainer/index.js +3 -0
- package/v2Containers/Email/index.js +1 -0
- package/v2Containers/EmailWrapper/index.js +3 -0
- package/v2Containers/MobilePush/Create/index.js +2 -0
- package/v2Containers/MobilePush/Edit/index.js +2 -0
- package/v2Containers/MobilepushWrapper/index.js +3 -1
- package/v2Containers/Sms/Create/index.js +2 -0
- package/v2Containers/Sms/Edit/index.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +3 -0
- package/v2Containers/SmsWrapper/index.js +2 -0
- package/v2Containers/TagList/index.js +27 -2
- package/v2Containers/TagList/messages.js +4 -0
- package/v2Containers/TagList/tests/TagList.test.js +19 -8
- package/v2Containers/TagList/tests/mockdata.js +59 -1
- package/v2Containers/Viber/index.js +2 -0
- package/v2Containers/Whatsapp/index.js +4 -1
- package/v2Containers/Zalo/index.js +3 -0
- package/containers/TestPage/constants.js +0 -7
- package/containers/TestPage/index.js +0 -31
- package/containers/TestPage/messages.js +0 -13
- package/containers/TestPage/reducer.js +0 -21
- package/containers/TestPage/sagas.js +0 -11
- package/containers/Testv2/actions.js +0 -15
- package/containers/Testv2/constants.js +0 -7
- package/containers/Testv2/index.js +0 -47
- package/containers/Testv2/messages.js +0 -21
- package/containers/Testv2/reducer.js +0 -23
- package/containers/Testv2/sagas.js +0 -11
- package/containers/Testv2/selectors.js +0 -25
- package/reducers.js +0 -77
- package/store.js +0 -61
- package/utils/tests/asyncInjectors.test.js +0 -173
- package/v2Containers/TestPage/constants.js +0 -7
- package/v2Containers/TestPage/index.js +0 -31
- package/v2Containers/TestPage/messages.js +0 -13
- package/v2Containers/TestPage/reducer.js +0 -21
- package/v2Containers/TestPage/sagas.js +0 -11
- package/v2Containers/Testv2/actions.js +0 -15
- package/v2Containers/Testv2/constants.js +0 -7
- package/v2Containers/Testv2/index.js +0 -47
- package/v2Containers/Testv2/messages.js +0 -21
- package/v2Containers/Testv2/reducer.js +0 -23
- package/v2Containers/Testv2/sagas.js +0 -11
- package/v2Containers/Testv2/selectors.js +0 -25
|
@@ -6,9 +6,10 @@ import { initialReducer } from '../../../initialReducer';
|
|
|
6
6
|
import { injectIntl } from "react-intl";
|
|
7
7
|
import { fireEvent } from "@testing-library/react";
|
|
8
8
|
import { TagList } from '../index';
|
|
9
|
-
import { TagListData } from './mockdata';
|
|
9
|
+
import { TagListData, eventContextTags } from './mockdata';
|
|
10
10
|
import { Provider } from 'react-redux';
|
|
11
11
|
import { screen, render } from '../../../utils/test-utils';
|
|
12
|
+
const { getByText } = screen;
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
const initializeTagList = (props) => {
|
|
@@ -29,16 +30,26 @@ const initializeTagList = (props) => {
|
|
|
29
30
|
);
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
const addLabelBtnAssertion = () => {
|
|
34
|
+
const addLabelButton = screen.getByRole('button', {
|
|
35
|
+
name: /add label/i
|
|
36
|
+
});
|
|
37
|
+
expect(addLabelButton).toBeInTheDocument();
|
|
38
|
+
fireEvent.click(addLabelButton);
|
|
39
|
+
};
|
|
32
40
|
|
|
33
41
|
describe("TagList test : UNIT", () => {
|
|
34
42
|
it("should render the TagList component with default props amd addLabel Button", async () => {
|
|
35
43
|
initializeTagList();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
addLabelBtnAssertion();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should render event context tags correctly from generateTags', () => {
|
|
48
|
+
initializeTagList({eventContextTags});
|
|
49
|
+
addLabelBtnAssertion();
|
|
50
|
+
const EVENT_CONTEXT_TAG_HEADER = getByText('Tags based on entry trigger event');
|
|
51
|
+
expect(EVENT_CONTEXT_TAG_HEADER).toBeInTheDocument();
|
|
52
|
+
fireEvent.click(EVENT_CONTEXT_TAG_HEADER);
|
|
53
|
+
expect(getByText('lifetimePurchases')).toBeInTheDocument();
|
|
43
54
|
});
|
|
44
55
|
});
|
|
@@ -105,4 +105,62 @@ export const TagListData = {
|
|
|
105
105
|
"actions": {},
|
|
106
106
|
"globalActions": {},
|
|
107
107
|
"isNewVersionFlow": false,
|
|
108
|
-
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const eventContextTags = [
|
|
111
|
+
{
|
|
112
|
+
"profileId": "BEHAVIOURAL_EVENT_PROFILE",
|
|
113
|
+
"method": "getEventData",
|
|
114
|
+
"field": "butterfly",
|
|
115
|
+
"params": null,
|
|
116
|
+
"returnType": {
|
|
117
|
+
"isList": false,
|
|
118
|
+
"typeInfo": {
|
|
119
|
+
"type": "DOUBLE",
|
|
120
|
+
"typeId": null
|
|
121
|
+
},
|
|
122
|
+
"list": false
|
|
123
|
+
},
|
|
124
|
+
"factId": "getEventData_butterfly",
|
|
125
|
+
"tagName": "(butterfly)",
|
|
126
|
+
"isTaggable": true,
|
|
127
|
+
"uniqueId": "yW_DH7vjKk__BEHAVIOURAL__monsoon",
|
|
128
|
+
"isDynamicFact": true
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"profileId": "BEHAVIOURAL_EVENT_PROFILE",
|
|
132
|
+
"method": "getEventData",
|
|
133
|
+
"field": "raindrops",
|
|
134
|
+
"params": null,
|
|
135
|
+
"returnType": {
|
|
136
|
+
"isList": false,
|
|
137
|
+
"typeInfo": {
|
|
138
|
+
"type": "DOUBLE",
|
|
139
|
+
"typeId": null
|
|
140
|
+
},
|
|
141
|
+
"list": false
|
|
142
|
+
},
|
|
143
|
+
"factId": "getEventData_raindrops",
|
|
144
|
+
"tagName": "",
|
|
145
|
+
"isTaggable": true,
|
|
146
|
+
"uniqueId": "yW_DH7vjKk__BEHAVIOURAL__monsoon",
|
|
147
|
+
"isDynamicFact": true
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"factId": "5LFP9e",
|
|
151
|
+
"profileId": "CUSTOMER_PROFILE",
|
|
152
|
+
"params": [],
|
|
153
|
+
"returnType": {
|
|
154
|
+
"isList": false,
|
|
155
|
+
"typeInfo": {
|
|
156
|
+
"type": "DOUBLE",
|
|
157
|
+
"typeId": null
|
|
158
|
+
},
|
|
159
|
+
"list": false
|
|
160
|
+
},
|
|
161
|
+
"tagName": "lifetimePurchases",
|
|
162
|
+
"isTaggable": true,
|
|
163
|
+
"uniqueId": "yW_DH7vjKk__BEHAVIOURAL__monsoon",
|
|
164
|
+
"isDynamicFact": false
|
|
165
|
+
}
|
|
166
|
+
];
|
|
@@ -75,6 +75,7 @@ export const Viber = (props) => {
|
|
|
75
75
|
viberData = {},
|
|
76
76
|
selectedOfferDetails = [],
|
|
77
77
|
currentOrgDetails,
|
|
78
|
+
eventContextTags,
|
|
78
79
|
} = props || {};
|
|
79
80
|
|
|
80
81
|
const { formatMessage } = intl;
|
|
@@ -274,6 +275,7 @@ export const Viber = (props) => {
|
|
|
274
275
|
id={"viber_tags"}
|
|
275
276
|
userLocale={localStorage.getItem("jlocale") || "en"}
|
|
276
277
|
selectedOfferDetails={selectedOfferDetails}
|
|
278
|
+
eventContextTags={eventContextTags}
|
|
277
279
|
/>
|
|
278
280
|
</CapColumn>
|
|
279
281
|
<div className="viber-textarea-wrapper">
|
|
@@ -133,7 +133,8 @@ export const Whatsapp = (props) => {
|
|
|
133
133
|
loadingTags,
|
|
134
134
|
getFormData,
|
|
135
135
|
selectedOfferDetails,
|
|
136
|
-
currentOrgDetails
|
|
136
|
+
currentOrgDetails,
|
|
137
|
+
eventContextTags,
|
|
137
138
|
} = props || {};
|
|
138
139
|
const { formatMessage } = intl;
|
|
139
140
|
const { TextArea } = CapInput;
|
|
@@ -506,6 +507,7 @@ export const Whatsapp = (props) => {
|
|
|
506
507
|
injectedTagsParams: injectedTags,
|
|
507
508
|
location,
|
|
508
509
|
tagModule: getDefaultTags,
|
|
510
|
+
eventContextTags,
|
|
509
511
|
}) || {};
|
|
510
512
|
const unsupportedTagsLengthCheck =
|
|
511
513
|
validationResponse?.unsupportedTags?.length > 0;
|
|
@@ -2056,6 +2058,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2056
2058
|
onContextChange={handleOnTagsContextChange}
|
|
2057
2059
|
injectedTags={injectedTags || {}}
|
|
2058
2060
|
selectedOfferDetails={selectedOfferDetails}
|
|
2061
|
+
eventContextTags={eventContextTags}
|
|
2059
2062
|
/>
|
|
2060
2063
|
)
|
|
2061
2064
|
}
|
|
@@ -70,6 +70,7 @@ export const Zalo = (props) => {
|
|
|
70
70
|
getFormData,
|
|
71
71
|
selectedOfferDetails,
|
|
72
72
|
hostName: zaloHostName = '',
|
|
73
|
+
eventContextTags,
|
|
73
74
|
} = props || {};
|
|
74
75
|
const {hostName = zaloHostName || ''} = senderDetails;
|
|
75
76
|
const { formatMessage } = intl;
|
|
@@ -260,6 +261,7 @@ export const Zalo = (props) => {
|
|
|
260
261
|
injectedTagsParams: injectedTags,
|
|
261
262
|
location,
|
|
262
263
|
tagModule: getDefaultTags,
|
|
264
|
+
eventContextTags,
|
|
263
265
|
}) || {};
|
|
264
266
|
const { unsupportedTags = [], isBraceError } = tagValidationResponse;
|
|
265
267
|
let tagError = '';
|
|
@@ -449,6 +451,7 @@ export const Zalo = (props) => {
|
|
|
449
451
|
injectedTags={injectedTags || {}}
|
|
450
452
|
selectedOfferDetails={selectedOfferDetails}
|
|
451
453
|
disabled={isFullMode}
|
|
454
|
+
eventContextTags={eventContextTags}
|
|
452
455
|
/>
|
|
453
456
|
}
|
|
454
457
|
/>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import React from "react";
|
|
3
|
-
import SmsTest from '../../components/SmsTest';
|
|
4
|
-
|
|
5
|
-
export default class TestPage extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
|
|
6
|
-
render() {
|
|
7
|
-
return (
|
|
8
|
-
<SmsTest />
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// const schema = {
|
|
14
|
-
// title: "Todo",
|
|
15
|
-
// type: "object",
|
|
16
|
-
// required: ["title"],
|
|
17
|
-
// properties: {
|
|
18
|
-
// title: {type: "string", title: "Title", default: "A new task"},
|
|
19
|
-
// done: {type: "boolean", title: "Done?", default: false},
|
|
20
|
-
// },
|
|
21
|
-
// };
|
|
22
|
-
|
|
23
|
-
// const log = (type) => console.log.bind(console, type);
|
|
24
|
-
|
|
25
|
-
// render((
|
|
26
|
-
// <div>
|
|
27
|
-
// <SmsTest
|
|
28
|
-
// />
|
|
29
|
-
// </div>
|
|
30
|
-
// ), document.getElementById("app"));
|
|
31
|
-
//export default TestPage;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* NotFoundPage Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the NotFoundPage component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'creatives.components.TestPage.header',
|
|
11
|
-
defaultMessage: 'Looks like youas are lost!',
|
|
12
|
-
},
|
|
13
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Dashboard reducer
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { fromJS } from 'immutable';
|
|
8
|
-
import { DEFAULT_ACTION } from './constants';
|
|
9
|
-
|
|
10
|
-
const initialState = fromJS({});
|
|
11
|
-
|
|
12
|
-
function TestPageReducer(state = initialState, action) {
|
|
13
|
-
switch (action.type) {
|
|
14
|
-
case DEFAULT_ACTION:
|
|
15
|
-
return state;
|
|
16
|
-
default:
|
|
17
|
-
return state;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default TestPageReducer;
|
|
@@ -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,47 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Testv2
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { connect } from 'react-redux';
|
|
11
|
-
import Helmet from 'react-helmet';
|
|
12
|
-
import { FormattedMessage } from 'react-intl';
|
|
13
|
-
import { createStructuredSelector } from 'reselect';
|
|
14
|
-
import makeSelectTestv2 from './selectors';
|
|
15
|
-
import messages from './messages';
|
|
16
|
-
|
|
17
|
-
export class Testv2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
18
|
-
render() {
|
|
19
|
-
return (
|
|
20
|
-
<div>
|
|
21
|
-
<Helmet
|
|
22
|
-
title={<FormattedMessage {...messages.testv2} />}
|
|
23
|
-
meta={[
|
|
24
|
-
{ name: 'description', content: <FormattedMessage {...messages.descriptionTestv2} /> },
|
|
25
|
-
]}
|
|
26
|
-
/>
|
|
27
|
-
<FormattedMessage {...messages.header} />
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
Testv2.propTypes = {
|
|
34
|
-
dispatch: PropTypes.func.isRequired,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const mapStateToProps = createStructuredSelector({
|
|
38
|
-
Testv2: makeSelectTestv2(),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
function mapDispatchToProps(dispatch) {
|
|
42
|
-
return {
|
|
43
|
-
dispatch,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default connect(mapStateToProps, mapDispatchToProps)(Testv2);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Testv2 Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the Testv2 component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'creatives.containers.Testv2.header',
|
|
11
|
-
defaultMessage: 'This is Testv2 container !',
|
|
12
|
-
},
|
|
13
|
-
testv2: {
|
|
14
|
-
id: 'creatives.containers.Testv2.testv2',
|
|
15
|
-
defaultMessage: 'Testv2',
|
|
16
|
-
},
|
|
17
|
-
descriptionTestv2: {
|
|
18
|
-
id: 'creatives.containers.Testv2.descriptionTestv2',
|
|
19
|
-
defaultMessage: 'Description of Testv2',
|
|
20
|
-
},
|
|
21
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Testv2 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 testv2Reducer(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 testv2Reducer;
|
|
@@ -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 testv2 state domain
|
|
5
|
-
*/
|
|
6
|
-
const selectTestv2Domain = () => (state) => state.get('testv2');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Other specific selectors
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Default selector used by Testv2
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const makeSelectTestv2 = () => createSelector(
|
|
18
|
-
selectTestv2Domain(),
|
|
19
|
-
(substate) => substate.toJS()
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export default makeSelectTestv2;
|
|
23
|
-
export {
|
|
24
|
-
selectTestv2Domain,
|
|
25
|
-
};
|
package/reducers.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Combine all reducers in this file and export the combined reducers.
|
|
3
|
-
* If we were to do this in store.js, reducers wouldn't be hot reloadable.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { combineReducers } from 'redux-immutable';
|
|
7
|
-
import { fromJS } from 'immutable';
|
|
8
|
-
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
9
|
-
|
|
10
|
-
import languageProviderReducer from 'v2Containers/LanguageProvider/reducer';
|
|
11
|
-
import beeEditorReducer from 'v2Containers/BeeEditor/reducer';
|
|
12
|
-
import CapFacebookPreviewReducer from 'v2Containers/CapFacebookPreview/reducer';
|
|
13
|
-
|
|
14
|
-
import capReducer from 'containers/Cap/reducer';
|
|
15
|
-
import appReducer from 'containers/App/reducer';
|
|
16
|
-
import createSmsReducer from 'containers/Sms/Create/reducer';
|
|
17
|
-
import editSmsReducer from 'containers/Sms/Edit/reducer';
|
|
18
|
-
import templateReducer from 'containers/Templates/reducer';
|
|
19
|
-
import tagsReducer from 'containers/TagList/reducer';
|
|
20
|
-
import emailReducer from 'containers/Email/reducer';
|
|
21
|
-
import ebillReducer from 'containers/Ebill/reducer';
|
|
22
|
-
import ftpReducer from 'v2Containers/FTP/reducer';
|
|
23
|
-
import galleryReducer from './v2Containers/Assets/Gallery/reducer';
|
|
24
|
-
import { AIRA_REDUCER_DOMAIN, askAiraReducer } from '@capillarytech/cap-ui-library/CapAskAira';
|
|
25
|
-
import CapCollapsibleLeftNavigationReducer from '@capillarytech/cap-ui-library/CapCollapsibleLeftNavigation/reducer';
|
|
26
|
-
/*
|
|
27
|
-
* routeReducer
|
|
28
|
-
*
|
|
29
|
-
* The reducer merges route location changes into our immutable state.
|
|
30
|
-
* The change is necessitated by moving to react-router-redux@4
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
// Initial routing state
|
|
35
|
-
const routeInitialState = fromJS({
|
|
36
|
-
locationBeforeTransitions: null,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Merge route into the global application state
|
|
41
|
-
*/
|
|
42
|
-
function routeReducer(state = routeInitialState, action) {
|
|
43
|
-
switch (action.type) {
|
|
44
|
-
/* istanbul ignore next */
|
|
45
|
-
case LOCATION_CHANGE:
|
|
46
|
-
return state.merge({
|
|
47
|
-
locationBeforeTransitions: action.payload,
|
|
48
|
-
});
|
|
49
|
-
default:
|
|
50
|
-
return state;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Creates the main reducer with the asynchronously loaded ones
|
|
56
|
-
*/
|
|
57
|
-
export default function createReducer(asyncReducers) {
|
|
58
|
-
return combineReducers({
|
|
59
|
-
route: routeReducer,
|
|
60
|
-
language: languageProviderReducer,
|
|
61
|
-
cap: capReducer,
|
|
62
|
-
app: appReducer,
|
|
63
|
-
create: createSmsReducer,
|
|
64
|
-
edit: editSmsReducer,
|
|
65
|
-
templates: templateReducer,
|
|
66
|
-
tagList: tagsReducer,
|
|
67
|
-
email: emailReducer,
|
|
68
|
-
ebill: ebillReducer,
|
|
69
|
-
beeEditor: beeEditorReducer,
|
|
70
|
-
facebookPreview: CapFacebookPreviewReducer,
|
|
71
|
-
FTP: ftpReducer,
|
|
72
|
-
gallery: galleryReducer,
|
|
73
|
-
navigationConfig: CapCollapsibleLeftNavigationReducer,
|
|
74
|
-
[AIRA_REDUCER_DOMAIN]: askAiraReducer,
|
|
75
|
-
...asyncReducers,
|
|
76
|
-
});
|
|
77
|
-
}
|
package/store.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create the store with asynchronously loaded reducers
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { createStore, applyMiddleware, compose } from 'redux';
|
|
6
|
-
import { fromJS } from 'immutable';
|
|
7
|
-
import { routerMiddleware } from 'react-router-redux';
|
|
8
|
-
import createSagaMiddleware from 'redux-saga';
|
|
9
|
-
// import { createMiddleware } from 'redux-beacon';
|
|
10
|
-
// import { logger } from 'redux-beacon/extensions/logger';
|
|
11
|
-
// import { GoogleTagManager } from 'redux-beacon/targets/google-tag-manager';
|
|
12
|
-
import createReducer from './reducers';
|
|
13
|
-
// import eventsMap from './gtm/eventDefinitionsMap';
|
|
14
|
-
|
|
15
|
-
const sagaMiddleware = createSagaMiddleware();
|
|
16
|
-
// const gtmMiddleware = createMiddleware(eventsMap, GoogleTagManager());
|
|
17
|
-
|
|
18
|
-
export default function configureStore(initialState = {}, history) {
|
|
19
|
-
const middlewares = [
|
|
20
|
-
sagaMiddleware,
|
|
21
|
-
routerMiddleware(history),
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
const enhancers = [
|
|
25
|
-
applyMiddleware(...middlewares),
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
// If Redux DevTools Extension is installed use it, otherwise use Redux compose
|
|
29
|
-
/* eslint-disable no-underscore-dangle */
|
|
30
|
-
const composeEnhancers =
|
|
31
|
-
process.env.NODE_ENV !== 'production' &&
|
|
32
|
-
typeof window === 'object' &&
|
|
33
|
-
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
|
|
34
|
-
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : compose;
|
|
35
|
-
/* eslint-enable */
|
|
36
|
-
|
|
37
|
-
const store = createStore(
|
|
38
|
-
createReducer(),
|
|
39
|
-
fromJS(initialState),
|
|
40
|
-
composeEnhancers(...enhancers)
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
// Extensions
|
|
44
|
-
store.runSaga = sagaMiddleware.run;
|
|
45
|
-
store.asyncReducers = {}; // Async reducer registry
|
|
46
|
-
|
|
47
|
-
// Make reducers hot reloadable, see http://mxs.is/googmo
|
|
48
|
-
/* istanbul ignore next */
|
|
49
|
-
if (module.hot) {
|
|
50
|
-
module.hot.accept('./reducers', () => {
|
|
51
|
-
import('./reducers').then((reducerModule) => {
|
|
52
|
-
const createReducers = reducerModule.default;
|
|
53
|
-
const nextReducers = createReducers(store.asyncReducers);
|
|
54
|
-
|
|
55
|
-
store.replaceReducer(nextReducers);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return store;
|
|
61
|
-
}
|