@capillarytech/creatives-library 7.17.169-alpha.3 → 7.17.169-alpha.4
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
|
@@ -125,7 +125,7 @@ export class Creatives extends React.Component {
|
|
|
125
125
|
sourceAccountIdentifier = "",
|
|
126
126
|
configs: { token = "" } = {},
|
|
127
127
|
} = get(this.props, "Templates.selectedZaloAccount", {});
|
|
128
|
-
const { hostName = ''} = this.props
|
|
128
|
+
const { hostName = ''} = get(this.props, "Templates.senderDetails", {});
|
|
129
129
|
if (hostName === VIET_GUYS) {
|
|
130
130
|
this.props.zaloActions.getTemplateInfoById({
|
|
131
131
|
username: name,
|
|
@@ -136,7 +136,7 @@ export class Creatives extends React.Component {
|
|
|
136
136
|
actionCallback: this.actionCallback,
|
|
137
137
|
});
|
|
138
138
|
} else {
|
|
139
|
-
window.open(template
|
|
139
|
+
window.open(get(template, 'versions.base.content.zalo.previewUrl'), '_blank');
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
};
|
|
@@ -2119,7 +2119,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2119
2119
|
id: template?._id,
|
|
2120
2120
|
preview: true,
|
|
2121
2121
|
actionCallback: this.actionCallback,
|
|
2122
|
-
}) : window.open(template
|
|
2122
|
+
}) : window.open(get(template, 'versions.base.content.zalo.previewUrl'), '_blank');
|
|
2123
2123
|
}
|
|
2124
2124
|
}
|
|
2125
2125
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import get from 'lodash/get';
|
|
1
2
|
import { call, put, takeLatest, take, cancel, select } from 'redux-saga/effects';
|
|
2
3
|
import { LOCATION_CHANGE } from 'react-router-redux';
|
|
3
4
|
// import { schema, normalize } from 'normalizr';
|
|
@@ -176,7 +177,7 @@ export function* getSenderDetails({
|
|
|
176
177
|
if (!apiResponse?.errors?.length) {
|
|
177
178
|
yield put({
|
|
178
179
|
type: types.GET_SENDER_DETAILS_SUCCESS,
|
|
179
|
-
payload: apiResponse
|
|
180
|
+
payload: get(apiResponse, `entity.${channel}[0].domainProperties.hostName`, ''),
|
|
180
181
|
});
|
|
181
182
|
} else {
|
|
182
183
|
yield put({
|
|
@@ -75,7 +75,16 @@ export const Zalo = (props) => {
|
|
|
75
75
|
const [username, setUsername] = useState('');
|
|
76
76
|
const [templateName, setTemplateName] = useState('');
|
|
77
77
|
const [templateId, setTemplateId] = useState('');
|
|
78
|
-
|
|
78
|
+
// Initialize the state for templateListParams based on the nested properties of templateData.
|
|
79
|
+
// If templateData.versions.base.content.zalo.listParams is available, use it.
|
|
80
|
+
// Otherwise, if hostName is VIET_GUYS and templateData.templateConfigs.varMapped is available,
|
|
81
|
+
// convert it to an array of entries. If not, use templateData.templateConfigs.varMapped or an empty array.
|
|
82
|
+
const [templateListParams, setTemplateListParams] = useState(
|
|
83
|
+
(templateData?.versions?.base?.content?.zalo?.listParams ||
|
|
84
|
+
((hostName === VIET_GUYS && templateData?.templateConfigs?.varMapped)
|
|
85
|
+
? Object.entries(templateData?.templateConfigs?.varMapped)
|
|
86
|
+
: templateData?.templateConfigs?.varMapped)) ?? []
|
|
87
|
+
);
|
|
79
88
|
const [templatePreviewUrl, setTemplatePreviewUrl] = useState('');
|
|
80
89
|
const [templateStatus, setZaloTemplateStatus] = useState(
|
|
81
90
|
ZALO_STATUSES.ENABLE,
|
|
@@ -172,7 +181,7 @@ export const Zalo = (props) => {
|
|
|
172
181
|
});
|
|
173
182
|
|
|
174
183
|
const setDataForEdit = (setValues) => {
|
|
175
|
-
if(
|
|
184
|
+
if(hostName === VIET_GUYS) {
|
|
176
185
|
const {
|
|
177
186
|
name = '',
|
|
178
187
|
_id: zaloId = '',
|
|
@@ -197,7 +206,7 @@ export const Zalo = (props) => {
|
|
|
197
206
|
updateTemplateData(gapitTemplateId, templateName, handledListParams, previewUrl, ZALO_STATUSES.ENABLE);
|
|
198
207
|
} else {
|
|
199
208
|
const { _id: gapitTemplateId = '' } = templateData;
|
|
200
|
-
let data = gapitAllTemplateData
|
|
209
|
+
let data = gapitAllTemplateData?.find(template => template?._id == gapitTemplateId);
|
|
201
210
|
const { templateName = "", listParams = [], previewUrl = "", status = "" } = data?.versions?.base?.content?.zalo || {};
|
|
202
211
|
updateTemplateData(gapitTemplateId, templateName, listParams, previewUrl, status);
|
|
203
212
|
}
|
|
@@ -390,7 +399,7 @@ export const Zalo = (props) => {
|
|
|
390
399
|
varMap = templateListParams;
|
|
391
400
|
} else {
|
|
392
401
|
templateListParams?.forEach((listParam) => {
|
|
393
|
-
const { name, value } = listParam;
|
|
402
|
+
const { name = '', value = '' } = listParam;
|
|
394
403
|
varMap[name] = value;
|
|
395
404
|
}
|
|
396
405
|
);
|