@capillarytech/creatives-library 7.17.204 → 7.17.205-alpha.0

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.204",
4
+ "version": "7.17.205-alpha.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -37,6 +37,7 @@ import { getCdnUrl } from '../../../utils/cdnTransformation';
37
37
  import { MAPP_SDK } from './constants';
38
38
  import { isEmbeddedEditOrPreview } from '../../../utils/commonUtils';
39
39
  import { EMBEDDED } from '../../Whatsapp/constants';
40
+ import { OUTBOUND } from '../../../v2Components/FormBuilder/constants';
40
41
 
41
42
  const PrefixWrapper = styled.div`
42
43
  margin-right: 16px;
@@ -111,7 +112,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
111
112
  let selectedWeChatAccount = {};
112
113
  const queryType = String(get(this.props, 'location.query.type', ''))?.toLowerCase();
113
114
  const creativesMode = String(get(this.props, 'creativesMode', ''))?.toLowerCase();
114
- const { Edit: EditProps, Templates } = this.props || {};
115
+ const { Edit: EditProps, templateData, Templates, type } = this.props || {};
115
116
  const { selectedWeChatAccount: editSelectedWeChatAccount, templateDetails } = EditProps || {};
116
117
  const { id: selectedWeChatAccountId } = editSelectedWeChatAccount || {};
117
118
  const { definition } = templateDetails || {};
@@ -126,13 +127,31 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
126
127
  }
127
128
 
128
129
  if (queryType === EMBEDDED && !nextEdit?.fetchingWeCrmAccounts && !_.isEqual(EditProps?.weCrmAccounts, nextEdit?.weCrmAccounts) && (!selectedWeChatAccount || _.isEmpty(selectedWeChatAccount))) {
129
- this.setMobilePushAccountOptions(nextEdit?.weCrmAccounts, get(this.props, "templateData.definition.accountId"));
130
- }
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 && templateAccountId && selectedWeChatAccountId && !_.isEqual(selectedWeChatAccountId, templateAccountId)) {
130
+ this.setMobilePushAccountOptions(nextEdit?.weCrmAccounts, templateData?.definition?.accountId);
131
+ }
132
+ // Check if the query type is 'embedded' and the creatives mode is either 'edit' or 'preview'.
133
+ // If the type is not 'outbound', ensure that the selected WeChat account ID is not equal to the account ID in the template details.
134
+ // If all conditions are met, set the mobile push account options using the provided weCrmAccounts and the account ID from templateData.
135
+ if (
136
+ isEmbeddedEditOrPreview(queryType, creativesMode) &&
137
+ type !== OUTBOUND.toLowerCase() &&
138
+ nextEdit?.weCrmAccounts &&
139
+ !EditProps?.fetchingWeCrmAccounts &&
140
+ templateData?.definition?.accountId &&
141
+ !_.isEqual(templateAccountId, templateData?.definition?.accountId)
142
+ ) {
143
+ this.setMobilePushAccountOptions(nextEdit?.weCrmAccounts, templateData?.definition?.accountId);
144
+ }
145
+ // If the type is 'outbound', ensure that the selected WeChat account ID is not equal to the account ID in the template details.
146
+ // If all conditions are met, set the mobile push account options using the provided weCrmAccounts and the template account ID.
147
+ if (
148
+ isEmbeddedEditOrPreview(queryType, creativesMode) &&
149
+ type === OUTBOUND.toLowerCase() &&
150
+ nextEdit?.weCrmAccounts &&
151
+ selectedWeChatAccountId &&
152
+ templateAccountId &&
153
+ !_.isEqual(selectedWeChatAccountId, templateAccountId)
154
+ ) {
136
155
  this.setMobilePushAccountOptions(nextEdit?.weCrmAccounts, templateAccountId);
137
156
  }
138
157
  if (!_.isEmpty(nextEdit?.selectedWeChatAccount) && !_.isEqual(editSelectedWeChatAccount, nextEdit?.selectedWeChatAccount) && (queryType === EMBEDDED) && this.props.location.query.module === "loyalty") {