@capillarytech/creatives-library 7.17.61-alpha.0 → 7.17.61

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.61-alpha.0",
4
+ "version": "7.17.61",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -55,7 +55,7 @@ export const Zalo = (props) => {
55
55
  isFullMode,
56
56
  templateData = {},
57
57
  editData = {},
58
- accountData = {},
58
+ accountData: { selectedZaloAccount = {} } = {},
59
59
  globalActions,
60
60
  location,
61
61
  getDefaultTags,
@@ -80,7 +80,13 @@ export const Zalo = (props) => {
80
80
  const [textAreaId, updateTextAreaId] = useState('');
81
81
  const { zaloTemplateInfoValue = {}, zaloTemplateInfoStatus = REQUEST } =
82
82
  editData;
83
- const { _id = '', templateConfigs: { id = '', varMapped = {} } = {} } = templateData;
83
+ const {
84
+ _id = '',
85
+ accountId = '',
86
+ accountName = '',
87
+ templateConfigs: { id = '', varMapped = {} } = {},
88
+ token: zaloToken = '',
89
+ } = templateData;
84
90
  const zaloTempId = _id || id;
85
91
  const ZaloFooter = styled.div`
86
92
  background-color: ${CAP_WHITE};
@@ -98,18 +104,17 @@ export const Zalo = (props) => {
98
104
  `;
99
105
  //gets account details
100
106
  useEffect(() => {
101
- const accountObj = accountData.selectedZaloAccount || {};
102
- if (!isEmpty(accountObj)) {
107
+ if (!isEmpty(selectedZaloAccount) || !isEmpty(templateData)) {
103
108
  const {
104
109
  sourceAccountIdentifier = '',
105
110
  configs: { token: accessToken = '' } = {},
106
111
  name = '',
107
- } = accountObj;
108
- setOaId(sourceAccountIdentifier);
109
- setToken(accessToken);
110
- setUsername(name);
112
+ } = selectedZaloAccount;
113
+ setOaId(sourceAccountIdentifier || accountId);
114
+ setToken(accessToken || zaloToken);
115
+ setUsername(name || accountName);
111
116
  }
112
- }, [accountData.selectedZaloAccount]);
117
+ }, [selectedZaloAccount, templateData]);
113
118
 
114
119
  //gets template details
115
120
  useEffect(() => {
@@ -170,7 +175,7 @@ export const Zalo = (props) => {
170
175
  if (!isEmpty(varMapped)) {
171
176
  setDataForEdit(true);
172
177
  }
173
- }, [varMapped]);
178
+ }, [varMapped, zaloTemplateInfoValue]);
174
179
 
175
180
  useEffect(() => {
176
181
  let tag = get(metaEntities, `tags.standard`, []);