@capillarytech/creatives-library 8.0.24-alpha.0 → 8.0.25
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 +11 -3
- package/utils/tests/tagValidations.test.js +14 -3
- package/v2Components/FormBuilder/index.js +13 -1
- package/v2Containers/BeeEditor/index.js +3 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +47 -26
- package/v2Containers/CreativesContainer/index.js +3 -0
- package/v2Containers/Email/index.js +1 -0
- package/v2Containers/EmailWrapper/index.js +3 -0
- package/v2Containers/MobilePush/Create/index.js +2 -0
- package/v2Containers/MobilePush/Edit/index.js +2 -0
- package/v2Containers/MobilepushWrapper/index.js +3 -1
- package/v2Containers/Sms/Create/index.js +2 -0
- package/v2Containers/Sms/Edit/index.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +3 -0
- package/v2Containers/SmsWrapper/index.js +2 -0
- package/v2Containers/TagList/index.js +27 -2
- package/v2Containers/TagList/messages.js +4 -0
- package/v2Containers/TagList/tests/TagList.test.js +19 -8
- package/v2Containers/TagList/tests/mockdata.js +59 -1
- package/v2Containers/Viber/index.js +2 -0
- package/v2Containers/Whatsapp/index.js +4 -1
- package/v2Containers/Zalo/index.js +3 -0
- package/containers/TestPage/constants.js +0 -7
- package/containers/TestPage/index.js +0 -31
- package/containers/TestPage/messages.js +0 -13
- package/containers/TestPage/reducer.js +0 -21
- package/containers/TestPage/sagas.js +0 -11
- package/containers/Testv2/actions.js +0 -15
- package/containers/Testv2/constants.js +0 -7
- package/containers/Testv2/index.js +0 -47
- package/containers/Testv2/messages.js +0 -21
- package/containers/Testv2/reducer.js +0 -23
- package/containers/Testv2/sagas.js +0 -11
- package/containers/Testv2/selectors.js +0 -25
- package/reducers.js +0 -77
- package/store.js +0 -61
- package/utils/tests/asyncInjectors.test.js +0 -173
- package/v2Containers/TestPage/constants.js +0 -7
- package/v2Containers/TestPage/index.js +0 -31
- package/v2Containers/TestPage/messages.js +0 -13
- package/v2Containers/TestPage/reducer.js +0 -21
- package/v2Containers/TestPage/sagas.js +0 -11
- package/v2Containers/Testv2/actions.js +0 -15
- package/v2Containers/Testv2/constants.js +0 -7
- package/v2Containers/Testv2/index.js +0 -47
- package/v2Containers/Testv2/messages.js +0 -21
- package/v2Containers/Testv2/reducer.js +0 -23
- package/v2Containers/Testv2/sagas.js +0 -11
- package/v2Containers/Testv2/selectors.js +0 -25
package/package.json
CHANGED
package/utils/tagValidations.js
CHANGED
|
@@ -17,10 +17,11 @@ 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 = {}) => {
|
|
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).
|
|
24
|
+
const checkNameInTagObjectOrEventContext = (name) => !!tagObject[name] || eventContextTags?.some((tag) => tag?.tagName === name);
|
|
24
25
|
|
|
25
26
|
// Verify if childTag is a valid sub-tag of parentTag from the 'Add Labels' section or if it's unsupported.
|
|
26
27
|
const checkSubtags = (parentTag, childName) => {
|
|
@@ -47,7 +48,7 @@ export const checkSupport = (response = {}, tagObject = {}) => {
|
|
|
47
48
|
|
|
48
49
|
//Checks if the tag is present in the Add Label Section
|
|
49
50
|
for (const item of response?.data || []) {
|
|
50
|
-
if (
|
|
51
|
+
if (checkNameInTagObjectOrEventContext(item?.name)) {
|
|
51
52
|
supportedList?.push(item?.name);
|
|
52
53
|
}
|
|
53
54
|
//Repeat the process for subtags
|
|
@@ -93,6 +94,7 @@ export const validateTags = ({
|
|
|
93
94
|
injectedTagsParams,
|
|
94
95
|
location,
|
|
95
96
|
tagModule,
|
|
97
|
+
eventContextTags,
|
|
96
98
|
}) => {
|
|
97
99
|
const tags = tagsParam;
|
|
98
100
|
const injectedTags = transformInjectedTags(injectedTagsParams);
|
|
@@ -145,6 +147,12 @@ export const validateTags = ({
|
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
}
|
|
150
|
+
// Journey Event Context Tags support
|
|
151
|
+
eventContextTags?.forEach((tag) => {
|
|
152
|
+
if (tagValue === tag?.tagName) {
|
|
153
|
+
ifSupported = true;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
148
156
|
ifSupported = ifSupported || checkIfSupportedTag(tagValue, injectedTags);
|
|
149
157
|
if (!ifSupported) {
|
|
150
158
|
response.unsupportedTags.push(tagValue);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@testing-library/jest-dom';
|
|
3
3
|
import { checkSupport, extractNames, getTagMapValue, preprocessHtml, validateIfTagClosed,validateTags} from '../tagValidations';
|
|
4
|
+
import { eventContextTags } from '../../v2Containers/TagList/tests/mockdata';
|
|
4
5
|
|
|
5
6
|
describe("check if curly brackets are balanced", () => {
|
|
6
7
|
it("test for balanced curly brackets", () => {
|
|
@@ -50,7 +51,7 @@ describe("validateTags", () => {
|
|
|
50
51
|
},
|
|
51
52
|
];
|
|
52
53
|
it("should return valid response when all tags are present", () => {
|
|
53
|
-
const content = "Hello {{tag1}}, {{tag2}}, {{tag3}}";
|
|
54
|
+
const content = "Hello {{tag1}}, {{tag2}}, {{tag3}} {{lifetimePurchases}}";
|
|
54
55
|
|
|
55
56
|
const injectedTagsParams = [];
|
|
56
57
|
const location = { query: { module: "DEFAULT" } };
|
|
@@ -62,6 +63,7 @@ describe("validateTags", () => {
|
|
|
62
63
|
injectedTagsParams,
|
|
63
64
|
location,
|
|
64
65
|
tagModule,
|
|
66
|
+
eventContextTags,
|
|
65
67
|
});
|
|
66
68
|
|
|
67
69
|
expect(result.valid).toEqual(true);
|
|
@@ -96,7 +98,7 @@ describe("validateTags", () => {
|
|
|
96
98
|
});
|
|
97
99
|
|
|
98
100
|
it("should return invalid response when an unsupported tag is present", () => {
|
|
99
|
-
const content = "Hello {{tag1}}, {{tag2}}, {{tag3}}";
|
|
101
|
+
const content = "Hello {{tag1}}, {{tag2}}, {{tag3}} {{missingEventContextTags}}";
|
|
100
102
|
const tagsParam = [
|
|
101
103
|
{
|
|
102
104
|
definition: {
|
|
@@ -125,7 +127,7 @@ describe("validateTags", () => {
|
|
|
125
127
|
|
|
126
128
|
expect(result.valid).toEqual(true);
|
|
127
129
|
expect(result.missingTags).toEqual([]);
|
|
128
|
-
expect(result.unsupportedTags).toEqual(["tag3"]);
|
|
130
|
+
expect(result.unsupportedTags).toEqual(["tag3", "missingEventContextTags"]);
|
|
129
131
|
expect(result.isBraceError).toEqual(false);
|
|
130
132
|
});
|
|
131
133
|
|
|
@@ -272,6 +274,15 @@ describe("checkSupport", () => {
|
|
|
272
274
|
expect(result).toEqual([]);
|
|
273
275
|
});
|
|
274
276
|
|
|
277
|
+
it("should return event context tags even if tagObject is empty", () => {
|
|
278
|
+
const response = {
|
|
279
|
+
data: [{ name: "tag1" }, { name: "lifetimePurchases" }],
|
|
280
|
+
};
|
|
281
|
+
const tagObject = {};
|
|
282
|
+
const result = checkSupport(response, tagObject, eventContextTags);
|
|
283
|
+
expect(result).toEqual(['lifetimePurchases']);
|
|
284
|
+
});
|
|
285
|
+
|
|
275
286
|
it("should return an array of supported tags", () => {
|
|
276
287
|
const response = {
|
|
277
288
|
data: [{ name: "tag1" }, { name: "tag2" }, { name: "tag3" }],
|
|
@@ -1120,7 +1120,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1120
1120
|
// Extracts the supported liquid tags from the given content.
|
|
1121
1121
|
const supportedLiquidTags = checkSupport(
|
|
1122
1122
|
result,
|
|
1123
|
-
this.props?.metaEntities?.tagLookupMap
|
|
1123
|
+
this.props?.metaEntities?.tagLookupMap,
|
|
1124
|
+
this.props?.eventContextTags
|
|
1124
1125
|
);
|
|
1125
1126
|
const unsupportedLiquidTags = extractedLiquidTags?.filter(
|
|
1126
1127
|
(tag) => !supportedLiquidTags?.includes(tag) && !this.skipTags(tag)
|
|
@@ -1283,6 +1284,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1283
1284
|
}
|
|
1284
1285
|
}
|
|
1285
1286
|
}
|
|
1287
|
+
|
|
1288
|
+
// Event Context Tags support
|
|
1289
|
+
this.props?.eventContextTags?.forEach((tag) => {
|
|
1290
|
+
if (tagValue === tag?.tagName) {
|
|
1291
|
+
ifSupported = true;
|
|
1292
|
+
}
|
|
1293
|
+
});
|
|
1294
|
+
|
|
1286
1295
|
ifSupported = ifSupported || this.checkIfSupportedTag(tagValue, injectedTags);
|
|
1287
1296
|
if (!ifSupported && !this.liquidFlow) {
|
|
1288
1297
|
response.unsupportedTags.push(tagValue);
|
|
@@ -2610,6 +2619,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2610
2619
|
id={val.id}
|
|
2611
2620
|
userLocale={this.props.userLocale}
|
|
2612
2621
|
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
2622
|
+
eventContextTags={this.props?.eventContextTags}
|
|
2613
2623
|
/>
|
|
2614
2624
|
</CapColumn>
|
|
2615
2625
|
);
|
|
@@ -3231,6 +3241,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3231
3241
|
userLocale={this.state.translationLang}
|
|
3232
3242
|
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
3233
3243
|
channel={channel}
|
|
3244
|
+
eventContextTags={this.props?.eventContextTags}
|
|
3234
3245
|
/>
|
|
3235
3246
|
</CapColumn>
|
|
3236
3247
|
);
|
|
@@ -3505,6 +3516,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3505
3516
|
saveBeeData={this.props.saveBeeData}
|
|
3506
3517
|
onContextChange={this.props.onContextChange}
|
|
3507
3518
|
moduleFilterEnabled={isModuleFilterEnabled}
|
|
3519
|
+
eventContextTags={this.props?.eventContextTags}
|
|
3508
3520
|
/>
|
|
3509
3521
|
</CapColumn>
|
|
3510
3522
|
);
|
|
@@ -54,6 +54,7 @@ function BeeEditor(props) {
|
|
|
54
54
|
actions,
|
|
55
55
|
BEESelect,
|
|
56
56
|
currentOrgDetails,
|
|
57
|
+
eventContextTags,
|
|
57
58
|
} = props;
|
|
58
59
|
const { saveRowRequest } = BEESelect;
|
|
59
60
|
const {formatMessage} = intl;
|
|
@@ -286,6 +287,7 @@ function BeeEditor(props) {
|
|
|
286
287
|
className: "bee-editor-tag-list",
|
|
287
288
|
}}
|
|
288
289
|
onContextChange={onContextChange}
|
|
290
|
+
eventContextTags={eventContextTags}
|
|
289
291
|
/>
|
|
290
292
|
<CapModal
|
|
291
293
|
className="custom-row-modal"
|
|
@@ -329,6 +331,7 @@ BeeEditor.propTypes = {
|
|
|
329
331
|
injectedTags: PropTypes.object,
|
|
330
332
|
onContextChange: PropTypes.func,
|
|
331
333
|
userLocale: PropTypes.string,
|
|
334
|
+
eventContextTags: PropTypes.array,
|
|
332
335
|
};
|
|
333
336
|
|
|
334
337
|
const mapStateToProps = () => createStructuredSelector({
|
|
@@ -156,6 +156,7 @@ export function SlideBoxContent(props) {
|
|
|
156
156
|
showLiquidErrorInFooter,
|
|
157
157
|
creativesMode,
|
|
158
158
|
hostName = '',
|
|
159
|
+
eventContextTags,
|
|
159
160
|
} = props;
|
|
160
161
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
161
162
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -396,6 +397,7 @@ export function SlideBoxContent(props) {
|
|
|
396
397
|
onCreateComplete,
|
|
397
398
|
selectedOfferDetails,
|
|
398
399
|
getFormData,
|
|
400
|
+
eventContextTags,
|
|
399
401
|
};
|
|
400
402
|
|
|
401
403
|
return (
|
|
@@ -430,6 +432,7 @@ export function SlideBoxContent(props) {
|
|
|
430
432
|
smsRegister={smsRegister}
|
|
431
433
|
enableNewChannels={enableNewChannels}
|
|
432
434
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
435
|
+
eventContextTags={eventContextTags}
|
|
433
436
|
/>
|
|
434
437
|
)}
|
|
435
438
|
{isPreview && (
|
|
@@ -509,6 +512,7 @@ export function SlideBoxContent(props) {
|
|
|
509
512
|
handleClose={handleClose}
|
|
510
513
|
onCreateComplete={onCreateComplete}
|
|
511
514
|
smsRegister={smsRegister}
|
|
515
|
+
eventContextTags={eventContextTags}
|
|
512
516
|
/>
|
|
513
517
|
)}
|
|
514
518
|
{isEditFTP && (
|
|
@@ -545,6 +549,7 @@ export function SlideBoxContent(props) {
|
|
|
545
549
|
search: '',
|
|
546
550
|
}}
|
|
547
551
|
hostName={hostName}
|
|
552
|
+
eventContextTags={eventContextTags}
|
|
548
553
|
/>
|
|
549
554
|
}
|
|
550
555
|
{
|
|
@@ -575,6 +580,7 @@ export function SlideBoxContent(props) {
|
|
|
575
580
|
onCreateComplete={onCreateComplete}
|
|
576
581
|
smsRegister={smsRegister}
|
|
577
582
|
onShowTemplates={onShowTemplates}
|
|
583
|
+
eventContextTags={eventContextTags}
|
|
578
584
|
/>
|
|
579
585
|
)}
|
|
580
586
|
|
|
@@ -606,6 +612,7 @@ export function SlideBoxContent(props) {
|
|
|
606
612
|
getCmsTemplatesInProgress={getCmsTemplatesInProgress}
|
|
607
613
|
moduleType={moduleType}
|
|
608
614
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
615
|
+
eventContextTags={eventContextTags}
|
|
609
616
|
/>
|
|
610
617
|
)}
|
|
611
618
|
{(isEditEmailWithId || isEmailEditWithContent) && (
|
|
@@ -634,6 +641,7 @@ export function SlideBoxContent(props) {
|
|
|
634
641
|
onTestContentClicked={onTestContentClicked}
|
|
635
642
|
moduleType={moduleType}
|
|
636
643
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
644
|
+
eventContextTags={eventContextTags}
|
|
637
645
|
/>
|
|
638
646
|
)}
|
|
639
647
|
{isEditMPush &&
|
|
@@ -659,35 +667,38 @@ export function SlideBoxContent(props) {
|
|
|
659
667
|
type={type}
|
|
660
668
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
661
669
|
creativesMode={creativesMode}
|
|
670
|
+
eventContextTags={eventContextTags}
|
|
662
671
|
/>
|
|
663
672
|
}
|
|
664
673
|
{isCreateMPush &&
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
674
|
+
<MobilepushWrapper
|
|
675
|
+
key="creatives-mobilepush-wrapper"
|
|
676
|
+
date={new Date().getMilliseconds()}
|
|
677
|
+
setIsLoadingContent={setIsLoadingContent}
|
|
678
|
+
onMobilepushModeChange={onMobilepushModeChange}
|
|
679
|
+
mobilePushCreateMode={mobilePushCreateMode}
|
|
680
|
+
isGetFormData={isGetFormData}
|
|
681
|
+
getFormData={getFormData}
|
|
682
|
+
templateData={templateData}
|
|
683
|
+
type={type}
|
|
684
|
+
step={templateStep}
|
|
685
|
+
showNextStep={onCreateNextStep}
|
|
686
|
+
isFullMode={isFullMode}
|
|
687
|
+
onEnterTemplateName={onEnterTemplateName}
|
|
688
|
+
onRemoveTemplateName={onRemoveTemplateName}
|
|
689
|
+
cap={cap}
|
|
690
|
+
onResetStep={onResetStep}
|
|
691
|
+
showTemplateName={showTemplateName}
|
|
692
|
+
query={query}
|
|
693
|
+
forwardedTags={forwardedTags}
|
|
694
|
+
onValidationFail={onValidationFail}
|
|
695
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
696
|
+
onPreviewContentClicked={onPreviewContentClicked}
|
|
697
|
+
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
698
|
+
onTestContentClicked={onTestContentClicked}
|
|
699
|
+
eventContextTags={eventContextTags}
|
|
700
|
+
/>
|
|
701
|
+
}
|
|
691
702
|
{
|
|
692
703
|
isCreateFacebook && (
|
|
693
704
|
<Facebook
|
|
@@ -704,6 +715,7 @@ export function SlideBoxContent(props) {
|
|
|
704
715
|
fbAdManager={fbAdManager}
|
|
705
716
|
onSelectTemplate={onSelectTemplate}
|
|
706
717
|
orgUnitId={orgUnitId}
|
|
718
|
+
eventContextTags={eventContextTags}
|
|
707
719
|
/>
|
|
708
720
|
)
|
|
709
721
|
}
|
|
@@ -723,6 +735,7 @@ export function SlideBoxContent(props) {
|
|
|
723
735
|
getFormSubscriptionData={getFormData}
|
|
724
736
|
fbAdManager={fbAdManager}
|
|
725
737
|
onSelectTemplate={onSelectTemplate}
|
|
738
|
+
eventContextTags={eventContextTags}
|
|
726
739
|
/>
|
|
727
740
|
)
|
|
728
741
|
}
|
|
@@ -744,6 +757,7 @@ export function SlideBoxContent(props) {
|
|
|
744
757
|
selectedAccount={selectedAccount}
|
|
745
758
|
handleClose={handleClose}
|
|
746
759
|
selectedOfferDetails={selectedOfferDetails}
|
|
760
|
+
eventContextTags={eventContextTags}
|
|
747
761
|
/>
|
|
748
762
|
)
|
|
749
763
|
}
|
|
@@ -762,6 +776,7 @@ export function SlideBoxContent(props) {
|
|
|
762
776
|
createNew
|
|
763
777
|
handleClose={handleClose}
|
|
764
778
|
selectedOfferDetails={selectedOfferDetails}
|
|
779
|
+
eventContextTags={eventContextTags}
|
|
765
780
|
/>
|
|
766
781
|
)
|
|
767
782
|
}
|
|
@@ -776,6 +791,7 @@ export function SlideBoxContent(props) {
|
|
|
776
791
|
onShowTemplates={onShowTemplates}
|
|
777
792
|
templateData={templateData}
|
|
778
793
|
selectedOfferDetails={selectedOfferDetails}
|
|
794
|
+
eventContextTags={eventContextTags}
|
|
779
795
|
createNew/>
|
|
780
796
|
)}
|
|
781
797
|
|
|
@@ -792,11 +808,13 @@ export function SlideBoxContent(props) {
|
|
|
792
808
|
onShowTemplates={onShowTemplates}
|
|
793
809
|
templateData={templateData}
|
|
794
810
|
selectedOfferDetails={selectedOfferDetails}
|
|
811
|
+
eventContextTags={eventContextTags}
|
|
795
812
|
createNew/> }
|
|
796
813
|
|
|
797
814
|
{isCreateWhatsapp && (<Whatsapp
|
|
798
815
|
isFullMode={isFullMode}
|
|
799
816
|
onCreateComplete={onCreateComplete}
|
|
817
|
+
eventContextTags={eventContextTags}
|
|
800
818
|
handleClose={handleClose}/>
|
|
801
819
|
)}
|
|
802
820
|
|
|
@@ -807,6 +825,7 @@ export function SlideBoxContent(props) {
|
|
|
807
825
|
getDefaultTags={type}
|
|
808
826
|
forwardedTags={forwardedTags}
|
|
809
827
|
selectedOfferDetails={selectedOfferDetails}
|
|
828
|
+
eventContextTags={eventContextTags}
|
|
810
829
|
params={{
|
|
811
830
|
id: templateData._id,
|
|
812
831
|
}}
|
|
@@ -830,6 +849,7 @@ export function SlideBoxContent(props) {
|
|
|
830
849
|
isGetFormData={isGetFormData}
|
|
831
850
|
templateData={templateData}
|
|
832
851
|
getDefaultTags={type}
|
|
852
|
+
eventContextTags={eventContextTags}
|
|
833
853
|
/>
|
|
834
854
|
)}
|
|
835
855
|
|
|
@@ -841,6 +861,7 @@ export function SlideBoxContent(props) {
|
|
|
841
861
|
forwardedTags={forwardedTags}
|
|
842
862
|
onCreateComplete={onCreateComplete}
|
|
843
863
|
selectedOfferDetails={selectedOfferDetails}
|
|
864
|
+
eventContextTags={eventContextTags}
|
|
844
865
|
params={{
|
|
845
866
|
id: templateData._id,
|
|
846
867
|
}}
|
|
@@ -1219,6 +1219,7 @@ export class Creatives extends React.Component {
|
|
|
1219
1219
|
editor,
|
|
1220
1220
|
smsRegister,
|
|
1221
1221
|
enableNewChannels,
|
|
1222
|
+
eventContextTags,
|
|
1222
1223
|
} = this.props;
|
|
1223
1224
|
const mapTemplateCreate =
|
|
1224
1225
|
slidBoxContent === "createTemplate" &&
|
|
@@ -1320,6 +1321,7 @@ export class Creatives extends React.Component {
|
|
|
1320
1321
|
showLiquidErrorInFooter={this.showLiquidErrorInFooter}
|
|
1321
1322
|
creativesMode={creativesMode} // An existing prop that we're using here. Required to ensure correct account details in Edit or Preview in case of Embedded mode.
|
|
1322
1323
|
hostName={this.props?.hostName || ''}
|
|
1324
|
+
eventContextTags={eventContextTags}
|
|
1323
1325
|
/>
|
|
1324
1326
|
}
|
|
1325
1327
|
footer={this.shouldShowFooter() &&
|
|
@@ -1379,6 +1381,7 @@ Creatives.propTypes = {
|
|
|
1379
1381
|
strategy: PropTypes.string,
|
|
1380
1382
|
orgUnitId: PropTypes.number,
|
|
1381
1383
|
hostName: PropTypes.string,
|
|
1384
|
+
eventContextTags: PropTypes.array,
|
|
1382
1385
|
};
|
|
1383
1386
|
const mapStatesToProps = () => createStructuredSelector({
|
|
1384
1387
|
isLoading: isLoadingSelector(),
|
|
@@ -2741,6 +2741,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2741
2741
|
isEmailLoading={isLoading}
|
|
2742
2742
|
moduleType={moduleType}
|
|
2743
2743
|
showLiquidErrorInFooter={this.props.showLiquidErrorInFooter}
|
|
2744
|
+
eventContextTags={this.props?.eventContextTags}
|
|
2744
2745
|
/> : ''}
|
|
2745
2746
|
</Col>
|
|
2746
2747
|
</Row>
|
|
@@ -215,6 +215,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
215
215
|
currentOrgDetails,
|
|
216
216
|
moduleType,
|
|
217
217
|
showLiquidErrorInFooter,
|
|
218
|
+
eventContextTags,
|
|
218
219
|
} = this.props;
|
|
219
220
|
const {
|
|
220
221
|
templateName,
|
|
@@ -287,6 +288,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
287
288
|
onTestContentClicked={onTestContentClicked}
|
|
288
289
|
editor={editor}
|
|
289
290
|
moduleType={moduleType}
|
|
291
|
+
eventContextTags={eventContextTags}
|
|
290
292
|
/>}
|
|
291
293
|
{!isShowEmailCreate && (
|
|
292
294
|
<CmsTemplatesComponent
|
|
@@ -332,6 +334,7 @@ EmailWrapper.propTypes = {
|
|
|
332
334
|
moduleType: PropTypes.string,
|
|
333
335
|
onEnterTemplateName: PropTypes.func,
|
|
334
336
|
onRemoveTemplateName: PropTypes.func,
|
|
337
|
+
eventContextTags: PropTypes.array,
|
|
335
338
|
};
|
|
336
339
|
|
|
337
340
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -1808,6 +1808,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1808
1808
|
templateData={this.props.templateData}
|
|
1809
1809
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1810
1810
|
isFullMode={this.props.isFullMode}
|
|
1811
|
+
eventContextTags={this.props?.eventContextTags}
|
|
1811
1812
|
/>
|
|
1812
1813
|
</CapColumn>
|
|
1813
1814
|
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
@@ -1899,6 +1900,7 @@ Create.propTypes = {
|
|
|
1899
1900
|
getFormLibraryData: PropTypes.func,
|
|
1900
1901
|
onPreviewContentClicked: PropTypes.func,
|
|
1901
1902
|
onTestContentClicked: PropTypes.func,
|
|
1903
|
+
eventContextTags: PropTypes.array,
|
|
1902
1904
|
};
|
|
1903
1905
|
|
|
1904
1906
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -1956,6 +1956,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1956
1956
|
templateData={this.props.templateData}
|
|
1957
1957
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1958
1958
|
isFullMode={this.props.isFullMode}
|
|
1959
|
+
eventContextTags={this.props?.eventContextTags}
|
|
1959
1960
|
/>}
|
|
1960
1961
|
</CapColumn>
|
|
1961
1962
|
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
@@ -2051,6 +2052,7 @@ Edit.propTypes = {
|
|
|
2051
2052
|
onPreviewContentClicked: PropTypes.func,
|
|
2052
2053
|
onTestContentClicked: PropTypes.func,
|
|
2053
2054
|
creativesMode: PropTypes.string,
|
|
2055
|
+
eventContextTags: PropTypes.array,
|
|
2054
2056
|
};
|
|
2055
2057
|
|
|
2056
2058
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -72,7 +72,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
render() {
|
|
75
|
-
const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData} = this.props;
|
|
75
|
+
const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = []} = this.props;
|
|
76
76
|
const {templateName} = this.state;
|
|
77
77
|
const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
|
|
78
78
|
return (
|
|
@@ -119,6 +119,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
119
119
|
onTestContentClicked={onTestContentClicked}
|
|
120
120
|
templateData={templateData}
|
|
121
121
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
122
|
+
eventContextTags={eventContextTags}
|
|
122
123
|
/>
|
|
123
124
|
|
|
124
125
|
|
|
@@ -144,6 +145,7 @@ MobilepushWrapper.propTypes = {
|
|
|
144
145
|
showTemplateName: PropTypes.func,
|
|
145
146
|
type: PropTypes.string,
|
|
146
147
|
onValidationFail: PropTypes.func,
|
|
148
|
+
eventContextTags: PropTypes.array,
|
|
147
149
|
};
|
|
148
150
|
|
|
149
151
|
|
|
@@ -993,6 +993,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
993
993
|
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
994
994
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
995
995
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
996
|
+
eventContextTags={this.props?.eventContextTags}
|
|
996
997
|
/>
|
|
997
998
|
</CapColumn>
|
|
998
999
|
</CapRow>
|
|
@@ -1019,6 +1020,7 @@ Create.propTypes = {
|
|
|
1019
1020
|
getFormSubscriptionData: PropTypes.func,
|
|
1020
1021
|
isLoadingMetaEntities: PropTypes.bool,
|
|
1021
1022
|
selectedOfferDetails: PropTypes.array,
|
|
1023
|
+
eventContextTags: PropTypes.array,
|
|
1022
1024
|
};
|
|
1023
1025
|
|
|
1024
1026
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -992,6 +992,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
992
992
|
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
993
993
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
994
994
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
995
|
+
eventContextTags={this.props?.eventContextTags}
|
|
995
996
|
/>
|
|
996
997
|
</CapColumn>
|
|
997
998
|
</CapRow>
|
|
@@ -1021,6 +1022,7 @@ Edit.propTypes = {
|
|
|
1021
1022
|
// route: PropTypes.object,
|
|
1022
1023
|
injectedTags: PropTypes.object,
|
|
1023
1024
|
selectedOfferDetails: PropTypes.array,
|
|
1025
|
+
eventContextTags: PropTypes.array,
|
|
1024
1026
|
};
|
|
1025
1027
|
|
|
1026
1028
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -75,6 +75,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
75
75
|
getFormSubscriptionData,
|
|
76
76
|
templateData = {},
|
|
77
77
|
selectedOfferDetails,
|
|
78
|
+
eventContextTags,
|
|
78
79
|
} = props || {};
|
|
79
80
|
const { formatMessage } = intl;
|
|
80
81
|
const [loading, updateLoading] = useState(true);
|
|
@@ -230,6 +231,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
230
231
|
injectedTagsParams: injectedTags,
|
|
231
232
|
location,
|
|
232
233
|
tagModule: getDefaultTags,
|
|
234
|
+
eventContextTags,
|
|
233
235
|
}) || {};
|
|
234
236
|
updateIsTagValidationError(
|
|
235
237
|
tagValidationResponse.unsupportedTags.length > 0,
|
|
@@ -573,6 +575,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
573
575
|
injectedTags={injectedTags || {}}
|
|
574
576
|
hidePopover={disablehandler()}
|
|
575
577
|
selectedOfferDetails={selectedOfferDetails}
|
|
578
|
+
eventContextTags={eventContextTags}
|
|
576
579
|
/>
|
|
577
580
|
}
|
|
578
581
|
/>
|
|
@@ -29,6 +29,7 @@ const SmsWrapper = (props) => {
|
|
|
29
29
|
handleClose,
|
|
30
30
|
smsRegister,
|
|
31
31
|
onShowTemplates,
|
|
32
|
+
eventContextTags,
|
|
32
33
|
} = props;
|
|
33
34
|
|
|
34
35
|
const smsProps = {
|
|
@@ -44,6 +45,7 @@ const SmsWrapper = (props) => {
|
|
|
44
45
|
selectedOfferDetails,
|
|
45
46
|
onPreviewContentClicked,
|
|
46
47
|
onTestContentClicked,
|
|
48
|
+
eventContextTags,
|
|
47
49
|
};
|
|
48
50
|
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
49
51
|
return <>
|
|
@@ -22,6 +22,7 @@ import './_tagList.scss';
|
|
|
22
22
|
import { selectCurrentOrgDetails, makeSelectFetchingSchemaError } from '../Cap/selectors';
|
|
23
23
|
import { injectIntl } from 'react-intl';
|
|
24
24
|
import { scope } from './messages';
|
|
25
|
+
import messages from './messages';
|
|
25
26
|
import { handleInjectedData, hasGiftVoucherFeature, hasPromoFeature, hasBadgesFeature, transformBadgeTags } from '../../utils/common';
|
|
26
27
|
import { GIFT_VOUCHER_RELATED_TAGS, PROMO_ENGINE_RELATED_TAGS, BADGES_RELATED_TAGS, BADGES_ENROLL, BADGES_ISSUE } from '../../containers/App/constants';
|
|
27
28
|
|
|
@@ -83,7 +84,9 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
83
84
|
generateTags = (props) => {
|
|
84
85
|
let tags = {};
|
|
85
86
|
let injectedTags = {};
|
|
86
|
-
const
|
|
87
|
+
const eventContextTagsObj = {};
|
|
88
|
+
|
|
89
|
+
const {selectedOfferDetails, eventContextTags } = props;
|
|
87
90
|
if (props.injectedTags && !_.isEmpty(props.injectedTags)) {
|
|
88
91
|
const formattedInjectedTags = handleInjectedData(
|
|
89
92
|
props.injectedTags,
|
|
@@ -101,7 +104,27 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
101
104
|
this.transformCouponTags(selectedOfferDetails, tags);
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
|
-
|
|
107
|
+
if (eventContextTags?.length) {
|
|
108
|
+
const TAG_HEADER_MSG_LABEL = this.props.intl.formatMessage(messages.tagsBasedOnEntryTriggerEvent);
|
|
109
|
+
eventContextTagsObj.EventContextTags = {
|
|
110
|
+
name: TAG_HEADER_MSG_LABEL,
|
|
111
|
+
desc: TAG_HEADER_MSG_LABEL,
|
|
112
|
+
resolved: true,
|
|
113
|
+
'tag-header': true,
|
|
114
|
+
subtags: {},
|
|
115
|
+
};
|
|
116
|
+
// Journey event context tags also should be displayed in the Add Labels.
|
|
117
|
+
eventContextTags.forEach((tag) => {
|
|
118
|
+
if (tag?.tagName) {
|
|
119
|
+
eventContextTagsObj.EventContextTags.subtags[tag?.tagName] = {
|
|
120
|
+
name: tag?.tagName,
|
|
121
|
+
desc: tag?.tagName,
|
|
122
|
+
resolved: true
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
this.setState({tags: _.merge( {}, tags, injectedTags, eventContextTagsObj )});
|
|
105
128
|
}
|
|
106
129
|
populateTags(tagsList) {
|
|
107
130
|
const mainTags = {};
|
|
@@ -299,6 +322,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
299
322
|
TagList.defaultProps = {
|
|
300
323
|
isNewVersionFlow: false,
|
|
301
324
|
userLocale: 'en',
|
|
325
|
+
eventContextTags: [],
|
|
302
326
|
};
|
|
303
327
|
|
|
304
328
|
TagList.propTypes = {
|
|
@@ -318,6 +342,7 @@ TagList.propTypes = {
|
|
|
318
342
|
channel: PropTypes.string,
|
|
319
343
|
disabled: PropTypes.bool,
|
|
320
344
|
fetchingSchemaError: PropTypes.bool,
|
|
345
|
+
eventContextTags: PropTypes.array,
|
|
321
346
|
};
|
|
322
347
|
|
|
323
348
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -11,4 +11,8 @@ export default defineMessages({
|
|
|
11
11
|
id: `${scope}.header`,
|
|
12
12
|
defaultMessage: 'This is TagList container !',
|
|
13
13
|
},
|
|
14
|
+
tagsBasedOnEntryTriggerEvent: {
|
|
15
|
+
id: `${scope}.tagsBasedOnEntryTriggerEvent`,
|
|
16
|
+
defaultMessage: 'Tags based on entry trigger event',
|
|
17
|
+
},
|
|
14
18
|
});
|