@capillarytech/creatives-library 6.3.2 → 6.3.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/containers/App/constants.js +2 -0
- package/containers/WeChat/MapTemplates/index.js +22 -10
- package/containers/WeChat/MapTemplates/messages.js +1 -1
- package/package.json +1 -1
- package/utils/common.js +7 -0
- package/v2Components/NewCallTask/index.js +4 -2
- package/v2Containers/WeChat/MapTemplates/index.js +22 -10
- package/v2Containers/WeChat/MapTemplates/messages.js +1 -1
|
@@ -459,9 +459,6 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
459
459
|
template_id: this.state.editTemplateData.versions.base.template_id,
|
|
460
460
|
Title: this.state.editTemplateData.versions.base.Title,
|
|
461
461
|
Tag: [],
|
|
462
|
-
url: this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'],
|
|
463
|
-
userName: this.state.formData['template-mini-program-id'] ? this.state.formData['template-mini-program-id'] : '',
|
|
464
|
-
path: this.state.formData['template-mini-program-page-path'] ? this.state.formData['template-mini-program-page-path'] : '',
|
|
465
462
|
TopColor: "#000000",
|
|
466
463
|
data: {},
|
|
467
464
|
preview: '',
|
|
@@ -472,6 +469,15 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
472
469
|
creative_template_id: this.state.editTemplateData._id,
|
|
473
470
|
touser: "{{wechat_open_id}}",
|
|
474
471
|
};
|
|
472
|
+
if (this.state.formData['template-redirect-options-radio'] === MINI_PROGRAM) {
|
|
473
|
+
const miniprogram = {};
|
|
474
|
+
miniprogram.appid = this.state.formData['template-mini-program-id'] || '';
|
|
475
|
+
miniprogram.pagepath = this.state.formData['template-mini-program-page-path'] || '';
|
|
476
|
+
data.miniprogram = miniprogram;
|
|
477
|
+
data.url = "notset";
|
|
478
|
+
} else if (this.state.formData['template-redirect-options-radio'] === URL) {
|
|
479
|
+
data.url = this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'];
|
|
480
|
+
}
|
|
475
481
|
_.forEach(this.state.selectedTemplateTags, (templateTag) => {
|
|
476
482
|
const tagName = templateTag.substr(0, templateTag.indexOf('.'));
|
|
477
483
|
let newTagname = tagName;
|
|
@@ -801,7 +807,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
801
807
|
}
|
|
802
808
|
formData[`template-${tagName}`] = this.state.editTemplateData.versions.base.data[tag].value;
|
|
803
809
|
});
|
|
804
|
-
if (this.state.editTemplateData.versions.base.url) {
|
|
810
|
+
if (this.state.editTemplateData.versions.base.url && this.state.editTemplateData.versions.base.url !== "notset") {
|
|
805
811
|
formData['template-redirect-options-radio'] = URL;
|
|
806
812
|
formData[`template-link`] = this.state.editTemplateData.versions.base.isInternalUrl ? this.unMaskTemplateUrl(this.state.editTemplateData.versions.base.url) : this.state.editTemplateData.versions.base.url;
|
|
807
813
|
schema.standalone.sections[0].childSections[1].childSections[0].childSections.push(this.getURLSchema());
|
|
@@ -809,10 +815,10 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
809
815
|
if (this.state.editTemplateData.versions.base.isInternalUrl) {
|
|
810
816
|
formData['is-internal-url'] = this.state.editTemplateData.versions.base.isInternalUrl;
|
|
811
817
|
}
|
|
812
|
-
if (this.state.editTemplateData.versions.base.
|
|
818
|
+
if (this.state.editTemplateData.versions.base.miniprogram && this.state.editTemplateData.versions.base.miniprogram.appid && this.state.editTemplateData.versions.base.miniprogram.pagepath) {
|
|
813
819
|
formData['template-redirect-options-radio'] = MINI_PROGRAM;
|
|
814
|
-
formData['template-mini-program-id'] = this.state.editTemplateData.versions.base.
|
|
815
|
-
formData['template-mini-program-page-path'] = this.state.editTemplateData.versions.base.
|
|
820
|
+
formData['template-mini-program-id'] = this.state.editTemplateData.versions.base.miniprogram.appid;
|
|
821
|
+
formData['template-mini-program-page-path'] = this.state.editTemplateData.versions.base.miniprogram.pagepath;
|
|
816
822
|
schema.standalone.sections[0].childSections[1].childSections[0].childSections.push(this.getMiniProgramSchema());
|
|
817
823
|
}
|
|
818
824
|
// schema.standalone.sections[0].childSections[1].childSections[1].inputFields[0].cols[0].content = weChatData.content;
|
|
@@ -1264,9 +1270,6 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
1264
1270
|
"template_id": selectedWechatData.template_id,
|
|
1265
1271
|
"Title": selectedWechatData.title,
|
|
1266
1272
|
Tag: [],
|
|
1267
|
-
url: this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'],
|
|
1268
|
-
userName: this.state.formData['template-mini-program-id'] ? this.state.formData['template-mini-program-id'] : '',
|
|
1269
|
-
path: this.state.formData['template-mini-program-page-path'] ? this.state.formData['template-mini-program-page-path'] : '',
|
|
1270
1273
|
TopColor: "#000000",
|
|
1271
1274
|
data: {},
|
|
1272
1275
|
preview: '',
|
|
@@ -1275,6 +1278,15 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
1275
1278
|
content: selectedWechatData.content,
|
|
1276
1279
|
isInternalUrl: this.state.formData['is-internal-url'],
|
|
1277
1280
|
}
|
|
1281
|
+
if (this.state.formData['template-redirect-options-radio'] === MINI_PROGRAM) {
|
|
1282
|
+
const miniprogram = {};
|
|
1283
|
+
miniprogram['appid'] = this.state.formData['template-mini-program-id'] || '';
|
|
1284
|
+
miniprogram['pagepath'] = this.state.formData['template-mini-program-page-path'] || '';
|
|
1285
|
+
obj.versions.base['miniprogram'] = miniprogram;
|
|
1286
|
+
obj.versions.base['url'] = "notset";
|
|
1287
|
+
} else if (this.state.formData['template-redirect-options-radio'] === URL) {
|
|
1288
|
+
obj.versions.base['url'] = this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'];
|
|
1289
|
+
}
|
|
1278
1290
|
_.forEach(this.state.selectedTemplateTags, (templateTag) => {
|
|
1279
1291
|
const tagName = templateTag.substr(0, templateTag.indexOf('.'));
|
|
1280
1292
|
let newTagname = tagName;
|
|
@@ -152,6 +152,6 @@ export default defineMessages({
|
|
|
152
152
|
},
|
|
153
153
|
"pagePathInductive": {
|
|
154
154
|
id: 'creatives.containers.WeChat.pagePathInductive',
|
|
155
|
-
defaultMessage: '
|
|
155
|
+
defaultMessage: 'User will be redirected to the Mini-Program path provided here',
|
|
156
156
|
},
|
|
157
157
|
});
|
package/package.json
CHANGED
package/utils/common.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
+
import { Auth } from '@capillarytech/cap-ui-utils';
|
|
3
|
+
import { STORE2DOOR_PLUS_ENABLED } from '../containers/App/constants';
|
|
2
4
|
|
|
3
5
|
export function getUserNameById(userId, allUserList) {
|
|
4
6
|
let userName = "";
|
|
@@ -30,3 +32,8 @@ export function removeLinksFromHtmlContent(content) {
|
|
|
30
32
|
doc.remove();
|
|
31
33
|
return copyContent;
|
|
32
34
|
}
|
|
35
|
+
|
|
36
|
+
export const hasStore2DoorFeature = Auth.hasFeatureAccess.bind(
|
|
37
|
+
null,
|
|
38
|
+
STORE2DOOR_PLUS_ENABLED,
|
|
39
|
+
);
|
|
@@ -15,6 +15,7 @@ import TagList from '../../v2Containers/TagList';
|
|
|
15
15
|
import CallTaskPreview from '../CallTaskPreview';
|
|
16
16
|
import messages from './messages';
|
|
17
17
|
import './_newCallTask.scss';
|
|
18
|
+
import { hasStore2DoorFeature } from '../../utils/common';
|
|
18
19
|
|
|
19
20
|
const CALL = 'CALL';
|
|
20
21
|
const STOREMAX_WHATSAPP = 'STOREMAX_WHATSAPP';
|
|
@@ -102,6 +103,7 @@ class NewCallTask extends React.Component { // eslint-disable-line react/prefer-
|
|
|
102
103
|
const { formatMessage } = intl;
|
|
103
104
|
const { subject, messageBody, description, callTaskActionType } = this.state;
|
|
104
105
|
const tags = metaEntities && metaEntities.tags ? metaEntities.tags.standard : [];
|
|
106
|
+
const isStore2DoorEnabled = hasStore2DoorFeature();
|
|
105
107
|
return (
|
|
106
108
|
<CapSpin spinning={isLoading}>
|
|
107
109
|
<CapRow gutter={16}>
|
|
@@ -138,13 +140,13 @@ class NewCallTask extends React.Component { // eslint-disable-line react/prefer-
|
|
|
138
140
|
value={description}
|
|
139
141
|
isRequired
|
|
140
142
|
/>
|
|
141
|
-
<CapCheckbox
|
|
143
|
+
{isStore2DoorEnabled && <CapCheckbox
|
|
142
144
|
onChange={this.onS2DCheckChange}
|
|
143
145
|
checked={callTaskActionType === STOREMAX_WHATSAPP}
|
|
144
146
|
style={{marginTop: FONT_SIZE_S}}
|
|
145
147
|
>
|
|
146
148
|
<FormattedMessage {...messages.useInS2D}/>
|
|
147
|
-
</CapCheckbox>
|
|
149
|
+
</CapCheckbox>}
|
|
148
150
|
</div>
|
|
149
151
|
<CapButton
|
|
150
152
|
disabled={!subject || !messageBody || !description}
|
|
@@ -443,9 +443,6 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
443
443
|
template_id: editTemplateData.versions.base.template_id,
|
|
444
444
|
Title: editTemplateData.versions.base.Title,
|
|
445
445
|
Tag: [],
|
|
446
|
-
url: this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'],
|
|
447
|
-
userName: this.state.formData['template-mini-program-id'] ? this.state.formData['template-mini-program-id'] : '',
|
|
448
|
-
path: this.state.formData['template-mini-program-page-path'] ? this.state.formData['template-mini-program-page-path'] : '',
|
|
449
446
|
TopColor: "#000000",
|
|
450
447
|
data: {},
|
|
451
448
|
BrandId: (selectedWeChatAccount.configs.brand_id ? selectedWeChatAccount.configs.brand_id : ''),
|
|
@@ -455,6 +452,15 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
455
452
|
creative_template_id: editTemplateData._id,
|
|
456
453
|
touser: "{{wechat_open_id}}",
|
|
457
454
|
};
|
|
455
|
+
if (this.state.formData['template-redirect-options-radio'] === MINI_PROGRAM) {
|
|
456
|
+
const miniprogram = {};
|
|
457
|
+
miniprogram.appid = this.state.formData['template-mini-program-id'] || '';
|
|
458
|
+
miniprogram.pagepath = this.state.formData['template-mini-program-page-path'] || '';
|
|
459
|
+
data.miniprogram = miniprogram;
|
|
460
|
+
data.url = "notset";
|
|
461
|
+
} else if (this.state.formData['template-redirect-options-radio'] === URL) {
|
|
462
|
+
data.url = this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'];
|
|
463
|
+
}
|
|
458
464
|
forEach(this.state.selectedTemplateTags, (templateTag) => {
|
|
459
465
|
const tagName = templateTag.substr(0, templateTag.indexOf('.'));
|
|
460
466
|
let newTagname = tagName;
|
|
@@ -691,7 +697,7 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
691
697
|
}
|
|
692
698
|
formData[`template-${tagName}`] = this.state.editTemplateData.versions.base.data[tag].value;
|
|
693
699
|
});
|
|
694
|
-
if (this.state.editTemplateData.versions.base.url) {
|
|
700
|
+
if (this.state.editTemplateData.versions.base.url && this.state.editTemplateData.versions.base.url !== "notset") {
|
|
695
701
|
formData['template-redirect-options-radio'] = URL;
|
|
696
702
|
formData[`template-link`] = this.state.editTemplateData.versions.base.isInternalUrl ? this.unMaskTemplateUrl(this.state.editTemplateData.versions.base.url) : this.state.editTemplateData.versions.base.url;
|
|
697
703
|
schema.standalone.sections[0].childSections[1].childSections[0].childSections.push(this.getURLSchema());
|
|
@@ -699,10 +705,10 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
699
705
|
if (this.state.editTemplateData.versions.base.isInternalUrl) {
|
|
700
706
|
formData['is-internal-url'] = this.state.editTemplateData.versions.base.isInternalUrl;
|
|
701
707
|
}
|
|
702
|
-
if (this.state.editTemplateData.versions.base.
|
|
708
|
+
if (this.state.editTemplateData.versions.base.miniprogram && this.state.editTemplateData.versions.base.miniprogram.appid && this.state.editTemplateData.versions.base.miniprogram.pagepath) {
|
|
703
709
|
formData['template-redirect-options-radio'] = MINI_PROGRAM;
|
|
704
|
-
formData['template-mini-program-id'] = this.state.editTemplateData.versions.base.
|
|
705
|
-
formData['template-mini-program-page-path'] = this.state.editTemplateData.versions.base.
|
|
710
|
+
formData['template-mini-program-id'] = this.state.editTemplateData.versions.base.miniprogram.appid;
|
|
711
|
+
formData['template-mini-program-page-path'] = this.state.editTemplateData.versions.base.miniprogram.pagepath;
|
|
706
712
|
schema.standalone.sections[0].childSections[1].childSections[0].childSections.push(this.getMiniProgramSchema());
|
|
707
713
|
}
|
|
708
714
|
// schema.standalone.sections[0].childSections[1].childSections[1].inputFields[0].cols[0].content = weChatData.content;
|
|
@@ -1125,9 +1131,6 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
1125
1131
|
"template_id": selectedWechatData.template_id,
|
|
1126
1132
|
"Title": selectedWechatData.title,
|
|
1127
1133
|
Tag: [],
|
|
1128
|
-
userName: this.state.formData['template-mini-program-id'] ? this.state.formData['template-mini-program-id'] : '',
|
|
1129
|
-
path: this.state.formData['template-mini-program-page-path'] ? this.state.formData['template-mini-program-page-path'] : '',
|
|
1130
|
-
url: this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'],
|
|
1131
1134
|
TopColor: "#000000",
|
|
1132
1135
|
data: {},
|
|
1133
1136
|
preview: '',
|
|
@@ -1136,6 +1139,15 @@ export class MapTemplates extends React.Component { // eslint-disable-line react
|
|
|
1136
1139
|
content: selectedWechatData.content,
|
|
1137
1140
|
isInternalUrl: this.state.formData['is-internal-url'],
|
|
1138
1141
|
}
|
|
1142
|
+
if (this.state.formData['template-redirect-options-radio'] === MINI_PROGRAM) {
|
|
1143
|
+
const miniprogram = {};
|
|
1144
|
+
miniprogram['appid'] = this.state.formData['template-mini-program-id'] || '';
|
|
1145
|
+
miniprogram['pagepath'] = this.state.formData['template-mini-program-page-path'] || '';
|
|
1146
|
+
obj.versions.base['miniprogram'] = miniprogram;
|
|
1147
|
+
obj.versions.base['url'] = "notset";
|
|
1148
|
+
} else if (this.state.formData['template-redirect-options-radio'] === URL) {
|
|
1149
|
+
obj.versions.base['url'] = this.state.formData['is-internal-url'] ? this.maskTemplateUrl(this.state.formData['template-link']) : this.state.formData['template-link'];
|
|
1150
|
+
}
|
|
1139
1151
|
forEach(this.state.selectedTemplateTags, (templateTag) => {
|
|
1140
1152
|
const tagName = templateTag.substr(0, templateTag.indexOf('.'));
|
|
1141
1153
|
let newTagname = tagName;
|
|
@@ -144,7 +144,7 @@ export default defineMessages({
|
|
|
144
144
|
},
|
|
145
145
|
"pagePathInductive": {
|
|
146
146
|
id: 'creatives.containersV2.WeChat.pagePathInductive',
|
|
147
|
-
defaultMessage: '
|
|
147
|
+
defaultMessage: 'User will be redirected to the Mini-Program path provided here',
|
|
148
148
|
},
|
|
149
149
|
"pagePathLabel": {
|
|
150
150
|
id: 'creatives.containersV2.WeChat.pagePathLabel',
|