@capillarytech/creatives-library 7.17.220-alpha.0 → 7.17.220
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 +1 -1
- package/utils/tagValidations.js +1 -8
- package/utils/tests/tagValidations.test.js +0 -18
- package/v2Components/FormBuilder/_formBuilder.scss +1 -1
- package/v2Components/FormBuilder/index.js +2 -3
- package/v2Containers/TagList/index.js +1 -1
- package/v2Containers/TagList/messages.js +3 -3
- package/v2Containers/TagList/tests/TagList.test.js +1 -1
package/package.json
CHANGED
package/utils/tagValidations.js
CHANGED
|
@@ -17,7 +17,7 @@ const SUBTAGS = 'subtags';
|
|
|
17
17
|
* @param {Object} response - The response object to check.
|
|
18
18
|
* @param {Object} tagObject - The tagLookupMap.
|
|
19
19
|
*/
|
|
20
|
-
export const checkSupport = (response = {}, tagObject = {}, eventContextTags = []
|
|
20
|
+
export const checkSupport = (response = {}, tagObject = {}, eventContextTags = []) => {
|
|
21
21
|
const supportedList = [];
|
|
22
22
|
// Verifies the presence of the tag in the 'Add Labels' section.
|
|
23
23
|
// Incase of journey event context the tags won't be available in the tagObject(tagLookupMap).
|
|
@@ -25,13 +25,6 @@ export const checkSupport = (response = {}, tagObject = {}, eventContextTags = [
|
|
|
25
25
|
|
|
26
26
|
// Verify if childTag is a valid sub-tag of parentTag from the 'Add Labels' section or if it's unsupported.
|
|
27
27
|
const checkSubtags = (parentTag, childName) => {
|
|
28
|
-
// For event context tags the parentTag will be the event context tag name and subtags will be the child attributes for leaderboards
|
|
29
|
-
if (checkNameInTagObjectOrEventContext(parentTag) && isLiquidFlow && eventContextTags?.length) {
|
|
30
|
-
const childNameAfterDot = childName?.split(".")?.[1];
|
|
31
|
-
if (eventContextTags?.some((tag) => tag?.subTags?.includes(childNameAfterDot))) {
|
|
32
|
-
supportedList.push(childName);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
28
|
if (!tagObject?.[parentTag]) return false;
|
|
36
29
|
let updatedChildName = childName;
|
|
37
30
|
if (childName?.includes(".")) {
|
|
@@ -376,24 +376,6 @@ describe("checkSupport", () => {
|
|
|
376
376
|
const result = checkSupport(response, {});
|
|
377
377
|
expect(result).toEqual([]);
|
|
378
378
|
});
|
|
379
|
-
|
|
380
|
-
it("should add childName to supportedList if it is a subtag of parentTag in eventContextTags", () => {
|
|
381
|
-
const response = { data: [{ name: "leaderboard", children: [{name: "person.userId"}]}]};
|
|
382
|
-
const tagObject = {};
|
|
383
|
-
const eventContextTags = [{ tagName: "leaderboard", subTags: ["userId"]}];
|
|
384
|
-
const isLiquidFlow = true;
|
|
385
|
-
const result = checkSupport(response, tagObject, eventContextTags, isLiquidFlow);
|
|
386
|
-
expect(result).toEqual( [ 'leaderboard', 'person.userId' ]);
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
it("should add only parent tag to supportedList if isLiquidFlow false", () => {
|
|
390
|
-
const response = { data: [{ name: "leaderboard", children: [{name: "person.userId"}]}]};
|
|
391
|
-
const tagObject = {};
|
|
392
|
-
const eventContextTags = [{ tagName: "leaderboard", subTags: ["userId"]}];
|
|
393
|
-
const isLiquidFlow = false;
|
|
394
|
-
const result = checkSupport(response, tagObject, eventContextTags, isLiquidFlow);
|
|
395
|
-
expect(result).toEqual( [ 'leaderboard' ]);
|
|
396
|
-
});
|
|
397
379
|
});
|
|
398
380
|
|
|
399
381
|
describe('preprocessHtml', () => {
|
|
@@ -1121,8 +1121,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1121
1121
|
const supportedLiquidTags = checkSupport(
|
|
1122
1122
|
result,
|
|
1123
1123
|
this.props?.metaEntities?.tagLookupMap,
|
|
1124
|
-
this.props?.eventContextTags
|
|
1125
|
-
this.liquidFlow,
|
|
1124
|
+
this.props?.eventContextTags
|
|
1126
1125
|
);
|
|
1127
1126
|
const unsupportedLiquidTags = extractedLiquidTags?.filter(
|
|
1128
1127
|
(tag) => !supportedLiquidTags?.includes(tag) && !this.skipTags(tag)
|
|
@@ -2479,7 +2478,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2479
2478
|
<TextArea
|
|
2480
2479
|
id={val.id}
|
|
2481
2480
|
placeholder={val.placeholder ? val.placeholder : ''}
|
|
2482
|
-
className={`${ifError ? 'error' : ''}`}
|
|
2481
|
+
className={`${ifError ? 'error-form-builder' : ''}`}
|
|
2483
2482
|
errorMessage={errorMessageText}
|
|
2484
2483
|
label={val.label}
|
|
2485
2484
|
autosize={val.autosize ? val.autosizeParams : false}
|
|
@@ -105,7 +105,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
if (eventContextTags?.length) {
|
|
108
|
-
const TAG_HEADER_MSG_LABEL = this.props.intl.formatMessage(messages.
|
|
108
|
+
const TAG_HEADER_MSG_LABEL = this.props.intl.formatMessage(messages.tagsBasedOnEntryTriggerEvent);
|
|
109
109
|
eventContextTagsObj.EventContextTags = {
|
|
110
110
|
name: TAG_HEADER_MSG_LABEL,
|
|
111
111
|
desc: TAG_HEADER_MSG_LABEL,
|
|
@@ -11,8 +11,8 @@ export default defineMessages({
|
|
|
11
11
|
id: `${scope}.header`,
|
|
12
12
|
defaultMessage: 'This is TagList container !',
|
|
13
13
|
},
|
|
14
|
-
|
|
15
|
-
id: `${scope}.
|
|
16
|
-
defaultMessage: '
|
|
14
|
+
tagsBasedOnEntryTriggerEvent: {
|
|
15
|
+
id: `${scope}.tagsBasedOnEntryTriggerEvent`,
|
|
16
|
+
defaultMessage: 'Tags based on entry trigger event',
|
|
17
17
|
},
|
|
18
18
|
});
|
|
@@ -44,7 +44,7 @@ describe("TagList test : UNIT", () => {
|
|
|
44
44
|
it('should render event context tags correctly from generateTags', () => {
|
|
45
45
|
initializeTagList({eventContextTags});
|
|
46
46
|
addLabelBtnAssertion();
|
|
47
|
-
const EVENT_CONTEXT_TAG_HEADER = getByText('
|
|
47
|
+
const EVENT_CONTEXT_TAG_HEADER = getByText('Tags based on entry trigger event');
|
|
48
48
|
expect(EVENT_CONTEXT_TAG_HEADER).toBeInTheDocument();
|
|
49
49
|
fireEvent.click(EVENT_CONTEXT_TAG_HEADER);
|
|
50
50
|
expect(getByText('lifetimePurchases')).toBeInTheDocument();
|