@capillarytech/creatives-library 7.17.203-alpha.2 → 7.17.203
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
package/services/api.js
CHANGED
|
@@ -357,15 +357,15 @@ export const getUserList = () => {
|
|
|
357
357
|
return API.get(url);// request(url, getAPICallObject('GET'));
|
|
358
358
|
};
|
|
359
359
|
|
|
360
|
-
export const fetchSchemaForEntity =
|
|
360
|
+
export const fetchSchemaForEntity = ({queryParams}) => {
|
|
361
361
|
if (queryParams.version === "v2" && queryParams.type === "LAYOUT") {
|
|
362
362
|
const schema = getSchema(queryParams.layout);
|
|
363
|
-
return
|
|
363
|
+
return schema.then((layout) => layout).catch((err) => {
|
|
364
364
|
console.error(err);
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
367
|
const url = `${API_ENDPOINT}/meta/${queryParams.type}?query=${JSON.stringify(queryParams)}`;
|
|
368
|
-
return
|
|
368
|
+
return request(url, getAPICallObject('GET'));// request(url, getAPICallObject('GET'));
|
|
369
369
|
};
|
|
370
370
|
|
|
371
371
|
export const fetchWeCrmAccounts = (sourceName) => {
|
|
@@ -1102,7 +1102,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1102
1102
|
this.props?.metaEntities?.tagLookupMap
|
|
1103
1103
|
);
|
|
1104
1104
|
const unsupportedLiquidTags = extractedLiquidTags?.filter(
|
|
1105
|
-
(tag) => !supportedLiquidTags?.includes(tag)
|
|
1105
|
+
(tag) => !supportedLiquidTags?.includes(tag) && !this.skipTags(tag)
|
|
1106
1106
|
);
|
|
1107
1107
|
if (
|
|
1108
1108
|
unsupportedLiquidTags?.length > 0
|
|
@@ -36,7 +36,6 @@ import { MOBILE_PUSH } from '../../CreativesContainer/constants';
|
|
|
36
36
|
import { getCdnUrl } from '../../../utils/cdnTransformation';
|
|
37
37
|
import { MAPP_SDK } from './constants';
|
|
38
38
|
import { isEmbeddedEditOrPreview } from '../../../utils/commonUtils';
|
|
39
|
-
import { EMBEDDED } from '../../Whatsapp/constants';
|
|
40
39
|
|
|
41
40
|
const PrefixWrapper = styled.div`
|
|
42
41
|
margin-right: 16px;
|
|
@@ -111,35 +110,27 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
111
110
|
let selectedWeChatAccount = {};
|
|
112
111
|
const queryType = String(get(this.props, 'location.query.type', ''))?.toLowerCase();
|
|
113
112
|
const creativesMode = String(get(this.props, 'creativesMode', ''))?.toLowerCase();
|
|
114
|
-
const { Edit: EditProps, Templates } = this.props || {};
|
|
115
|
-
const { selectedWeChatAccount: editSelectedWeChatAccount, templateDetails } = EditProps || {};
|
|
116
|
-
const { id: selectedWeChatAccountId } = editSelectedWeChatAccount || {};
|
|
117
|
-
const { definition } = templateDetails || {};
|
|
118
|
-
const { accountId: templateAccountId } = definition || {};
|
|
119
|
-
const { Edit: nextEdit } = nextProps || {};
|
|
120
113
|
if (isEmbeddedEditOrPreview(queryType, creativesMode)) {
|
|
121
|
-
selectedWeChatAccount = !_.isEmpty(
|
|
122
|
-
?
|
|
123
|
-
:
|
|
124
|
-
} else if (!_.isEmpty(Templates
|
|
125
|
-
selectedWeChatAccount = Templates
|
|
114
|
+
selectedWeChatAccount = !_.isEmpty(this.props.Edit.selectedWeChatAccount)
|
|
115
|
+
? this.props.Edit.selectedWeChatAccount
|
|
116
|
+
: nextProps.Edit.selectedWeChatAccount;
|
|
117
|
+
} else if (!_.isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
118
|
+
selectedWeChatAccount = this.props.Templates.selectedWeChatAccount;
|
|
126
119
|
}
|
|
127
120
|
|
|
128
|
-
if (
|
|
129
|
-
this.setMobilePushAccountOptions(
|
|
121
|
+
if (this.props.location.query.type === 'embedded' && !nextProps.Edit.fetchingWeCrmAccounts && !_.isEqual(this.props.Edit.weCrmAccounts, nextProps.Edit.weCrmAccounts) && (!selectedWeChatAccount || _.isEmpty(selectedWeChatAccount))) {
|
|
122
|
+
this.setMobilePushAccountOptions(nextProps.Edit.weCrmAccounts, get(this.props, "templateData.definition.accountId"));
|
|
130
123
|
}
|
|
131
|
-
// Check if the
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (isEmbeddedEditOrPreview(queryType, creativesMode) && nextEdit?.weCrmAccounts && templateAccountId && selectedWeChatAccountId && !_.isEqual(selectedWeChatAccountId, templateAccountId)) {
|
|
136
|
-
this.setMobilePushAccountOptions(nextEdit?.weCrmAccounts, templateAccountId);
|
|
124
|
+
// Check if the query type is 'embedded' and the creatives mode is either 'edit' or 'preview'. Also, ensure that the selected WeChat account ID is not equal to the account ID in the template details.
|
|
125
|
+
// If all conditions are met, set the mobile push account options using the provided weCrmAccounts and the account ID from templateData.
|
|
126
|
+
if (isEmbeddedEditOrPreview(queryType, creativesMode) && !_.isEqual(this.props.Edit.selectedWeChatAccount?.id, this.props.Edit.templateDetails?.definition?.accountId)) {
|
|
127
|
+
this.setMobilePushAccountOptions(nextProps.Edit.weCrmAccounts, get(this.props, "templateData.definition.accountId"));
|
|
137
128
|
}
|
|
138
|
-
if (!_.isEmpty(
|
|
129
|
+
if (!_.isEmpty(nextProps.Edit.selectedWeChatAccount) && !_.isEqual(this.props.Edit.selectedWeChatAccount, nextProps.Edit.selectedWeChatAccount) && (this.props.location.query.type === 'embedded') && this.props.location.query.module === "loyalty") {
|
|
139
130
|
const params = {
|
|
140
131
|
name: '',
|
|
141
132
|
sortBy: 'Most Recent',
|
|
142
|
-
accountId:
|
|
133
|
+
accountId: nextProps.Edit.selectedWeChatAccount.id,
|
|
143
134
|
};
|
|
144
135
|
this.props.actions.getMobilepushTemplatesList('mobilepush', params);
|
|
145
136
|
}
|
|
@@ -168,6 +159,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
168
159
|
this.setTemplateOptions(nextProps.Edit.mobilepushTemplates);
|
|
169
160
|
}
|
|
170
161
|
}
|
|
162
|
+
|
|
171
163
|
this.handleEditSchemaOnPropsChange(nextProps, selectedWeChatAccount);
|
|
172
164
|
if (nextProps.Edit.uploadedAssetData) {
|
|
173
165
|
const formData = _.cloneDeep(this.state.formData);
|