@capillarytech/creatives-library 7.17.114-alpha.0 → 7.17.115
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.
|
@@ -16,7 +16,6 @@ export const BADGES_UI_ENABLED = 'BADGES_UI_ENABLED';
|
|
|
16
16
|
export const JP_LOCALE_HIDE_FEATURE = 'JP_LOCALE_HIDE_FEATURE';
|
|
17
17
|
export const ENABLE_WECHAT = 'ENABLE_WECHAT';
|
|
18
18
|
export const ENABLE_CUSTOMER_BARCODE_TAG = "ENABLE_CUSTOMER_BARCODE_TAG";
|
|
19
|
-
export const EMAIL_UNSUBSCRIBE_TAG_MANDATORY = "EMAIL_UNSUBSCRIBE_TAG_MANDATORY";
|
|
20
19
|
|
|
21
20
|
export const CARD_RELATED_TAGS = [
|
|
22
21
|
'card_series',
|
package/package.json
CHANGED
package/utils/common.js
CHANGED
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
ENABLE_CUSTOMER_BARCODE_TAG,
|
|
19
19
|
BADGES_UI_ENABLED,
|
|
20
20
|
BADGES_ENROLL,
|
|
21
|
-
EMAIL_UNSUBSCRIBE_TAG_MANDATORY,
|
|
22
21
|
BADGES_ISSUE,
|
|
23
22
|
ENABLE_WECHAT,
|
|
24
23
|
} from '../containers/App/constants';
|
|
@@ -113,10 +112,6 @@ export const hasCustomerBarcodeFeatureEnabled = Auth.hasFeatureAccess.bind(
|
|
|
113
112
|
ENABLE_CUSTOMER_BARCODE_TAG,
|
|
114
113
|
);
|
|
115
114
|
|
|
116
|
-
export const hasRemoveEmailUnsubscribeTag = Auth.hasFeatureAccess.bind(
|
|
117
|
-
null,
|
|
118
|
-
EMAIL_UNSUBSCRIBE_TAG_MANDATORY,
|
|
119
|
-
);
|
|
120
115
|
//filtering tags based on scope
|
|
121
116
|
export const filterTags = (tagsToFilter, tagsList) => tagsList?.filter(
|
|
122
117
|
(tag) => !tagsToFilter?.includes(tag?.definition?.value)
|
|
@@ -55,7 +55,6 @@ import { AI_SUGGESTION_API_URL, CONTENT_RECOMMENDATION_BOT } from './constants';
|
|
|
55
55
|
import { GET_TRANSLATION_MAPPED } from '../../containers/TagList/constants';
|
|
56
56
|
import moment from 'moment';
|
|
57
57
|
import { CUSTOMER_BARCODE_TAG , COPY_OF} from '../../containers/App/constants';
|
|
58
|
-
import { hasRemoveEmailUnsubscribeTag } from '../../utils/common';
|
|
59
58
|
const TabPane = Tabs.TabPane;
|
|
60
59
|
const {Column} = Table;
|
|
61
60
|
const {TextArea} = CapInput;
|
|
@@ -990,9 +989,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
990
989
|
if (tagValidationResponse.isBraceError){
|
|
991
990
|
errorString += this.props.intl.formatMessage(globalMessages.unbalanacedCurlyBraces);
|
|
992
991
|
}
|
|
993
|
-
if (tagValidationResponse.isContentEmpty) {
|
|
994
|
-
errorString += this.props.intl.formatMessage(messages.emailBodyEmptyError);
|
|
995
|
-
}
|
|
996
992
|
}
|
|
997
993
|
}
|
|
998
994
|
}
|
|
@@ -1131,8 +1127,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1131
1127
|
response.missingTags = [];
|
|
1132
1128
|
response.unsupportedTags = [];
|
|
1133
1129
|
response.isBraceError = false;
|
|
1134
|
-
response.isContentEmpty = false;
|
|
1135
|
-
const contentForValidation = isEmail ? convert(content) : content ;
|
|
1136
1130
|
if(tags && tags.length) {
|
|
1137
1131
|
_.forEach(tags, (tag) => {
|
|
1138
1132
|
_.forEach(tag.definition.supportedModules, (module) => {
|
|
@@ -1150,19 +1144,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1150
1144
|
let matchImg = regexImgSrc.exec(content);
|
|
1151
1145
|
const regexCustomerBarcode = /{{customer_barcode}}(?![^<]*>)/g;
|
|
1152
1146
|
let matchCustomerBarcode = regexCustomerBarcode.exec(content);
|
|
1153
|
-
// \S matches anything other than a space, a tab, a newline, or a carriage return.
|
|
1154
|
-
const validString= /\S/.test(contentForValidation);
|
|
1155
|
-
if (hasRemoveEmailUnsubscribeTag() && isEmail) {
|
|
1156
|
-
const missingTagIndex = response.missingTags.indexOf("unsubscribe");
|
|
1157
|
-
if(missingTagIndex != -1) { //skip regex tags for mandatory tags also
|
|
1158
|
-
response.missingTags.splice(missingTagIndex, 1);
|
|
1159
|
-
if (validString) {
|
|
1160
|
-
response.valid = true;
|
|
1161
|
-
} else {
|
|
1162
|
-
response.isContentEmpty = true;
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
1147
|
while (match !== null ) {
|
|
1167
1148
|
const tagValue = match[0].substring(this.indexOfEnd(match[0], '{{'), match[0].indexOf('}}'));
|
|
1168
1149
|
match = regex.exec(content);
|
|
@@ -1196,6 +1177,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1196
1177
|
}
|
|
1197
1178
|
}
|
|
1198
1179
|
}
|
|
1180
|
+
const contentForValidation = isEmail ? convert(content) : content ;
|
|
1199
1181
|
if(!validateIfTagClosed(contentForValidation)){
|
|
1200
1182
|
response.isBraceError = true;
|
|
1201
1183
|
response.valid = false;
|
|
@@ -86,8 +86,4 @@ export default defineMessages({
|
|
|
86
86
|
id: 'creatives.componentsV2.FormBuilder.imageReUpload',
|
|
87
87
|
defaultMessage: 'Re upload',
|
|
88
88
|
},
|
|
89
|
-
emailBodyEmptyError: {
|
|
90
|
-
id: 'creatives.componentsV2.FormBuilder.emailBodyEmptyError',
|
|
91
|
-
defaultMessage: 'Email body cannot be empty',
|
|
92
|
-
},
|
|
93
89
|
});
|
|
@@ -239,6 +239,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
239
239
|
this.onAccountSelect = this.onAccountSelect.bind(this);
|
|
240
240
|
this.prepareMobilePushPreviewData = this.prepareMobilePushPreviewData.bind(this);
|
|
241
241
|
this.menuOnClickEvent = this.menuOnClickEvent.bind(this);
|
|
242
|
+
this.delayTimer = 0;
|
|
242
243
|
}
|
|
243
244
|
|
|
244
245
|
componentWillMount() {
|
|
@@ -1766,6 +1767,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1766
1767
|
}
|
|
1767
1768
|
}
|
|
1768
1769
|
|
|
1770
|
+
delay(callback, ms) {
|
|
1771
|
+
clearTimeout(this.delayTimer);
|
|
1772
|
+
this.delayTimer = setTimeout(callback, ms);
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1769
1775
|
searchTemplate(data, channel) {
|
|
1770
1776
|
if (channel.toLowerCase() === ZALO_LOWERCASE) {
|
|
1771
1777
|
if (data) {
|
|
@@ -1795,7 +1801,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1795
1801
|
if (this.state.channel.toLowerCase() === MOBILE_PUSH_LOWERCASE) {
|
|
1796
1802
|
params.accountId = this.props.Templates.selectedWeChatAccount.id;
|
|
1797
1803
|
}
|
|
1798
|
-
this.
|
|
1804
|
+
this.delay(() => {
|
|
1805
|
+
this.getAllTemplates({params, resetPage: true});
|
|
1806
|
+
}, 500);
|
|
1799
1807
|
});
|
|
1800
1808
|
}
|
|
1801
1809
|
}
|