@capillarytech/creatives-library 7.9.13 → 7.9.15

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 (45) hide show
  1. package/assets/group.png +0 -0
  2. package/components/Card/index.js +1 -1
  3. package/components/Card/tests/__snapshots__/index.test.js.snap +22 -0
  4. package/components/Card/tests/index.test.js +19 -7
  5. package/containers/App/constants.js +2 -1
  6. package/helpers/intl-enzym-test-helpers.js +40 -0
  7. package/index.js +6 -0
  8. package/package.json +3 -2
  9. package/routes.js +5 -0
  10. package/services/api.js +9 -15
  11. package/utils/common.js +17 -4
  12. package/v2Components/CapTagList/index.js +38 -9
  13. package/v2Components/CapTagList/messages.js +4 -0
  14. package/v2Containers/Cap/constants.js +2 -0
  15. package/v2Containers/Cap/index.js +9 -2
  16. package/v2Containers/Cap/reducer.js +5 -1
  17. package/v2Containers/Cap/selectors.js +10 -1
  18. package/v2Containers/CreativesContainer/SlideBoxContent.js +10 -4
  19. package/v2Containers/CreativesContainer/SlideBoxHeader.js +6 -1
  20. package/v2Containers/CreativesContainer/messages.js +4 -0
  21. package/v2Containers/FTP/index.js +14 -4
  22. package/v2Containers/Sms/Create/index.js +5 -6
  23. package/v2Containers/Sms/Edit/sagas.js +1 -1
  24. package/v2Containers/SmsTrai/Create/actions.js +25 -0
  25. package/v2Containers/SmsTrai/Create/constants.js +74 -0
  26. package/v2Containers/SmsTrai/Create/index.js +681 -0
  27. package/v2Containers/SmsTrai/Create/index.scss +92 -0
  28. package/v2Containers/SmsTrai/Create/messages.js +116 -0
  29. package/v2Containers/SmsTrai/Create/reducer.js +43 -0
  30. package/v2Containers/SmsTrai/Create/sagas.js +36 -0
  31. package/v2Containers/SmsTrai/Create/selectors.js +26 -0
  32. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +10351 -0
  33. package/v2Containers/SmsTrai/Create/tests/index.test.js +77 -0
  34. package/v2Containers/SmsTrai/Create/tests/mockData.js +58 -0
  35. package/v2Containers/SmsTrai/Edit/constants.js +16 -0
  36. package/v2Containers/SmsTrai/Edit/index.js +483 -0
  37. package/v2Containers/SmsTrai/Edit/messages.js +58 -0
  38. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +16103 -0
  39. package/v2Containers/SmsTrai/Edit/tests/index.test.js +61 -0
  40. package/v2Containers/SmsTrai/Edit/tests/mockData.js +36 -0
  41. package/v2Containers/SmsWrapper/index.js +75 -0
  42. package/v2Containers/SmsWrapper/tests/index.test.js +10 -0
  43. package/v2Containers/Templates/_templates.scss +2 -0
  44. package/v2Containers/Templates/index.js +89 -27
  45. package/v2Containers/Templates/messages.js +16 -0
@@ -0,0 +1,92 @@
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables';
2
+
3
+ .upload-type-group-create-container {
4
+ .upload-file-title {
5
+ margin-bottom: 10px;
6
+ }
7
+ .file-drop-zone {
8
+ height: 285px;
9
+ border: 1px dashed $CAP_G06;
10
+ &:focus {
11
+ outline: none;
12
+ }
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ cursor: pointer;
17
+ text-align: center;
18
+ }
19
+ .drop-zone-text-1 {
20
+ margin-top: 8px;
21
+ }
22
+ .drop-zone-text-2 {
23
+ margin-top: 12px;
24
+ }
25
+ .drop-zone-text-3 {
26
+ margin-top: 13px;
27
+ }
28
+ .upload-file-preview-divider-1 {
29
+ margin-bottom: $CAP_SPACE_12;
30
+ margin-top: 5px;
31
+ }
32
+ .upload-file-preview-divider-2 {
33
+ margin-top: $CAP_SPACE_12;
34
+ margin-bottom: 2px;
35
+ }
36
+ .number-of-records {
37
+ margin-left: 7px;
38
+ }
39
+ .upload-failed-container {
40
+ display: flex;
41
+ align-items: flex-end;
42
+ justify-content: flex-end;
43
+ .upload-failed-message {
44
+ display: contents;
45
+ }
46
+ .upload-failed-icon {
47
+ margin-left: 2px;
48
+ }
49
+ }
50
+ .validation-count-container {
51
+ display: flex;
52
+ .validation-count-label {
53
+ display: contents;
54
+ }
55
+ .validation-count-icon {
56
+ margin-left: 2px;
57
+ }
58
+ }
59
+ .delete-csv {
60
+ display: flex;
61
+ justify-content: flex-end;
62
+ bottom: -5px;
63
+ }
64
+ .upload-instructions-container {
65
+ padding-left: $CAP_SPACE_32;
66
+ margin-top: 30px;
67
+
68
+ .upload-instruction-list {
69
+ list-style-type: none;
70
+ padding-left: 0;
71
+ .instruction {
72
+ margin-top: 30px;
73
+ .instruction-num {
74
+ display: inline-block;
75
+ width: 30px;
76
+ height: 30px;
77
+ background: #dfe2e7;
78
+ border-radius: 50%;
79
+ display: inline-flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+ font-size: 12px;
83
+ margin-right: 8px;
84
+ }
85
+
86
+ a:link {
87
+ text-decoration: none;
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
@@ -0,0 +1,116 @@
1
+ /*
2
+ * SmsTrai Messages
3
+ *
4
+ * This contains all the text for the SmsTrai component.
5
+ */
6
+ import { defineMessages } from 'react-intl';
7
+ const prefix = 'app.v2containers.SmsTrai.Create';
8
+
9
+ export default defineMessages({
10
+ uploadFile: {
11
+ id: `${prefix}.uploadFile`,
12
+ defaultMessage: 'Upload file',
13
+ },
14
+ dropCsvFile: {
15
+ id: `${prefix}.dropCsvFile`,
16
+ defaultMessage: 'Drag and drop a CSV file here',
17
+ },
18
+ or: {
19
+ id: `${prefix}.or`,
20
+ defaultMessage: 'OR',
21
+ },
22
+ selectFileFromComputer: {
23
+ id: `${prefix}.selectFileFromComputer`,
24
+ defaultMessage: 'Select a file from computer',
25
+ },
26
+ numberOfRecords: {
27
+ id: `${prefix}.numberOfRecords`,
28
+ defaultMessage: '{value, number} Record{value, plural, one {} other {s}}',
29
+ },
30
+ sampleCsv: {
31
+ id: `${prefix}.sampleCsv`,
32
+ defaultMessage: 'Sample CSV',
33
+ },
34
+ uploadInstructions: {
35
+ id: `${prefix}.uploadInstructions`,
36
+ defaultMessage: 'Upload Instructions',
37
+ },
38
+ downloadInstruction: {
39
+ id: `${prefix}.downloadInstruction`,
40
+ defaultMessage: 'Download {link} file',
41
+ },
42
+ firstRowInstruction: {
43
+ id: `${prefix}.firstRowInstruction`,
44
+ defaultMessage:
45
+ 'Please ensure that each template has the following mandatory fields: Template name,Template ID, Type, Sender ID, Approval status, Template message.',
46
+ },
47
+ secondRowInstruction: {
48
+ id: `${prefix}.secondRowInstruction`,
49
+ defaultMessage: 'Only the "Approved" templates will be uploaded.',
50
+ },
51
+ duplicateEntriesInstruction: {
52
+ id: `${prefix}.duplicateEntriesInstruction`,
53
+ defaultMessage: 'Duplicate entries will be overwritten.',
54
+ },
55
+ fileMinlengthError: {
56
+ id: `${prefix}.fileMinlengthError`,
57
+ defaultMessage: 'Please select a csv file with minimum 1 template.',
58
+ },
59
+ fileMaxlengthError: {
60
+ id: `${prefix}.fileMaxlengthError`,
61
+ defaultMessage:
62
+ 'More then 500 records are not allowed for the selected file.',
63
+ },
64
+ invalidFileErrorDescription: {
65
+ id: `${prefix}.invalidFileErrorDescription`,
66
+ defaultMessage: 'Mandatory fields ({columns}) are required for templates.',
67
+ },
68
+ repetitiveColsErrorDescription: {
69
+ id: `${prefix}.repetitiveColsErrorDescription`,
70
+ defaultMessage:
71
+ 'Please remove repetitive fields ({repetitiveCols}) from the file.',
72
+ },
73
+ headerAliasErrorDescription: {
74
+ id: `${prefix}.headerAliasErrorDescription`,
75
+ defaultMessage:
76
+ 'Please include mandatory field header. It can be {headerAliases}.',
77
+ },
78
+ templateIdAliasErrorDescription: {
79
+ id: `${prefix}.templateIdAliasErrorDescription`,
80
+ defaultMessage:
81
+ 'Please include mandatory field template id. It can be {templateIdAliases}.',
82
+ },
83
+ templateMessageAliasErrorDescription: {
84
+ id: `${prefix}.templateMessageAliasErrorDescription`,
85
+ defaultMessage:
86
+ 'Please include mandatory field template message. It can be {templateMessageAliases}.',
87
+ },
88
+ nonCsvErrorDescription: {
89
+ id: `${prefix}.nonCsvErrorDescription`,
90
+ defaultMessage: 'Please select a csv file.',
91
+ },
92
+ doneButtonLabel: {
93
+ id: `${prefix}.doneButtonLabel`,
94
+ defaultMessage: 'Done',
95
+ },
96
+ failedToUpload: {
97
+ id: `${prefix}.failedToUpload`,
98
+ defaultMessage: 'Failed to upload',
99
+ },
100
+ passedVal: {
101
+ id: `${prefix}.passedVal`,
102
+ defaultMessage: '{number} passed ',
103
+ },
104
+ failedVal: {
105
+ id: `${prefix}.failedVal`,
106
+ defaultMessage: '{number} failed ',
107
+ },
108
+ downloadIssues: {
109
+ id: `${prefix}.downloadIssues`,
110
+ defaultMessage: 'Download issues',
111
+ },
112
+ smsCreateNotification: {
113
+ id: `${prefix}.smsCreateNotification`,
114
+ defaultMessage: 'Sms templates created successfully',
115
+ },
116
+ });
@@ -0,0 +1,43 @@
1
+ /*
2
+ *
3
+ * SmsTrai reducer
4
+ *
5
+ */
6
+
7
+ import { fromJS } from 'immutable';
8
+ import {
9
+ CREATE_TRAI_SMS_TEMPLATE_REQUEST,
10
+ CREATE_TRAI_SMS_TEMPLATE_SUCCESS,
11
+ CREATE_TRAI_SMS_TEMPLATE_FAILURE,
12
+ CLEAR_TRAI_SMS_TEMPLATE_CREATE_RESPONSE_REQUEST,
13
+ } from './constants';
14
+
15
+ const initialState = fromJS({
16
+ createTemplateInProgress: false,
17
+ });
18
+
19
+ function smsTraiReducer(state = initialState, action) {
20
+ switch (action.type) {
21
+ case CREATE_TRAI_SMS_TEMPLATE_REQUEST:
22
+ return state
23
+ .set('createTemplateInProgress', true)
24
+ .set('createTemplateError', false)
25
+ .set('createTemplateErrorMessage', fromJS(""));
26
+ case CREATE_TRAI_SMS_TEMPLATE_SUCCESS:
27
+ return state.set('createTemplateInProgress', false)
28
+ .set('response', action.data)
29
+ .set('createTemplateError', (action.statusCode !== undefined && action.statusCode > 300))
30
+ .set('createTemplateErrorMessage', fromJS(action.errorMsg));
31
+ case CREATE_TRAI_SMS_TEMPLATE_FAILURE:
32
+ return state
33
+ .set('createTemplateInProgress', false)
34
+ .set('createTemplateError', true)
35
+ .set('createTemplateErrorMessage', fromJS(action.errorMsg));
36
+ case CLEAR_TRAI_SMS_TEMPLATE_CREATE_RESPONSE_REQUEST:
37
+ return state.set('response', {});
38
+ default:
39
+ return state;
40
+ }
41
+ }
42
+
43
+ export default smsTraiReducer;
@@ -0,0 +1,36 @@
1
+ import { take, cancel, call, put, takeLatest } 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* createTraiSMSTemplates({templates, callback }) {
7
+ let errorMsg;
8
+ try {
9
+ const result = yield call(Api.createBulkSMSTemplate, templates);
10
+ if (result?.status?.code && result.status.code >= 400) {
11
+ errorMsg = result.message;
12
+ throw errorMsg;
13
+ }
14
+ yield put({ type: types.CREATE_TRAI_SMS_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
15
+
16
+ if (callback) {
17
+ callback(result.response);
18
+ }
19
+ } catch (error) {
20
+ yield put({ type: types.CREATE_TRAI_SMS_TEMPLATE_FAILURE, error, errorMsg });
21
+ if (callback) {
22
+ callback(null, errorMsg);
23
+ }
24
+ }
25
+ }
26
+
27
+ function* watchCreateTemplate() {
28
+ const watcher = yield takeLatest(types.CREATE_TRAI_SMS_TEMPLATE_REQUEST, createTraiSMSTemplates);
29
+ yield take(LOCATION_CHANGE);
30
+ yield cancel(watcher);
31
+ }
32
+
33
+ export default [
34
+ watchCreateTemplate,
35
+ ];
36
+
@@ -0,0 +1,26 @@
1
+ import { createSelector } from 'reselect';
2
+
3
+ /**
4
+ * Direct selector to the smsTrai state domain
5
+ */
6
+ const selectSmsTraiDomain = () => (state) => state.get('smsTrai');
7
+
8
+ /**
9
+ * Other specific selectors
10
+ */
11
+
12
+
13
+ /**
14
+ * Default selector used by SmsTrai
15
+ */
16
+
17
+ const makeSelectSmsTrai = () => createSelector(
18
+ selectSmsTraiDomain(),
19
+ (substate) => substate.toJS()
20
+ );
21
+
22
+ export default makeSelectSmsTrai;
23
+
24
+ export {
25
+ selectSmsTraiDomain,
26
+ };