@capillarytech/creatives-library 7.17.82-alpha.0 → 7.17.82-alpha.1

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 (32) hide show
  1. package/containers/Cap/sagas.js +7 -5
  2. package/containers/Cap/tests/saga.test.js +81 -1
  3. package/package.json +2 -2
  4. package/services/api.js +5 -0
  5. package/services/tests/api.test.js +9 -1
  6. package/v2Components/CapWhatsappQuickReply/index.js +96 -83
  7. package/v2Components/CapWhatsappQuickReply/index.scss +4 -1
  8. package/v2Components/CapWhatsappQuickReply/messages.js +4 -0
  9. package/v2Components/TemplatePreview/_templatePreview.scss +23 -0
  10. package/v2Components/TemplatePreview/index.js +43 -23
  11. package/v2Components/TemplatePreview/messages.js +4 -0
  12. package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +0 -14
  13. package/v2Containers/CreativesContainer/index.js +22 -2
  14. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +4 -4
  15. package/v2Containers/Templates/index.js +3 -3
  16. package/v2Containers/Whatsapp/actions.js +16 -0
  17. package/v2Containers/Whatsapp/constants.js +8 -1
  18. package/v2Containers/Whatsapp/index.js +347 -253
  19. package/v2Containers/Whatsapp/index.scss +12 -1
  20. package/v2Containers/Whatsapp/messages.js +10 -1
  21. package/v2Containers/Whatsapp/reducer.js +19 -0
  22. package/v2Containers/Whatsapp/sagas.js +40 -1
  23. package/v2Containers/Whatsapp/styles.scss +6 -3
  24. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +12145 -51281
  25. package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +20 -20
  26. package/v2Containers/Whatsapp/tests/actions.test.js +21 -0
  27. package/v2Containers/Whatsapp/tests/index.test.js +8 -0
  28. package/v2Containers/Whatsapp/tests/mockData.js +6 -0
  29. package/v2Containers/Whatsapp/tests/reducer.test.js +67 -0
  30. package/v2Containers/Whatsapp/tests/saga.test.js +90 -0
  31. package/v2Containers/Whatsapp/utils.js +13 -13
  32. package/v2Containers/mockdata.js +8 -18
@@ -73,7 +73,7 @@
73
73
  }
74
74
 
75
75
  .whatsapp-footer-edit-container {
76
- background-color: #fafbfc;
76
+ background-color: $CAP_G10;
77
77
  margin: $CAP_SPACE_08 0;
78
78
  padding: $CAP_SPACE_12;
79
79
  .whatsapp-footer-edit-text {
@@ -129,6 +129,7 @@
129
129
 
130
130
  .whatsapp-button-quick-reply {
131
131
  display: inline-grid;
132
+ margin-top: $CAP_SPACE_24;
132
133
  }
133
134
 
134
135
  .whatsapp-optional-label {
@@ -192,4 +193,14 @@
192
193
  font-size: 0.571rem;
193
194
  margin-top: $CAP_SPACE_08;
194
195
  }
196
+
197
+ .whatsapp-text-field_spacing {
198
+ margin-left: $CAP_SPACE_04;
199
+ }
200
+
201
+ .whatsapp-render-url-preview-text {
202
+ color: $CAP_G01;
203
+ font-size: $FONT_SIZE_M;
204
+ font-weight: $FONT_WEIGHT_MEDIUM;
205
+ }
195
206
  }
@@ -184,6 +184,11 @@ export default defineMessages({
184
184
  defaultMessage:
185
185
  'Variable name should be numeric value from {one} to {nineteen}',
186
186
  },
187
+ headerUnknownVars: {
188
+ id: `${prefix}.headerUnknownVars`,
189
+ defaultMessage:
190
+ 'Variable name should be numeric value and its always {{1}}',
191
+ },
187
192
  removeMultinewlineChars: {
188
193
  id: `${prefix}.removeMultinewlineChars`,
189
194
  defaultMessage:
@@ -654,5 +659,9 @@ export default defineMessages({
654
659
  quickReplyButtons: {
655
660
  id: `${prefix}.quickReplyButtons`,
656
661
  defaultMessage: 'Quick reply buttons',
657
- }
662
+ },
663
+ showUrlPreview: {
664
+ id: `${prefix}.showUrlPreview`,
665
+ defaultMessage: 'Show URL preview',
666
+ },
658
667
  });
@@ -12,11 +12,18 @@ import {
12
12
  UPLOAD_WHATSAPP_ASSET_SUCCESS,
13
13
  UPLOAD_WHATSAPP_ASSET_FAILURE,
14
14
  CLEAR_WHATSAPP_ASSET,
15
+ URL_META_TAGS_REQUEST,
16
+ URL_META_TAGS_SUCCESS,
17
+ URL_META_TAGS_FAILURE,
18
+ URL_META_TAGS_RESET,
15
19
  } from './constants';
16
20
 
17
21
  const initialState = fromJS({
18
22
  uploadedAssetData: {},
19
23
  createTemplateInProgress: false,
24
+ getMetaTagsRequest: false,
25
+ metaTagsDetails: {},
26
+ getMetaTagsError: '',
20
27
  });
21
28
 
22
29
  function whatsappReducer(state = initialState, action) {
@@ -51,6 +58,18 @@ function whatsappReducer(state = initialState, action) {
51
58
  .set('templateDetails', action.data);
52
59
  case GET_TEMPLATE_DETAILS_FAILURE:
53
60
  return state.set('getTemplateDetailsInProgress', false);
61
+ case URL_META_TAGS_REQUEST:
62
+ return state.set('getMetaTagsRequest', true)
63
+ .set('metaTagsDetails', {});
64
+ case URL_META_TAGS_SUCCESS:
65
+ return state.set('getMetaTagsRequest', false)
66
+ .set('metaTagsDetails', action?.data);
67
+ case URL_META_TAGS_FAILURE:
68
+ return state.set('getMetaTagsRequest', false)
69
+ .set('getMetaTagsError', action?.error)
70
+ .set('metaTagsDetails', {});
71
+ case URL_META_TAGS_RESET:
72
+ return state.set('metaTagsDetails', {});
54
73
  case RESET_EDIT_TEMPLATE:
55
74
  return state.set('templateDetails', {});
56
75
  case UPLOAD_WHATSAPP_ASSET_REQUEST:
@@ -12,6 +12,9 @@ import {
12
12
  UPLOAD_WHATSAPP_ASSET_REQUEST,
13
13
  UPLOAD_WHATSAPP_ASSET_SUCCESS,
14
14
  UPLOAD_WHATSAPP_ASSET_FAILURE,
15
+ URL_META_TAGS_REQUEST,
16
+ URL_META_TAGS_SUCCESS,
17
+ URL_META_TAGS_FAILURE,
15
18
  } from './constants';
16
19
 
17
20
  export function* uploadWhatsappAsset(params) {
@@ -90,11 +93,46 @@ export function* getTemplateDetails({ id }) {
90
93
  }
91
94
  }
92
95
 
96
+ //For getMetaTags
97
+ export function* getMetaTagsDetails({ previewUrl, callBack }) {
98
+ try {
99
+ const result = yield call(Api.getMetaTags, {
100
+ previewUrl,
101
+ });
102
+ if (result?.success) {
103
+ yield put({
104
+ type: URL_META_TAGS_SUCCESS,
105
+ data: result?.response,
106
+ });
107
+ } else {
108
+ if (callBack) {
109
+ callBack({errorMessage: result?.message});
110
+ }
111
+ yield put({
112
+ type: URL_META_TAGS_FAILURE,
113
+ error: result?.message,
114
+ });
115
+ }
116
+ } catch (error) {
117
+ if (callBack) {
118
+ callBack({errorMessage: error});
119
+ }
120
+ yield put({ type: URL_META_TAGS_FAILURE, error });
121
+ }
122
+ }
123
+
93
124
  function* watchGetTemplateDetails() {
94
- const watcher = yield takeLatest(
125
+ yield takeLatest(
95
126
  GET_TEMPLATE_DETAILS_REQUEST,
96
127
  getTemplateDetails,
97
128
  );
129
+ }
130
+
131
+ export function* watchGetMetaTagsDetails() {
132
+ const watcher = yield takeLatest(
133
+ URL_META_TAGS_REQUEST,
134
+ getMetaTagsDetails,
135
+ );
98
136
  yield take(LOCATION_CHANGE);
99
137
  yield cancel(watcher);
100
138
  }
@@ -103,4 +141,5 @@ export default [
103
141
  watchCreateTemplate,
104
142
  watchGetTemplateDetails,
105
143
  watchUploadWhatsappAsset,
144
+ watchGetMetaTagsDetails,
106
145
  ];
@@ -41,14 +41,14 @@
41
41
  }
42
42
  }
43
43
 
44
- .whatsapp-template-header-preview {
44
+ .whatsapp-template-list-header-preview {
45
45
  color: $CAP_G01;
46
46
  font-weight: $FONT_WEIGHT_MEDIUM;
47
47
  font-size: $FONT_SIZE_M;
48
48
  margin-bottom: $CAP_SPACE_08;
49
49
  }
50
50
 
51
- .whatsapp-template-footer-preview {
51
+ .whatsapp-template-list-footer-preview {
52
52
  color: $CAP_G04;
53
53
  font-weight: $FONT_WEIGHT_REGULAR;
54
54
  font-size: $FONT_SIZE_VS;
@@ -56,11 +56,14 @@
56
56
  margin-bottom: $CAP_SPACE_08;
57
57
  }
58
58
 
59
- .whatsapp-list-cta-preview {
59
+ .whatsapp-list-quick-reply-preview {
60
60
  margin: $CAP_SPACE_12 0;
61
61
  display: flex;
62
62
  justify-content: center;
63
63
  font-size: $FONT_SIZE_M;
64
+ svg {
65
+ margin-right: $CAP_SPACE_04;
66
+ }
64
67
  }
65
68
 
66
69
  .whatsapp-list-view-divider {