@capillarytech/creatives-library 7.17.22-alpha.0 → 7.17.23
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/config/app.js +0 -1
- package/containers/App/constants.js +0 -1
- package/package.json +1 -1
- package/utils/common.js +59 -6
- package/utils/commonUtils.js +6 -0
- package/utils/tests/common.test.js +81 -1
- package/v2Components/CapTagList/index.js +14 -3
- package/v2Components/CmsTemplatesComponent/index.js +0 -1
- package/v2Components/CmsTemplatesComponent/messages.js +0 -4
- package/v2Components/TemplatePreview/index.js +3 -8
- package/v2Containers/Cap/constants.js +3 -3
- package/v2Containers/ChannelTemplates/actions.js +20 -0
- package/v2Containers/ChannelTemplates/constants.js +8 -0
- package/v2Containers/ChannelTemplates/index.js +47 -0
- package/v2Containers/ChannelTemplates/messages.js +13 -0
- package/v2Containers/ChannelTemplates/reducer.js +34 -0
- package/v2Containers/ChannelTemplates/sagas.js +32 -0
- package/v2Containers/ChannelTemplates/selectors.js +25 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +0 -2
- package/v2Containers/LanguageProvider/reducer.js +3 -1
- package/v2Containers/LanguageProvider/tests/reducer.test.js +9 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +3 -3
- package/v2Containers/Line/Container/index.js +0 -4
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +120 -120
- package/v2Containers/Sms/Create/tests/sagas.test.js +82 -0
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +16 -16
- package/v2Containers/TagList/index.js +40 -22
- package/v2Containers/TagList/messages.js +2 -1
- package/v2Containers/TagList/tests/TagList.test.js +41 -0
- package/v2Containers/TagList/tests/mockdata.js +108 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +16 -16
- package/assets/Line_Preview_English.svg +0 -24
- package/assets/Line_Preview_Japanese.svg +0 -24
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { expectSaga } from "redux-saga-test-plan";
|
|
2
|
+
import { take, cancel, takeLatest } from "redux-saga/effects";
|
|
3
|
+
import * as matchers from "redux-saga-test-plan/matchers";
|
|
4
|
+
import { LOCATION_CHANGE } from "react-router-redux";
|
|
5
|
+
import { throwError } from "redux-saga-test-plan/providers";
|
|
6
|
+
import { createMockTask } from "redux-saga/utils";
|
|
7
|
+
import * as types from "../constants";
|
|
8
|
+
import { watchAiSuggestions, getAiSuggestions } from "../sagas";
|
|
9
|
+
import * as Api from "../../../../services/api";
|
|
10
|
+
|
|
11
|
+
describe("getAiSuggestions saga", () => {
|
|
12
|
+
it("Should handle valid response from api", () => {
|
|
13
|
+
const successCallback = () => {};
|
|
14
|
+
const failureCallback = () => {};
|
|
15
|
+
const action = {
|
|
16
|
+
type: types.GET_AI_SUGGESTIONS,
|
|
17
|
+
prompt: {},
|
|
18
|
+
successCallback,
|
|
19
|
+
failureCallback,
|
|
20
|
+
};
|
|
21
|
+
expectSaga(getAiSuggestions, action)
|
|
22
|
+
.provide([
|
|
23
|
+
[
|
|
24
|
+
matchers.call.fn(Api.getAiSuggestions),
|
|
25
|
+
{
|
|
26
|
+
success: true,
|
|
27
|
+
status: {
|
|
28
|
+
isError: false,
|
|
29
|
+
code: 200,
|
|
30
|
+
message: "success",
|
|
31
|
+
},
|
|
32
|
+
message: "Meta data fetched successfully",
|
|
33
|
+
response: {
|
|
34
|
+
"https://response.com": 1400,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
[matchers.call.fn(successCallback)],
|
|
39
|
+
])
|
|
40
|
+
.run();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("Should handles error thrown from api", () => {
|
|
44
|
+
const successCallback = () => {};
|
|
45
|
+
const failureCallback = () => {};
|
|
46
|
+
const action = {
|
|
47
|
+
type: types.GET_AI_SUGGESTIONS,
|
|
48
|
+
prompt: {},
|
|
49
|
+
successCallback,
|
|
50
|
+
failureCallback,
|
|
51
|
+
};
|
|
52
|
+
expectSaga(getAiSuggestions, action)
|
|
53
|
+
.provide([[matchers.call.fn(Api.getAiSuggestions), throwError()]])
|
|
54
|
+
.run();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe("watchAiSuggestions saga", () => {
|
|
59
|
+
let generator = null;
|
|
60
|
+
beforeEach(() => {
|
|
61
|
+
generator = watchAiSuggestions();
|
|
62
|
+
});
|
|
63
|
+
it("Should handle valid response from api", () => {
|
|
64
|
+
const progress1 = generator.next();
|
|
65
|
+
const mockTask = takeLatest(types.GET_AI_SUGGESTIONS, getAiSuggestions);
|
|
66
|
+
expect(progress1.value).toEqual(mockTask);
|
|
67
|
+
const progress2 = generator.next();
|
|
68
|
+
expect(progress2.value).toEqual(take(LOCATION_CHANGE));
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("Should handle LOCATION_CHANGE action and cancel the watcher", () => {
|
|
72
|
+
generator = watchAiSuggestions();
|
|
73
|
+
const mockTask = createMockTask();
|
|
74
|
+
|
|
75
|
+
expect(generator.next().value).toEqual(
|
|
76
|
+
takeLatest(types.GET_AI_SUGGESTIONS, getAiSuggestions)
|
|
77
|
+
);
|
|
78
|
+
expect(generator.next(mockTask).value).toEqual(take(LOCATION_CHANGE));
|
|
79
|
+
expect(generator.next().value).toEqual(cancel(mockTask));
|
|
80
|
+
expect(generator.next().done).toEqual(true);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -3134,7 +3134,7 @@ FREE GIFTS-
|
|
|
3134
3134
|
key=".0"
|
|
3135
3135
|
size="regular"
|
|
3136
3136
|
suffix={
|
|
3137
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
3137
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
3138
3138
|
hidePopover={false}
|
|
3139
3139
|
injectedTags={Object {}}
|
|
3140
3140
|
location={
|
|
@@ -3173,7 +3173,7 @@ FREE GIFTS-
|
|
|
3173
3173
|
/>
|
|
3174
3174
|
</CapHeading>
|
|
3175
3175
|
</div>
|
|
3176
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
3176
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
3177
3177
|
hidePopover={false}
|
|
3178
3178
|
injectedTags={Object {}}
|
|
3179
3179
|
location={
|
|
@@ -3190,7 +3190,7 @@ FREE GIFTS-
|
|
|
3190
3190
|
onTagSelect={[Function]}
|
|
3191
3191
|
tags={Array []}
|
|
3192
3192
|
>
|
|
3193
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
3193
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
3194
3194
|
authData={
|
|
3195
3195
|
Object {
|
|
3196
3196
|
"app": Object {},
|
|
@@ -3233,7 +3233,7 @@ FREE GIFTS-
|
|
|
3233
3233
|
redirect={[Function]}
|
|
3234
3234
|
tags={Array []}
|
|
3235
3235
|
/>
|
|
3236
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
3236
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
3237
3237
|
</div>
|
|
3238
3238
|
</CapHeader__Flex>
|
|
3239
3239
|
</CapHeader>
|
|
@@ -10463,7 +10463,7 @@ FREE GIFTS-
|
|
|
10463
10463
|
key=".0"
|
|
10464
10464
|
size="regular"
|
|
10465
10465
|
suffix={
|
|
10466
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
10466
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
10467
10467
|
hidePopover={false}
|
|
10468
10468
|
injectedTags={Object {}}
|
|
10469
10469
|
location={
|
|
@@ -10502,7 +10502,7 @@ FREE GIFTS-
|
|
|
10502
10502
|
/>
|
|
10503
10503
|
</CapHeading>
|
|
10504
10504
|
</div>
|
|
10505
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
10505
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
10506
10506
|
hidePopover={false}
|
|
10507
10507
|
injectedTags={Object {}}
|
|
10508
10508
|
location={
|
|
@@ -10519,7 +10519,7 @@ FREE GIFTS-
|
|
|
10519
10519
|
onTagSelect={[Function]}
|
|
10520
10520
|
tags={Array []}
|
|
10521
10521
|
>
|
|
10522
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
10522
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
10523
10523
|
authData={
|
|
10524
10524
|
Object {
|
|
10525
10525
|
"app": Object {},
|
|
@@ -10562,7 +10562,7 @@ FREE GIFTS-
|
|
|
10562
10562
|
redirect={[Function]}
|
|
10563
10563
|
tags={Array []}
|
|
10564
10564
|
/>
|
|
10565
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
10565
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
10566
10566
|
</div>
|
|
10567
10567
|
</CapHeader__Flex>
|
|
10568
10568
|
</CapHeader>
|
|
@@ -18212,7 +18212,7 @@ FREE GIFTS-
|
|
|
18212
18212
|
key=".0"
|
|
18213
18213
|
size="regular"
|
|
18214
18214
|
suffix={
|
|
18215
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
18215
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
18216
18216
|
hidePopover={false}
|
|
18217
18217
|
injectedTags={Object {}}
|
|
18218
18218
|
location={
|
|
@@ -18251,7 +18251,7 @@ FREE GIFTS-
|
|
|
18251
18251
|
/>
|
|
18252
18252
|
</CapHeading>
|
|
18253
18253
|
</div>
|
|
18254
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
18254
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
18255
18255
|
hidePopover={false}
|
|
18256
18256
|
injectedTags={Object {}}
|
|
18257
18257
|
location={
|
|
@@ -18268,7 +18268,7 @@ FREE GIFTS-
|
|
|
18268
18268
|
onTagSelect={[Function]}
|
|
18269
18269
|
tags={Array []}
|
|
18270
18270
|
>
|
|
18271
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
18271
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
18272
18272
|
authData={
|
|
18273
18273
|
Object {
|
|
18274
18274
|
"app": Object {},
|
|
@@ -18311,7 +18311,7 @@ FREE GIFTS-
|
|
|
18311
18311
|
redirect={[Function]}
|
|
18312
18312
|
tags={Array []}
|
|
18313
18313
|
/>
|
|
18314
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
18314
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
18315
18315
|
</div>
|
|
18316
18316
|
</CapHeader__Flex>
|
|
18317
18317
|
</CapHeader>
|
|
@@ -26070,7 +26070,7 @@ FREE GIFTS-
|
|
|
26070
26070
|
key=".0"
|
|
26071
26071
|
size="regular"
|
|
26072
26072
|
suffix={
|
|
26073
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
26073
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
26074
26074
|
hidePopover={false}
|
|
26075
26075
|
injectedTags={Object {}}
|
|
26076
26076
|
location={
|
|
@@ -26109,7 +26109,7 @@ FREE GIFTS-
|
|
|
26109
26109
|
/>
|
|
26110
26110
|
</CapHeading>
|
|
26111
26111
|
</div>
|
|
26112
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
26112
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
26113
26113
|
hidePopover={false}
|
|
26114
26114
|
injectedTags={Object {}}
|
|
26115
26115
|
location={
|
|
@@ -26126,7 +26126,7 @@ FREE GIFTS-
|
|
|
26126
26126
|
onTagSelect={[Function]}
|
|
26127
26127
|
tags={Array []}
|
|
26128
26128
|
>
|
|
26129
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
26129
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
26130
26130
|
authData={
|
|
26131
26131
|
Object {
|
|
26132
26132
|
"app": Object {},
|
|
@@ -26169,7 +26169,7 @@ FREE GIFTS-
|
|
|
26169
26169
|
redirect={[Function]}
|
|
26170
26170
|
tags={Array []}
|
|
26171
26171
|
/>
|
|
26172
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
26172
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
26173
26173
|
</div>
|
|
26174
26174
|
</CapHeader__Flex>
|
|
26175
26175
|
</CapHeader>
|
|
@@ -21,12 +21,16 @@ import CapTagList from '../../v2Components/CapTagList';
|
|
|
21
21
|
import './_tagList.scss';
|
|
22
22
|
import { selectCurrentOrgDetails } from '../Cap/selectors';
|
|
23
23
|
const TreeNode = Tree.TreeNode;
|
|
24
|
+
import { injectIntl } from 'react-intl';
|
|
25
|
+
import { scope } from './messages';
|
|
26
|
+
import { handleInjectedData } from '../../utils/common';
|
|
24
27
|
|
|
25
28
|
export class TagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
26
29
|
constructor(props) {
|
|
27
30
|
super(props);
|
|
28
31
|
this.state = {
|
|
29
32
|
loading: false,
|
|
33
|
+
tags: []
|
|
30
34
|
};
|
|
31
35
|
this.renderTags = this.renderTags.bind(this);
|
|
32
36
|
this.populateTags = this.populateTags.bind(this);
|
|
@@ -39,6 +43,34 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
39
43
|
|
|
40
44
|
}
|
|
41
45
|
|
|
46
|
+
componentDidUpdate(prevProps) {
|
|
47
|
+
if (this.props.tags !== prevProps.tags || this.props.injectedTags !== prevProps.injectedTags || this.props.selectedOfferDetails !== prevProps.selectedOfferDetails) {
|
|
48
|
+
this.setState({
|
|
49
|
+
tags: this.generateTags(this.props),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
generateTags(props) {
|
|
55
|
+
let tags = {};
|
|
56
|
+
let injectedTags = {};
|
|
57
|
+
if (props.injectedTags && !_.isEmpty(props.injectedTags)) {
|
|
58
|
+
const formattedInjectedTags = handleInjectedData(
|
|
59
|
+
props.injectedTags,
|
|
60
|
+
scope
|
|
61
|
+
);
|
|
62
|
+
injectedTags = this.transformInjectedTags(formattedInjectedTags);
|
|
63
|
+
}
|
|
64
|
+
if (props.tags && props.tags.length > 0) {
|
|
65
|
+
tags = this.populateTags(props.tags);
|
|
66
|
+
console.log('populating tags', Object.keys(tags || {}).length);
|
|
67
|
+
}
|
|
68
|
+
if (props.selectedOfferDetails && !_.isEmpty(props.selectedOfferDetails) && (tags && tags.coupon)) {
|
|
69
|
+
this.transformCouponTags(props.selectedOfferDetails, tags);
|
|
70
|
+
}
|
|
71
|
+
return _.merge( {}, tags, injectedTags);
|
|
72
|
+
}
|
|
73
|
+
|
|
42
74
|
componentWillReceiveProps(nextProps) {
|
|
43
75
|
if (_.isEmpty(this.props.injectedTags) && _.isEmpty(this.props.tags)) {
|
|
44
76
|
this.setState({loading: true});
|
|
@@ -51,6 +83,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
51
83
|
|
|
52
84
|
this.setState({loading: false});
|
|
53
85
|
}
|
|
86
|
+
|
|
54
87
|
}
|
|
55
88
|
|
|
56
89
|
onSelect = (selectedKeys) => {
|
|
@@ -73,11 +106,11 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
73
106
|
//Form tags object with tag headers
|
|
74
107
|
_.forEach(tagsList, (temp) => {
|
|
75
108
|
const tag = temp.definition;
|
|
76
|
-
const { userLocale } = this.props;
|
|
109
|
+
const { locale : userLocale } = this.props.intl;
|
|
77
110
|
if (!tag['tag-header']) {
|
|
78
111
|
mainTags[tag.value] = {
|
|
79
|
-
name: tag
|
|
80
|
-
desc: tag
|
|
112
|
+
"name": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
|
|
113
|
+
"desc": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
|
|
81
114
|
};
|
|
82
115
|
} else if (tag['tag-header'] && mainTags[tag.value]) {
|
|
83
116
|
mainTags[tag.value].subtags = _.concat(mainTags[tag.value].subtags, tag.subtags);
|
|
@@ -85,8 +118,8 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
85
118
|
//
|
|
86
119
|
mainTags[tag.value] = {
|
|
87
120
|
'tag-header': true,
|
|
88
|
-
"name": tag
|
|
89
|
-
"desc": tag
|
|
121
|
+
"name": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
|
|
122
|
+
"desc": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
|
|
90
123
|
"subtags": tag.subtags,
|
|
91
124
|
};
|
|
92
125
|
}
|
|
@@ -222,26 +255,11 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
222
255
|
}
|
|
223
256
|
|
|
224
257
|
render() {
|
|
225
|
-
let tags = {};
|
|
226
|
-
let injectedTags = {};
|
|
227
|
-
if (this.props.injectedTags && !_.isEmpty(this.props.injectedTags)) {
|
|
228
|
-
injectedTags = this.transformInjectedTags(this.props.injectedTags);
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
if (this.props.tags && this.props.tags.length > 0) {
|
|
232
|
-
tags = this.populateTags(this.props.tags);
|
|
233
|
-
console.log('populating tags', Object.keys(tags || {}).length);
|
|
234
|
-
}
|
|
235
|
-
if (this.props.selectedOfferDetails && !_.isEmpty(this.props.selectedOfferDetails) && (tags && tags.coupon)) {
|
|
236
|
-
this.transformCouponTags(this.props.selectedOfferDetails, tags);
|
|
237
|
-
}
|
|
238
|
-
tags = _.merge( {}, tags, injectedTags);
|
|
239
|
-
console.log('merged tags', Object.keys(tags || {}).length);
|
|
240
258
|
return (
|
|
241
259
|
<div className={this.props.className ? this.props.className : ''}>
|
|
242
260
|
<CapTagList
|
|
243
261
|
loading={this.state.loading}
|
|
244
|
-
tags={tags}
|
|
262
|
+
tags={this.state.tags}
|
|
245
263
|
onSelect={this.onSelect}
|
|
246
264
|
label={this.props.label}
|
|
247
265
|
visibleTaglist={this.props.visibleTaglist}
|
|
@@ -291,4 +309,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
291
309
|
};
|
|
292
310
|
}
|
|
293
311
|
|
|
294
|
-
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(TagList));
|
|
312
|
+
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(TagList)));
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* This contains all the text for the TagList component.
|
|
5
5
|
*/
|
|
6
6
|
import { defineMessages } from 'react-intl';
|
|
7
|
+
export const scope = `creatives.containersV2.TagList`;
|
|
7
8
|
|
|
8
9
|
export default defineMessages({
|
|
9
10
|
header: {
|
|
10
|
-
id:
|
|
11
|
+
id: `${scope}.header`,
|
|
11
12
|
defaultMessage: 'This is TagList container !',
|
|
12
13
|
},
|
|
13
14
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import "@testing-library/jest-dom";
|
|
3
|
+
import configureStore from "../../../store";
|
|
4
|
+
import { injectIntl } from "react-intl";
|
|
5
|
+
import { fireEvent } from "@testing-library/react";
|
|
6
|
+
import { TagList } from '../index';
|
|
7
|
+
import { TagListData } from './mockdata';
|
|
8
|
+
import { Provider } from 'react-redux';
|
|
9
|
+
import { screen, render } from '../../../utils/test-utils';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const initializeTagList = (props) => {
|
|
13
|
+
const store = configureStore({}, null);
|
|
14
|
+
const Component = injectIntl(TagList);
|
|
15
|
+
|
|
16
|
+
const propsObj = {
|
|
17
|
+
...TagListData,
|
|
18
|
+
onTagSelect: jest.fn(),
|
|
19
|
+
...props,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return render(
|
|
23
|
+
<Provider store={store}>
|
|
24
|
+
<Component {...propsObj} />
|
|
25
|
+
</Provider>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
describe("TagList test : UNIT", () => {
|
|
31
|
+
it("should render the TagList component with default props amd addLabel Button", async () => {
|
|
32
|
+
initializeTagList();
|
|
33
|
+
|
|
34
|
+
const addLabelButton = screen.getByRole('button', {
|
|
35
|
+
name: /add label/i
|
|
36
|
+
})
|
|
37
|
+
expect(addLabelButton).toBeInTheDocument();
|
|
38
|
+
|
|
39
|
+
fireEvent.click(addLabelButton);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export const TagListData = {
|
|
2
|
+
tags : [
|
|
3
|
+
{
|
|
4
|
+
"_id": "5a291cdd85c3db29a2041e5a",
|
|
5
|
+
"type": "TAG",
|
|
6
|
+
"definition": {
|
|
7
|
+
"label": {
|
|
8
|
+
"en": "Optout",
|
|
9
|
+
"ja-JP": "撤回"
|
|
10
|
+
},
|
|
11
|
+
"value": "optout",
|
|
12
|
+
"subtags": [],
|
|
13
|
+
"tag-header": false,
|
|
14
|
+
"supportedModules": [
|
|
15
|
+
{
|
|
16
|
+
"context": "journey",
|
|
17
|
+
"layout": "sms",
|
|
18
|
+
"mandatory": false
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"context": "outbound",
|
|
22
|
+
"layout": "sms",
|
|
23
|
+
"mandatory": false
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"context": "default",
|
|
27
|
+
"layout": "sms",
|
|
28
|
+
"mandatory": false
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"context": "coupon_expiry",
|
|
32
|
+
"layout": "sms",
|
|
33
|
+
"mandatory": false
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"context": "coupons",
|
|
37
|
+
"layout": "sms",
|
|
38
|
+
"mandatory": false
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"scope": {
|
|
43
|
+
"tag": "STANDARD",
|
|
44
|
+
"orgId": -1,
|
|
45
|
+
"verticals": []
|
|
46
|
+
},
|
|
47
|
+
"isActive": true,
|
|
48
|
+
"createdBy": 4,
|
|
49
|
+
"updatedBy": 15000449,
|
|
50
|
+
"createdAt": "2017-12-07T10:50:05.800Z",
|
|
51
|
+
"updatedAt": "2018-01-22T11:43:05.611Z"
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
injectedTags : {
|
|
55
|
+
"dummys": {
|
|
56
|
+
"name": "dummys",
|
|
57
|
+
"subtags": {
|
|
58
|
+
"custom_field.age_group": {
|
|
59
|
+
"name": "age_group",
|
|
60
|
+
"desc": "age_group"
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
"tag-header": true
|
|
64
|
+
},
|
|
65
|
+
"Registration custom fields": {
|
|
66
|
+
"name": "Registration custom fields",
|
|
67
|
+
"subtags": {
|
|
68
|
+
"custom_field.age_group": {
|
|
69
|
+
"name": "age_group",
|
|
70
|
+
"desc": "age_group"
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
"tag-header": true
|
|
74
|
+
},
|
|
75
|
+
"Customer extended fields": {
|
|
76
|
+
"name": "Customer extended fields",
|
|
77
|
+
"subtags": {
|
|
78
|
+
"extended_field.gender": {
|
|
79
|
+
"name": "gender",
|
|
80
|
+
"desc": "Gender"
|
|
81
|
+
},
|
|
82
|
+
"extended_field.marital_status": {
|
|
83
|
+
"name": "marital_status",
|
|
84
|
+
"desc": "Marital Status",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
"tag-header": true
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"authData": {},
|
|
91
|
+
"moduleFilterEnabled": true,
|
|
92
|
+
"label": "Add label",
|
|
93
|
+
"location": {
|
|
94
|
+
"pathname": "/sms/edit",
|
|
95
|
+
"query": {
|
|
96
|
+
"type": false,
|
|
97
|
+
"module": "default"
|
|
98
|
+
},
|
|
99
|
+
"search": ""
|
|
100
|
+
},
|
|
101
|
+
"className": "add-label",
|
|
102
|
+
"id": "tagList",
|
|
103
|
+
"userLocale": "en",
|
|
104
|
+
"TagList": {},
|
|
105
|
+
"actions": {},
|
|
106
|
+
"globalActions": {},
|
|
107
|
+
"isNewVersionFlow": false,
|
|
108
|
+
}
|
|
@@ -120064,7 +120064,7 @@ Click {{3}} to unsubscribe'",
|
|
|
120064
120064
|
key=".0"
|
|
120065
120065
|
size="large"
|
|
120066
120066
|
suffix={
|
|
120067
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
120067
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
120068
120068
|
injectedTags={Object {}}
|
|
120069
120069
|
location={
|
|
120070
120070
|
Object {
|
|
@@ -120116,7 +120116,7 @@ Click {{3}} to unsubscribe'",
|
|
|
120116
120116
|
</div>
|
|
120117
120117
|
</CapHeading>
|
|
120118
120118
|
</div>
|
|
120119
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
120119
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
120120
120120
|
injectedTags={Object {}}
|
|
120121
120121
|
location={
|
|
120122
120122
|
Object {
|
|
@@ -120132,7 +120132,7 @@ Click {{3}} to unsubscribe'",
|
|
|
120132
120132
|
onTagSelect={[Function]}
|
|
120133
120133
|
tags={Array []}
|
|
120134
120134
|
>
|
|
120135
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
120135
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
120136
120136
|
authData={
|
|
120137
120137
|
Object {
|
|
120138
120138
|
"app": Object {},
|
|
@@ -120174,7 +120174,7 @@ Click {{3}} to unsubscribe'",
|
|
|
120174
120174
|
redirect={[Function]}
|
|
120175
120175
|
tags={Array []}
|
|
120176
120176
|
/>
|
|
120177
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
120177
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
120178
120178
|
</div>
|
|
120179
120179
|
</CapHeader__Flex>
|
|
120180
120180
|
</CapHeader>
|
|
@@ -154586,7 +154586,7 @@ Click {{3}} to unsubscribe'",
|
|
|
154586
154586
|
key=".0"
|
|
154587
154587
|
size="large"
|
|
154588
154588
|
suffix={
|
|
154589
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
154589
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
154590
154590
|
injectedTags={Object {}}
|
|
154591
154591
|
location={
|
|
154592
154592
|
Object {
|
|
@@ -154638,7 +154638,7 @@ Click {{3}} to unsubscribe'",
|
|
|
154638
154638
|
</div>
|
|
154639
154639
|
</CapHeading>
|
|
154640
154640
|
</div>
|
|
154641
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
154641
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
154642
154642
|
injectedTags={Object {}}
|
|
154643
154643
|
location={
|
|
154644
154644
|
Object {
|
|
@@ -154654,7 +154654,7 @@ Click {{3}} to unsubscribe'",
|
|
|
154654
154654
|
onTagSelect={[Function]}
|
|
154655
154655
|
tags={Array []}
|
|
154656
154656
|
>
|
|
154657
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
154657
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
154658
154658
|
authData={
|
|
154659
154659
|
Object {
|
|
154660
154660
|
"app": Object {},
|
|
@@ -154696,7 +154696,7 @@ Click {{3}} to unsubscribe'",
|
|
|
154696
154696
|
redirect={[Function]}
|
|
154697
154697
|
tags={Array []}
|
|
154698
154698
|
/>
|
|
154699
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
154699
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
154700
154700
|
</div>
|
|
154701
154701
|
</CapHeader__Flex>
|
|
154702
154702
|
</CapHeader>
|
|
@@ -171659,7 +171659,7 @@ Click {{unsubscribe}} to unsubscribe",
|
|
|
171659
171659
|
key=".0"
|
|
171660
171660
|
size="large"
|
|
171661
171661
|
suffix={
|
|
171662
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
171662
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
171663
171663
|
injectedTags={Object {}}
|
|
171664
171664
|
location={
|
|
171665
171665
|
Object {
|
|
@@ -171711,7 +171711,7 @@ Click {{unsubscribe}} to unsubscribe",
|
|
|
171711
171711
|
</div>
|
|
171712
171712
|
</CapHeading>
|
|
171713
171713
|
</div>
|
|
171714
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
171714
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
171715
171715
|
injectedTags={Object {}}
|
|
171716
171716
|
location={
|
|
171717
171717
|
Object {
|
|
@@ -171727,7 +171727,7 @@ Click {{unsubscribe}} to unsubscribe",
|
|
|
171727
171727
|
onTagSelect={[Function]}
|
|
171728
171728
|
tags={Array []}
|
|
171729
171729
|
>
|
|
171730
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
171730
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
171731
171731
|
authData={
|
|
171732
171732
|
Object {
|
|
171733
171733
|
"app": Object {},
|
|
@@ -171769,7 +171769,7 @@ Click {{unsubscribe}} to unsubscribe",
|
|
|
171769
171769
|
redirect={[Function]}
|
|
171770
171770
|
tags={Array []}
|
|
171771
171771
|
/>
|
|
171772
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
171772
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
171773
171773
|
</div>
|
|
171774
171774
|
</CapHeader__Flex>
|
|
171775
171775
|
</CapHeader>
|
|
@@ -183805,7 +183805,7 @@ new message content.",
|
|
|
183805
183805
|
key=".0"
|
|
183806
183806
|
size="large"
|
|
183807
183807
|
suffix={
|
|
183808
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
183808
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
183809
183809
|
injectedTags={Object {}}
|
|
183810
183810
|
location={
|
|
183811
183811
|
Object {
|
|
@@ -183857,7 +183857,7 @@ new message content.",
|
|
|
183857
183857
|
</div>
|
|
183858
183858
|
</CapHeading>
|
|
183859
183859
|
</div>
|
|
183860
|
-
<Connect(UserIsAuthenticated(Connect(TagList)))
|
|
183860
|
+
<Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
|
|
183861
183861
|
injectedTags={Object {}}
|
|
183862
183862
|
location={
|
|
183863
183863
|
Object {
|
|
@@ -183873,7 +183873,7 @@ new message content.",
|
|
|
183873
183873
|
onTagSelect={[Function]}
|
|
183874
183874
|
tags={Array []}
|
|
183875
183875
|
>
|
|
183876
|
-
<UserIsAuthenticated(Connect(TagList))
|
|
183876
|
+
<UserIsAuthenticated(Connect(InjectIntl(TagList)))
|
|
183877
183877
|
authData={
|
|
183878
183878
|
Object {
|
|
183879
183879
|
"app": Object {},
|
|
@@ -183915,7 +183915,7 @@ new message content.",
|
|
|
183915
183915
|
redirect={[Function]}
|
|
183916
183916
|
tags={Array []}
|
|
183917
183917
|
/>
|
|
183918
|
-
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
183918
|
+
</Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
|
|
183919
183919
|
</div>
|
|
183920
183920
|
</CapHeader__Flex>
|
|
183921
183921
|
</CapHeader>
|