@capillarytech/creatives-library 8.0.136-alpha.4 → 8.0.136-beta.3
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/BreadCrumbs/index.js +65 -0
- package/components/BreadCrumbs/messages.js +13 -0
- package/components/CapTagList/index.js +235 -0
- package/components/CapTagList/messages.js +45 -0
- package/components/Card/_customCard.scss +40 -0
- package/components/Card/index.js +78 -0
- package/components/Card/tests/__snapshots__/index.test.js.snap +22 -0
- package/components/Card/tests/index.test.js +20 -0
- package/components/CardGrid/index.js +71 -0
- package/components/Ckeditor/index.js +238 -0
- package/components/Ckeditor/messages.js +13 -0
- package/components/Ckeditor/style.scss +3 -0
- package/components/Component/index.js +29 -0
- package/components/CustomPopOver/index.js +81 -0
- package/components/CustomPopOver/messages.js +17 -0
- package/components/DateFilter/index.js +349 -0
- package/components/DateFilter/messages.js +57 -0
- package/components/DateRange/index.js +114 -0
- package/components/DateRange/messages.js +25 -0
- package/components/Edmeditor/index.js +65 -0
- package/components/Edmeditor/messages.js +13 -0
- package/components/EmailPreview/_emailPreview.scss +119 -0
- package/components/EmailPreview/assets/images/iPad.svg +10 -0
- package/components/EmailPreview/assets/images/mobile.png +0 -0
- package/components/EmailPreview/index.js +107 -0
- package/components/EmailPreview/messages.js +33 -0
- package/components/Footer/index.js +27 -0
- package/components/Footer/messages.js +13 -0
- package/components/FormBuilder/_formBuilder.scss +83 -0
- package/components/FormBuilder/index.js +3279 -0
- package/components/FormBuilder/messages.js +61 -0
- package/components/Header/index.js +44 -0
- package/components/Header/messages.js +29 -0
- package/components/ImagePreview/_imagePreview.scss +63 -0
- package/components/ImagePreview/index.js +52 -0
- package/components/ImagePreview/messages.js +17 -0
- package/components/PageHeader/_pageHeader.scss +22 -0
- package/components/PageHeader/index.js +37 -0
- package/components/PageHeader/messages.js +13 -0
- package/components/Pagination/_pagination.scss +5 -0
- package/components/Pagination/index.js +49 -0
- package/components/PreviewSideBar/_previewsidebar.scss +28 -0
- package/components/PreviewSideBar/index.js +152 -0
- package/components/PreviewSideBar/messages.js +41 -0
- package/components/Sidebar/_sidebar.scss +115 -0
- package/components/Sidebar/index.js +214 -0
- package/components/Sidebar/messages.js +21 -0
- package/components/SlideBox/_slideBox.scss +63 -0
- package/components/SlideBox/index.js +47 -0
- package/components/SlideBox/tests/index.test.js +103 -0
- package/components/SmsEditor/index.js +55 -0
- package/components/SmsTest/index.js +117 -0
- package/components/SmsTest/messages.js +21 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +141 -0
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
- package/components/TemplatePreview/_templatePreview.scss +642 -0
- package/components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
- package/components/TemplatePreview/assets/images/androidPushMessage.svg +45 -0
- package/components/TemplatePreview/assets/images/home-screen-android.svg +21 -0
- package/components/TemplatePreview/assets/images/home-screen-ios.svg +16 -0
- package/components/TemplatePreview/assets/images/iPhonePushMessage.svg +135 -0
- package/components/TemplatePreview/assets/images/mobile.svg +24 -0
- package/components/TemplatePreview/assets/images/sms-body.png +0 -0
- package/components/TemplatePreview/assets/images/sms-icon.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -0
- package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +16 -0
- package/components/TemplatePreview/assets/images/user-icon.svg +19 -0
- package/components/TemplatePreview/assets/images/wechat-mobile.svg +78 -0
- package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -0
- package/components/TemplatePreview/index.js +617 -0
- package/components/TemplatePreview/messages.js +78 -0
- package/components/Toastr/index.js +60 -0
- package/components/Toastr/messages.js +13 -0
- package/components/ToastrMessage/index.js +113 -0
- package/components/ToastrMessage/messages.js +17 -0
- package/components/TopBar/_topbar.scss +46 -0
- package/components/TopBar/assets/images/capillary_logo.png +0 -0
- package/components/TopBar/assets/images/old_capillary_logo.png +0 -0
- package/components/TopBar/index.js +113 -0
- package/components/TopBar/messages.js +29 -0
- package/containers/App/actions.js +7 -0
- package/containers/App/constants.js +114 -0
- package/containers/App/index.js +52 -0
- package/containers/App/reducer.js +19 -0
- package/containers/App/sagas.js +31 -0
- package/containers/App/selectors.js +25 -0
- package/containers/App/test/saga.test.js +11 -0
- package/containers/Assets/Gallery/_gallery.scss +126 -0
- package/containers/Assets/Gallery/actions.js +37 -0
- package/containers/Assets/Gallery/constants.js +23 -0
- package/containers/Assets/Gallery/index.js +473 -0
- package/containers/Assets/Gallery/messages.js +93 -0
- package/containers/Assets/Gallery/reducer.js +81 -0
- package/containers/Assets/Gallery/sagas.js +80 -0
- package/containers/Assets/Gallery/selectors.js +25 -0
- package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +9 -0
- package/containers/Assets/Gallery/tests/actions.test.js +25 -0
- package/containers/Assets/Gallery/tests/reducer.test.js +96 -0
- package/containers/Assets/Gallery/tests/saga.test.js +157 -0
- package/containers/Cap/actions.js +66 -0
- package/containers/Cap/constants.js +25 -0
- package/containers/Cap/index.js +402 -0
- package/containers/Cap/messages.js +75 -0
- package/containers/Cap/reducer.js +113 -0
- package/containers/Cap/sagas.js +159 -0
- package/containers/Cap/selectors.js +75 -0
- package/containers/Cap/tests/__snapshots__/index.test.js.snap +2269 -0
- package/containers/Cap/tests/index.test.js +22 -0
- package/containers/Cap/tests/saga.test.js +284 -0
- package/containers/Dashboard/actions.js +15 -0
- package/containers/Dashboard/constants.js +7 -0
- package/containers/Dashboard/index.js +76 -0
- package/containers/Dashboard/messages.js +13 -0
- package/containers/Dashboard/reducer.js +21 -0
- package/containers/Dashboard/sagas.js +17 -0
- package/containers/Dashboard/selectors.js +25 -0
- package/containers/Dashboard/test/saga.test.js +9 -0
- package/containers/Ebill/_ebill.scss +5 -0
- package/containers/Ebill/actions.js +43 -0
- package/containers/Ebill/constants.js +20 -0
- package/containers/Ebill/index.js +1278 -0
- package/containers/Ebill/messages.js +77 -0
- package/containers/Ebill/reducer.js +72 -0
- package/containers/Ebill/sagas.js +74 -0
- package/containers/Ebill/selectors.js +25 -0
- package/containers/Ebill/test/saga.test.js +11 -0
- package/containers/Email/_email.scss +141 -0
- package/containers/Email/actions.js +81 -0
- package/containers/Email/constants.js +36 -0
- package/containers/Email/index.js +3325 -0
- package/containers/Email/messages.js +289 -0
- package/containers/Email/reducer.js +142 -0
- package/containers/Email/sagas.js +135 -0
- package/containers/Email/selectors.js +31 -0
- package/containers/Email/test/saga.test.js +671 -0
- package/containers/LanguageProvider/actions.js +17 -0
- package/containers/LanguageProvider/constants.js +8 -0
- package/containers/LanguageProvider/index.js +80 -0
- package/containers/LanguageProvider/reducer.js +30 -0
- package/containers/LanguageProvider/selectors.js +20 -0
- package/containers/LanguageProvider/tests/actions.test.js +19 -0
- package/containers/LanguageProvider/tests/index.test.js +78 -0
- package/containers/LanguageProvider/tests/reducer.test.js +20 -0
- package/containers/LanguageProvider/tests/selectors.test.js +15 -0
- package/containers/Line/Create/_lineCreate.scss +54 -0
- package/containers/Line/Create/actions.js +90 -0
- package/containers/Line/Create/constants.js +39 -0
- package/containers/Line/Create/index.js +836 -0
- package/containers/Line/Create/messages.js +189 -0
- package/containers/Line/Create/reducer.js +99 -0
- package/containers/Line/Create/sagas.js +121 -0
- package/containers/Line/Create/selectors.js +36 -0
- package/containers/Line/Create/tests/saga.test.js +202 -0
- package/containers/Line/Edit/_lineEdit.scss +35 -0
- package/containers/Line/Edit/actions.js +79 -0
- package/containers/Line/Edit/constants.js +27 -0
- package/containers/Line/Edit/index.js +1050 -0
- package/containers/Line/Edit/messages.js +177 -0
- package/containers/Line/Edit/reducer.js +83 -0
- package/containers/Line/Edit/sagas.js +80 -0
- package/containers/Line/Edit/selectors.js +29 -0
- package/containers/Line/Edit/test/saga.test.js +160 -0
- package/containers/Login/assets/images/capillary_logo.png +0 -0
- package/containers/Login/components/LoginForm/index.js +62 -0
- package/containers/Login/components/LoginForm/messages.js +33 -0
- package/containers/Login/index.js +130 -0
- package/containers/Login/messages.js +25 -0
- package/containers/Login/selectors.js +25 -0
- package/containers/MobilePush/Create/_mobilePushCreate.scss +39 -0
- package/containers/MobilePush/Create/actions.js +46 -0
- package/containers/MobilePush/Create/constants.js +23 -0
- package/containers/MobilePush/Create/index.js +2303 -0
- package/containers/MobilePush/Create/messages.js +269 -0
- package/containers/MobilePush/Create/reducer.js +70 -0
- package/containers/MobilePush/Create/sagas.js +74 -0
- package/containers/MobilePush/Create/selectors.js +28 -0
- package/containers/MobilePush/Create/test/saga.test.js +19 -0
- package/containers/MobilePush/Edit/_mobilePushCreate.scss +39 -0
- package/containers/MobilePush/Edit/actions.js +91 -0
- package/containers/MobilePush/Edit/constants.js +35 -0
- package/containers/MobilePush/Edit/index.js +2601 -0
- package/containers/MobilePush/Edit/messages.js +266 -0
- package/containers/MobilePush/Edit/reducer.js +112 -0
- package/containers/MobilePush/Edit/sagas.js +126 -0
- package/containers/MobilePush/Edit/selectors.js +29 -0
- package/containers/MobilePush/Edit/tests/saga.test.js +255 -0
- package/containers/NotFoundPage/index.js +25 -0
- package/containers/NotFoundPage/messages.js +13 -0
- package/containers/NotFoundPage/tests/index.test.js +17 -0
- package/containers/Sms/Create/_smsCreate.scss +42 -0
- package/containers/Sms/Create/actions.js +27 -0
- package/containers/Sms/Create/constants.js +16 -0
- package/containers/Sms/Create/index.js +1488 -0
- package/containers/Sms/Create/messages.js +109 -0
- package/containers/Sms/Create/reducer.js +41 -0
- package/containers/Sms/Create/sagas.js +40 -0
- package/containers/Sms/Create/selectors.js +28 -0
- package/containers/Sms/Create/test/saga.test.js +11 -0
- package/containers/Sms/Edit/actions.js +40 -0
- package/containers/Sms/Edit/constants.js +17 -0
- package/containers/Sms/Edit/index.js +1472 -0
- package/containers/Sms/Edit/messages.js +105 -0
- package/containers/Sms/Edit/reducer.js +50 -0
- package/containers/Sms/Edit/sagas.js +60 -0
- package/containers/Sms/Edit/selectors.js +32 -0
- package/containers/Sms/Edit/test/saga.test.js +13 -0
- package/containers/TagList/_tagList.scss +8 -0
- package/containers/TagList/actions.js +15 -0
- package/containers/TagList/constants.js +32 -0
- package/containers/TagList/index.js +236 -0
- package/containers/TagList/messages.js +13 -0
- package/containers/TagList/reducer.js +23 -0
- package/containers/TagList/sagas.js +11 -0
- package/containers/TagList/selectors.js +25 -0
- package/containers/Templates/_templates.scss +333 -0
- package/containers/Templates/actions.js +103 -0
- package/containers/Templates/constants.js +60 -0
- package/containers/Templates/index.js +1756 -0
- package/containers/Templates/messages.js +337 -0
- package/containers/Templates/reducer.js +142 -0
- package/containers/Templates/sagas.js +163 -0
- package/containers/Templates/selectors.js +28 -0
- package/containers/Templates/test/saga.test.js +241 -0
- package/containers/WeChat/MapTemplates/_mapTemplates.scss +8 -0
- package/containers/WeChat/MapTemplates/actions.js +52 -0
- package/containers/WeChat/MapTemplates/constants.js +28 -0
- package/containers/WeChat/MapTemplates/index.js +1610 -0
- package/containers/WeChat/MapTemplates/messages.js +157 -0
- package/containers/WeChat/MapTemplates/reducer.js +74 -0
- package/containers/WeChat/MapTemplates/sagas.js +84 -0
- package/containers/WeChat/MapTemplates/selectors.js +25 -0
- package/containers/WeChat/MapTemplates/test/saga.test.js +155 -0
- package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +57 -0
- package/containers/WeChat/RichmediaTemplates/Create/actions.js +36 -0
- package/containers/WeChat/RichmediaTemplates/Create/constants.js +15 -0
- package/containers/WeChat/RichmediaTemplates/Create/index.js +1071 -0
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +165 -0
- package/containers/WeChat/RichmediaTemplates/Create/reducer.js +60 -0
- package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +51 -0
- package/containers/WeChat/RichmediaTemplates/Create/selectors.js +37 -0
- package/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +13 -0
- package/containers/WeChat/RichmediaTemplates/Edit/actions.js +20 -0
- package/containers/WeChat/RichmediaTemplates/Edit/constants.js +10 -0
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +136 -0
- package/containers/WeChat/RichmediaTemplates/Edit/messages.js +13 -0
- package/containers/WeChat/RichmediaTemplates/Edit/reducer.js +28 -0
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +36 -0
- package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +30 -0
- package/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +12 -0
- package/containers/WeChat/RichmediaTemplates/View/actions.js +15 -0
- package/containers/WeChat/RichmediaTemplates/View/constants.js +7 -0
- package/containers/WeChat/RichmediaTemplates/View/index.js +47 -0
- package/containers/WeChat/RichmediaTemplates/View/messages.js +21 -0
- package/containers/WeChat/RichmediaTemplates/View/reducer.js +23 -0
- package/containers/WeChat/RichmediaTemplates/View/sagas.js +11 -0
- package/containers/WeChat/RichmediaTemplates/View/selectors.js +25 -0
- package/index.js +2 -4
- package/package.json +1 -1
- package/routes.js +202 -136
- package/services/getSchema.js +1 -1
- package/services/localStorageApi.js +0 -1
- package/tests/i18n.test.js +1 -1
- package/utils/asyncInjectors.js +78 -0
- package/utils/authWrapper.js +1 -1
- package/utils/callNativeEvent.js +16 -0
- package/utils/checkStore.js +21 -0
- package/utils/common.js +2 -2
- package/utils/customAuthWrapper.js +62 -0
- package/utils/customConnectedAuthWrapper.js +26 -0
- package/utils/tagValidations.js +1 -1
- package/utils/tests/checkStore.test.js +1 -1
- package/utils/tests/customAuth.test.js +1 -1
- package/utils/transformerUtils.js +195 -1
- package/v2Components/CapTagList/index.js +14 -9
- package/v2Components/Carousel/style.scss +1 -1
- package/v2Components/EmailMobilePreview/index.js +2 -2
- package/v2Components/FormBuilder/index.js +2 -2
- package/v2Components/TemplatePreview/index.js +1 -2
- package/v2Containers/Cap/tests/saga.test.js +1 -1
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/FTP/index.js +1 -1
- package/v2Containers/Line/Container/Text/index.js +6 -6
- package/v2Containers/Sms/Create/index.js +2 -2
- package/v2Containers/Sms/Edit/index.js +1 -1
- package/v2Containers/TagList/index.js +1 -1
- package/v2Containers/TagList/utils.js +1 -1
- package/v2Containers/Templates/index.js +1 -1
- package/v2Containers/Templates/sagas.js +1 -1
- package/constants/unified.js +0 -189
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* LanguageProvider
|
|
4
|
+
*
|
|
5
|
+
* this component connects the redux state language locale to the
|
|
6
|
+
* IntlProvider component and i18n messages (loaded from `app/translations`)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
import moment from 'moment';
|
|
12
|
+
import { connect } from 'react-redux';
|
|
13
|
+
import { IntlProvider } from 'react-intl';
|
|
14
|
+
import { createStructuredSelector } from 'reselect';
|
|
15
|
+
import { bindActionCreators } from 'redux';
|
|
16
|
+
import { DEFAULT_LOCALE } from '../Cap/constants';
|
|
17
|
+
import { makeSelectLocale } from './selectors';
|
|
18
|
+
import makeSelectApp from '../App/selectors';
|
|
19
|
+
import * as appActions from '../App/actions';
|
|
20
|
+
import { getLocale } from '../../utils/ApiCaller';
|
|
21
|
+
export class LanguageProvider extends React.PureComponent {
|
|
22
|
+
// eslint-disable-line react/prefer-stateless-function
|
|
23
|
+
|
|
24
|
+
componentDidMount() {
|
|
25
|
+
const jlocale = getLocale() || DEFAULT_LOCALE;
|
|
26
|
+
const locale = this.getReversedMappedLocale(jlocale);
|
|
27
|
+
this.props.actions.getLocizMessage(locale);
|
|
28
|
+
moment.locale(jlocale);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getReversedMappedLocale = locale => {
|
|
32
|
+
const map = {
|
|
33
|
+
en: 'en-US',
|
|
34
|
+
'zh-cn': 'zh',
|
|
35
|
+
hi: 'hi',
|
|
36
|
+
vi: 'vi',
|
|
37
|
+
tr: 'tr',
|
|
38
|
+
'ja-JP': 'ja-JP',
|
|
39
|
+
};
|
|
40
|
+
return map[locale];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
render() {
|
|
44
|
+
const { messagesData } = this.props.messages;
|
|
45
|
+
return (
|
|
46
|
+
<IntlProvider
|
|
47
|
+
locale={this.props.locale}
|
|
48
|
+
key={this.props.locale}
|
|
49
|
+
messages={messagesData}
|
|
50
|
+
>
|
|
51
|
+
{React.Children.only(this.props.children)}
|
|
52
|
+
</IntlProvider>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
LanguageProvider.propTypes = {
|
|
58
|
+
locale: PropTypes.string,
|
|
59
|
+
messages: PropTypes.object,
|
|
60
|
+
children: PropTypes.element.isRequired,
|
|
61
|
+
actions: PropTypes.object,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const mapStateToProps = createStructuredSelector({
|
|
65
|
+
messages: makeSelectApp(),
|
|
66
|
+
locale: makeSelectLocale(),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
function mapDispatchToProps(dispatch) {
|
|
70
|
+
return {
|
|
71
|
+
actions: bindActionCreators(appActions, dispatch),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const withConnect = connect(
|
|
76
|
+
mapStateToProps,
|
|
77
|
+
mapDispatchToProps,
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
export default withConnect(LanguageProvider);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* LanguageProvider reducer
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { fromJS } from 'immutable';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
CHANGE_LOCALE,
|
|
11
|
+
} from './constants';
|
|
12
|
+
import {
|
|
13
|
+
DEFAULT_LOCALE,
|
|
14
|
+
} from '../Cap/constants'; // eslint-disable-line
|
|
15
|
+
|
|
16
|
+
const initialState = fromJS({
|
|
17
|
+
locale: DEFAULT_LOCALE,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
function languageProviderReducer(state = initialState, action) {
|
|
21
|
+
switch (action.type) {
|
|
22
|
+
case CHANGE_LOCALE:
|
|
23
|
+
return state
|
|
24
|
+
.set('locale', action.locale);
|
|
25
|
+
default:
|
|
26
|
+
return state;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default languageProviderReducer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createSelector } from 'reselect';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Direct selector to the languageToggle state domain
|
|
5
|
+
*/
|
|
6
|
+
const selectLanguage = (state) => state.get('language');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Select the language locale
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const makeSelectLocale = () => createSelector(
|
|
13
|
+
selectLanguage,
|
|
14
|
+
(languageState) => languageState.get('locale')
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
selectLanguage,
|
|
19
|
+
makeSelectLocale,
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
changeLocale,
|
|
3
|
+
} from '../actions';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
CHANGE_LOCALE,
|
|
7
|
+
} from '../constants';
|
|
8
|
+
|
|
9
|
+
describe('LanguageProvider actions', () => {
|
|
10
|
+
describe('Change Local Action', () => {
|
|
11
|
+
test.concurrent('has a type of CHANGE_LOCALE', () => {
|
|
12
|
+
const expected = {
|
|
13
|
+
type: CHANGE_LOCALE,
|
|
14
|
+
locale: 'de',
|
|
15
|
+
};
|
|
16
|
+
expect(changeLocale('de')).toEqual(expected);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shallow, mount } from 'enzyme';
|
|
3
|
+
import { FormattedMessage, defineMessages } from 'react-intl';
|
|
4
|
+
import { Provider } from 'react-redux';
|
|
5
|
+
import history from '../../../utils/history';
|
|
6
|
+
|
|
7
|
+
import ConnectedLanguageProvider, { LanguageProvider } from '../index';
|
|
8
|
+
import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
|
|
9
|
+
import { initialReducer } from '../../../initialReducer';
|
|
10
|
+
|
|
11
|
+
import { translationMessages } from '../../../i18n';
|
|
12
|
+
|
|
13
|
+
const messages = defineMessages({
|
|
14
|
+
someMessage: {
|
|
15
|
+
id: 'some.id',
|
|
16
|
+
defaultMessage: 'This is some default message',
|
|
17
|
+
en: 'This is some en message',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
jest.mock('antd/es/locale-provider/en_US', () => 'enUS');
|
|
21
|
+
jest.mock('antd/es/locale-provider/zh_CN', () => 'zhCN');
|
|
22
|
+
jest.mock('antd/es/locale-provider/ja_JP', () => 'jaJP');
|
|
23
|
+
|
|
24
|
+
describe('<LanguageProvider />', () => {
|
|
25
|
+
it('should render its children', () => {
|
|
26
|
+
const children = (<h1>Test</h1>);
|
|
27
|
+
const mockActions = {
|
|
28
|
+
getLocizMessage: jest.fn(),
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const language={
|
|
32
|
+
locale: 'en',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const props = {
|
|
36
|
+
messages : messages,
|
|
37
|
+
language: language,
|
|
38
|
+
actions: mockActions,
|
|
39
|
+
};
|
|
40
|
+
const renderedComponent = shallow(
|
|
41
|
+
<LanguageProvider {...props}>
|
|
42
|
+
{children}
|
|
43
|
+
</LanguageProvider>
|
|
44
|
+
);
|
|
45
|
+
expect(renderedComponent.contains(children)).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe('<ConnectedLanguageProvider />', () => {
|
|
50
|
+
let store;
|
|
51
|
+
|
|
52
|
+
beforeAll(() => {
|
|
53
|
+
store = configureStore({}, initialReducer, history);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should render the default language messages', () => {
|
|
57
|
+
const mockActions = {
|
|
58
|
+
getLocizMessage: jest.fn(),
|
|
59
|
+
};
|
|
60
|
+
const language = {
|
|
61
|
+
locale: 'en',
|
|
62
|
+
}
|
|
63
|
+
const messages = {translationMessages}
|
|
64
|
+
const props = {
|
|
65
|
+
messages: messages,
|
|
66
|
+
language: language,
|
|
67
|
+
actions: mockActions,
|
|
68
|
+
}
|
|
69
|
+
const renderedComponent = shallow(
|
|
70
|
+
<Provider store={store}>
|
|
71
|
+
<ConnectedLanguageProvider {...props}>
|
|
72
|
+
<FormattedMessage {...messages.someMessage} />
|
|
73
|
+
</ConnectedLanguageProvider>
|
|
74
|
+
</Provider>
|
|
75
|
+
);
|
|
76
|
+
expect(renderedComponent.contains(<FormattedMessage {...messages.someMessage} />)).toBe(true);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { fromJS } from 'immutable';
|
|
2
|
+
|
|
3
|
+
import languageProviderReducer from '../reducer';
|
|
4
|
+
import {
|
|
5
|
+
CHANGE_LOCALE,
|
|
6
|
+
} from '../constants';
|
|
7
|
+
|
|
8
|
+
describe('languageProviderReducer', () => {
|
|
9
|
+
it.concurrent('returns the initial state', () => {
|
|
10
|
+
expect(languageProviderReducer(undefined, {})).toEqual(fromJS({
|
|
11
|
+
locale: 'en',
|
|
12
|
+
}));
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it.concurrent('changes the locale', () => {
|
|
16
|
+
expect(languageProviderReducer(undefined, { type: CHANGE_LOCALE, locale: 'de' }).toJS()).toEqual({
|
|
17
|
+
locale: 'de',
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { fromJS } from 'immutable';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
selectLanguage,
|
|
5
|
+
} from '../selectors';
|
|
6
|
+
|
|
7
|
+
describe('selectLanguage', () => {
|
|
8
|
+
it.concurrent('should select the global state', () => {
|
|
9
|
+
const globalState = fromJS({});
|
|
10
|
+
const mockedState = fromJS({
|
|
11
|
+
language: globalState,
|
|
12
|
+
});
|
|
13
|
+
expect(selectLanguage(mockedState)).toEqual(globalState);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
.line-row{
|
|
2
|
+
margin-bottom: 16px;
|
|
3
|
+
}
|
|
4
|
+
.image-container{
|
|
5
|
+
display: flex;
|
|
6
|
+
// height: 150px;
|
|
7
|
+
// width: 320px;
|
|
8
|
+
// border: solid 1px #C2C2C2;
|
|
9
|
+
border-radius: 5px;
|
|
10
|
+
.image-placeholder{
|
|
11
|
+
line-height: 150px;
|
|
12
|
+
}
|
|
13
|
+
img {
|
|
14
|
+
object-fit: cover;
|
|
15
|
+
max-width: 100%;
|
|
16
|
+
max-height: 100%;
|
|
17
|
+
height: auto !important;
|
|
18
|
+
width: auto !important;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//.ant-tabs-bar{
|
|
22
|
+
// margin-bottom: 0 !important;
|
|
23
|
+
// display: flex;
|
|
24
|
+
// align-items: center;
|
|
25
|
+
// flex-direction: row-reverse;
|
|
26
|
+
// justify-content: flex-end;
|
|
27
|
+
//}
|
|
28
|
+
//.ant-tabs-tabpane{
|
|
29
|
+
// padding: 16px 16px 16px 0;
|
|
30
|
+
// border: solid 1px #D6D6D6;
|
|
31
|
+
//}
|
|
32
|
+
//.ant-radio-wrapper{
|
|
33
|
+
// font-size: 14px;
|
|
34
|
+
// font-family: 'open-sans';
|
|
35
|
+
//}
|
|
36
|
+
|
|
37
|
+
.ant-radio-inner::after{
|
|
38
|
+
top: 3px;
|
|
39
|
+
left: 3px;
|
|
40
|
+
}
|
|
41
|
+
.ant-radio-inner{
|
|
42
|
+
border: 1px solid #d9d9d9;
|
|
43
|
+
}
|
|
44
|
+
.ant-radio-checked .ant-radio-inner{
|
|
45
|
+
border: 1px solid #47af46;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.sms-text {
|
|
49
|
+
img {
|
|
50
|
+
display: block;
|
|
51
|
+
max-width: 100%;
|
|
52
|
+
object-fit: cover;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* Create actions
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as types from './constants';
|
|
8
|
+
|
|
9
|
+
export function createTemplate(template, callback) {
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
type: types.CREATE_TEMPLATE_REQUEST, template, callback,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function clearCreateResponse() {
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
type: types.CLEAR_CREATE_RESPONSE_REQUEST,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function defaultAction() {
|
|
24
|
+
return {
|
|
25
|
+
type: types.DEFAULT_ACTION,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function uploadAsset(file, assetType, fileParams) {
|
|
30
|
+
return {
|
|
31
|
+
type: types.UPLOAD_ASSET_REQUEST,
|
|
32
|
+
file,
|
|
33
|
+
assetType,
|
|
34
|
+
fileParams,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function clearAsset() {
|
|
39
|
+
return {
|
|
40
|
+
type: types.CLEAR_ASSET,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
// FOR EDIT
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
export function editTemplate(template) {
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
type: types.EDIT_TEMPLATE_REQUEST, template,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export function getTemplateDetails(id) {
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
type: types.GET_TEMPLATE_DETAILS_REQUEST,
|
|
59
|
+
id,
|
|
60
|
+
channel: 'LINE',
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export function clearEditResponse() {
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
type: types.CLEAR_EDIT_RESPONSE_REQUEST,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export function clearData() {
|
|
72
|
+
return {
|
|
73
|
+
type: types.CLEAR_DATA,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function getLineTemplatesList(channel, queryParams) {
|
|
78
|
+
return {
|
|
79
|
+
type: types.GET_LINE_TEMPLATES_LIST_REQUEST,
|
|
80
|
+
channel,
|
|
81
|
+
queryParams,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export function setSelectedTemplate(templateData) {
|
|
86
|
+
return {
|
|
87
|
+
type: types.SET_SELECTED_TEMPLATE,
|
|
88
|
+
data: templateData,
|
|
89
|
+
};
|
|
90
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* Create constants
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const DEFAULT_ACTION = 'app/Create/DEFAULT_ACTION';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const CREATE_TEMPLATE_REQUEST = 'app/containers/Line/Create/CREATE_TEMPLATE_REQUEST';
|
|
11
|
+
export const CREATE_TEMPLATE_SUCCESS = 'app/containers/Line/Create/CREATE_TEMPLATE_SUCCESS';
|
|
12
|
+
export const CREATE_TEMPLATE_FAILURE = 'app/containers/Line/Create/CREATE_TEMPLATE_FAILURE';
|
|
13
|
+
export const UPLOAD_ASSET_REQUEST = 'app/containers/Line/Create/UPLOAD_ASSET_REQUEST';
|
|
14
|
+
export const UPLOAD_ASSET_SUCCESS = 'app/containers/Line/Create/UPLOAD_ASSET_SUCCESS';
|
|
15
|
+
export const UPLOAD_ASSET_FAILURE = 'app/containers/Line/Create/UPLOAD_ASSET_FAILURE';
|
|
16
|
+
export const CLEAR_ASSET = 'app/containers/Line/Create/CLEAR_ASSET';
|
|
17
|
+
|
|
18
|
+
export const CLEAR_CREATE_RESPONSE_REQUEST = 'app/containers/Line/Create/CLEAR_CREATE_RESPONSE_REQUEST';
|
|
19
|
+
export const CLEAR_CREATE_RESPONSE_SUCCESS = 'app/containers/Line/Create/CLEAR_CREATE_RESPONSE_SUCCESS';
|
|
20
|
+
export const CLEAR_CREATE_RESPONSE_FAILURE = 'app/containers/Line/Create/CLEAR_CREATE_RESPONSE_FAILURE';
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
// edit
|
|
24
|
+
|
|
25
|
+
export const GET_TEMPLATE_DETAILS_REQUEST = 'app/containers/line/Edit/GET_TEMPLATE_DETAILS_REQUEST';
|
|
26
|
+
export const GET_TEMPLATE_DETAILS_SUCCESS = 'app/containers/line/Edit/GET_TEMPLATE_DETAILS_SUCCESS';
|
|
27
|
+
export const GET_TEMPLATE_DETAILS_FAILURE = 'app/containers/line/Edit/GET_TEMPLATE_DETAILS_FAILURE';
|
|
28
|
+
|
|
29
|
+
export const EDIT_TEMPLATE_REQUEST = 'app/containers/line/Edit/EDIT_TEMPLATE_REQUEST';
|
|
30
|
+
export const EDIT_TEMPLATE_SUCCESS = 'app/containers/line/Edit/EDIT_TEMPLATE_SUCCESS';
|
|
31
|
+
export const EDIT_TEMPLATE_FAILURE = 'app/containers/line/Edit/EDIT_TEMPLATE_FAILURE';
|
|
32
|
+
|
|
33
|
+
export const CLEAR_EDIT_RESPONSE_REQUEST = 'app/containers/line/Edit/CLEAR_EDIT_RESPONSE_REQUEST';
|
|
34
|
+
export const CLEAR_DATA = 'app/containers/Line/Edit/CLEAR_DATA';
|
|
35
|
+
export const SET_SELECTED_TEMPLATE = 'app/containers/Line/Edit/SET_SELECTED_TEMPLATE';
|
|
36
|
+
|
|
37
|
+
export const GET_LINE_TEMPLATES_LIST_REQUEST = 'app/containers/Line/GET_LINE_TEMPLATES_LIST_REQUEST';
|
|
38
|
+
export const GET_LINE_TEMPLATES_LIST_SUCCESS = 'app/containers/Line/GET_LINE_TEMPLATES_LIST_SUCCESS';
|
|
39
|
+
export const GET_LINE_TEMPLATES_LIST_FAILURE = 'app/containers/Line/GET_LINE_TEMPLATES_LIST_FAILURE';
|