@capillarytech/creatives-library 7.17.202 → 7.17.203-alpha.1
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
|
@@ -36,6 +36,7 @@ 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';
|
|
39
40
|
|
|
40
41
|
const PrefixWrapper = styled.div`
|
|
41
42
|
margin-right: 16px;
|
|
@@ -110,27 +111,35 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
110
111
|
let selectedWeChatAccount = {};
|
|
111
112
|
const queryType = String(get(this.props, 'location.query.type', ''))?.toLowerCase();
|
|
112
113
|
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 || {};
|
|
113
120
|
if (isEmbeddedEditOrPreview(queryType, creativesMode)) {
|
|
114
|
-
selectedWeChatAccount = !_.isEmpty(
|
|
115
|
-
?
|
|
116
|
-
:
|
|
117
|
-
} else if (!_.isEmpty(
|
|
118
|
-
selectedWeChatAccount =
|
|
121
|
+
selectedWeChatAccount = !_.isEmpty(editSelectedWeChatAccount)
|
|
122
|
+
? editSelectedWeChatAccount
|
|
123
|
+
: nextEdit?.selectedWeChatAccount;
|
|
124
|
+
} else if (!_.isEmpty(Templates?.selectedWeChatAccount)) {
|
|
125
|
+
selectedWeChatAccount = Templates?.selectedWeChatAccount;
|
|
119
126
|
}
|
|
120
127
|
|
|
121
|
-
if (
|
|
122
|
-
this.setMobilePushAccountOptions(
|
|
128
|
+
if (queryType === EMBEDDED && !nextEdit?.fetchingWeCrmAccounts && !_.isEqual(EditProps?.weCrmAccounts, nextEdit?.weCrmAccounts) && (!selectedWeChatAccount || _.isEmpty(selectedWeChatAccount))) {
|
|
129
|
+
this.setMobilePushAccountOptions(nextEdit?.weCrmAccounts, get(this.props, "templateData.definition.accountId"));
|
|
123
130
|
}
|
|
124
|
-
// Check if the
|
|
125
|
-
|
|
126
|
-
if
|
|
127
|
-
|
|
131
|
+
// Check if the current mode is either embedded edit or preview, and if the selected WeChat account ID,
|
|
132
|
+
// template account ID, and the next props' weCrmAccounts are available, and if fetchingWeCrmAccounts is false,
|
|
133
|
+
// and if the selected WeChat account ID is not equal to the template account ID.
|
|
134
|
+
// If all conditions are met, set the mobile push account options using the next props' weCrmAccounts and the template account ID.
|
|
135
|
+
if (isEmbeddedEditOrPreview(queryType, creativesMode) && nextEdit?.weCrmAccounts && !_.isEqual(selectedWeChatAccountId, templateAccountId)) {
|
|
136
|
+
this.setMobilePushAccountOptions(nextEdit?.weCrmAccounts, get(this.props, "templateData.definition.accountId"));
|
|
128
137
|
}
|
|
129
|
-
if (!_.isEmpty(
|
|
138
|
+
if (!_.isEmpty(nextEdit?.selectedWeChatAccount) && !_.isEqual(editSelectedWeChatAccount, nextEdit?.selectedWeChatAccount) && (queryType === EMBEDDED) && this.props.location.query.module === "loyalty") {
|
|
130
139
|
const params = {
|
|
131
140
|
name: '',
|
|
132
141
|
sortBy: 'Most Recent',
|
|
133
|
-
accountId:
|
|
142
|
+
accountId: nextEdit?.selectedWeChatAccount?.id,
|
|
134
143
|
};
|
|
135
144
|
this.props.actions.getMobilepushTemplatesList('mobilepush', params);
|
|
136
145
|
}
|
|
@@ -159,7 +168,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
159
168
|
this.setTemplateOptions(nextProps.Edit.mobilepushTemplates);
|
|
160
169
|
}
|
|
161
170
|
}
|
|
162
|
-
|
|
163
171
|
this.handleEditSchemaOnPropsChange(nextProps, selectedWeChatAccount);
|
|
164
172
|
if (nextProps.Edit.uploadedAssetData) {
|
|
165
173
|
const formData = _.cloneDeep(this.state.formData);
|