@capillarytech/creatives-library 7.17.194 → 7.17.195
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
|
@@ -35,3 +35,6 @@ export const GET_MOBILEPUSH_TEMPLATES_LIST_SUCCESS = 'app/v2Containers/WeChat/GE
|
|
|
35
35
|
export const GET_MOBILEPUSH_TEMPLATES_LIST_FAILURE = 'app/v2Containers/WeChat/GET_MOBILEPUSH_TEMPLATES_LIST_FAILURE';
|
|
36
36
|
|
|
37
37
|
export const MAPP_SDK = 'MAPP_SDK';
|
|
38
|
+
export const EMBEDDED = 'EMBEDDED';
|
|
39
|
+
export const EDIT = 'EDIT';
|
|
40
|
+
export const PREVIEW = 'PREVIEW';
|
|
@@ -34,7 +34,7 @@ import { GA } from '@capillarytech/cap-ui-utils';
|
|
|
34
34
|
import { EDIT, TRACK_EDIT_MPUSH } from '../../App/constants';
|
|
35
35
|
import { MOBILE_PUSH } from '../../CreativesContainer/constants';
|
|
36
36
|
import { getCdnUrl } from '../../../utils/cdnTransformation';
|
|
37
|
-
import { MAPP_SDK } from './constants';
|
|
37
|
+
import { EMBEDDED, MAPP_SDK, PREVIEW } from './constants';
|
|
38
38
|
|
|
39
39
|
const PrefixWrapper = styled.div`
|
|
40
40
|
margin-right: 16px;
|
|
@@ -107,7 +107,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
107
107
|
this.startValidation();
|
|
108
108
|
}
|
|
109
109
|
let selectedWeChatAccount = {};
|
|
110
|
-
if (this.props.location.query.type ===
|
|
110
|
+
if (this.props.location.query.type === EMBEDDED.toLowerCase() && (this.props.creativesMode === EDIT.toLowerCase() || this.props.creativesMode === PREVIEW.toLowerCase())) {
|
|
111
111
|
if (!_.isEmpty(this.props.Edit.selectedWeChatAccount)) {
|
|
112
112
|
selectedWeChatAccount = this.props.Edit.selectedWeChatAccount;
|
|
113
113
|
} else {
|
|
@@ -120,7 +120,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
120
120
|
if (this.props.location.query.type === 'embedded' && !nextProps.Edit.fetchingWeCrmAccounts && !_.isEqual(this.props.Edit.weCrmAccounts, nextProps.Edit.weCrmAccounts) && (!selectedWeChatAccount || _.isEmpty(selectedWeChatAccount))) {
|
|
121
121
|
this.setMobilePushAccountOptions(nextProps.Edit.weCrmAccounts, get(this.props, "templateData.definition.accountId"));
|
|
122
122
|
}
|
|
123
|
-
if
|
|
123
|
+
// 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.
|
|
124
|
+
// If all conditions are met, set the mobile push account options using the provided weCrmAccounts and the account ID from templateData.
|
|
125
|
+
if (this.props.location.query.type === EMBEDDED.toLowerCase() && (this.props.creativesMode === EDIT.toLowerCase() || this.props.creativesMode === PREVIEW.toLowerCase()) && !_.isEqual(this.props.Edit.selectedWeChatAccount?.id, this.props.Edit.templateDetails?.definition?.accountId)) {
|
|
124
126
|
this.setMobilePushAccountOptions(nextProps.Edit.weCrmAccounts, get(this.props, "templateData.definition.accountId"));
|
|
125
127
|
}
|
|
126
128
|
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") {
|
|
@@ -228,10 +230,10 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
228
230
|
|
|
229
231
|
getWeChatAccount = () => {
|
|
230
232
|
let selectedWeChatAccount = {};
|
|
231
|
-
const {type = ''} = this.props.location
|
|
233
|
+
const {type = ''} = this.props.location?.query;
|
|
232
234
|
const {creativesMode = ''} = this.props;
|
|
233
235
|
|
|
234
|
-
if (type ===
|
|
236
|
+
if (type === EMBEDDED.toLowerCase() && (creativesMode === EDIT.toLowerCase() || creativesMode === PREVIEW.toLowerCase())) {
|
|
235
237
|
if (!_.isEmpty(this.props.Edit.selectedWeChatAccount)) {
|
|
236
238
|
selectedWeChatAccount = this.props.Edit.selectedWeChatAccount;
|
|
237
239
|
} else {
|
|
@@ -368,8 +370,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
368
370
|
};
|
|
369
371
|
obj.type = 'MOBILEPUSH';
|
|
370
372
|
obj.name = formData['template-name'];
|
|
371
|
-
if (this.props.location.query.type ===
|
|
372
|
-
if (this.props
|
|
373
|
+
if (this.props.location.query.type === EMBEDDED.toLowerCase() && (this.props.creativesMode === EDIT.toLowerCase() || this.props.creativesMode === PREVIEW.toLowerCase())) {
|
|
374
|
+
if (get(this.props, 'Edit.selectedWeChatAccount.sourceTypeName') === MAPP_SDK) {
|
|
373
375
|
obj.definition = {
|
|
374
376
|
accountId: selectedWeChatAccount.id,
|
|
375
377
|
licenseCode: selectedWeChatAccount.sourceAccountIdentifier,
|
|
@@ -384,7 +386,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
384
386
|
sourceType: selectedWeChatAccount.sourceTypeName,
|
|
385
387
|
};
|
|
386
388
|
}
|
|
387
|
-
} else if (this.props
|
|
389
|
+
} else if (get(this.props, 'Templates.selectedWeChatAccount.sourceTypeName') === MAPP_SDK) {
|
|
388
390
|
obj.definition = {
|
|
389
391
|
accountId: selectedWeChatAccount.id,
|
|
390
392
|
licenseCode: selectedWeChatAccount.sourceAccountIdentifier,
|
|
@@ -1522,7 +1524,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1522
1524
|
temp.options = this.state.templateOptions ? this.state.accountsOptions : [];
|
|
1523
1525
|
}
|
|
1524
1526
|
if (temp.id === "mobile-push-preview") {
|
|
1525
|
-
if (this.props.location.query.type ===
|
|
1527
|
+
if (this.props.location.query.type === EMBEDDED.toLowerCase() && (this.props.creativesMode === EDIT.toLowerCase() || this.props.creativesMode === PREVIEW.toLowerCase()) && this.props.Edit.selectedWeChatAccount && !_.isEmpty(this.props.Edit.selectedWeChatAccount)) {
|
|
1526
1528
|
temp.content.appName = this.props.Edit.selectedWeChatAccount.name;
|
|
1527
1529
|
} else if (this.props.Templates.selectedWeChatAccount && !_.isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
1528
1530
|
temp.content.appName = this.props.Templates.selectedWeChatAccount.name;
|
|
@@ -1748,7 +1750,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1748
1750
|
if (!_.isEmpty(actionText)) {
|
|
1749
1751
|
this.deleteSecondaryCtaIos();
|
|
1750
1752
|
}
|
|
1751
|
-
if ((this.props.location.query.type ===
|
|
1753
|
+
if ((this.props.location.query.type === EMBEDDED.toLowerCase() && (this.props.creativesMode === EDIT.toLowerCase() || this.props.creativesMode === PREVIEW.toLowerCase()))) {
|
|
1752
1754
|
this.props.actions.getIosCtas(this.props.Edit.selectedWeChatAccount.sourceAccountIdentifier);
|
|
1753
1755
|
} else {
|
|
1754
1756
|
this.props.actions.getIosCtas(this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier);
|