@capillarytech/creatives-library 6.8.4 → 6.8.5

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 (53) hide show
  1. package/app.js +1 -0
  2. package/package.json +1 -1
  3. package/utils/tagValidations.js +137 -0
  4. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +151 -151
  5. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +33 -33
  6. package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/tests/index.test.js +10 -10
  7. package/v2Components/TemplatePreview/_templatePreview.scss +380 -380
  8. package/v2Components/TemplatePreview/assets/images/androidPushMessage.svg +44 -44
  9. package/v2Components/TemplatePreview/assets/images/home-screen-android.svg +21 -21
  10. package/v2Components/TemplatePreview/assets/images/home-screen-ios.svg +16 -16
  11. package/v2Components/TemplatePreview/assets/images/iPhonePushMessage.svg +134 -134
  12. package/v2Components/TemplatePreview/assets/images/mobile.svg +23 -23
  13. package/v2Components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -22
  14. package/v2Components/TemplatePreview/assets/images/user-icon.svg +18 -18
  15. package/v2Components/TemplatePreview/assets/images/wechat-home-screen-android.svg +21 -21
  16. package/v2Components/TemplatePreview/assets/images/wechat-mobile.svg +77 -77
  17. package/v2Components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -20
  18. package/v2Components/TemplatePreview/tests/index.test.js +10 -10
  19. package/v2Containers/CreativesContainer/SlideBoxFooter.js +51 -51
  20. package/v2Containers/CreativesContainer/actions.js +27 -27
  21. package/v2Containers/CreativesContainer/constants.js +17 -17
  22. package/v2Containers/CreativesContainer/index.scss +44 -44
  23. package/v2Containers/CreativesContainer/messages.js +305 -305
  24. package/v2Containers/CreativesContainer/reducer.js +29 -29
  25. package/v2Containers/CreativesContainer/sagas.js +11 -11
  26. package/v2Containers/CreativesContainer/selectors.js +30 -30
  27. package/v2Containers/CreativesContainer/tests/actions.test.js +18 -18
  28. package/v2Containers/CreativesContainer/tests/index.test.js +10 -10
  29. package/v2Containers/CreativesContainer/tests/reducer.test.js +9 -9
  30. package/v2Containers/CreativesContainer/tests/sagas.test.js +15 -15
  31. package/v2Containers/CreativesContainer/tests/selectors.test.js +10 -10
  32. package/v2Containers/Line/Container/Text/index.js +19 -4
  33. package/v2Containers/Line/Container/Text/messages.js +4 -0
  34. package/v2Containers/Templates/_templates.scss +405 -405
  35. package/v2Containers/Templates/actions.js +117 -117
  36. package/v2Containers/Templates/constants.js +47 -47
  37. package/v2Containers/Templates/reducer.js +145 -145
  38. package/v2Containers/Templates/sagas.js +179 -179
  39. package/v2Containers/Templates/tests/actions.test.js +18 -18
  40. package/v2Containers/Templates/tests/index.test.js +10 -10
  41. package/v2Containers/Templates/tests/reducer.test.js +9 -9
  42. package/v2Containers/Templates/tests/sagas.test.js +15 -15
  43. package/v2Containers/Templates/tests/selectors.test.js +10 -10
  44. package/v2Containers/TemplatesV2/TemplatesV2.style.js +29 -29
  45. package/v2Containers/TemplatesV2/actions.js +16 -16
  46. package/v2Containers/TemplatesV2/constants.js +10 -10
  47. package/v2Containers/TemplatesV2/messages.js +61 -61
  48. package/v2Containers/TemplatesV2/selectors.js +25 -25
  49. package/v2Containers/TemplatesV2/tests/actions.test.js +18 -18
  50. package/v2Containers/TemplatesV2/tests/index.test.js +10 -10
  51. package/v2Containers/TemplatesV2/tests/reducer.test.js +9 -9
  52. package/v2Containers/TemplatesV2/tests/sagas.test.js +15 -15
  53. package/v2Containers/TemplatesV2/tests/selectors.test.js +10 -10
@@ -1,11 +1,11 @@
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
+ // 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,30 +1,30 @@
1
- import { createSelector } from 'reselect';
2
-
3
- /**
4
- * Direct selector to the creativesContainer state domain
5
- */
6
- const selectCreativesContainerDomain = () => (state) => state.get('creativesContainer');
7
-
8
- /**
9
- * Other specific selectors
10
- */
11
-
12
-
13
- /**
14
- * Default selector used by CreativesContainer
15
- */
16
-
17
- const makeSelectCreativesContainer = () => createSelector(
18
- selectCreativesContainerDomain(),
19
- (substate) => substate.toJS()
20
- );
21
- const isLoading = () => createSelector(
22
- makeSelectCreativesContainer(),
23
- (substate) => substate.containerLoader
24
- );
25
-
26
- export default makeSelectCreativesContainer;
27
- export {
28
- selectCreativesContainerDomain,
29
- isLoading,
30
- };
1
+ import { createSelector } from 'reselect';
2
+
3
+ /**
4
+ * Direct selector to the creativesContainer state domain
5
+ */
6
+ const selectCreativesContainerDomain = () => (state) => state.get('creativesContainer');
7
+
8
+ /**
9
+ * Other specific selectors
10
+ */
11
+
12
+
13
+ /**
14
+ * Default selector used by CreativesContainer
15
+ */
16
+
17
+ const makeSelectCreativesContainer = () => createSelector(
18
+ selectCreativesContainerDomain(),
19
+ (substate) => substate.toJS()
20
+ );
21
+ const isLoading = () => createSelector(
22
+ makeSelectCreativesContainer(),
23
+ (substate) => substate.containerLoader
24
+ );
25
+
26
+ export default makeSelectCreativesContainer;
27
+ export {
28
+ selectCreativesContainerDomain,
29
+ isLoading,
30
+ };
@@ -1,18 +1,18 @@
1
-
2
- import {
3
- defaultAction,
4
- } from '../actions';
5
- import {
6
- DEFAULT_ACTION,
7
- } from '../constants';
8
-
9
- describe('CreativesContainer 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
- });
1
+
2
+ import {
3
+ defaultAction,
4
+ } from '../actions';
5
+ import {
6
+ DEFAULT_ACTION,
7
+ } from '../constants';
8
+
9
+ describe('CreativesContainer 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
+ });
@@ -1,10 +1,10 @@
1
- // import React from 'react';
2
- // import { shallow } from 'enzyme';
3
-
4
- // import { CreativesContainer } from '../index';
5
-
6
- describe('<CreativesContainer />', () => {
7
- it('Expect to have unit tests specified', () => {
8
- expect(true).toEqual(true);
9
- });
10
- });
1
+ // import React from 'react';
2
+ // import { shallow } from 'enzyme';
3
+
4
+ // import { CreativesContainer } from '../index';
5
+
6
+ describe('<CreativesContainer />', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(true);
9
+ });
10
+ });
@@ -1,9 +1,9 @@
1
-
2
- import { fromJS } from 'immutable';
3
- import creativesContainerReducer from '../reducer';
4
-
5
- describe('creativesContainerReducer', () => {
6
- it('returns the initial state', () => {
7
- expect(creativesContainerReducer(undefined, {})).toEqual(fromJS({}));
8
- });
9
- });
1
+
2
+ import { fromJS } from 'immutable';
3
+ import creativesContainerReducer from '../reducer';
4
+
5
+ describe('creativesContainerReducer', () => {
6
+ it('returns the initial state', () => {
7
+ expect(creativesContainerReducer(undefined, {})).toEqual(fromJS({}));
8
+ });
9
+ });
@@ -1,15 +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(true);
14
- });
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(true);
14
+ });
15
+ });
@@ -1,10 +1,10 @@
1
- // import { fromJS } from 'immutable';
2
- // import { makeSelectCreativesContainerDomain } from '../selectors';
3
-
4
- // const selector = makeSelectCreativesContainerDomain();
5
-
6
- describe('makeSelectCreativesContainerDomain', () => {
7
- it('Expect to have unit tests specified', () => {
8
- expect(true).toEqual(true);
9
- });
10
- });
1
+ // import { fromJS } from 'immutable';
2
+ // import { makeSelectCreativesContainerDomain } from '../selectors';
3
+
4
+ // const selector = makeSelectCreativesContainerDomain();
5
+
6
+ describe('makeSelectCreativesContainerDomain', () => {
7
+ it('Expect to have unit tests specified', () => {
8
+ expect(true).toEqual(true);
9
+ });
10
+ });
@@ -15,6 +15,8 @@ import messages from './messages';
15
15
  import style from './style';
16
16
  import withStyles from '../../../../hoc/withStyles';
17
17
 
18
+ import { validateTags } from '../../../../utils/tagValidations';
19
+
18
20
  const { TextArea } = CapInput;
19
21
  const {CapCustomCardList} = CapCustomCard;
20
22
 
@@ -71,7 +73,7 @@ export const LineText = ({
71
73
  useEffect(() => {
72
74
  if (messageContent && (isFullMode ? messageTitle : true)) {
73
75
  updateMessageState({
74
- isError: (messageContent.length > charLimit) || (!messageContent || !(isFullMode ? messageTitle : true) || (errorMessageTextarea && errorMessageTitle)),
76
+ isError: (messageContent.length > charLimit) || (!messageContent || !(isFullMode ? messageTitle : true) || (errorMessageTextarea || errorMessageTitle)),
75
77
  messageContent,
76
78
  messageTitle,
77
79
  index,
@@ -116,10 +118,19 @@ export const LineText = ({
116
118
 
117
119
  const updateTextContentError = (value) => {
118
120
  let errorMessage = false;
121
+ const { valid } = validateTags({
122
+ content: value,
123
+ tagsParam: tags,
124
+ injectedTagsParams: injectedTags,
125
+ location,
126
+ tagModule: 'outbound',
127
+ }) || {};
119
128
  if (value === '') {
120
129
  errorMessage = formatMessage(messages.emptyTitleErrorMessage);
121
130
  } else if (value.length > charLimit) {
122
131
  errorMessage = formatMessage(messages.limitExceededContentErrorMessage);
132
+ } else if (!valid && !isFullMode) {
133
+ errorMessage = formatMessage(messages.invalidTagError);
123
134
  }
124
135
  updateErrorMessageTextArea(errorMessage);
125
136
  }
@@ -128,7 +139,7 @@ export const LineText = ({
128
139
  updateTextMessageContent(value);
129
140
  updateTextContentError(value);
130
141
  updateMessageState({
131
- isError: (value.length > charLimit) || (!value || !(isFullMode ? messageTitle : true) || (!value && errorMessageTitle)),
142
+ isError: (value.length > charLimit) || (!value || !(isFullMode ? messageTitle : true) || (!value || errorMessageTitle)),
132
143
  messageContent: value,
133
144
  messageTitle,
134
145
  index,
@@ -149,7 +160,7 @@ export const LineText = ({
149
160
  updateTextMessageTitle(value);
150
161
  updateTextTitleError(value);
151
162
  updateMessageState({
152
- isError: (messageContent.length > charLimit) || (!messageContent || !(isFullMode ? value : true) || (!value && errorMessageTextarea)),
163
+ isError: (messageContent.length > charLimit) || (!messageContent || !(isFullMode ? value : true) || (!value || errorMessageTextarea)),
153
164
  messageContent,
154
165
  messageTitle: value,
155
166
  index,
@@ -158,7 +169,11 @@ export const LineText = ({
158
169
  });
159
170
  }
160
171
 
161
- const onTagSelect = (data) => updateTextMessageContent(`${messageContent}{{${data}}}`);
172
+ const onTagSelect = (data) => {
173
+ const messageData = `${messageContent}{{${data}}}`;
174
+ updateTextMessageContent(messageData);
175
+ updateTextContentError(messageData);
176
+ }
162
177
 
163
178
  const setNewContent = () => updateCreateNew(true);
164
179
 
@@ -71,4 +71,8 @@ export default defineMessages({
71
71
  id: `${scope}.searchText`,
72
72
  defaultMessage: 'Search Text',
73
73
  },
74
+ "invalidTagError": {
75
+ id: `${scope}.invalidTagError`,
76
+ defaultMessage: 'Please check the message content for unsupported/missing tags',
77
+ },
74
78
  });