@capillarytech/creatives-library 2.0.62 → 2.0.64

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.
Files changed (48) hide show
  1. package/assets/NoImage1.js +50 -0
  2. package/assets/WithImage1.js +57 -0
  3. package/components/EmailPreview/assets/images/iPad.svg +10 -0
  4. package/components/EmailPreview/assets/images/mobile.png +0 -0
  5. package/components/FormBuilder/_formBuilder.scss +7 -1
  6. package/components/FormBuilder/index.js +97 -65
  7. package/components/MobilePushPreviewV2/index.js +120 -0
  8. package/components/MobilePushPreviewV2/messages.js +13 -0
  9. package/components/MobilePushPreviewV2/tests/index.test.js +10 -0
  10. package/components/TemplatePreview/index.js +1 -1
  11. package/containers/CreativesContainer/SlideBoxContent.js +27 -4
  12. package/containers/CreativesContainer/SlideBoxFooter.js +3 -3
  13. package/containers/CreativesContainer/index.js +71 -24
  14. package/containers/MobilePush/Create/_mobilePushCreate.scss +13 -0
  15. package/containers/MobilePush/Create/actions.js +6 -0
  16. package/containers/MobilePush/Create/constants.js +1 -0
  17. package/containers/MobilePush/Create/index.js +630 -1130
  18. package/containers/MobilePush/Create/messages.js +5 -1
  19. package/containers/MobilePush/Create/reducer.js +2 -0
  20. package/containers/MobilePush/Create/selectors.js +3 -3
  21. package/containers/MobilePush/Edit/_mobilePushCreate.scss +10 -0
  22. package/containers/MobilePush/Edit/index.js +375 -1106
  23. package/containers/MobilePush/Edit/messages.js +4 -0
  24. package/containers/MobilePush/Edit/reducer.js +2 -1
  25. package/containers/MobilePush/Edit/selectors.js +3 -1
  26. package/containers/MobilePush/commonMethods.js +249 -0
  27. package/containers/MobilePush/eventsMap.js +127 -0
  28. package/containers/MobilePush/initialSchema.js +1751 -0
  29. package/containers/MobilepushWrapper/_mobilepushWrapper.scss +18 -0
  30. package/containers/MobilepushWrapper/index.js +95 -0
  31. package/containers/MobilepushWrapper/messages.js +25 -0
  32. package/containers/MobilepushWrapper/tests/index.test.js +10 -0
  33. package/containers/WeChat/_wechat.scss +8 -0
  34. package/containers/WeChat/actions.js +52 -0
  35. package/containers/WeChat/constants.js +28 -0
  36. package/containers/WeChat/index.js +1635 -0
  37. package/containers/WeChat/messages.js +73 -0
  38. package/containers/WeChat/reducer.js +74 -0
  39. package/containers/WeChat/sagas.js +86 -0
  40. package/containers/WeChat/selectors.js +25 -0
  41. package/containers/WeChat/tests/actions.test.js +18 -0
  42. package/containers/WeChat/tests/index.test.js +10 -0
  43. package/containers/WeChat/tests/reducer.test.js +9 -0
  44. package/containers/WeChat/tests/sagas.test.js +15 -0
  45. package/containers/WeChat/tests/selectors.test.js +10 -0
  46. package/index.js +1 -1
  47. package/package.json +1 -1
  48. package/services/api.js +3 -0
@@ -0,0 +1,73 @@
1
+ /*
2
+ * WeChat Messages
3
+ *
4
+ * This contains all the text for the WeChat component.
5
+ */
6
+ import { defineMessages } from 'react-intl';
7
+
8
+ export default defineMessages({
9
+ header: {
10
+ id: 'app.containers.WeChat.header',
11
+ defaultMessage: 'WeChat',
12
+ },
13
+ 'Template mapping': {
14
+ id: 'app.containers.WeChat.templateMapping',
15
+ defaultMessage: 'Template mapping',
16
+ },
17
+ 'Discard': {
18
+ id: 'app.containers.WeChat.discard',
19
+ defaultMessage: 'Discard',
20
+ },
21
+ 'Cancel': {
22
+ id: 'app.containers.WeChat.cancel',
23
+ defaultMessage: 'Cancel',
24
+ },
25
+ 'Save': {
26
+ id: 'app.containers.WeChat.save',
27
+ defaultMessage: 'Save',
28
+ },
29
+ 'Account Id': {
30
+ id: 'app.containers.WeChat.accountId',
31
+ defaultMessage: 'Account Id',
32
+ },
33
+ 'Select Wechat Account': {
34
+ id: 'app.containers.WeChat.selectWechatAccount',
35
+ defaultMessage: 'Select Wechat Account',
36
+ },
37
+ 'Template': {
38
+ id: 'app.containers.WeChat.template',
39
+ defaultMessage: 'Template',
40
+ },
41
+ 'Select Wechat Template': {
42
+ id: 'app.containers.WeChat.selectWechatTemplate',
43
+ defaultMessage: 'Select Wechat Template',
44
+ },
45
+ 'Link': {
46
+ id: 'app.containers.WeChat.link',
47
+ defaultMessage: 'Link',
48
+ },
49
+ 'Is this internal url': {
50
+ id: 'app.containers.WeChat.isInternalUrl',
51
+ defaultMessage: 'Is this internal url',
52
+ },
53
+ "Tags": {
54
+ id: 'app.containers.WeChat.tagsLabel',
55
+ defaultMessage: "Tags",
56
+ },
57
+ "gettingTemplateData": {
58
+ id: 'app.containers.WeChat.gettingTemplateData',
59
+ defaultMessage: "Getting Template Data..",
60
+ },
61
+ "wechatEditSuccess": {
62
+ id: 'app.containers.WeChat.wechatEditSuccess',
63
+ defaultMessage: "WeChat template unmapped successfully",
64
+ },
65
+ "wechatCreateSuccess": {
66
+ id: 'app.containers.WeChat.wechatCreateSuccess',
67
+ defaultMessage: "WeChat template mapped successfully",
68
+ },
69
+ "somethingWentWrong": {
70
+ id: 'app.containers.WeChat.somethingWentWrong',
71
+ defaultMessage: "Something Went Wrong!!",
72
+ },
73
+ });
@@ -0,0 +1,74 @@
1
+ /*
2
+ *
3
+ * WeChat reducer
4
+ *
5
+ */
6
+
7
+ import { fromJS } from 'immutable';
8
+ import * as types from './constants';
9
+
10
+ const initialState = fromJS({
11
+ weChatDefaultTemplate: fromJS({}),
12
+ fetchingDefaultTemplates: false,
13
+ errorFetchingDefaultTempalte: false,
14
+ });
15
+
16
+ function weChatReducer(state = initialState, action) {
17
+ switch (action.type) {
18
+ case types.GET_WECHAT_DEFAULT_TEMPLATES_REQUEST:
19
+ return state
20
+ .set('fetchingDefaultTemplates', true)
21
+ .set('weChatDefaultTemplate', fromJS({}))
22
+ .set('weChatTemplates', fromJS({}))
23
+ .set('errorFetchingDefaultTempalte', false);
24
+ case types.GET_WECHAT_DEFAULT_TEMPLATES_SUCCESS:
25
+ return state
26
+ .set('fetchingDefaultTemplates', false)
27
+ .set('weChatDefaultTemplate', fromJS(action.data))
28
+ .set('weChatTemplates', fromJS(action.templateData));
29
+ case types.GET_WECHAT_DEFAULT_TEMPLATES_FAILURE:
30
+ return state
31
+ .set('fetchingDefaultTemplates', false)
32
+ .set('errorFetchingDefaultTempalte', true);
33
+ case types.CREATE_TEMPLATE_REQUEST:
34
+ return state
35
+ .set('createTemplateInProgress', true)
36
+ .set('createTemplateError', false);
37
+ case types.CREATE_TEMPLATE_SUCCESS:
38
+ return state.set('createTemplateInProgress', false)
39
+ .set('createResponse', action.data)
40
+ .set('createTemplateError', (action.statusCode !== undefined && action.statusCode > 300));
41
+ case types.CREATE_TEMPLATE_FAILURE:
42
+ return state
43
+ .set('createTemplateInProgress', false)
44
+ .set('createTemplateError', true);
45
+ case types.CLEAR_CREATE_RESPONSE_REQUEST:
46
+ return state.set('createResponse', {});
47
+ case types.GET_WECRM_ACCOUNTS_REQUEST:
48
+ return state
49
+ .set('fetchingWeCrmAccounts', true)
50
+ .set('weCrmAccountFetchingError', false);
51
+ case types.GET_WECRM_ACCOUNTS_SUCCESS:
52
+ return state
53
+ .set('fetchingWeCrmAccounts', false)
54
+ .set('weCrmAccounts', fromJS(action.data));
55
+ case types.GET_WECRM_ACCOUNTS_FAILURE:
56
+ return state
57
+ .set('fetchingWeCrmAccounts', false)
58
+ .set('weCrmAccountFetchingError', true);
59
+ case types.GET_TEMPLATE_DETAILS_REQUEST:
60
+ return state.set('getTemplateDetailsInProgress', true);
61
+ case types.GET_TEMPLATE_DETAILS_SUCCESS:
62
+ return state.set('getTemplateDetailsInProgress', false)
63
+ .set('templateDetails', action.data);
64
+ case types.GET_TEMPLATE_DETAILS_FAILURE:
65
+ return state.set('getTemplateDetailsInProgress', false);
66
+ case types.SET_WECHAT_ACCOUNT:
67
+ return state
68
+ .set('selectedWeChatAccount', fromJS(action.weChatAccount));
69
+ default:
70
+ return state;
71
+ }
72
+ }
73
+
74
+ export default weChatReducer;
@@ -0,0 +1,86 @@
1
+ import { take, call, put, takeLatest, cancel } from 'redux-saga/effects';
2
+ import { LOCATION_CHANGE } from 'react-router-redux';
3
+ import * as Api from '../../services/api';
4
+ import * as types from './constants';
5
+
6
+ export function* getDefaultWeChatTemplates(params) {
7
+ try {
8
+ console.log('Saga param ', params.channel, params.queryParams);
9
+ const result = yield call(Api.getAllTemplates, {channel: params.channel, queryParams: params.queryParams});
10
+ yield put({ type: types.GET_WECHAT_DEFAULT_TEMPLATES_SUCCESS, data: result.response.unMapped, templateData: result.response.mapped});
11
+ } catch (error) {
12
+ yield put({ type: types.GET_WECHAT_DEFAULT_TEMPLATES_FAILURE, error });
13
+ }
14
+ }
15
+
16
+ export function* createTemplate(template) {
17
+ try {
18
+ const result = yield call(Api.createWeChatTemplate, template);
19
+ // const sidebar = result.response.sidebar;
20
+ yield put({ type: types.CREATE_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '' });
21
+ } catch (error) {
22
+ yield put({ type: types.CREATE_TEMPLATE_FAILURE, error });
23
+ }
24
+ }
25
+
26
+ export function* fetchWeCrmAccounts() {
27
+ try {
28
+ const result = yield call(Api.fetchWeCrmAccounts);
29
+ yield [
30
+ put({
31
+ type: types.GET_WECRM_ACCOUNTS_SUCCESS,
32
+ data: result.response,
33
+ }),
34
+ ];
35
+ } catch (error) {
36
+ yield [
37
+ put({
38
+ type: types.GET_WECRM_ACCOUNTS_FAILURE,
39
+ data: error,
40
+ }),
41
+ ];
42
+ }
43
+ }
44
+
45
+ export function* getTemplateDetails(id) {
46
+ try {
47
+ console.log('saga get Template details', id);
48
+ const result = yield call(Api.getTemplateDetails, id);
49
+ // const sidebar = result.response.sidebar;
50
+ yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
51
+ } catch (error) {
52
+ yield put({ type: types.GET_TEMPLATE_DETAILS_FAILURE, error });
53
+ }
54
+ }
55
+
56
+ function* watchGetDefaultWechatTemplates() {
57
+ const watcher = yield takeLatest(types.GET_WECHAT_DEFAULT_TEMPLATES_REQUEST, getDefaultWeChatTemplates);
58
+ yield take(LOCATION_CHANGE);
59
+ yield cancel(watcher);
60
+ }
61
+
62
+ function* watchCreateTemplate() {
63
+ const watcher = yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
64
+ yield take(LOCATION_CHANGE);
65
+ yield cancel(watcher);
66
+ }
67
+
68
+ function* watchFetchWeCrmAccounts() {
69
+ const watcher = yield takeLatest(types.GET_WECRM_ACCOUNTS_REQUEST, fetchWeCrmAccounts);
70
+ yield take(LOCATION_CHANGE);
71
+ yield cancel(watcher);
72
+ }
73
+
74
+ function* watchGetTemplateDetails() {
75
+ const watcher = yield takeLatest(types.GET_TEMPLATE_DETAILS_REQUEST, getTemplateDetails);
76
+ yield take(LOCATION_CHANGE);
77
+ yield cancel(watcher);
78
+ }
79
+
80
+ // All sagas to be loaded
81
+ export default [
82
+ watchGetDefaultWechatTemplates,
83
+ watchCreateTemplate,
84
+ watchFetchWeCrmAccounts,
85
+ watchGetTemplateDetails,
86
+ ];
@@ -0,0 +1,25 @@
1
+ import { createSelector } from 'reselect';
2
+
3
+ /**
4
+ * Direct selector to the weChat state domain
5
+ */
6
+ const selectWeChatDomain = () => (state) => state.get('weChat');
7
+
8
+ /**
9
+ * Other specific selectors
10
+ */
11
+
12
+
13
+ /**
14
+ * Default selector used by WeChat
15
+ */
16
+
17
+ const makeSelectWeChat = () => createSelector(
18
+ selectWeChatDomain(),
19
+ (substate) => substate.toJS()
20
+ );
21
+
22
+ export default makeSelectWeChat;
23
+ export {
24
+ selectWeChatDomain,
25
+ };
@@ -0,0 +1,18 @@
1
+
2
+ import {
3
+ defaultAction,
4
+ } from '../actions';
5
+ import {
6
+ DEFAULT_ACTION,
7
+ } from '../constants';
8
+
9
+ describe('WeChat actions', () => {
10
+ describe('Default Action', () => {
11
+ it('has a type of DEFAULT_ACTION', () => {
12
+ const expected = {
13
+ type: DEFAULT_ACTION,
14
+ };
15
+ expect(defaultAction()).toEqual(expected);
16
+ });
17
+ });
18
+ });
@@ -0,0 +1,10 @@
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import { WeChat } from '../index';
5
+
6
+ describe('<WeChat />', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });
@@ -0,0 +1,9 @@
1
+
2
+ import { fromJS } from 'immutable';
3
+ import weChatReducer from '../reducer';
4
+
5
+ describe('weChatReducer', () => {
6
+ it('returns the initial state', () => {
7
+ expect(weChatReducer(undefined, {})).toEqual(fromJS({}));
8
+ });
9
+ });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Test sagas
3
+ */
4
+
5
+ /* eslint-disable redux-saga/yield-effects */
6
+ // import { take, call, put, select } from 'redux-saga/effects';
7
+ // import { defaultSaga } from '../sagas';
8
+
9
+ // const generator = defaultSaga();
10
+
11
+ describe('defaultSaga Saga', () => {
12
+ it('Expect to have unit tests specified', () => {
13
+ expect(true).toEqual(false);
14
+ });
15
+ });
@@ -0,0 +1,10 @@
1
+ // import { fromJS } from 'immutable';
2
+ // import { makeSelectWeChatDomain } from '../selectors';
3
+
4
+ // const selector = makeSelectWeChatDomain();
5
+
6
+ describe('makeSelectWeChatDomain', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(false);
9
+ });
10
+ });
package/index.js CHANGED
@@ -75,7 +75,7 @@ export {default as EmailPreview} from './components/EmailPreview';
75
75
  export {default as EmailPreviewV2} from './components/EmailPreviewV2';
76
76
  export {default as CallTaskPreview} from './components/CallTaskPreview';
77
77
  export {default as EmailMobilePreview} from './components/EmailMobilePreview';
78
-
78
+ export {default as MobilePushPreview} from './components/MobilePushPreviewV2';
79
79
  CreativesContainer.CreativesContainerReducer = CreativesContainerReducer;
80
80
 
81
81
  export { CapContainer,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "2.0.62",
4
+ "version": "2.0.64",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/services/api.js CHANGED
@@ -257,6 +257,9 @@ export const getUserList = () => {
257
257
  };
258
258
 
259
259
  export const fetchSchemaForEntity = ({queryParams}) => {
260
+ if (queryParams.version === "v2" && queryParams.type === "LAYOUT" && queryParams.layout === "MOBILEPUSH") {
261
+ return import('../containers/MobilePush/initialSchema').then((layout) => layout);
262
+ }
260
263
  const url = `${API_ENDPOINT}/meta/${queryParams.type}?query=${JSON.stringify(queryParams)}`;
261
264
  return request(url, getAPICallObject('GET'));// request(url, getAPICallObject('GET'));
262
265
  };