@capillarytech/creatives-library 7.10.40 → 7.10.41

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.
@@ -4,15 +4,21 @@
4
4
  margin-top: $CAP_SPACE_16;
5
5
  margin-bottom: 6px;
6
6
  }
7
- .whatsapp-render-unsubscribe-text {
7
+ .whatsapp-template-name-desc {
8
+ margin-bottom: 6px;
9
+ }
10
+ .whatsapp-create-render-unsubscribe-text {
8
11
  color: $FONT_COLOR_02;
9
12
  margin: $CAP_SPACE_08 0px $CAP_SPACE_08 16px;
10
13
  }
14
+ .whatsapp-edit-render-unsubscribe-text {
15
+ color: $FONT_COLOR_02;
16
+ }
11
17
  .whatsapp-render-message-length {
12
18
  text-align: right;
13
19
  }
14
- .whatsapp-template-message-input {
15
- background-color: $BG_01;
20
+ .whatsapp-create-template-message-input {
21
+ background-color: #fafbfc;
16
22
  padding-top: $CAP_SPACE_16;
17
23
  }
18
24
  .whatsapp-template-message-error {
@@ -22,7 +28,25 @@
22
28
  .whatsapp-scroll-div {
23
29
  margin-bottom: 250px;
24
30
  }
25
- #whatsapp-template-message-input {
31
+ .whatsapp-category-tag {
32
+ margin-left: 8px;
33
+ }
34
+ .whatsapp-edit-alert-margin {
35
+ margin-top: 46px;
36
+ }
37
+ .whatsapp-edit-template-message-input {
38
+ background-color: #fafbfc;
39
+ padding: 0 $CAP_SPACE_16;
40
+ }
41
+ .whatsapp-edit-template-message-heading {
42
+ margin-top: $CAP_SPACE_16;
43
+ margin-bottom: $CAP_SPACE_08;
44
+ }
45
+ .whatsapp-edit-disabled {
46
+ cursor: not-allowed;
47
+ opacity: 0.4;
48
+ }
49
+ #whatsapp-create-template-message-input {
26
50
  margin-left: $CAP_SPACE_16;
27
51
  margin-right: $CAP_SPACE_16;
28
52
  width: 95%;
@@ -30,7 +54,3 @@
30
54
  #select-whatsapp-category {
31
55
  width: 100%;
32
56
  }
33
-
34
- .whatsapp-category-tag {
35
- margin-left: 8px;
36
- }
@@ -181,4 +181,41 @@ export default defineMessages({
181
181
  id: `${prefix}.rejected`,
182
182
  defaultMessage: 'Rejected',
183
183
  },
184
+ languageLabel: {
185
+ id: `${prefix}.languageLabel`,
186
+ defaultMessage: 'Language',
187
+ },
188
+ labelSeperator: {
189
+ id: `${prefix}.labelSeperator`,
190
+ defaultMessage: '|',
191
+ },
192
+ approvedStatusMsg: {
193
+ id: `${prefix}.approvedStatusMsg`,
194
+ defaultMessage: 'This template has been approved',
195
+ },
196
+ rejectedStatusMsg: {
197
+ id: `${prefix}.rejectedStatusMsg`,
198
+ defaultMessage: 'This template has been rejected',
199
+ },
200
+ awaitingStatusMsg: {
201
+ id: `${prefix}.awaitingStatusMsg`,
202
+ defaultMessage: 'This template is awaiting approval',
203
+ },
204
+ awaitingStatusDesc: {
205
+ id: `${prefix}.awaitingStatusDesc`,
206
+ defaultMessage:
207
+ 'The template has been sent for approval at {date}, {time}. It takes up to 48 hrs to get approved.',
208
+ },
209
+ addLabels: {
210
+ id: `${prefix}.addLabels`,
211
+ defaultMessage: 'Add labels',
212
+ },
213
+ inputplaceHolderText: {
214
+ id: `${prefix}.inputplaceHolderText`,
215
+ defaultMessage: '{value} Add labels or text or combination of both',
216
+ },
217
+ disabledEditTooltip: {
218
+ id: `${prefix}.disabledEditTooltip`,
219
+ defaultMessage: 'This template is non-editable as this is {status}',
220
+ },
184
221
  });
@@ -1,21 +1,25 @@
1
1
  import { fromJS } from 'immutable';
2
2
  import {
3
- WHATSAPP_TEMPLATE_CREATE_REQUEST,
4
- WHATSAPP_TEMPLATE_CREATE_SUCCESS,
5
- WHATSAPP_TEMPLATE_CREATE_FAILURE,
6
- CLEAR_WHATSAPP_TEMPLATE_REQUEST,
3
+ TEMPLATE_CREATE_REQUEST,
4
+ TEMPLATE_CREATE_SUCCESS,
5
+ TEMPLATE_CREATE_FAILURE,
6
+ CLEAR_CREATE_RESPONSE_REQUEST,
7
+ GET_TEMPLATE_DETAILS_REQUEST,
8
+ GET_TEMPLATE_DETAILS_SUCCESS,
9
+ GET_TEMPLATE_DETAILS_FAILURE,
10
+ RESET_EDIT_TEMPLATE,
7
11
  } from './constants';
8
12
 
9
13
  const initialState = fromJS({ createTemplateInProgress: false });
10
14
 
11
15
  function whatsappReducer(state = initialState, action) {
12
16
  switch (action.type) {
13
- case WHATSAPP_TEMPLATE_CREATE_REQUEST:
17
+ case TEMPLATE_CREATE_REQUEST:
14
18
  return state
15
19
  .set('createTemplateInProgress', true)
16
20
  .set('createTemplateError', false)
17
21
  .set('createTemplateErrorMessage', fromJS(''));
18
- case WHATSAPP_TEMPLATE_CREATE_SUCCESS:
22
+ case TEMPLATE_CREATE_SUCCESS:
19
23
  return state
20
24
  .set('createTemplateInProgress', false)
21
25
  .set('response', action.data)
@@ -24,13 +28,24 @@ function whatsappReducer(state = initialState, action) {
24
28
  action.statusCode !== undefined && action.statusCode > 300,
25
29
  )
26
30
  .set('createTemplateErrorMessage', fromJS(action.errorMsg));
27
- case WHATSAPP_TEMPLATE_CREATE_FAILURE:
31
+ case TEMPLATE_CREATE_FAILURE:
28
32
  return state
29
33
  .set('createTemplateInProgress', false)
30
34
  .set('createTemplateError', true)
31
35
  .set('createTemplateErrorMessage', fromJS(action.errorMsg));
32
- case CLEAR_WHATSAPP_TEMPLATE_REQUEST:
36
+ case CLEAR_CREATE_RESPONSE_REQUEST:
33
37
  return state.set('response', {});
38
+ // FOR EDIT
39
+ case GET_TEMPLATE_DETAILS_REQUEST:
40
+ return state.set('getTemplateDetailsInProgress', true);
41
+ case GET_TEMPLATE_DETAILS_SUCCESS:
42
+ return state
43
+ .set('getTemplateDetailsInProgress', false)
44
+ .set('templateDetails', action.data);
45
+ case GET_TEMPLATE_DETAILS_FAILURE:
46
+ return state.set('getTemplateDetailsInProgress', false);
47
+ case RESET_EDIT_TEMPLATE:
48
+ return state.set('templateDetails', {});
34
49
  default:
35
50
  return state;
36
51
  }
@@ -2,9 +2,13 @@ import { take, cancel, call, put, takeLatest } from 'redux-saga/effects';
2
2
  import { LOCATION_CHANGE } from 'react-router-redux';
3
3
  import * as Api from '../../services/api';
4
4
  import {
5
- WHATSAPP_TEMPLATE_CREATE_REQUEST,
6
- WHATSAPP_TEMPLATE_CREATE_SUCCESS,
7
- WHATSAPP_TEMPLATE_CREATE_FAILURE,
5
+ TEMPLATE_CREATE_REQUEST,
6
+ TEMPLATE_CREATE_SUCCESS,
7
+ TEMPLATE_CREATE_FAILURE,
8
+ WHATSAPP,
9
+ GET_TEMPLATE_DETAILS_REQUEST,
10
+ GET_TEMPLATE_DETAILS_SUCCESS,
11
+ GET_TEMPLATE_DETAILS_FAILURE,
8
12
  } from './constants';
9
13
 
10
14
  export function* sendForApprovalCreate({ payload, callback }) {
@@ -16,7 +20,7 @@ export function* sendForApprovalCreate({ payload, callback }) {
16
20
  throw errorMsg;
17
21
  }
18
22
  yield put({
19
- type: WHATSAPP_TEMPLATE_CREATE_SUCCESS,
23
+ type: TEMPLATE_CREATE_SUCCESS,
20
24
  data: result.response,
21
25
  statusCode: result.status ? result.status.code : '',
22
26
  errorMsg,
@@ -26,7 +30,7 @@ export function* sendForApprovalCreate({ payload, callback }) {
26
30
  }
27
31
  } catch (error) {
28
32
  yield put({
29
- type: WHATSAPP_TEMPLATE_CREATE_FAILURE,
33
+ type: TEMPLATE_CREATE_FAILURE,
30
34
  error,
31
35
  errorMsg,
32
36
  });
@@ -38,11 +42,36 @@ export function* sendForApprovalCreate({ payload, callback }) {
38
42
 
39
43
  function* watchCreateTemplate() {
40
44
  const watcher = yield takeLatest(
41
- WHATSAPP_TEMPLATE_CREATE_REQUEST,
45
+ TEMPLATE_CREATE_REQUEST,
42
46
  sendForApprovalCreate,
43
47
  );
44
48
  yield take(LOCATION_CHANGE);
45
49
  yield cancel(watcher);
46
50
  }
47
51
 
48
- export default [watchCreateTemplate];
52
+ // FOR EDIT
53
+ export function* getTemplateDetails({ id }) {
54
+ try {
55
+ const result = yield call(Api.getTemplateDetails, {
56
+ id,
57
+ channel: WHATSAPP,
58
+ });
59
+ yield put({
60
+ type: GET_TEMPLATE_DETAILS_SUCCESS,
61
+ data: result.response,
62
+ });
63
+ } catch (error) {
64
+ yield put({ type: GET_TEMPLATE_DETAILS_FAILURE, error });
65
+ }
66
+ }
67
+
68
+ function* watchGetTemplateDetails() {
69
+ const watcher = yield takeLatest(
70
+ GET_TEMPLATE_DETAILS_REQUEST,
71
+ getTemplateDetails,
72
+ );
73
+ yield take(LOCATION_CHANGE);
74
+ yield cancel(watcher);
75
+ }
76
+
77
+ export default [watchCreateTemplate, watchGetTemplateDetails];
@@ -1,25 +1,12 @@
1
1
  import { createSelector } from 'reselect';
2
2
 
3
- /**
4
- * Direct selector to the whatsapp state domain
5
- */
6
3
  const selectWhatsappDomain = () => (state) => state.get('whatsapp');
4
+ const selectAccountDomain = () => (state) => state.get('templates');
7
5
 
8
- /**
9
- * Other specific selectors
10
- */
6
+ const makeSelectWhatsapp = () =>
7
+ createSelector(selectWhatsappDomain(), (substate) => substate.toJS());
11
8
 
9
+ const makeSelectAccount = () =>
10
+ createSelector(selectAccountDomain(), (substate) => substate.toJS());
12
11
 
13
- /**
14
- * Default selector used by Whatsapp
15
- */
16
-
17
- const makeSelectWhatsapp = () => createSelector(
18
- selectWhatsappDomain(),
19
- (substate) => substate.toJS()
20
- );
21
-
22
- export default makeSelectWhatsapp;
23
- export {
24
- selectWhatsappDomain,
25
- };
12
+ export { makeSelectWhatsapp, makeSelectAccount };