@capillarytech/creatives-library 7.17.61-alpha.0 → 7.17.62
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/package.json
CHANGED
|
@@ -17,6 +17,7 @@ export const DEFAULT = 'default';
|
|
|
17
17
|
export const LIBRARY = 'library';
|
|
18
18
|
export const FULL = 'full';
|
|
19
19
|
export const ALL = 'all';
|
|
20
|
+
export const OUTBOUND = 'outbound';
|
|
20
21
|
|
|
21
22
|
const prefix = 'app/v2Containers/Zalo';
|
|
22
23
|
export const ZALO_TEMPLATE_INFO_REQUEST = `${prefix}/ZALO_TEMPLATE_INFO_REQUEST`;
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
TAG,
|
|
36
36
|
FULL,
|
|
37
37
|
ALL,
|
|
38
|
+
OUTBOUND,
|
|
38
39
|
LIBRARY,
|
|
39
40
|
ERROR_ALERT,
|
|
40
41
|
WARNING_ALERT,
|
|
@@ -55,7 +56,7 @@ export const Zalo = (props) => {
|
|
|
55
56
|
isFullMode,
|
|
56
57
|
templateData = {},
|
|
57
58
|
editData = {},
|
|
58
|
-
accountData = {},
|
|
59
|
+
accountData: { selectedZaloAccount = {} } = {},
|
|
59
60
|
globalActions,
|
|
60
61
|
location,
|
|
61
62
|
getDefaultTags,
|
|
@@ -80,7 +81,14 @@ export const Zalo = (props) => {
|
|
|
80
81
|
const [textAreaId, updateTextAreaId] = useState('');
|
|
81
82
|
const { zaloTemplateInfoValue = {}, zaloTemplateInfoStatus = REQUEST } =
|
|
82
83
|
editData;
|
|
83
|
-
const {
|
|
84
|
+
const {
|
|
85
|
+
_id = '',
|
|
86
|
+
accountId = '',
|
|
87
|
+
zaloAccountId = '',
|
|
88
|
+
accountName = '',
|
|
89
|
+
templateConfigs: { id = '', varMapped = {} } = {},
|
|
90
|
+
token: zaloToken = '',
|
|
91
|
+
} = templateData;
|
|
84
92
|
const zaloTempId = _id || id;
|
|
85
93
|
const ZaloFooter = styled.div`
|
|
86
94
|
background-color: ${CAP_WHITE};
|
|
@@ -98,18 +106,18 @@ export const Zalo = (props) => {
|
|
|
98
106
|
`;
|
|
99
107
|
//gets account details
|
|
100
108
|
useEffect(() => {
|
|
101
|
-
|
|
102
|
-
if (!isEmpty(accountObj)) {
|
|
109
|
+
if (!isEmpty(selectedZaloAccount) || !isEmpty(templateData)) {
|
|
103
110
|
const {
|
|
104
111
|
sourceAccountIdentifier = '',
|
|
105
112
|
configs: { token: accessToken = '' } = {},
|
|
106
113
|
name = '',
|
|
107
|
-
} =
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
} = selectedZaloAccount;
|
|
115
|
+
const oaId = getDefaultTags === OUTBOUND ? zaloAccountId : accountId;
|
|
116
|
+
setOaId(sourceAccountIdentifier || oaId);
|
|
117
|
+
setToken(accessToken || zaloToken);
|
|
118
|
+
setUsername(name || accountName);
|
|
111
119
|
}
|
|
112
|
-
}, [
|
|
120
|
+
}, [selectedZaloAccount, templateData]);
|
|
113
121
|
|
|
114
122
|
//gets template details
|
|
115
123
|
useEffect(() => {
|
|
@@ -170,7 +178,7 @@ export const Zalo = (props) => {
|
|
|
170
178
|
if (!isEmpty(varMapped)) {
|
|
171
179
|
setDataForEdit(true);
|
|
172
180
|
}
|
|
173
|
-
}, [varMapped]);
|
|
181
|
+
}, [varMapped, zaloTemplateInfoValue]);
|
|
174
182
|
|
|
175
183
|
useEffect(() => {
|
|
176
184
|
let tag = get(metaEntities, `tags.standard`, []);
|
|
@@ -351,6 +359,9 @@ export const Zalo = (props) => {
|
|
|
351
359
|
const payload = {
|
|
352
360
|
channel: ZALO,
|
|
353
361
|
accountId: oa_id,
|
|
362
|
+
...(getDefaultTags === OUTBOUND && {
|
|
363
|
+
zaloAccountId: oa_id,
|
|
364
|
+
}),
|
|
354
365
|
accountName: username,
|
|
355
366
|
templateConfigs: {
|
|
356
367
|
id: templateId?.toString(),
|