@capillarytech/creatives-library 7.16.19 → 7.17.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.
@@ -13,7 +13,7 @@ import React from 'react';
13
13
  import _ from 'lodash';
14
14
  // import messages from './messages';
15
15
  const loadScript = require('load-script');
16
- const defaultScriptUrl = "https://ckeditor.com/assets/libs/ckeditor4/4.22.1/ckeditor.js";
16
+ const defaultScriptUrl = "https://crm-nightly-new-fileservice.s3.amazonaws.com/ckeditor_test/ckeditor4/ckeditor.js";
17
17
  const user = localStorage.getItem('user');
18
18
  let locale = 'en';
19
19
  if (user && JSON.parse(user).lang) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.16.19",
4
+ "version": "7.17.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -13,7 +13,7 @@ import React from 'react';
13
13
  import _ from 'lodash';
14
14
  // import messages from './messages';
15
15
  const loadScript = require('load-script');
16
- const defaultScriptUrl = "https://ckeditor.com/assets/libs/ckeditor4/4.22.1/ckeditor.js";
16
+ const defaultScriptUrl = "https://crm-nightly-new-fileservice.s3.amazonaws.com/ckeditor_test/ckeditor4/ckeditor.js";
17
17
  const user = localStorage.getItem('user');
18
18
  let locale = 'en';
19
19
  if (user && JSON.parse(user).lang) {
@@ -1,20 +0,0 @@
1
- /*
2
- *
3
- * ChannelTemplates actions
4
- *
5
- */
6
-
7
- import * as types from './constants';
8
-
9
- export function defaultAction() {
10
- return {
11
- type: types.DEFAULT_ACTION,
12
- };
13
- }
14
-
15
- export function getTemplates(channel) {
16
- return {
17
- type: types.GET_TEMPLATES_REQUEST,
18
- channel,
19
- };
20
- }
@@ -1,8 +0,0 @@
1
- /*
2
- *
3
- * ChannelTemplates constants
4
- *
5
- */
6
-
7
- export const DEFAULT_ACTION = 'app/ChannelTemplates/DEFAULT_ACTION';
8
-
@@ -1,47 +0,0 @@
1
- /*
2
- *
3
- * ChannelTemplates
4
- *
5
- */
6
-
7
- import PropTypes from 'prop-types';
8
-
9
- import React from 'react';
10
- import { connect } from 'react-redux';
11
- import { FormattedMessage } from 'react-intl';
12
- import { bindActionCreators } from 'redux';
13
- import { createStructuredSelector } from 'reselect';
14
- import makeSelectChannelTemplates from './selectors';
15
- import * as actions from './actions';
16
- import messages from './messages';
17
-
18
-
19
- export class ChannelTemplates extends React.Component { // eslint-disable-line react/prefer-stateless-function
20
- componentDidMount() {
21
- this.props.actions.getTemplates(this.props.channel);
22
- }
23
- render() {
24
- return (
25
- <CardGrid
26
- cardDataList={[]}
27
- />
28
- );
29
- }
30
- }
31
-
32
- ChannelTemplates.propTypes = {
33
- actions: PropTypes.object.isRequired,
34
- channel: PropTypes.string,
35
- };
36
-
37
- const mapStateToProps = createStructuredSelector({
38
- ChannelTemplates: makeSelectChannelTemplates(),
39
- });
40
-
41
- function mapDispatchToProps(dispatch) {
42
- return {
43
- actions: bindActionCreators(actions, dispatch),
44
- };
45
- }
46
-
47
- export default connect(mapStateToProps, mapDispatchToProps)(ChannelTemplates);
@@ -1,13 +0,0 @@
1
- /*
2
- * ChannelTemplates Messages
3
- *
4
- * This contains all the text for the ChannelTemplates component.
5
- */
6
- import { defineMessages } from 'react-intl';
7
-
8
- export default defineMessages({
9
- header: {
10
- id: 'creatives.containersV2.ChannelTemplates.header',
11
- defaultMessage: 'This is ChannelTemplates container !',
12
- },
13
- });
@@ -1,34 +0,0 @@
1
- /*
2
- *
3
- * ChannelTemplates reducer
4
- *
5
- */
6
-
7
- import { fromJS } from 'immutable';
8
- import * as types from './constants';
9
-
10
- const initialState = fromJS({
11
- loadingTemplates: true,
12
- smsTemplates: [],
13
- emailTemplates: [],
14
- wechatTemplates: [],
15
- mobilepushTemplates: [],
16
- });
17
-
18
- function channelTemplatesReducer(state = initialState, action) {
19
- const channelTemplates = `${action.channel}Templates`;
20
- switch (action.type) {
21
- case types.DEFAULT_ACTION:
22
- return state;
23
- case types.GET_TEMPLATES_REQUEST:
24
- return state.set('loadingTemplates', true);
25
- case types.GET_TEMPLATES_SUCESS:
26
- return state.set('loadingTemplates', false).set(channelTemplates, action.templates);
27
- case types.GET_TEMPLATES_FAILURE:
28
- return state.set('loadingTemplates', false).set('error', action.error);
29
- default:
30
- return state;
31
- }
32
- }
33
-
34
- export default channelTemplatesReducer;
@@ -1,32 +0,0 @@
1
- import { take, takeLatest, call, put, cancel } from 'redux-saga/effects';
2
- import { LOCATION_CHANGE } from 'react-router-redux';
3
- import * as Api from '../../services/api';
4
-
5
-
6
- import * as types from './constants';
7
- // Individual exports for testing
8
- export function* defaultSaga() {
9
- // See example in v2Containers/HomePage/sagas.js
10
- }
11
- function* getTemplates(action) {
12
- try {
13
- const req = {
14
- channel: action.channel,
15
- queryParams: action.query,
16
- };
17
- const res = call(Api.getAllTemplates, req);
18
- put({type: types.GET_TEMPLATES_SUCESS, templates: res.response, channel: action.channel});
19
- } catch (error) {
20
- put({type: types.GET_TEMPLATES_FAILURE, error});
21
- }
22
- }
23
- function* getTemplatesWatcher() {
24
- const watcher = yield takeLatest(types.GET_TEMPLATES_REQUEST, getTemplates);
25
- yield take(LOCATION_CHANGE);
26
- yield cancel(watcher);
27
- }
28
- // All sagas to be loaded
29
- export default [
30
- defaultSaga,
31
- getTemplatesWatcher,
32
- ];
@@ -1,25 +0,0 @@
1
- import { createSelector } from 'reselect';
2
-
3
- /**
4
- * Direct selector to the channelTemplates state domain
5
- */
6
- const selectChannelTemplatesDomain = () => (state) => state.get('templates');
7
-
8
- /**
9
- * Other specific selectors
10
- */
11
-
12
-
13
- /**
14
- * Default selector used by ChannelTemplates
15
- */
16
-
17
- const makeSelectChannelTemplates = () => createSelector(
18
- selectChannelTemplatesDomain(),
19
- (substate) => substate.toJS()
20
- );
21
-
22
- export default makeSelectChannelTemplates;
23
- export {
24
- selectChannelTemplatesDomain,
25
- };
@@ -1,82 +0,0 @@
1
- import { expectSaga } from "redux-saga-test-plan";
2
- import { take, cancel, takeLatest } from "redux-saga/effects";
3
- import * as matchers from "redux-saga-test-plan/matchers";
4
- import { LOCATION_CHANGE } from "react-router-redux";
5
- import { throwError } from "redux-saga-test-plan/providers";
6
- import { createMockTask } from "redux-saga/utils";
7
- import * as types from "../constants";
8
- import { watchAiSuggestions, getAiSuggestions } from "../sagas";
9
- import * as Api from "../../../../services/api";
10
-
11
- describe("getAiSuggestions saga", () => {
12
- it("Should handle valid response from api", () => {
13
- const successCallback = () => {};
14
- const failureCallback = () => {};
15
- const action = {
16
- type: types.GET_AI_SUGGESTIONS,
17
- prompt: {},
18
- successCallback,
19
- failureCallback,
20
- };
21
- expectSaga(getAiSuggestions, action)
22
- .provide([
23
- [
24
- matchers.call.fn(Api.getAiSuggestions),
25
- {
26
- success: true,
27
- status: {
28
- isError: false,
29
- code: 200,
30
- message: "success",
31
- },
32
- message: "Meta data fetched successfully",
33
- response: {
34
- "https://response.com": 1400,
35
- },
36
- },
37
- ],
38
- [matchers.call.fn(successCallback)],
39
- ])
40
- .run();
41
- });
42
-
43
- it("Should handles error thrown from api", () => {
44
- const successCallback = () => {};
45
- const failureCallback = () => {};
46
- const action = {
47
- type: types.GET_AI_SUGGESTIONS,
48
- prompt: {},
49
- successCallback,
50
- failureCallback,
51
- };
52
- expectSaga(getAiSuggestions, action)
53
- .provide([[matchers.call.fn(Api.getAiSuggestions), throwError()]])
54
- .run();
55
- });
56
- });
57
-
58
- describe("watchAiSuggestions saga", () => {
59
- let generator = null;
60
- beforeEach(() => {
61
- generator = watchAiSuggestions();
62
- });
63
- it("Should handle valid response from api", () => {
64
- const progress1 = generator.next();
65
- const mockTask = takeLatest(types.GET_AI_SUGGESTIONS, getAiSuggestions);
66
- expect(progress1.value).toEqual(mockTask);
67
- const progress2 = generator.next();
68
- expect(progress2.value).toEqual(take(LOCATION_CHANGE));
69
- });
70
-
71
- it("Should handle LOCATION_CHANGE action and cancel the watcher", () => {
72
- generator = watchAiSuggestions();
73
- const mockTask = createMockTask();
74
-
75
- expect(generator.next().value).toEqual(
76
- takeLatest(types.GET_AI_SUGGESTIONS, getAiSuggestions)
77
- );
78
- expect(generator.next(mockTask).value).toEqual(take(LOCATION_CHANGE));
79
- expect(generator.next().value).toEqual(cancel(mockTask));
80
- expect(generator.next().done).toEqual(true);
81
- });
82
- });