@capillarytech/creatives-library 7.17.91-alpha.0 → 7.17.92-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/containers/App/constants.js +11 -1
- package/containers/Ebill/index.js +0 -1
- package/containers/MobilePush/Edit/index.js +0 -1
- package/package.json +1 -1
- package/utils/common.js +2 -6
- package/utils/tests/common.mockdata.js +11 -0
- package/v2Components/FormBuilder/index.js +5 -22
- package/v2Components/FormBuilder/messages.js +0 -4
- package/v2Containers/MobilePush/Edit/index.js +1 -3
- package/v2Containers/TagList/index.js +2 -2
- package/v2Containers/Templates/_templates.scss +0 -3
|
@@ -15,7 +15,6 @@ export const EXTENDED_TAG = 'ExtendedTagMessage';
|
|
|
15
15
|
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_CUSTOMER_BARCODE_TAG = "ENABLE_CUSTOMER_BARCODE_TAG";
|
|
18
|
-
export const EMAIL_UNSUBSCRIBE_TAG_MANDATORY = "EMAIL_UNSUBSCRIBE_TAG_MANDATORY";
|
|
19
18
|
|
|
20
19
|
export const CARD_RELATED_TAGS = [
|
|
21
20
|
'card_series',
|
|
@@ -74,6 +73,7 @@ export const PROMO_ENGINE_RELATED_TAGS = [
|
|
|
74
73
|
|
|
75
74
|
export const BADGES_RELATED_TAGS = [
|
|
76
75
|
"Badge_expiry_date",
|
|
76
|
+
"badges_issue_expiry_date",
|
|
77
77
|
"badge_expiry_mm_slash_dd_slash_yyyy",
|
|
78
78
|
"badge_expiry_dd_slash_mm_slash_yyyy",
|
|
79
79
|
"badge_expiry_yyyy_hyphen_mm_hyphen_dd",
|
|
@@ -92,8 +92,18 @@ export const BADGES_RELATED_TAGS = [
|
|
|
92
92
|
"badges_enroll_expiry_date.FORMAT_7",
|
|
93
93
|
"badges_enroll_expiry_date.FORMAT_8",
|
|
94
94
|
"badges_enroll_expiring_in_days",
|
|
95
|
+
"badges_issue_expiry_date.FORMAT_1",
|
|
96
|
+
"badges_issue_expiry_date.FORMAT_2",
|
|
97
|
+
"badges_issue_expiry_date.FORMAT_3",
|
|
98
|
+
"badges_issue_expiry_date.FORMAT_4",
|
|
99
|
+
"badges_issue_expiry_date.FORMAT_5",
|
|
100
|
+
"badges_issue_expiry_date.FORMAT_6",
|
|
101
|
+
"badges_issue_expiry_date.FORMAT_7",
|
|
102
|
+
"badges_issue_expiry_date.FORMAT_8",
|
|
103
|
+
"badges_issue_expiring_in_days",
|
|
95
104
|
];
|
|
96
105
|
export const BADGES_ENROLL = 'BADGES_ENROLL';
|
|
106
|
+
export const BADGES_ISSUE = 'BADGES_ISSUE';
|
|
97
107
|
|
|
98
108
|
export const CUSTOMER_BARCODE_TAG = "customer_barcode";
|
|
99
109
|
export const COPY_OF = "Copy of";
|
|
@@ -956,7 +956,6 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
956
956
|
}
|
|
957
957
|
temp.injectedEvents = {};
|
|
958
958
|
_.forEach(col.supportedEvents, (event) => {
|
|
959
|
-
console.log('injected event for ', col, event, this.getMappedEvent(col.id, event));
|
|
960
959
|
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
961
960
|
});
|
|
962
961
|
|
|
@@ -1779,7 +1779,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1779
1779
|
temp.content.appName = this.props.Templates.selectedWeChatAccount.name;
|
|
1780
1780
|
}
|
|
1781
1781
|
_.forEach(col.supportedEvents, (event) => {
|
|
1782
|
-
console.log('injected event for ', col, event, this.getMappedEvent(col.id, event));
|
|
1783
1782
|
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
1784
1783
|
});
|
|
1785
1784
|
return true;
|
package/package.json
CHANGED
package/utils/common.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
ENABLE_CUSTOMER_BARCODE_TAG,
|
|
18
18
|
BADGES_UI_ENABLED,
|
|
19
19
|
BADGES_ENROLL,
|
|
20
|
-
|
|
20
|
+
BADGES_ISSUE,
|
|
21
21
|
} from '../containers/App/constants';
|
|
22
22
|
import { apiMessageFormatHandler } from './commonUtils';
|
|
23
23
|
|
|
@@ -105,10 +105,6 @@ export const hasCustomerBarcodeFeatureEnabled = Auth.hasFeatureAccess.bind(
|
|
|
105
105
|
ENABLE_CUSTOMER_BARCODE_TAG,
|
|
106
106
|
);
|
|
107
107
|
|
|
108
|
-
export const hasRemoveEmailUnsubscribeTag = Auth.hasFeatureAccess.bind(
|
|
109
|
-
null,
|
|
110
|
-
EMAIL_UNSUBSCRIBE_TAG_MANDATORY,
|
|
111
|
-
);
|
|
112
108
|
//filtering tags based on scope
|
|
113
109
|
export const filterTags = (tagsToFilter, tagsList) => tagsList?.filter(
|
|
114
110
|
(tag) => !tagsToFilter?.includes(tag?.definition?.value)
|
|
@@ -182,7 +178,7 @@ export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails
|
|
|
182
178
|
});
|
|
183
179
|
let combinedTags = result;
|
|
184
180
|
if (offerDetails?.length) {
|
|
185
|
-
if (offerDetails?.[0]?.type
|
|
181
|
+
if ([BADGES_ENROLL, BADGES_ISSUE].includes(offerDetails?.[0]?.type)) {
|
|
186
182
|
combinedTags = transformBadgeTags(offerDetails, result);
|
|
187
183
|
} else {
|
|
188
184
|
combinedTags = transformCouponTags(offerDetails, result);
|
|
@@ -115,8 +115,10 @@ export const badgesTags = [
|
|
|
115
115
|
"value": "Badge",
|
|
116
116
|
"subtags": [
|
|
117
117
|
"Badge_expiry_date",
|
|
118
|
+
"badges_issue_expiry_date",
|
|
118
119
|
"Days_until_expiry",
|
|
119
120
|
"badges_enroll_expiring_in_days",
|
|
121
|
+
"badges_issue_expiring_in_days",
|
|
120
122
|
],
|
|
121
123
|
"tag-header": true,
|
|
122
124
|
"supportedModules": [
|
|
@@ -234,6 +236,15 @@ export const badgesTags = [
|
|
|
234
236
|
"badges_enroll_expiry_date.FORMAT_6",
|
|
235
237
|
"badges_enroll_expiry_date.FORMAT_7",
|
|
236
238
|
"badges_enroll_expiry_date.FORMAT_8",
|
|
239
|
+
"badges_issue_expiry_date.FORMAT_1",
|
|
240
|
+
"badges_issue_expiry_date.FORMAT_2",
|
|
241
|
+
"badges_issue_expiry_date.FORMAT_3",
|
|
242
|
+
"badges_issue_expiry_date.FORMAT_4",
|
|
243
|
+
"badges_issue_expiry_date.FORMAT_5",
|
|
244
|
+
"badges_issue_expiry_date.FORMAT_6",
|
|
245
|
+
"badges_issue_expiry_date.FORMAT_7",
|
|
246
|
+
"badges_issue_expiry_date.FORMAT_8",
|
|
247
|
+
"badges_issue_expiring_in_days",
|
|
237
248
|
],
|
|
238
249
|
"tag-header": true,
|
|
239
250
|
"supportedModules": [
|
|
@@ -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;
|
|
@@ -215,9 +214,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
215
214
|
this.setState({usingTabContainer: true});
|
|
216
215
|
}
|
|
217
216
|
}
|
|
218
|
-
//
|
|
219
|
-
|
|
220
|
-
|
|
217
|
+
//currentTab represents whether its Android or IOS tab , 1 for Android and 2 for IOS
|
|
218
|
+
if (nextProps.currentTab && _.get(this.props, 'schema.channel') === MOBILE_PUSH) {
|
|
219
|
+
this.setState({currentTab: nextProps.currentTab});
|
|
220
|
+
}
|
|
221
221
|
} else if (!_.isEmpty(nextProps.formData) &&
|
|
222
222
|
( !this.state.usingTabContainer || (this.state.usingTabContainer && nextProps.tabKey !== ''))
|
|
223
223
|
&& !_.isEqual(nextProps.formData, this.state.formData) &&
|
|
@@ -988,9 +988,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
988
988
|
if (tagValidationResponse.isBraceError){
|
|
989
989
|
errorString += this.props.intl.formatMessage(globalMessages.unbalanacedCurlyBraces);
|
|
990
990
|
}
|
|
991
|
-
if (tagValidationResponse.isContentEmpty) {
|
|
992
|
-
errorString += this.props.intl.formatMessage(messages.emailBodyEmptyError);
|
|
993
|
-
}
|
|
994
991
|
}
|
|
995
992
|
}
|
|
996
993
|
}
|
|
@@ -1129,8 +1126,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1129
1126
|
response.missingTags = [];
|
|
1130
1127
|
response.unsupportedTags = [];
|
|
1131
1128
|
response.isBraceError = false;
|
|
1132
|
-
response.isContentEmpty = false;
|
|
1133
|
-
const contentForValidation = isEmail ? convert(content) : content ;
|
|
1134
1129
|
if(tags && tags.length) {
|
|
1135
1130
|
_.forEach(tags, (tag) => {
|
|
1136
1131
|
_.forEach(tag.definition.supportedModules, (module) => {
|
|
@@ -1148,19 +1143,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1148
1143
|
let matchImg = regexImgSrc.exec(content);
|
|
1149
1144
|
const regexCustomerBarcode = /{{customer_barcode}}(?![^<]*>)/g;
|
|
1150
1145
|
let matchCustomerBarcode = regexCustomerBarcode.exec(content);
|
|
1151
|
-
// \S matches anything other than a space, a tab, a newline, or a carriage return.
|
|
1152
|
-
const validString= /\S/.test(contentForValidation);
|
|
1153
|
-
if (hasRemoveEmailUnsubscribeTag() && isEmail) {
|
|
1154
|
-
const missingTagIndex = response.missingTags.indexOf("unsubscribe");
|
|
1155
|
-
if(missingTagIndex != -1) { //skip regex tags for mandatory tags also
|
|
1156
|
-
response.missingTags.splice(missingTagIndex, 1);
|
|
1157
|
-
if (validString) {
|
|
1158
|
-
response.valid = true;
|
|
1159
|
-
} else {
|
|
1160
|
-
response.isContentEmpty = true;
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
1146
|
while (match !== null ) {
|
|
1165
1147
|
const tagValue = match[0].substring(this.indexOfEnd(match[0], '{{'), match[0].indexOf('}}'));
|
|
1166
1148
|
match = regex.exec(content);
|
|
@@ -1194,6 +1176,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1194
1176
|
}
|
|
1195
1177
|
}
|
|
1196
1178
|
}
|
|
1179
|
+
const contentForValidation = isEmail ? convert(content) : content ;
|
|
1197
1180
|
if(!validateIfTagClosed(contentForValidation)){
|
|
1198
1181
|
response.isBraceError = true;
|
|
1199
1182
|
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
|
});
|
|
@@ -768,10 +768,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
768
768
|
formData[0].base = true;
|
|
769
769
|
// formData[0].tabKey = '1';
|
|
770
770
|
// formData[1].tabKey = '2';
|
|
771
|
-
|
|
772
771
|
this.setState({templateCta}, () => {
|
|
773
772
|
this.getSchemaForFormData(formData, schema);
|
|
774
|
-
this.setState({tabCount, formData, editData: data
|
|
773
|
+
this.setState({tabCount, formData, editData: data}, () => {
|
|
775
774
|
this.props.showTemplateName({formData, onFormDataChange: this.onFormDataChange});
|
|
776
775
|
});
|
|
777
776
|
});
|
|
@@ -1469,7 +1468,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1469
1468
|
temp.content.appName = this.props.Templates.selectedWeChatAccount.name;
|
|
1470
1469
|
}
|
|
1471
1470
|
_.forEach(col.supportedEvents, (event) => {
|
|
1472
|
-
console.log('injected event for ', col, event, this.getMappedEvent(col.id, event));
|
|
1473
1471
|
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
1474
1472
|
});
|
|
1475
1473
|
return true;
|
|
@@ -23,7 +23,7 @@ import { selectCurrentOrgDetails, makeSelectFetchingSchemaError } from '../Cap/s
|
|
|
23
23
|
import { injectIntl } from 'react-intl';
|
|
24
24
|
import { scope } from './messages';
|
|
25
25
|
import { handleInjectedData, hasGiftVoucherFeature, hasPromoFeature, hasBadgesFeature, transformBadgeTags } from '../../utils/common';
|
|
26
|
-
import { GIFT_VOUCHER_RELATED_TAGS, PROMO_ENGINE_RELATED_TAGS, BADGES_RELATED_TAGS, BADGES_ENROLL } from '../../containers/App/constants';
|
|
26
|
+
import { GIFT_VOUCHER_RELATED_TAGS, PROMO_ENGINE_RELATED_TAGS, BADGES_RELATED_TAGS, BADGES_ENROLL, BADGES_ISSUE } from '../../containers/App/constants';
|
|
27
27
|
|
|
28
28
|
const TreeNode = Tree.TreeNode;
|
|
29
29
|
|
|
@@ -95,7 +95,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
95
95
|
tags = this.populateTags(props.tags);
|
|
96
96
|
}
|
|
97
97
|
if (selectedOfferDetails && !_.isEmpty(selectedOfferDetails) ) {
|
|
98
|
-
if ((selectedOfferDetails[0]?.type
|
|
98
|
+
if (([BADGES_ENROLL, BADGES_ISSUE].includes(selectedOfferDetails[0]?.type)) && (tags && tags?.Badge) ) {
|
|
99
99
|
transformBadgeTags(selectedOfferDetails, tags);
|
|
100
100
|
} else if (tags && tags?.coupon) {
|
|
101
101
|
this.transformCouponTags(selectedOfferDetails, tags);
|