@capillarytech/creatives-library 7.17.91-alpha.0 → 7.17.91
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.
|
@@ -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";
|
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;
|
|
@@ -988,9 +987,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
988
987
|
if (tagValidationResponse.isBraceError){
|
|
989
988
|
errorString += this.props.intl.formatMessage(globalMessages.unbalanacedCurlyBraces);
|
|
990
989
|
}
|
|
991
|
-
if (tagValidationResponse.isContentEmpty) {
|
|
992
|
-
errorString += this.props.intl.formatMessage(messages.emailBodyEmptyError);
|
|
993
|
-
}
|
|
994
990
|
}
|
|
995
991
|
}
|
|
996
992
|
}
|
|
@@ -1129,8 +1125,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1129
1125
|
response.missingTags = [];
|
|
1130
1126
|
response.unsupportedTags = [];
|
|
1131
1127
|
response.isBraceError = false;
|
|
1132
|
-
response.isContentEmpty = false;
|
|
1133
|
-
const contentForValidation = isEmail ? convert(content) : content ;
|
|
1134
1128
|
if(tags && tags.length) {
|
|
1135
1129
|
_.forEach(tags, (tag) => {
|
|
1136
1130
|
_.forEach(tag.definition.supportedModules, (module) => {
|
|
@@ -1148,19 +1142,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1148
1142
|
let matchImg = regexImgSrc.exec(content);
|
|
1149
1143
|
const regexCustomerBarcode = /{{customer_barcode}}(?![^<]*>)/g;
|
|
1150
1144
|
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
1145
|
while (match !== null ) {
|
|
1165
1146
|
const tagValue = match[0].substring(this.indexOfEnd(match[0], '{{'), match[0].indexOf('}}'));
|
|
1166
1147
|
match = regex.exec(content);
|
|
@@ -1194,6 +1175,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1194
1175
|
}
|
|
1195
1176
|
}
|
|
1196
1177
|
}
|
|
1178
|
+
const contentForValidation = isEmail ? convert(content) : content ;
|
|
1197
1179
|
if(!validateIfTagClosed(contentForValidation)){
|
|
1198
1180
|
response.isBraceError = true;
|
|
1199
1181
|
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
|
});
|
|
@@ -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);
|