@capillarytech/creatives-library 8.0.332 → 8.0.334
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/tests/tagValidations.test.js +20 -0
- package/v2Components/CapTagList/index.js +28 -23
- package/v2Components/CapTagList/style.scss +29 -0
- package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +63 -0
- package/v2Components/CapTagListWithInput/index.js +4 -0
- package/v2Components/CapWhatsappCTA/index.js +2 -0
- package/v2Components/FormBuilder/index.js +7 -0
- package/v2Components/HtmlEditor/HTMLEditor.js +6 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +927 -2
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +3 -0
- package/v2Containers/BeeEditor/index.js +3 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +28 -1
- package/v2Containers/CreativesContainer/index.js +9 -7
- package/v2Containers/Email/index.js +1 -0
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +6 -1
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +3 -0
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +20 -2
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +16 -1
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +3 -0
- package/v2Containers/EmailWrapper/index.js +4 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +1 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +9 -0
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +1 -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/Rcs/index.js +1 -7
- package/v2Containers/Sms/Create/index.js +2 -0
- package/v2Containers/Sms/Edit/index.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +2 -0
- package/v2Containers/SmsWrapper/index.js +2 -0
- package/v2Containers/TagList/index.js +62 -5
- package/v2Containers/TagList/messages.js +4 -0
- package/v2Containers/TagList/tests/TagList.test.js +124 -20
- package/v2Containers/TagList/tests/mockdata.js +17 -0
- package/v2Containers/Viber/index.js +3 -0
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -2
- package/v2Containers/WebPush/Create/index.js +9 -1
- package/v2Containers/Whatsapp/index.js +5 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +20 -0
- package/v2Containers/Zalo/index.js +2 -0
|
@@ -148,6 +148,7 @@ export const Rcs = (props) => {
|
|
|
148
148
|
smsRegister,
|
|
149
149
|
selectedOfferDetails,
|
|
150
150
|
eventContextTags,
|
|
151
|
+
waitEventContextTags,
|
|
151
152
|
accountData = {},
|
|
152
153
|
// TestAndPreviewSlidebox props
|
|
153
154
|
showTestAndPreviewSlidebox: propsShowTestAndPreviewSlidebox,
|
|
@@ -300,7 +301,6 @@ export const Rcs = (props) => {
|
|
|
300
301
|
const [accessToken, setAccessToken] = useState('');
|
|
301
302
|
const [hostName, setHostName] = useState('');
|
|
302
303
|
const [accountName, setAccountName] = useState('');
|
|
303
|
-
const [rcsAccount, setRcsAccount] = useState('');
|
|
304
304
|
useEffect(() => {
|
|
305
305
|
const accountObj = accountData.selectedRcsAccount || {};
|
|
306
306
|
if (!isEmpty(accountObj)) {
|
|
@@ -313,7 +313,6 @@ export const Rcs = (props) => {
|
|
|
313
313
|
setAccessToken(configs.accessToken || '');
|
|
314
314
|
setHostName(accountObj.hostName || '');
|
|
315
315
|
setAccountName(accountObj.name || '');
|
|
316
|
-
setRcsAccount(accountObj.id || '');
|
|
317
316
|
}
|
|
318
317
|
}, [accountData.selectedRcsAccount]);
|
|
319
318
|
|
|
@@ -608,10 +607,6 @@ export const Rcs = (props) => {
|
|
|
608
607
|
const mediaData = get(details, 'versions.base.content.RCS.rcsContent.cardContent[0].media', '');
|
|
609
608
|
const cardSettings = get(details, 'versions.base.content.RCS.rcsContent.cardSettings', '');
|
|
610
609
|
setMediaData(mediaData, mediaType, cardSettings);
|
|
611
|
-
if (details?.edit) {
|
|
612
|
-
const rcsAccountId = get(details, 'versions.base.content.RCS.rcsContent.accountId', '');
|
|
613
|
-
setRcsAccount(rcsAccountId);
|
|
614
|
-
}
|
|
615
610
|
}
|
|
616
611
|
}, [rcsData, templateData, isFullMode, isEditFlow]);
|
|
617
612
|
|
|
@@ -1967,7 +1962,6 @@ const splitTemplateVarString = (str) => {
|
|
|
1967
1962
|
content: {
|
|
1968
1963
|
RCS: {
|
|
1969
1964
|
rcsContent: {
|
|
1970
|
-
...(rcsAccount && !isFullMode && { accountId: rcsAccount }),
|
|
1971
1965
|
cardType: STANDALONE,
|
|
1972
1966
|
cardSettings: {
|
|
1973
1967
|
cardOrientation: isMediaTypeImage ? RCS_IMAGE_DIMENSIONS[selectedDimension]?.orientation || VERTICAL : RCS_VIDEO_THUMBNAIL_DIMENSIONS[selectedDimension]?.orientation || VERTICAL,
|
|
@@ -1096,6 +1096,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1096
1096
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
1097
1097
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
1098
1098
|
eventContextTags={this.props?.eventContextTags}
|
|
1099
|
+
waitEventContextTags={this.props?.waitEventContextTags}
|
|
1099
1100
|
/>
|
|
1100
1101
|
</CapColumn>
|
|
1101
1102
|
</CapRow>
|
|
@@ -1132,6 +1133,7 @@ Create.propTypes = {
|
|
|
1132
1133
|
isLoadingMetaEntities: PropTypes.bool,
|
|
1133
1134
|
selectedOfferDetails: PropTypes.array,
|
|
1134
1135
|
eventContextTags: PropTypes.array,
|
|
1136
|
+
waitEventContextTags: PropTypes.object,
|
|
1135
1137
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
1136
1138
|
handleTestAndPreview: PropTypes.func,
|
|
1137
1139
|
handleCloseTestAndPreview: PropTypes.func,
|
|
@@ -1091,6 +1091,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1091
1091
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
1092
1092
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
1093
1093
|
eventContextTags={this.props?.eventContextTags}
|
|
1094
|
+
waitEventContextTags={this.props?.waitEventContextTags}
|
|
1094
1095
|
messageDetails={this.props?.messageDetails}
|
|
1095
1096
|
/>
|
|
1096
1097
|
</CapColumn>
|
|
@@ -1131,6 +1132,7 @@ Edit.propTypes = {
|
|
|
1131
1132
|
injectedTags: PropTypes.object,
|
|
1132
1133
|
selectedOfferDetails: PropTypes.array,
|
|
1133
1134
|
eventContextTags: PropTypes.array,
|
|
1135
|
+
waitEventContextTags: PropTypes.object,
|
|
1134
1136
|
messageDetails: PropTypes.object,
|
|
1135
1137
|
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
1136
1138
|
handleTestAndPreview: PropTypes.func,
|
|
@@ -82,6 +82,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
82
82
|
templateData = {},
|
|
83
83
|
selectedOfferDetails,
|
|
84
84
|
eventContextTags,
|
|
85
|
+
waitEventContextTags,
|
|
85
86
|
fetchingLiquidTags,
|
|
86
87
|
getLiquidTags,
|
|
87
88
|
showLiquidErrorInFooter,
|
|
@@ -660,6 +661,7 @@ export const SmsTraiEdit = (props) => {
|
|
|
660
661
|
hidePopover={disablehandler()}
|
|
661
662
|
selectedOfferDetails={selectedOfferDetails}
|
|
662
663
|
eventContextTags={eventContextTags}
|
|
664
|
+
waitEventContextTags={waitEventContextTags}
|
|
663
665
|
/>
|
|
664
666
|
)}
|
|
665
667
|
/>
|
|
@@ -30,6 +30,7 @@ const SmsWrapper = (props) => {
|
|
|
30
30
|
smsRegister,
|
|
31
31
|
onShowTemplates,
|
|
32
32
|
eventContextTags,
|
|
33
|
+
waitEventContextTags,
|
|
33
34
|
showLiquidErrorInFooter,
|
|
34
35
|
getLiquidTags,
|
|
35
36
|
showTestAndPreviewSlidebox,
|
|
@@ -53,6 +54,7 @@ const SmsWrapper = (props) => {
|
|
|
53
54
|
onPreviewContentClicked,
|
|
54
55
|
onTestContentClicked,
|
|
55
56
|
eventContextTags,
|
|
57
|
+
waitEventContextTags,
|
|
56
58
|
showLiquidErrorInFooter,
|
|
57
59
|
getLiquidTags,
|
|
58
60
|
showTestAndPreviewSlidebox,
|
|
@@ -94,10 +94,28 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
componentDidUpdate(prevProps) {
|
|
97
|
-
const {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const {
|
|
98
|
+
tags,
|
|
99
|
+
injectedTags,
|
|
100
|
+
selectedOfferDetails,
|
|
101
|
+
eventContextTags,
|
|
102
|
+
waitEventContextTags,
|
|
103
|
+
} = this.props;
|
|
104
|
+
const {
|
|
105
|
+
tags: prevTags,
|
|
106
|
+
injectedTags: prevInjectedTags,
|
|
107
|
+
selectedOfferDetails: prevSelectedOfferDetails,
|
|
108
|
+
eventContextTags: prevEventContextTags,
|
|
109
|
+
waitEventContextTags: prevWaitEventContextTags,
|
|
110
|
+
} = prevProps;
|
|
111
|
+
|
|
112
|
+
if (
|
|
113
|
+
tags !== prevTags
|
|
114
|
+
|| injectedTags !== prevInjectedTags
|
|
115
|
+
|| selectedOfferDetails !== prevSelectedOfferDetails
|
|
116
|
+
|| !_.isEqual(eventContextTags, prevEventContextTags)
|
|
117
|
+
|| !_.isEqual(waitEventContextTags, prevWaitEventContextTags)
|
|
118
|
+
) {
|
|
101
119
|
this.generateTags(this.props);
|
|
102
120
|
}
|
|
103
121
|
}
|
|
@@ -162,7 +180,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
162
180
|
let injectedTags = {};
|
|
163
181
|
const eventContextTagsObj = {};
|
|
164
182
|
|
|
165
|
-
const {selectedOfferDetails, eventContextTags } = props;
|
|
183
|
+
const {selectedOfferDetails, eventContextTags, waitEventContextTags } = props;
|
|
166
184
|
if (props.injectedTags && !_.isEmpty(props.injectedTags)) {
|
|
167
185
|
const formattedInjectedTags = handleInjectedData(
|
|
168
186
|
props.injectedTags,
|
|
@@ -214,6 +232,43 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
214
232
|
};
|
|
215
233
|
});
|
|
216
234
|
}
|
|
235
|
+
// Wait event context tags should be displayed in the Add Labels when node is next to Event based wait node.
|
|
236
|
+
if (waitEventContextTags && Object.keys(waitEventContextTags)?.length) {
|
|
237
|
+
|
|
238
|
+
Object.keys(waitEventContextTags).forEach((blockId) => {
|
|
239
|
+
const WAIT_EVENT_HEADER_MSG_LABEL = `${waitEventContextTags[blockId].eventName} (${waitEventContextTags[blockId].blockName})`;
|
|
240
|
+
eventContextTagsObj[blockId] = {
|
|
241
|
+
"name": WAIT_EVENT_HEADER_MSG_LABEL,
|
|
242
|
+
"desc": WAIT_EVENT_HEADER_MSG_LABEL,
|
|
243
|
+
"resolved": true,
|
|
244
|
+
'tag-header': true,
|
|
245
|
+
"subtags": {},
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
waitEventContextTags?.[blockId]?.tags?.forEach((tag) => {
|
|
249
|
+
const {
|
|
250
|
+
tagName, label, profileId, profileName, blockName, eventName
|
|
251
|
+
} = tag || {};
|
|
252
|
+
if (!profileId || !tagName || !label || !profileName) return;
|
|
253
|
+
// Initializing the tags profile if it doesn't exist
|
|
254
|
+
if (!eventContextTagsObj?.[blockId]?.subtags?.[profileId]) {
|
|
255
|
+
eventContextTagsObj[blockId].subtags[profileId] = {
|
|
256
|
+
"name": profileName,
|
|
257
|
+
"desc": profileName,
|
|
258
|
+
"resolved": true,
|
|
259
|
+
'tag-header': true,
|
|
260
|
+
"subtags": {},
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
// Adding the current tag to the profile group
|
|
264
|
+
eventContextTagsObj[blockId].subtags[profileId].subtags[tagName] = {
|
|
265
|
+
name: label,
|
|
266
|
+
desc: label,
|
|
267
|
+
resolved: true,
|
|
268
|
+
};
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
}
|
|
217
272
|
this.setState({tags: _.merge( {}, tags, injectedTags, eventContextTagsObj )});
|
|
218
273
|
}
|
|
219
274
|
|
|
@@ -432,6 +487,7 @@ TagList.defaultProps = {
|
|
|
432
487
|
isNewVersionFlow: false,
|
|
433
488
|
userLocale: 'en',
|
|
434
489
|
eventContextTags: [],
|
|
490
|
+
waitEventContextTags: {},
|
|
435
491
|
};
|
|
436
492
|
|
|
437
493
|
TagList.propTypes = {
|
|
@@ -452,6 +508,7 @@ TagList.propTypes = {
|
|
|
452
508
|
disabled: PropTypes.bool,
|
|
453
509
|
fetchingSchemaError: PropTypes.bool,
|
|
454
510
|
eventContextTags: PropTypes.array,
|
|
511
|
+
waitEventContextTags: PropTypes.object,
|
|
455
512
|
popoverPlacement: PropTypes.string,
|
|
456
513
|
// message to show when Add Label button is disabled (e.g. personalization restriction)
|
|
457
514
|
disableTooltipMsg: PropTypes.string,
|
|
@@ -19,4 +19,8 @@ export default defineMessages({
|
|
|
19
19
|
id: `${scope}.personalizationNotSupportedAnonymous`,
|
|
20
20
|
defaultMessage: 'Personalization tags are not supported for anonymous customers',
|
|
21
21
|
},
|
|
22
|
+
waitEvent: {
|
|
23
|
+
id: `${scope}.waitEvent`,
|
|
24
|
+
defaultMessage: 'Wait Event',
|
|
25
|
+
},
|
|
22
26
|
});
|
|
@@ -5,28 +5,34 @@ import { initialReducer } from '../../../initialReducer';
|
|
|
5
5
|
import { injectIntl } from "react-intl";
|
|
6
6
|
import { fireEvent } from "@testing-library/react";
|
|
7
7
|
import { TagList } from '../index';
|
|
8
|
-
import { TagListData, eventContextTags } from './mockdata';
|
|
8
|
+
import { TagListData, eventContextTags, waitEventContextTags } from './mockdata';
|
|
9
|
+
import { OfferTag, badgesTags, offer } from '../../../utils/tests/common.mockdata';
|
|
10
|
+
import * as commonUtils from "../../../utils/common";
|
|
9
11
|
import { Provider } from 'react-redux';
|
|
10
12
|
import { screen, render } from '../../../utils/test-utils';
|
|
11
13
|
import history from '../../../utils/history';
|
|
12
14
|
const { getByText, queryByText } = screen;
|
|
13
15
|
|
|
16
|
+
const buildProps = (props = {}) => ({
|
|
17
|
+
...TagListData,
|
|
18
|
+
onTagSelect: jest.fn(),
|
|
19
|
+
...props,
|
|
20
|
+
});
|
|
14
21
|
|
|
15
|
-
const initializeTagList = (props) => {
|
|
22
|
+
const initializeTagList = (props = {}) => {
|
|
16
23
|
const store = configureStore({}, initialReducer, history);
|
|
17
24
|
const Component = injectIntl(TagList);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
...
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
const propsObj = buildProps(props);
|
|
26
|
+
return {
|
|
27
|
+
...render(
|
|
28
|
+
<Provider store={store}>
|
|
29
|
+
<Component {...propsObj} />
|
|
30
|
+
</Provider>
|
|
31
|
+
),
|
|
32
|
+
store,
|
|
33
|
+
Component,
|
|
34
|
+
propsObj,
|
|
23
35
|
};
|
|
24
|
-
|
|
25
|
-
return render(
|
|
26
|
-
<Provider store={store}>
|
|
27
|
-
<Component {...propsObj} />
|
|
28
|
-
</Provider>
|
|
29
|
-
);
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
const addLabelBtnAssertion = () => {
|
|
@@ -41,19 +47,117 @@ describe("TagList test : UNIT", () => {
|
|
|
41
47
|
addLabelBtnAssertion();
|
|
42
48
|
});
|
|
43
49
|
|
|
44
|
-
it('should render event context
|
|
45
|
-
initializeTagList({eventContextTags});
|
|
50
|
+
it('should render event context tag section from generateTags', () => {
|
|
51
|
+
initializeTagList({ eventContextTags, moduleFilterEnabled: false });
|
|
46
52
|
addLabelBtnAssertion();
|
|
47
53
|
const EVENT_CONTEXT_TAG_HEADER = getByText(/Entry event/i);
|
|
48
54
|
expect(EVENT_CONTEXT_TAG_HEADER).toBeInTheDocument();
|
|
49
|
-
fireEvent.click(EVENT_CONTEXT_TAG_HEADER);
|
|
50
|
-
// Customer profile tags
|
|
51
|
-
const CUSTOMER_PROFILE = getByText(/Current Customer/i);
|
|
52
|
-
fireEvent.click(CUSTOMER_PROFILE);
|
|
53
|
-
expect(getByText(/lifetimePurchases/i)).toBeInTheDocument();
|
|
54
55
|
|
|
55
56
|
// Behavioural event profile tags should not be visible as label and profile name is not present
|
|
56
57
|
const BEHAVIOURAL_EVENT_PROFILE = queryByText(/Behavioural event/i);
|
|
57
58
|
expect(BEHAVIOURAL_EVENT_PROFILE).not.toBeInTheDocument();
|
|
58
59
|
});
|
|
60
|
+
|
|
61
|
+
it('should render wait event context section when waitEventContextTags is provided', () => {
|
|
62
|
+
initializeTagList({ waitEventContextTags, moduleFilterEnabled: false });
|
|
63
|
+
addLabelBtnAssertion();
|
|
64
|
+
const WAIT_EVENT_HEADER = getByText(/Order Placed \(Wait Block\)/i);
|
|
65
|
+
expect(WAIT_EVENT_HEADER).toBeInTheDocument();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should merge empty waitEventContextTags with entry event tags', () => {
|
|
69
|
+
initializeTagList({ eventContextTags, waitEventContextTags: {}, moduleFilterEnabled: false });
|
|
70
|
+
addLabelBtnAssertion();
|
|
71
|
+
expect(getByText(/Entry event/i)).toBeInTheDocument();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('calls parent onContextChange with Outbound when tags and injectedTags are empty on popover open', () => {
|
|
75
|
+
const onContextChange = jest.fn();
|
|
76
|
+
initializeTagList({
|
|
77
|
+
tags: [],
|
|
78
|
+
injectedTags: {},
|
|
79
|
+
onContextChange,
|
|
80
|
+
onTagSelect: jest.fn(),
|
|
81
|
+
});
|
|
82
|
+
// Default fetch is triggered when the Add Label popover opens (not on mount)
|
|
83
|
+
addLabelBtnAssertion();
|
|
84
|
+
expect(onContextChange).toHaveBeenCalledWith('Outbound');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('applies fetchingSchemaError from props via componentWillReceiveProps', () => {
|
|
88
|
+
const { rerender, Component, propsObj, store } = initializeTagList({ fetchingSchemaError: false });
|
|
89
|
+
addLabelBtnAssertion();
|
|
90
|
+
rerender(
|
|
91
|
+
<Provider store={store}>
|
|
92
|
+
<Component {...propsObj} fetchingSchemaError />
|
|
93
|
+
</Provider>
|
|
94
|
+
);
|
|
95
|
+
expect(screen.getByText(/add label/i)).toBeInTheDocument();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('disables Add label when restrictPersonalization is true', () => {
|
|
99
|
+
initializeTagList({
|
|
100
|
+
restrictPersonalization: true,
|
|
101
|
+
disabled: false,
|
|
102
|
+
moduleFilterEnabled: false,
|
|
103
|
+
});
|
|
104
|
+
const btn = screen.getByText(/add label/i).closest('button');
|
|
105
|
+
expect(btn).toBeDisabled();
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('calls transformCouponTags when selectedOfferDetails and coupon tags are present', () => {
|
|
109
|
+
const spy = jest.spyOn(TagList.prototype, 'transformCouponTags');
|
|
110
|
+
initializeTagList({
|
|
111
|
+
tags: OfferTag,
|
|
112
|
+
injectedTags: {},
|
|
113
|
+
selectedOfferDetails: [{ id: 'c1', couponName: 'Promo Coupon', couponSeriesId: 'c1' }],
|
|
114
|
+
moduleFilterEnabled: false,
|
|
115
|
+
});
|
|
116
|
+
expect(spy).toHaveBeenCalled();
|
|
117
|
+
spy.mockRestore();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('calls transformBadgeTags from common when badge offer and Badge tags are present', () => {
|
|
121
|
+
const spy = jest.spyOn(commonUtils, 'transformBadgeTags');
|
|
122
|
+
initializeTagList({
|
|
123
|
+
tags: badgesTags,
|
|
124
|
+
injectedTags: {},
|
|
125
|
+
selectedOfferDetails: offer,
|
|
126
|
+
moduleFilterEnabled: false,
|
|
127
|
+
});
|
|
128
|
+
expect(spy).toHaveBeenCalled();
|
|
129
|
+
spy.mockRestore();
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('unmounts without throwing', () => {
|
|
133
|
+
const { unmount } = initializeTagList();
|
|
134
|
+
expect(() => unmount()).not.toThrow();
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('regenerates tags when props.tags change (componentDidUpdate)', () => {
|
|
138
|
+
const { rerender, Component, store } = initializeTagList({ tags: TagListData.tags });
|
|
139
|
+
const extra = [
|
|
140
|
+
...TagListData.tags,
|
|
141
|
+
{
|
|
142
|
+
_id: 'extra-tag',
|
|
143
|
+
type: 'TAG',
|
|
144
|
+
definition: {
|
|
145
|
+
label: { en: 'Extra' },
|
|
146
|
+
value: 'extra_value',
|
|
147
|
+
subtags: [],
|
|
148
|
+
'tag-header': false,
|
|
149
|
+
supportedModules: [{ context: 'default', layout: 'sms', mandatory: false }],
|
|
150
|
+
},
|
|
151
|
+
scope: { tag: 'STANDARD', orgId: -1, verticals: [] },
|
|
152
|
+
isActive: true,
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
rerender(
|
|
156
|
+
<Provider store={store}>
|
|
157
|
+
<Component {...buildProps({ tags: extra })} />
|
|
158
|
+
</Provider>
|
|
159
|
+
);
|
|
160
|
+
addLabelBtnAssertion();
|
|
161
|
+
expect(screen.getByText(/add label/i)).toBeInTheDocument();
|
|
162
|
+
});
|
|
59
163
|
});
|
|
@@ -149,3 +149,20 @@ export const eventContextTags = [
|
|
|
149
149
|
"isDynamicFact": false
|
|
150
150
|
}
|
|
151
151
|
];
|
|
152
|
+
|
|
153
|
+
export const waitEventContextTags = {
|
|
154
|
+
block1: {
|
|
155
|
+
eventName: 'Order Placed',
|
|
156
|
+
blockName: 'Wait Block',
|
|
157
|
+
tags: [
|
|
158
|
+
{
|
|
159
|
+
tagName: 'waitEvent.orderId',
|
|
160
|
+
label: 'Order ID',
|
|
161
|
+
profileId: 'ORDER_PROFILE',
|
|
162
|
+
profileName: 'Order Profile',
|
|
163
|
+
blockName: 'Wait Block',
|
|
164
|
+
eventName: 'Order Placed',
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
};
|
|
@@ -82,6 +82,7 @@ export const Viber = (props) => {
|
|
|
82
82
|
viberData = {},
|
|
83
83
|
selectedOfferDetails = [],
|
|
84
84
|
eventContextTags,
|
|
85
|
+
waitEventContextTags,
|
|
85
86
|
// TestAndPreviewSlidebox props
|
|
86
87
|
showTestAndPreviewSlidebox: propsShowTestAndPreviewSlidebox,
|
|
87
88
|
handleTestAndPreview: propsHandleTestAndPreview,
|
|
@@ -287,6 +288,7 @@ export const Viber = (props) => {
|
|
|
287
288
|
userLocale={localStorage.getItem("jlocale") || "en"}
|
|
288
289
|
selectedOfferDetails={selectedOfferDetails}
|
|
289
290
|
eventContextTags={eventContextTags}
|
|
291
|
+
waitEventContextTags={waitEventContextTags}
|
|
290
292
|
/>
|
|
291
293
|
</CapColumn>
|
|
292
294
|
<div className="viber-textarea-wrapper">
|
|
@@ -592,6 +594,7 @@ export const Viber = (props) => {
|
|
|
592
594
|
userLocale={localStorage.getItem("jlocale") || "en"}
|
|
593
595
|
selectedOfferDetails={selectedOfferDetails}
|
|
594
596
|
eventContextTags={eventContextTags}
|
|
597
|
+
waitEventContextTags={waitEventContextTags}
|
|
595
598
|
/>
|
|
596
599
|
<CapColumn className="cta-actions">
|
|
597
600
|
<CapButton
|
|
@@ -84,6 +84,7 @@ const MemoizedTagList = memo(({
|
|
|
84
84
|
injectedTags,
|
|
85
85
|
selectedOfferDetails,
|
|
86
86
|
eventContextTags,
|
|
87
|
+
waitEventContextTags,
|
|
87
88
|
forwardedTags,
|
|
88
89
|
onTagSelect,
|
|
89
90
|
restrictPersonalization = false,
|
|
@@ -99,6 +100,7 @@ const MemoizedTagList = memo(({
|
|
|
99
100
|
injectedTags={injectedTags}
|
|
100
101
|
selectedOfferDetails={selectedOfferDetails}
|
|
101
102
|
eventContextTags={eventContextTags}
|
|
103
|
+
waitEventContextTags={waitEventContextTags}
|
|
102
104
|
forwardedTags={forwardedTags}
|
|
103
105
|
onTagSelect={onTagSelect}
|
|
104
106
|
restrictPersonalization={restrictPersonalization}
|
|
@@ -116,6 +118,7 @@ const MemoizedTagList = memo(({
|
|
|
116
118
|
&& prevProps.injectedTags === nextProps.injectedTags
|
|
117
119
|
&& prevProps.selectedOfferDetails === nextProps.selectedOfferDetails
|
|
118
120
|
&& prevProps.eventContextTags === nextProps.eventContextTags
|
|
121
|
+
&& prevProps.waitEventContextTags === nextProps.waitEventContextTags
|
|
119
122
|
&& prevProps.forwardedTags === nextProps.forwardedTags
|
|
120
123
|
&& prevProps.onTagSelect === nextProps.onTagSelect
|
|
121
124
|
&& prevProps.restrictPersonalization === nextProps.restrictPersonalization
|
|
@@ -152,6 +155,7 @@ const WebPushCreate = ({
|
|
|
152
155
|
forwardedTags,
|
|
153
156
|
selectedOfferDetails = [],
|
|
154
157
|
eventContextTags = [],
|
|
158
|
+
waitEventContextTags = {},
|
|
155
159
|
templateActions: templateActionsProps,
|
|
156
160
|
Templates,
|
|
157
161
|
restrictPersonalization = false,
|
|
@@ -232,6 +236,7 @@ const WebPushCreate = ({
|
|
|
232
236
|
supportedTags: memoizedSupportedTags,
|
|
233
237
|
injectedTags,
|
|
234
238
|
eventContextTags,
|
|
239
|
+
waitEventContextTags,
|
|
235
240
|
});
|
|
236
241
|
const { tags, handleOnTagsContextChange, validationConfig } = tagState;
|
|
237
242
|
const { weCrmAccounts } = Templates;
|
|
@@ -837,12 +842,13 @@ const WebPushCreate = ({
|
|
|
837
842
|
injectedTags,
|
|
838
843
|
selectedOfferDetails,
|
|
839
844
|
eventContextTags,
|
|
845
|
+
waitEventContextTags,
|
|
840
846
|
forwardedTags,
|
|
841
847
|
restrictPersonalization,
|
|
842
848
|
disabled: restrictPersonalization,
|
|
843
849
|
disableTooltipMsg: restrictPersonalization ? formatMessage(messages.personalizationNotSupportedAnonymous) : undefined,
|
|
844
850
|
}),
|
|
845
|
-
[tags, injectedTags, selectedOfferDetails, eventContextTags, forwardedTags, restrictPersonalization, formatMessage],
|
|
851
|
+
[tags, injectedTags, selectedOfferDetails, eventContextTags, waitEventContextTags, forwardedTags, restrictPersonalization, formatMessage],
|
|
846
852
|
);
|
|
847
853
|
|
|
848
854
|
// Memoized TagList components with optimized props
|
|
@@ -1083,6 +1089,7 @@ WebPushCreate.propTypes = {
|
|
|
1083
1089
|
forwardedTags: PropTypes.object,
|
|
1084
1090
|
selectedOfferDetails: PropTypes.array,
|
|
1085
1091
|
eventContextTags: PropTypes.array,
|
|
1092
|
+
waitEventContextTags: PropTypes.object,
|
|
1086
1093
|
templateActions: PropTypes.object,
|
|
1087
1094
|
restrictPersonalization: PropTypes.bool,
|
|
1088
1095
|
};
|
|
@@ -1111,6 +1118,7 @@ WebPushCreate.defaultProps = {
|
|
|
1111
1118
|
forwardedTags: {},
|
|
1112
1119
|
selectedOfferDetails: [],
|
|
1113
1120
|
eventContextTags: [],
|
|
1121
|
+
waitEventContextTags: {},
|
|
1114
1122
|
templateActions: {},
|
|
1115
1123
|
Templates: {},
|
|
1116
1124
|
restrictPersonalization: false,
|
|
@@ -180,6 +180,7 @@ export const Whatsapp = (props) => {
|
|
|
180
180
|
getFormData,
|
|
181
181
|
selectedOfferDetails,
|
|
182
182
|
eventContextTags,
|
|
183
|
+
waitEventContextTags = {},
|
|
183
184
|
metaDataStatus = "",
|
|
184
185
|
showTestAndPreviewSlidebox: propsShowTestAndPreviewSlidebox,
|
|
185
186
|
handleTestAndPreview: propsHandleTestAndPreview,
|
|
@@ -950,6 +951,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
950
951
|
injectedTags={injectedTags || {}}
|
|
951
952
|
selectedOfferDetails={selectedOfferDetails}
|
|
952
953
|
eventContextTags={eventContextTags}
|
|
954
|
+
waitEventContextTags={waitEventContextTags}
|
|
953
955
|
/>
|
|
954
956
|
)}
|
|
955
957
|
</>
|
|
@@ -1951,6 +1953,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1951
1953
|
injectedTags={injectedTags || {}}
|
|
1952
1954
|
selectedOfferDetails={selectedOfferDetails}
|
|
1953
1955
|
eventContextTags={eventContextTags}
|
|
1956
|
+
waitEventContextTags={waitEventContextTags}
|
|
1954
1957
|
/>
|
|
1955
1958
|
)
|
|
1956
1959
|
: !isAuthenticationTemplate && (
|
|
@@ -2757,6 +2760,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2757
2760
|
injectedTags={injectedTags || {}}
|
|
2758
2761
|
selectedOfferDetails={selectedOfferDetails}
|
|
2759
2762
|
eventContextTags={eventContextTags}
|
|
2763
|
+
waitEventContextTags={waitEventContextTags}
|
|
2760
2764
|
/>
|
|
2761
2765
|
)
|
|
2762
2766
|
}
|
|
@@ -2875,6 +2879,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2875
2879
|
injectedTags={injectedTags || {}}
|
|
2876
2880
|
selectedOfferDetails={selectedOfferDetails}
|
|
2877
2881
|
eventContextTags={eventContextTags}
|
|
2882
|
+
waitEventContextTags={waitEventContextTags}
|
|
2878
2883
|
/>
|
|
2879
2884
|
)}
|
|
2880
2885
|
{isBtnTypeQuickReply && (
|