@capillarytech/creatives-library 8.0.20 → 8.0.21-alpha.0
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/v2Containers/Cap/reducer.js +1 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +0 -3
- package/v2Containers/CreativesContainer/index.js +0 -2
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -5
- package/v2Containers/FTP/index.js +1 -1
- package/v2Containers/Zalo/index.js +1 -2
- 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
package/package.json
CHANGED
|
@@ -126,14 +126,12 @@ function capReducer(state = fromJS(initialState.cap), action) {
|
|
|
126
126
|
tags: action.data && action.entityType === 'TAG' ? action.data.metaEntities : stateMeta.tags,
|
|
127
127
|
tagLookupMap: action?.data && action?.entityType === TAG ? combinedTagMap : stateMeta?.tagLookupMap,
|
|
128
128
|
})
|
|
129
|
-
.set('fetchingSchemaError', false)
|
|
130
|
-
.set('fetchingLiquidTags', false);
|
|
129
|
+
.set('fetchingSchemaError', false);
|
|
131
130
|
}
|
|
132
131
|
case types.CLEAR_META_ENTITIES:
|
|
133
132
|
return state.set('metaEntities', {
|
|
134
133
|
layouts: [],
|
|
135
134
|
tags: [],
|
|
136
|
-
tagLookupMap: [],
|
|
137
135
|
});
|
|
138
136
|
// eslint-disable-next-line no-case-declarations
|
|
139
137
|
case types.HIDE_TAGS:
|
|
@@ -155,7 +155,6 @@ export function SlideBoxContent(props) {
|
|
|
155
155
|
moduleType,
|
|
156
156
|
showLiquidErrorInFooter,
|
|
157
157
|
creativesMode,
|
|
158
|
-
hostName = '',
|
|
159
158
|
} = props;
|
|
160
159
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
161
160
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -544,7 +543,6 @@ export function SlideBoxContent(props) {
|
|
|
544
543
|
query,
|
|
545
544
|
search: '',
|
|
546
545
|
}}
|
|
547
|
-
hostName={hostName}
|
|
548
546
|
/>
|
|
549
547
|
}
|
|
550
548
|
{
|
|
@@ -926,6 +924,5 @@ SlideBoxContent.propTypes = {
|
|
|
926
924
|
moduleType: PropTypes.string,
|
|
927
925
|
showLiquidErrorInFooter: PropTypes.bool,
|
|
928
926
|
creativesMode: PropTypes.string,
|
|
929
|
-
hostName: PropTypes.string,
|
|
930
927
|
};
|
|
931
928
|
export default SlideBoxContent;
|
|
@@ -1319,7 +1319,6 @@ export class Creatives extends React.Component {
|
|
|
1319
1319
|
moduleType={this.props.messageDetails?.type}
|
|
1320
1320
|
showLiquidErrorInFooter={this.showLiquidErrorInFooter}
|
|
1321
1321
|
creativesMode={creativesMode} // An existing prop that we're using here. Required to ensure correct account details in Edit or Preview in case of Embedded mode.
|
|
1322
|
-
hostName={this.props?.hostName || ''}
|
|
1323
1322
|
/>
|
|
1324
1323
|
}
|
|
1325
1324
|
footer={this.shouldShowFooter() &&
|
|
@@ -1378,7 +1377,6 @@ Creatives.propTypes = {
|
|
|
1378
1377
|
selectedAccount: PropTypes.object,
|
|
1379
1378
|
strategy: PropTypes.string,
|
|
1380
1379
|
orgUnitId: PropTypes.number,
|
|
1381
|
-
hostName: PropTypes.string,
|
|
1382
1380
|
};
|
|
1383
1381
|
const mapStatesToProps = () => createStructuredSelector({
|
|
1384
1382
|
isLoading: isLoadingSelector(),
|
|
@@ -14,7 +14,6 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
14
14
|
currentChannel="RCS"
|
|
15
15
|
getFormData={[Function]}
|
|
16
16
|
handleClose={[Function]}
|
|
17
|
-
hostName=""
|
|
18
17
|
onCallTaskSubmit={[Function]}
|
|
19
18
|
onChannelChange={[Function]}
|
|
20
19
|
onCreateComplete={[MockFunction]}
|
|
@@ -91,7 +90,6 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
91
90
|
currentChannel="WHATSAPP"
|
|
92
91
|
getFormData={[Function]}
|
|
93
92
|
handleClose={[Function]}
|
|
94
|
-
hostName=""
|
|
95
93
|
onCallTaskSubmit={[Function]}
|
|
96
94
|
onChannelChange={[Function]}
|
|
97
95
|
onCreateComplete={[MockFunction]}
|
|
@@ -168,7 +166,6 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
168
166
|
currentChannel="WHATSAPP"
|
|
169
167
|
getFormData={[Function]}
|
|
170
168
|
handleClose={[Function]}
|
|
171
|
-
hostName=""
|
|
172
169
|
onCallTaskSubmit={[Function]}
|
|
173
170
|
onChannelChange={[Function]}
|
|
174
171
|
onCreateComplete={[MockFunction]}
|
|
@@ -249,7 +246,6 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
249
246
|
currentChannel="WHATSAPP"
|
|
250
247
|
getFormData={[Function]}
|
|
251
248
|
handleClose={[Function]}
|
|
252
|
-
hostName=""
|
|
253
249
|
onCallTaskSubmit={[Function]}
|
|
254
250
|
onChannelChange={[Function]}
|
|
255
251
|
onCreateComplete={[MockFunction]}
|
|
@@ -330,7 +326,6 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
330
326
|
currentChannel="WHATSAPP"
|
|
331
327
|
getFormData={[Function]}
|
|
332
328
|
handleClose={[Function]}
|
|
333
|
-
hostName=""
|
|
334
329
|
onCallTaskSubmit={[Function]}
|
|
335
330
|
onChannelChange={[Function]}
|
|
336
331
|
onCreateComplete={[MockFunction]}
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
CapTooltip,
|
|
23
23
|
} from '@capillarytech/cap-ui-library';
|
|
24
24
|
import { FONT_SIZE_L } from '@capillarytech/cap-ui-library/styled/variables';
|
|
25
|
-
import { find, cloneDeep, findIndex, isEmpty, isEqual, filter, flattenDeep, replace } from 'lodash';
|
|
25
|
+
import _, { find, cloneDeep, findIndex, isEmpty, isEqual, filter, flattenDeep, replace } from 'lodash';
|
|
26
26
|
import * as actions from './actions';
|
|
27
27
|
import { makeSelectFTP, makeSelectMetaEntities } from './selectors';
|
|
28
28
|
import { makeSelectLoyaltyPromotionDisplay, setInjectedTags } from '../Cap/selectors';
|
|
@@ -69,9 +69,8 @@ export const Zalo = (props) => {
|
|
|
69
69
|
injectedTags,
|
|
70
70
|
getFormData,
|
|
71
71
|
selectedOfferDetails,
|
|
72
|
-
hostName: zaloHostName = '',
|
|
73
72
|
} = props || {};
|
|
74
|
-
const {hostName =
|
|
73
|
+
const {hostName = ''} = senderDetails;
|
|
75
74
|
const { formatMessage } = intl;
|
|
76
75
|
const [oa_id, setOaId] = useState('');
|
|
77
76
|
const [token, setToken] = useState('');
|
|
@@ -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
|
-
}
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test async injectors
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { memoryHistory } from 'react-router';
|
|
6
|
-
import { put } from 'redux-saga/effects';
|
|
7
|
-
import { fromJS } from 'immutable';
|
|
8
|
-
|
|
9
|
-
import configureStore from 'store';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
injectAsyncReducer,
|
|
13
|
-
injectAsyncSagas,
|
|
14
|
-
getAsyncInjectors,
|
|
15
|
-
} from '../asyncInjectors';
|
|
16
|
-
|
|
17
|
-
// Fixtures
|
|
18
|
-
|
|
19
|
-
const initialState = fromJS({ reduced: 'soon' });
|
|
20
|
-
|
|
21
|
-
const reducer = (state = initialState, action) => {
|
|
22
|
-
switch (action.type) {
|
|
23
|
-
case 'TEST':
|
|
24
|
-
return state.set('reduced', action.payload);
|
|
25
|
-
default:
|
|
26
|
-
return state;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
function* testSaga() {
|
|
31
|
-
yield put({ type: 'TEST', payload: 'yup' });
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const sagas = [
|
|
35
|
-
testSaga,
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
describe('asyncInjectors', () => {
|
|
39
|
-
let store;
|
|
40
|
-
|
|
41
|
-
describe('getAsyncInjectors', () => {
|
|
42
|
-
beforeAll(() => {
|
|
43
|
-
store = configureStore({}, memoryHistory);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('given a store, should return all async injectors', () => {
|
|
47
|
-
const { injectReducer, injectSagas } = getAsyncInjectors(store);
|
|
48
|
-
|
|
49
|
-
injectReducer('test', reducer);
|
|
50
|
-
injectSagas(sagas);
|
|
51
|
-
|
|
52
|
-
const actual = store.getState().get('test');
|
|
53
|
-
const expected = initialState.merge({ reduced: 'yup' });
|
|
54
|
-
|
|
55
|
-
expect(actual.toJS()).toEqual(expected.toJS());
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('should throw if passed invalid store shape', () => {
|
|
59
|
-
let result = false;
|
|
60
|
-
|
|
61
|
-
Reflect.deleteProperty(store, 'dispatch');
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
getAsyncInjectors(store);
|
|
65
|
-
} catch (err) {
|
|
66
|
-
result = err.name === 'Invariant Violation';
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
expect(result).toEqual(true);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
describe('helpers', () => {
|
|
74
|
-
beforeAll(() => {
|
|
75
|
-
store = configureStore({}, memoryHistory);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe('injectAsyncReducer', () => {
|
|
79
|
-
it('given a store, it should provide a function to inject a reducer', () => {
|
|
80
|
-
const injectReducer = injectAsyncReducer(store);
|
|
81
|
-
|
|
82
|
-
injectReducer('test', reducer);
|
|
83
|
-
|
|
84
|
-
const actual = store.getState().get('test');
|
|
85
|
-
const expected = initialState;
|
|
86
|
-
|
|
87
|
-
expect(actual.toJS()).toEqual(expected.toJS());
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('should not assign reducer if already existing', () => {
|
|
91
|
-
const injectReducer = injectAsyncReducer(store);
|
|
92
|
-
|
|
93
|
-
injectReducer('test', reducer);
|
|
94
|
-
injectReducer('test', () => {});
|
|
95
|
-
|
|
96
|
-
expect(store.asyncReducers.test.toString()).toEqual(reducer.toString());
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('should throw if passed invalid name', () => {
|
|
100
|
-
let result = false;
|
|
101
|
-
|
|
102
|
-
const injectReducer = injectAsyncReducer(store);
|
|
103
|
-
|
|
104
|
-
try {
|
|
105
|
-
injectReducer('', reducer);
|
|
106
|
-
} catch (err) {
|
|
107
|
-
result = err.name === 'Invariant Violation';
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
try {
|
|
111
|
-
injectReducer(999, reducer);
|
|
112
|
-
} catch (err) {
|
|
113
|
-
result = err.name === 'Invariant Violation';
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
expect(result).toEqual(true);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it('should throw if passed invalid reducer', () => {
|
|
120
|
-
let result = false;
|
|
121
|
-
|
|
122
|
-
const injectReducer = injectAsyncReducer(store);
|
|
123
|
-
|
|
124
|
-
try {
|
|
125
|
-
injectReducer('bad', 'nope');
|
|
126
|
-
} catch (err) {
|
|
127
|
-
result = err.name === 'Invariant Violation';
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
try {
|
|
131
|
-
injectReducer('coolio', 12345);
|
|
132
|
-
} catch (err) {
|
|
133
|
-
result = err.name === 'Invariant Violation';
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
expect(result).toEqual(true);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
describe('injectAsyncSagas', () => {
|
|
141
|
-
it('given a store, it should provide a function to inject a saga', () => {
|
|
142
|
-
const injectSagas = injectAsyncSagas(store);
|
|
143
|
-
|
|
144
|
-
injectSagas(sagas);
|
|
145
|
-
|
|
146
|
-
const actual = store.getState().get('test');
|
|
147
|
-
const expected = initialState.merge({ reduced: 'yup' });
|
|
148
|
-
|
|
149
|
-
expect(actual.toJS()).toEqual(expected.toJS());
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('should throw if passed invalid saga', () => {
|
|
153
|
-
let result = false;
|
|
154
|
-
|
|
155
|
-
const injectSagas = injectAsyncSagas(store);
|
|
156
|
-
|
|
157
|
-
try {
|
|
158
|
-
injectSagas({ testSaga });
|
|
159
|
-
} catch (err) {
|
|
160
|
-
result = err.name === 'Invariant Violation';
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
try {
|
|
164
|
-
injectSagas(testSaga);
|
|
165
|
-
} catch (err) {
|
|
166
|
-
result = err.name === 'Invariant Violation';
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
expect(result).toEqual(true);
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import React from "react";
|
|
3
|
-
import SmsTest from '../../v2Components/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.containersV2.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 v2Containers/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.containersV2.Testv2.header',
|
|
11
|
-
defaultMessage: 'This is Testv2 container !',
|
|
12
|
-
},
|
|
13
|
-
testv2: {
|
|
14
|
-
id: 'creatives.containersV2.Testv2.testv2',
|
|
15
|
-
defaultMessage: 'Testv2',
|
|
16
|
-
},
|
|
17
|
-
descriptionTestv2: {
|
|
18
|
-
id: 'creatives.containersV2.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 v2Containers/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
|
-
};
|