@capillarytech/creatives-library 7.17.40-alpha.0 → 7.17.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.
Files changed (43) hide show
  1. package/components/CapTagList/index.js +1 -1
  2. package/components/CapTagList/messages.js +0 -4
  3. package/components/FormBuilder/index.js +2 -2
  4. package/components/FormBuilder/messages.js +0 -8
  5. package/containers/App/constants.js +0 -26
  6. package/containers/Assets/Gallery/index.js +1 -1
  7. package/containers/Assets/Gallery/messages.js +0 -4
  8. package/containers/Email/index.js +1 -1
  9. package/containers/Templates/index.js +1 -1
  10. package/containers/Templates/messages.js +0 -4
  11. package/index.js +2 -2
  12. package/package.json +1 -1
  13. package/services/api.js +6 -6
  14. package/utils/common.js +6 -13
  15. package/utils/tests/common.test.js +5 -5
  16. package/v2Components/CapTagList/index.js +2 -1
  17. package/v2Components/FormBuilder/index.js +1 -1
  18. package/v2Components/FormBuilder/messages.js +0 -4
  19. package/v2Components/TemplatePreview/_templatePreview.scss +40 -0
  20. package/v2Components/TemplatePreview/index.js +34 -0
  21. package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +47 -0
  22. package/v2Components/TemplatePreview/tests/index.test.js +9 -0
  23. package/v2Containers/CreativesContainer/SlideBoxContent.js +12 -6
  24. package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -3
  25. package/v2Containers/CreativesContainer/index.js +57 -7
  26. package/v2Containers/CreativesContainer/messages.js +1 -9
  27. package/v2Containers/TagList/index.js +5 -18
  28. package/v2Containers/Templates/index.js +19 -4
  29. package/v2Containers/Templates/messages.js +4 -0
  30. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +28 -129
  31. package/v2Containers/TemplatesV2/tests/index.test.js +1 -0
  32. package/v2Containers/Zalo/constants.js +0 -1
  33. package/v2Containers/Zalo/index.js +280 -189
  34. package/v2Containers/Zalo/index.scss +3 -4
  35. package/v2Containers/Zalo/messages.js +17 -5
  36. package/v2Containers/Zalo/saga.js +10 -4
  37. package/v2Containers/Zalo/selectors.js +8 -10
  38. package/v2Containers/Zalo/tests/index.test.js +67 -48
  39. package/v2Containers/Zalo/tests/mockData.js +5056 -5045
  40. package/v2Containers/Zalo/tests/reducer.test.js +3 -3
  41. package/v2Containers/Zalo/tests/saga.test.js +5 -2
  42. package/v2Containers/Zalo/tests/selector.test.js +28 -0
  43. package/v2Containers/Zalo/tests/selectors.test.js +0 -52
@@ -1,29 +1,32 @@
1
- /* eslint-disable react/prop-types */
2
- import React, { useState, useEffect } from "react";
3
- import { injectIntl } from "react-intl";
4
- import { createStructuredSelector } from "reselect";
5
- import { bindActionCreators } from "redux";
6
- import { get } from "lodash";
1
+ /* eslint-disable camelcase */
2
+ /* eslint-disable react/jsx-indent */
3
+ import React, { useState, useEffect } from 'react';
4
+ import { bindActionCreators } from 'redux';
5
+ import { createStructuredSelector } from 'reselect';
6
+ import { injectIntl, FormattedMessage } from 'react-intl';
7
+ import { get, isEmpty } from 'lodash';
7
8
  import styled from 'styled-components';
8
- import {
9
- CapSpin,
10
- CapRow,
11
- CapColumn,
12
- CapLabel,
13
- CapAlert,
14
- CapInput,
15
- CapHeading,
16
- CapHeader,
17
- CapIcon,
18
- } from "@capillarytech/cap-ui-library";
9
+ import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
10
+ import CapRow from '@capillarytech/cap-ui-library/CapRow';
11
+ import CapColumn from '@capillarytech/cap-ui-library/CapColumn';
12
+ import CapLabel from '@capillarytech/cap-ui-library/CapLabel';
13
+ import CapAlert from '@capillarytech/cap-ui-library/CapAlert';
14
+ import CapInput from '@capillarytech/cap-ui-library/CapInput';
15
+ import CapHeading from '@capillarytech/cap-ui-library/CapHeading';
16
+ import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
17
+ import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
18
+ import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
19
+ import CapButton from '@capillarytech/cap-ui-library/CapButton';
19
20
  import {
20
21
  CAP_SPACE_16,
21
22
  CAP_SPACE_24,
22
23
  CAP_SPACE_32,
23
24
  CAP_WHITE,
24
25
  } from '@capillarytech/cap-ui-library/styled/variables';
25
- import messages from "./messages";
26
- import withCreatives from "../../hoc/withCreatives";
26
+ import { makeSelectZalo, makeSelectAccount } from './selectors';
27
+ import { makeSelectMetaEntities, setInjectedTags } from '../Cap/selectors';
28
+ import * as zaloActions from './actions';
29
+ import './index.scss';
27
30
  import {
28
31
  SUCCESS_ALERT,
29
32
  REQUEST,
@@ -36,40 +39,48 @@ import {
36
39
  ERROR_ALERT,
37
40
  WARNING_ALERT,
38
41
  ZALO_STATUSES,
39
- ENABLE,
40
- } from "./constants";
41
- import "./index.scss";
42
- import { makeSelectZalo } from "./selectors";
43
- import * as zaloActions from "./actions";
44
- import * as templateActions from "../Templates/actions";
45
- import { makeSelectTemplates } from "../Templates/selectors";
46
- import TagList from "../TagList";
47
- import globalMessages from "../Cap/messages";
48
- import { makeSelectMetaEntities, setInjectedTags } from "../Cap/selectors";
49
- import * as globalActions from "../Cap/actions";
50
- import { validateTags } from "../../utils/tagValidations";
51
-
42
+ } from './constants';
43
+ import { ZALO } from '../CreativesContainer/constants';
44
+ import messages from './messages';
45
+ import globalMessages from '../Cap/messages';
46
+ import withCreatives from '../../hoc/withCreatives';
47
+ import TagList from '../TagList';
48
+ import { validateTags } from '../../utils/tagValidations';
49
+ import TemplatePreview from '../../v2Components/TemplatePreview';
52
50
 
53
- export const Zalo = ({
54
- intl,
55
- actions,
56
- zaloTemplateInfoData,
57
- templateData,
58
- location,
59
- metaEntities,
60
- getDefaultTags,
61
- supportedTags,
62
- injectedTags,
63
- selectedOfferDetails,
64
- template,
65
- }) => {
51
+ export const Zalo = (props) => {
52
+ const {
53
+ intl,
54
+ actions,
55
+ isFullMode,
56
+ templateData = {},
57
+ editData = {},
58
+ accountData = {},
59
+ globalActions,
60
+ location,
61
+ getDefaultTags,
62
+ supportedTags,
63
+ metaEntities,
64
+ injectedTags,
65
+ getFormData,
66
+ selectedOfferDetails,
67
+ } = props || {};
66
68
  const { formatMessage } = intl;
67
- const [zaloTemplateListParams, setZaloTemplateListParams] = useState([]);
68
- const [templatePreviewUrl, setTemplatePreviewUrl] = useState("");
69
+ const [oa_id, setOaId] = useState('');
70
+ const [token, setToken] = useState('');
71
+ const [username, setUsername] = useState('');
72
+ const [templateName, setTemplateName] = useState('');
73
+ const [templateId, setTemplateId] = useState('');
74
+ const [templateListParams, setTemplateListParams] = useState([]);
75
+ const [templatePreviewUrl, setTemplatePreviewUrl] = useState('');
76
+ const [templateStatus, setZaloTemplateStatus] = useState(
77
+ ZALO_STATUSES.ENABLE,
78
+ );
69
79
  const [tags, updateTags] = useState([]);
70
- const [textAreaId, updateTextAreaId] = useState("");
71
- const [templateStatus, setZaloTemplateStatus] = useState(ENABLE);
72
-
80
+ const [textAreaId, updateTextAreaId] = useState('');
81
+ const { zaloTemplateInfoValue = {}, zaloTemplateInfoStatus = REQUEST } =
82
+ editData;
83
+ const { _id, templateConfigs: { varMapped = {} } = {} } = templateData;
73
84
  const ZaloFooter = styled.div`
74
85
  background-color: ${CAP_WHITE};
75
86
  position: fixed;
@@ -84,47 +95,77 @@ export const Zalo = ({
84
95
  }
85
96
  }
86
97
  `;
87
-
88
- const { zaloTemplateInfoStatus, zaloTemplateInfoValue } =
89
- zaloTemplateInfoData;
90
-
91
- // here listParams and previewUrl data will be setting in respective states. We got that data by destructring
98
+ //gets account details
92
99
  useEffect(() => {
93
- if (zaloTemplateInfoValue) {
100
+ const accountObj = accountData.selectedZaloAccount || {};
101
+ if (!isEmpty(accountObj)) {
94
102
  const {
95
- versions: {
96
- base: {
97
- content: {
98
- zalo: { listParams = [], previewUrl = "", status = "" } = {},
103
+ sourceAccountIdentifier = '',
104
+ configs: { token: accessToken = '' } = {},
105
+ name = '',
106
+ } = accountObj;
107
+ setOaId(sourceAccountIdentifier);
108
+ setToken(accessToken);
109
+ setUsername(name);
110
+ }
111
+ }, [accountData.selectedZaloAccount]);
112
+
113
+ //gets template details
114
+ useEffect(() => {
115
+ if (_id && oa_id && token && username && isEmpty(varMapped)) {
116
+ actions.getTemplateInfoById({
117
+ username,
118
+ oa_id,
119
+ token,
120
+ id: _id,
121
+ actionCallback,
122
+ });
123
+ }
124
+ }, [_id, oa_id, token, username]);
125
+
126
+ const handleSetValues = (paramsData = []) =>
127
+ paramsData.map((paramData) => {
128
+ for (const key in varMapped) {
129
+ if (paramData?.name === key) {
130
+ paramData.value = varMapped[key];
131
+ }
132
+ }
133
+ return paramData;
134
+ });
135
+
136
+ const setDataForEdit = (setValues) => {
137
+ const {
138
+ name = '',
139
+ _id: id = '',
140
+ versions: {
141
+ base: {
142
+ content: {
143
+ zalo: {
144
+ listParams: paramsData = [],
145
+ previewUrl = '',
146
+ status = '',
99
147
  } = {},
100
148
  } = {},
101
149
  } = {},
102
- } = zaloTemplateInfoValue;
103
- setZaloTemplateListParams(listParams);
104
- setTemplatePreviewUrl(previewUrl);
105
- setZaloTemplateStatus(status);
106
- updateTextAreaId(listParams[0]?.name);
107
- }
150
+ } = {},
151
+ } = zaloTemplateInfoValue;
152
+ setTemplateName(name);
153
+ setTemplateId(id);
154
+ setTemplateListParams(setValues ? handleSetValues(paramsData) : paramsData);
155
+ setTemplatePreviewUrl(previewUrl);
156
+ setZaloTemplateStatus(status);
157
+ updateTextAreaId(paramsData[0]?.name);
158
+ };
159
+
160
+ useEffect(() => {
161
+ setDataForEdit(false);
108
162
  }, [zaloTemplateInfoValue]);
109
163
 
110
164
  useEffect(() => {
111
- const {
112
- weCrmAccounts: [
113
- {
114
- name,
115
- sourceAccountIdentifier,
116
- configs: { token },
117
- },
118
- ],
119
- } = template;
120
- const { _id: id } = templateData;
121
- actions.getTemplateInfoById({
122
- username: name,
123
- oa_id: sourceAccountIdentifier,
124
- token,
125
- id,
126
- });
127
- }, []);
165
+ if (!isEmpty(varMapped)) {
166
+ setDataForEdit(true);
167
+ }
168
+ }, [varMapped]);
128
169
 
129
170
  useEffect(() => {
130
171
  let tag = get(metaEntities, `tags.standard`, []);
@@ -140,7 +181,7 @@ export const Zalo = ({
140
181
  const { type, module } = location?.query || {};
141
182
  const isEmbedded = type === EMBEDDED;
142
183
  const query = {
143
- layout: "SMS",
184
+ layout: 'SMS',
144
185
  type: TAG,
145
186
  context: isEmbedded ? module : DEFAULT,
146
187
  embedded: isEmbedded ? type : FULL,
@@ -148,44 +189,46 @@ export const Zalo = ({
148
189
  if (getDefaultTags) {
149
190
  query.context = getDefaultTags;
150
191
  }
151
- actions.fetchSchemaForEntity(query);
192
+ globalActions.fetchSchemaForEntity(query);
152
193
  }, []);
153
194
 
154
195
  const handleOnTagsContextChange = (data) => {
155
196
  const { type } = location?.query || {};
156
197
  const isEmbedded = type === EMBEDDED;
157
198
  const query = {
158
- layout: "SMS",
199
+ layout: 'SMS',
159
200
  type: TAG,
160
201
  context:
161
- (data || "").toLowerCase() === ALL
202
+ (data || '').toLowerCase() === ALL
162
203
  ? DEFAULT
163
- : (data || "").toLowerCase(),
204
+ : (data || '').toLowerCase(),
164
205
  embedded: isEmbedded ? type : FULL,
165
206
  };
166
- actions.fetchSchemaForEntity(query);
207
+ globalActions.fetchSchemaForEntity(query);
167
208
  };
168
209
 
169
210
  const onTagSelect = (data) => {
170
211
  if (data && textAreaId) {
171
- const updatedZaloTemplateInfo = zaloTemplateListParams.map((item) => {
172
- if (item?.name === textAreaId) {
173
- const text = `${item?.value ? item?.value : ""}{{${data}}}`;
212
+ const updatedZaloTemplateInfo = templateListParams?.map((listParams) => {
213
+ const { name = '', value = '', minLength, maxLength } = listParams;
214
+ if (name === textAreaId) {
215
+ const text = `${value}{{${data}}}`;
216
+ const isLengthError =
217
+ text.length <= minLength || text.length > maxLength;
174
218
  return {
175
- ...item,
219
+ ...listParams,
176
220
  value: text,
177
- error:
178
- text.length <= item?.minLength || text.length > item?.maxLength
179
- ? formatMessage(messages.maxMinLengthMessage, {
180
- minLength: item?.minLength,
181
- maxLength: item?.maxLength,
221
+ error: isLengthError
222
+ ? formatMessage(messages.maxMinLengthMessage, {
223
+ minLength,
224
+ maxLength,
182
225
  })
183
- : "",
226
+ : '',
184
227
  };
185
228
  }
186
- return item;
229
+ return listParams;
187
230
  });
188
- setZaloTemplateListParams(updatedZaloTemplateInfo);
231
+ setTemplateListParams(updatedZaloTemplateInfo);
189
232
  }
190
233
  };
191
234
 
@@ -199,7 +242,7 @@ export const Zalo = ({
199
242
  tagModule: getDefaultTags,
200
243
  }) || {};
201
244
  const { unsupportedTags = [], isBraceError } = tagValidationResponse;
202
- let tagError = "";
245
+ let tagError = '';
203
246
  if (unsupportedTags.length > 0) {
204
247
  tagError = formatMessage(globalMessages.unsupportedTagsValidationError, {
205
248
  unsupportedTags,
@@ -211,38 +254,36 @@ export const Zalo = ({
211
254
  return tagError;
212
255
  };
213
256
 
257
+ //this function is used for checking errror validation in this it validate tags error and length error
258
+ const handleErrorValidation = (e, field) => {
259
+ const { minLength, maxLength } = field;
260
+ let error = e ? tagValidationErrorMessage(e) : '';
261
+ if (!e || e.length <= minLength || e.length > maxLength) {
262
+ error = formatMessage(messages.maxMinLengthMessage, {
263
+ minLength,
264
+ maxLength,
265
+ });
266
+ }
267
+ return error;
268
+ };
269
+
214
270
  // this function is used for handle form data change in this also handle error validtion on change of value
215
271
  const handleFormDataChange = (e, field) => {
216
272
  const {
217
273
  target: { value },
218
274
  } = e;
219
- const updatedZaloTemplateInfo = zaloTemplateListParams?.map((item) => {
220
- if (item?.name === field?.name) {
275
+ const updatedZaloTemplateInfo = templateListParams?.map((listParams) => {
276
+ if (listParams?.name === field?.name) {
221
277
  const error = handleErrorValidation(value, field);
222
278
  return {
223
- ...item,
279
+ ...listParams,
224
280
  value,
225
281
  error,
226
282
  };
227
283
  }
228
- return item;
284
+ return listParams;
229
285
  });
230
- setZaloTemplateListParams(updatedZaloTemplateInfo);
231
- };
232
-
233
- //this function is used for checking errror validation in this it validate tags error and length error
234
- const handleErrorValidation = (e, field) => {
235
- const { minLength, maxLength } = field;
236
- let error = tagValidationErrorMessage(e);
237
-
238
- if (e.length <= minLength || e.length > maxLength) {
239
- error = formatMessage(messages.maxMinLengthMessage, {
240
- minLength,
241
- maxLength,
242
- });
243
- }
244
-
245
- return error;
286
+ setTemplateListParams(updatedZaloTemplateInfo);
246
287
  };
247
288
 
248
289
  const renderTextBoxesForListParams = (listParam) => {
@@ -253,10 +294,11 @@ export const Zalo = ({
253
294
  onChange={(e) => handleFormDataChange(e, listParam)}
254
295
  errorMessage={error}
255
296
  placeholder={formatMessage(messages.addVariableWithMessage)}
256
- defaultValue={value || ""}
257
- value={value || ""}
297
+ defaultValue={value || ''}
298
+ value={value || ''}
258
299
  size="default"
259
300
  onFocus={() => setTextAreaId(name)}
301
+ disabled={isFullMode}
260
302
  />
261
303
  );
262
304
  };
@@ -265,10 +307,6 @@ export const Zalo = ({
265
307
  updateTextAreaId(fieldName);
266
308
  };
267
309
 
268
- const handlePreview = () => {
269
- window.open(templatePreviewUrl, "_blank");
270
- };
271
-
272
310
  const getTemplateStatusType = () => {
273
311
  switch (templateStatus) {
274
312
  case ZALO_STATUSES.ENABLE:
@@ -280,20 +318,93 @@ export const Zalo = ({
280
318
  }
281
319
  };
282
320
 
321
+ const actionCallback = () => {
322
+ CapNotification.error({
323
+ message: formatMessage(messages.zaloFailureNotificationTemplate),
324
+ });
325
+ };
326
+
327
+ const isEditDoneDisabled = () => {
328
+ let disableCheck = false;
329
+ templateListParams.forEach((listParams) => {
330
+ const { error, value } = listParams;
331
+ const errorMessage = !error
332
+ ? handleErrorValidation(value, listParams)
333
+ : error;
334
+ if (errorMessage) {
335
+ disableCheck = true;
336
+ }
337
+ });
338
+ return disableCheck;
339
+ };
340
+ const createPayload = () => {
341
+ const varMap = {};
342
+ templateListParams.forEach((listParam) => {
343
+ const { name, value } = listParam;
344
+ varMap[name] = value;
345
+ });
346
+ const payload = {
347
+ channel: ZALO,
348
+ accountId: oa_id,
349
+ accountName: username,
350
+ templateConfigs: {
351
+ id: templateId?.toString(),
352
+ name: templateName,
353
+ template: templatePreviewUrl,
354
+ varMapped: varMap,
355
+ },
356
+ };
357
+ return payload;
358
+ };
359
+
360
+ const saveToMessage = () => {
361
+ getFormData({
362
+ value: createPayload(),
363
+ _id: templateId,
364
+ validity: true,
365
+ type: ZALO,
366
+ });
367
+ };
368
+
369
+ const renderContent = () =>
370
+ templateListParams?.map((listParam) => {
371
+ const { name = '', value = '', maxLength } = listParam;
372
+ return (
373
+ <>
374
+ {renderTextBoxesForListParams(listParam)}
375
+ <CapRow className="variable-field-container">
376
+ <CapLabel className="variable-field-name">
377
+ {formatMessage(messages.variableType, {
378
+ name,
379
+ })}
380
+ </CapLabel>
381
+ <CapLabel className="variable-field-length">
382
+ {formatMessage(messages.charactersCount, {
383
+ variableLength: value.length,
384
+ maxLength,
385
+ })}
386
+ </CapLabel>
387
+ </CapRow>
388
+ </>
389
+ );
390
+ });
391
+
283
392
  return (
284
393
  <CapSpin spinning={zaloTemplateInfoStatus === REQUEST}>
285
394
  <CapRow type="flex" className="cap-zalo-creatives">
286
395
  <CapColumn span={14}>
287
- <CapAlert
288
- message={
289
- <CapLabel type="label2">
290
- {formatMessage(messages.approvedStatusMsg, {
291
- status: formatMessage(messages?.[templateStatus]),
292
- })}
293
- </CapLabel>
294
- }
295
- type={getTemplateStatusType()}
296
- />
396
+ {templateStatus && (
397
+ <CapAlert
398
+ message={
399
+ <CapLabel type="label2">
400
+ {formatMessage(messages.approvedStatusMsg, {
401
+ status: formatMessage(messages?.[templateStatus]),
402
+ })}
403
+ </CapLabel>
404
+ }
405
+ type={getTemplateStatusType()}
406
+ />
407
+ )}
297
408
  <CapRow>
298
409
  <CapRow className="whatsapp-render-heading">
299
410
  <CapHeader
@@ -312,75 +423,55 @@ export const Zalo = ({
312
423
  onContextChange={handleOnTagsContextChange}
313
424
  injectedTags={injectedTags || {}}
314
425
  selectedOfferDetails={selectedOfferDetails}
426
+ disabled={isFullMode}
315
427
  />
316
428
  }
317
429
  />
318
430
  </CapRow>
319
- <CapRow className="zalo-variable-list">
320
- {zaloTemplateListParams?.map((listParam) => {
321
- const { name = "", maxLength, value = "" } = listParam;
322
- return (
323
- <>
324
- {renderTextBoxesForListParams(listParam)}
325
- <CapRow className="variable-field-container">
326
- <CapLabel className="variable-field-name">
327
- {formatMessage(messages.variableType, {
328
- fieldName: name,
329
- })}
330
- </CapLabel>
331
- <CapLabel className="variable-field-length">
332
- {formatMessage(messages.charactersCount, {
333
- variableLength: value?.length,
334
- fixedLength: maxLength,
335
- })}
336
- </CapLabel>
337
- </CapRow>
338
- </>
339
- );
340
- })}
341
- </CapRow>
431
+ <CapRow className="zalo-variable-list">{renderContent()}</CapRow>
342
432
  </CapRow>
343
433
  </CapColumn>
344
- <CapColumn type="flex" span={10} className="zalo-preview-container">
345
- <CapRow>
346
- <CapLabel className="preview-head">
347
- {formatMessage(messages.previewHead)}
348
- </CapLabel>
349
- </CapRow>
350
- <CapRow>
351
- <CapLabel className="preview-text">
352
- {formatMessage(messages.previewText)}
353
- </CapLabel>
354
- </CapRow>
355
- <CapRow>
356
- <CapLabel
357
- data-testid="preview-link-button"
358
- onClick={handlePreview}
359
- className="preview-link"
360
- >
361
- {formatMessage(messages.openPreview)}{" "}
362
- <CapIcon type="open-in-new-light"></CapIcon>
363
- </CapLabel>
364
- </CapRow>
434
+ <CapColumn span={10}>
435
+ <TemplatePreview
436
+ channel={ZALO}
437
+ templateData={{templatePreviewUrl, fullMode: isFullMode}}
438
+ />
365
439
  </CapColumn>
366
440
  </CapRow>
367
- <ZaloFooter></ZaloFooter>
441
+ <ZaloFooter>
442
+ {!isFullMode && (
443
+ <CapTooltip
444
+ title={
445
+ isEditDoneDisabled()
446
+ ? formatMessage(messages.btnDisabledTooltip)
447
+ : ''
448
+ }
449
+ placement={'right'}
450
+ >
451
+ <div className="button-disabled-tooltip-wrapper">
452
+ <CapButton
453
+ onClick={saveToMessage}
454
+ disabled={isEditDoneDisabled()}
455
+ >
456
+ <FormattedMessage {...globalMessages.done} />
457
+ </CapButton>
458
+ </div>
459
+ </CapTooltip>
460
+ )}
461
+ </ZaloFooter>
368
462
  </CapSpin>
369
463
  );
370
464
  };
371
465
 
372
466
  const mapStateToProps = createStructuredSelector({
373
- zaloTemplateInfoData: makeSelectZalo(),
374
- template: makeSelectTemplates(),
467
+ editData: makeSelectZalo(),
468
+ accountData: makeSelectAccount(),
375
469
  metaEntities: makeSelectMetaEntities(),
376
470
  injectedTags: setInjectedTags(),
377
471
  });
378
472
 
379
473
  const mapDispatchToProps = (dispatch) => ({
380
- actions: bindActionCreators(
381
- { ...zaloActions, ...templateActions, ...globalActions },
382
- dispatch
383
- ),
474
+ actions: bindActionCreators(zaloActions, dispatch),
384
475
  });
385
476
 
386
477
  export default withCreatives({
@@ -42,11 +42,10 @@
42
42
  }
43
43
 
44
44
  .zalo-preview-container {
45
- text-align: center;
46
45
  position: fixed;
47
- right: 0;
48
- padding-left: 194px;
49
- padding-right: 116px;
46
+ text-align: center;
47
+ padding-left: 72px;
48
+ padding-right: 110px;
50
49
 
51
50
  .preview-head {
52
51
  font-weight: 500;
@@ -16,19 +16,19 @@ export default defineMessages({
16
16
  },
17
17
  variableType: {
18
18
  id: `${prefix}.variableType`,
19
- defaultMessage: "Variable type: <{fieldName}>",
19
+ defaultMessage: "Variable type: <{name}>",
20
20
  },
21
21
  charactersCount: {
22
22
  id: `${prefix}.charactersCount`,
23
- defaultMessage: "Characters count {variableLength}/{fixedLength}",
23
+ defaultMessage: "Characters count {variableLength}/{maxLength}",
24
24
  },
25
25
  maxMinLengthMessage: {
26
- id: `${prefix}.maxLengthMessage`,
26
+ id: `${prefix}.maxMinLengthMessage`,
27
27
  defaultMessage:
28
28
  "Character count for this variable should be in between {minLength} to {maxLength}",
29
29
  },
30
30
  previewHead: {
31
- id: `${prefix}.previewText`,
31
+ id: `${prefix}.previewHead`,
32
32
  defaultMessage: "Preview",
33
33
  },
34
34
  previewText: {
@@ -70,5 +70,17 @@ export default defineMessages({
70
70
  PENDING_REVIEW: {
71
71
  id: `${prefix}.PENDING_REVIEW`,
72
72
  defaultMessage: 'pending review',
73
- }
73
+ },
74
+ zaloFailureNotificationTemplate: {
75
+ id: `${prefix}.zaloFailureNotificationTemplate`,
76
+ defaultMessage: 'Unable to load zalo template',
77
+ },
78
+ zaloFailureNotificationPreview: {
79
+ id: `${prefix}.zaloFailureNotificationPreview`,
80
+ defaultMessage: 'Unable to load zalo preview',
81
+ },
82
+ btnDisabledTooltip: {
83
+ id: `${prefix}.btnDisabledTooltip`,
84
+ defaultMessage: 'Please add all mandatory fields to proceed further',
85
+ },
74
86
  });