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