@capillarytech/creatives-library 7.17.10 → 7.17.12
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/components/Ckeditor/index.js +2 -2
- package/containers/TagList/constants.js +2 -0
- package/package.json +1 -1
- package/v2Components/CapTagList/index.js +35 -19
- package/v2Components/Ckeditor/index.js +2 -2
- package/v2Containers/Line/Container/Text/index.js +19 -2
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/TagList/index.js +6 -2
- package/.npmrc copy +0 -2
- package/v2Components/Ckeditor/tests/index.test.js +0 -44
|
@@ -13,14 +13,14 @@ import React from 'react';
|
|
|
13
13
|
import _ from 'lodash';
|
|
14
14
|
// import messages from './messages';
|
|
15
15
|
const loadScript = require('load-script');
|
|
16
|
-
const defaultScriptUrl = "https://storage.crm.n.content-cdn.io/
|
|
16
|
+
const defaultScriptUrl = "https://storage.crm.n.content-cdn.io/ckeditor_test/ckeditor4/ckeditor.js";
|
|
17
17
|
const user = localStorage.getItem('user');
|
|
18
18
|
let locale = 'en';
|
|
19
19
|
if (user && JSON.parse(user).lang) {
|
|
20
20
|
locale = JSON.parse(user).lang;
|
|
21
21
|
}
|
|
22
22
|
const CKEditorConfig = {
|
|
23
|
-
skin: 'moono
|
|
23
|
+
skin: 'moono',
|
|
24
24
|
toolbar: [
|
|
25
25
|
{ name: 'document', items: ['Source', '-'] },
|
|
26
26
|
{ name: 'clipboard', items: ['Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
|
package/package.json
CHANGED
|
@@ -19,7 +19,8 @@ import { CARD_RELATED_TAGS } from '../../containers/App/constants';
|
|
|
19
19
|
import { hasCardBasedScope } from '../../utils/common';
|
|
20
20
|
import moment from 'moment';
|
|
21
21
|
import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
22
|
-
import { GET_TRANSLATION_MAPPED, JAPANESE_HELP_TEXT, TAG_TRANSLATION_DOC } from '../../containers/TagList/constants';
|
|
22
|
+
import { GET_TRANSLATION_MAPPED, JAPANESE_HELP_TEXT, JAPANESE_HIDE_DATE_ARRAY, TAG_TRANSLATION_DOC } from '../../containers/TagList/constants';
|
|
23
|
+
import { HIDE_ENGAGEMENT_CHANNELS } from '../../v2Containers/App/constants';
|
|
23
24
|
|
|
24
25
|
const {Search} = CapInput;
|
|
25
26
|
const {CapTreeNode} = CapTree;
|
|
@@ -155,7 +156,9 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
155
156
|
};
|
|
156
157
|
|
|
157
158
|
renderTags(tags, searchString = '') {
|
|
158
|
-
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags} = this.props.disableTagsDetails;
|
|
159
|
+
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags } = this.props.disableTagsDetails;
|
|
160
|
+
const { accessibleFeatures = [] } = this.props.currentOrgDetails || {};
|
|
161
|
+
const hideDefaultJpTranslation = accessibleFeatures.includes(HIDE_ENGAGEMENT_CHANNELS);
|
|
159
162
|
const list = [];
|
|
160
163
|
const loyaltyAttrDisableText = <FormattedMessage {...messages.loyaltyAttributeDisable} />;
|
|
161
164
|
let clonedTags = _.cloneDeep(tags);
|
|
@@ -171,7 +174,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
171
174
|
if (_.has(val, 'subtags')) {
|
|
172
175
|
const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
|
|
173
176
|
const temp = this.renderTags(val.subtags, '', disabled);
|
|
174
|
-
|
|
177
|
+
const tempNode = (
|
|
175
178
|
<CapTreeNode
|
|
176
179
|
title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val.name}</CapTooltip> : val.name}
|
|
177
180
|
tag={val}
|
|
@@ -180,7 +183,14 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
180
183
|
>
|
|
181
184
|
{temp}
|
|
182
185
|
</CapTreeNode>
|
|
183
|
-
)
|
|
186
|
+
);
|
|
187
|
+
if (hideDefaultJpTranslation) {
|
|
188
|
+
if (!JAPANESE_HIDE_DATE_ARRAY.includes(val.name)) {
|
|
189
|
+
list.push(tempNode);
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
list.push(tempNode);
|
|
193
|
+
}
|
|
184
194
|
} else if (searchString === '' || !searchString || ((val.name || '').toLowerCase().indexOf(searchString.toLowerCase()) !== -1)) {
|
|
185
195
|
const childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
|
|
186
196
|
const tempNode = (
|
|
@@ -192,7 +202,13 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
192
202
|
disabled={childDisabled}
|
|
193
203
|
>
|
|
194
204
|
</CapTreeNode>);
|
|
195
|
-
|
|
205
|
+
if (hideDefaultJpTranslation) {
|
|
206
|
+
if (!JAPANESE_HIDE_DATE_ARRAY.includes(val.name)) {
|
|
207
|
+
list.push(tempNode);
|
|
208
|
+
}
|
|
209
|
+
} else {
|
|
210
|
+
list.push(tempNode);
|
|
211
|
+
}
|
|
196
212
|
}
|
|
197
213
|
});
|
|
198
214
|
return list;
|
|
@@ -243,7 +259,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
243
259
|
expandedKeys={expandedKeys}
|
|
244
260
|
autoExpandParent={autoExpandParent}
|
|
245
261
|
onExpand={this.onExpand}
|
|
246
|
-
|
|
262
|
+
>
|
|
247
263
|
{this.renderTags(tg, searchValue)}
|
|
248
264
|
</CapTree>
|
|
249
265
|
{translationLang === "ja-JP" &&
|
|
@@ -251,7 +267,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
251
267
|
<CapIcon
|
|
252
268
|
type="help"
|
|
253
269
|
size="s"
|
|
254
|
-
/>
|
|
270
|
+
/>
|
|
255
271
|
<CapLink>
|
|
256
272
|
<CapButton id="translationtagfooter" type="flat" onClick={this.openTranslationLink} >
|
|
257
273
|
<div className="tag-list-footer-icon">
|
|
@@ -264,8 +280,8 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
264
280
|
</div>
|
|
265
281
|
</CapButton>
|
|
266
282
|
</CapLink>
|
|
267
|
-
|
|
268
|
-
|
|
283
|
+
</div>
|
|
284
|
+
}
|
|
269
285
|
|
|
270
286
|
</CapSpin>
|
|
271
287
|
</div>);
|
|
@@ -275,18 +291,18 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
275
291
|
visible={this.props.visibleTaglist}
|
|
276
292
|
footer={[]}
|
|
277
293
|
{...modalProps}
|
|
278
|
-
|
|
294
|
+
>
|
|
279
295
|
{contentSection}
|
|
280
296
|
</CapModal> :
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
297
|
+
<CapPopover
|
|
298
|
+
visible={visible}
|
|
299
|
+
onVisibleChange={this.togglePopoverVisibility}
|
|
300
|
+
content={contentSection}
|
|
301
|
+
trigger="click"
|
|
302
|
+
placement="rightTop"
|
|
287
303
|
>
|
|
288
|
-
|
|
289
|
-
|
|
304
|
+
<CapButton isAddBtn type="flat">{label || ''}</CapButton>
|
|
305
|
+
</CapPopover>
|
|
290
306
|
}
|
|
291
307
|
<CapModal
|
|
292
308
|
visible={this.state.showModal}
|
|
@@ -320,6 +336,7 @@ CapTagList.propTypes = {
|
|
|
320
336
|
hidePopover: PropTypes.bool,
|
|
321
337
|
modalProps: PropTypes.any,
|
|
322
338
|
disableTagsDetails: PropTypes.object,
|
|
339
|
+
currentOrgDetails: PropTypes.object,
|
|
323
340
|
};
|
|
324
341
|
|
|
325
342
|
CapTagList.defaultValue = {
|
|
@@ -337,4 +354,3 @@ const mapStateToProps = createStructuredSelector({
|
|
|
337
354
|
|
|
338
355
|
|
|
339
356
|
export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(CapTagList));
|
|
340
|
-
|
|
@@ -13,14 +13,14 @@ import React from 'react';
|
|
|
13
13
|
import _ from 'lodash';
|
|
14
14
|
// import messages from './messages';
|
|
15
15
|
const loadScript = require('load-script');
|
|
16
|
-
const defaultScriptUrl = "https://storage.crm.n.content-cdn.io/
|
|
16
|
+
const defaultScriptUrl = "https://storage.crm.n.content-cdn.io/ckeditor_test/ckeditor4/ckeditor.js";
|
|
17
17
|
const user = localStorage.getItem('user');
|
|
18
18
|
let locale = 'en';
|
|
19
19
|
if (user && JSON.parse(user).lang) {
|
|
20
20
|
locale = JSON.parse(user).lang;
|
|
21
21
|
}
|
|
22
22
|
const CKEditorConfig = {
|
|
23
|
-
skin: 'moono
|
|
23
|
+
skin: 'moono',
|
|
24
24
|
toolbar: [
|
|
25
25
|
{ name: 'document', items: ['Source', '-'] },
|
|
26
26
|
{ name: 'clipboard', items: ['Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
|
|
@@ -16,6 +16,8 @@ import style from './style';
|
|
|
16
16
|
import withStyles from '../../../../hoc/withStyles';
|
|
17
17
|
import globalMessages from '../../../Cap/messages';
|
|
18
18
|
import { validateTags } from '../../../../utils/tagValidations';
|
|
19
|
+
import moment from 'moment';
|
|
20
|
+
import { GET_TRANSLATION_MAPPED } from '../../../../containers/TagList/constants';
|
|
19
21
|
|
|
20
22
|
const { TextArea } = CapInput;
|
|
21
23
|
const {CapCustomCardList} = CapCustomCard;
|
|
@@ -54,6 +56,7 @@ export const LineText = ({
|
|
|
54
56
|
const [messageTitle, updateTextMessageTitle] = useState('');
|
|
55
57
|
const [isDrawerRequired, updateDrawerRequirement] = useState(false);
|
|
56
58
|
const [selectedTemplate, updateSelectedTemplate] = useState();
|
|
59
|
+
const [translationLang, updateTranslationLang] = useState('');
|
|
57
60
|
|
|
58
61
|
useEffect(() => {
|
|
59
62
|
const { messageTitle = '', messageContent = '', type, isInit } = content;
|
|
@@ -70,7 +73,21 @@ export const LineText = ({
|
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
}, [content]);
|
|
73
|
-
|
|
76
|
+
const getTranslationMappedLocale = (locale) => {
|
|
77
|
+
return GET_TRANSLATION_MAPPED?.[locale];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
const user = localStorage.getItem('user');
|
|
82
|
+
let locale = 'en';
|
|
83
|
+
moment.locale(locale);
|
|
84
|
+
if (user) {
|
|
85
|
+
locale = JSON.parse(user).lang || locale;
|
|
86
|
+
}
|
|
87
|
+
locale = getTranslationMappedLocale(locale);
|
|
88
|
+
updateTranslationLang(locale);
|
|
89
|
+
}, []);
|
|
90
|
+
|
|
74
91
|
useEffect(() => {
|
|
75
92
|
if (messageContent && (isFullMode ? messageTitle : true)) {
|
|
76
93
|
updateMessageState({
|
|
@@ -260,7 +277,7 @@ export const LineText = ({
|
|
|
260
277
|
injectedTags={injectedTags || {}}
|
|
261
278
|
// className={val.className ? val.className : ''}
|
|
262
279
|
id={`${id}_tags`}
|
|
263
|
-
userLocale={
|
|
280
|
+
userLocale={translationLang}
|
|
264
281
|
selectedOfferDetails={selectedOfferDetails}
|
|
265
282
|
/>
|
|
266
283
|
</>
|
|
@@ -23077,7 +23077,7 @@ new message content.",
|
|
|
23077
23077
|
onContextChange={[Function]}
|
|
23078
23078
|
onTagSelect={[Function]}
|
|
23079
23079
|
tags={Array []}
|
|
23080
|
-
userLocale="en"
|
|
23080
|
+
userLocale="en-US"
|
|
23081
23081
|
>
|
|
23082
23082
|
<UserIsAuthenticated(Connect(TagList))
|
|
23083
23083
|
authData={
|
|
@@ -23123,7 +23123,7 @@ new message content.",
|
|
|
23123
23123
|
onTagSelect={[Function]}
|
|
23124
23124
|
redirect={[Function]}
|
|
23125
23125
|
tags={Array []}
|
|
23126
|
-
userLocale="en"
|
|
23126
|
+
userLocale="en-US"
|
|
23127
23127
|
/>
|
|
23128
23128
|
</Connect(UserIsAuthenticated(Connect(TagList)))>
|
|
23129
23129
|
<CapDrawer
|
|
@@ -19,6 +19,7 @@ import * as globalActions from '../Cap/actions';
|
|
|
19
19
|
// import styled from styled-components;
|
|
20
20
|
import CapTagList from '../../v2Components/CapTagList';
|
|
21
21
|
import './_tagList.scss';
|
|
22
|
+
import { selectCurrentOrgDetails } from '../Cap/selectors';
|
|
22
23
|
const TreeNode = Tree.TreeNode;
|
|
23
24
|
|
|
24
25
|
export class TagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -76,7 +77,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
76
77
|
if (!tag['tag-header']) {
|
|
77
78
|
mainTags[tag.value] = {
|
|
78
79
|
name: tag.label[userLocale] ? tag.label[userLocale] : tag.label.en,
|
|
79
|
-
desc: tag.desc ? tag.desc : tag.label
|
|
80
|
+
desc: tag.desc ? tag.desc : tag.label[userLocale],
|
|
80
81
|
};
|
|
81
82
|
} else if (tag['tag-header'] && mainTags[tag.value]) {
|
|
82
83
|
mainTags[tag.value].subtags = _.concat(mainTags[tag.value].subtags, tag.subtags);
|
|
@@ -85,7 +86,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
85
86
|
mainTags[tag.value] = {
|
|
86
87
|
'tag-header': true,
|
|
87
88
|
"name": tag.label[userLocale] ? tag.label[userLocale] : tag.label.en,
|
|
88
|
-
"desc": tag.desc ? tag.desc : tag.label
|
|
89
|
+
"desc": tag.desc ? tag.desc : tag.label[userLocale],
|
|
89
90
|
"subtags": tag.subtags,
|
|
90
91
|
};
|
|
91
92
|
}
|
|
@@ -248,6 +249,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
248
249
|
onContextChange={this.getTagsforContext}
|
|
249
250
|
moduleFilterEnabled={this.props.moduleFilterEnabled}
|
|
250
251
|
modalProps={this.props.modalProps}
|
|
252
|
+
currentOrgDetails={this.props.currentOrgDetails}
|
|
251
253
|
/>
|
|
252
254
|
</div>
|
|
253
255
|
);
|
|
@@ -272,10 +274,12 @@ TagList.propTypes = {
|
|
|
272
274
|
visibleTaglist: PropTypes.bool,
|
|
273
275
|
hidePopover: PropTypes.bool,
|
|
274
276
|
modalProps: PropTypes.any,
|
|
277
|
+
currentOrgDetails: PropTypes.object,
|
|
275
278
|
};
|
|
276
279
|
|
|
277
280
|
const mapStateToProps = createStructuredSelector({
|
|
278
281
|
TagList: makeSelectTagList(),
|
|
282
|
+
currentOrgDetails: selectCurrentOrgDetails(),
|
|
279
283
|
});
|
|
280
284
|
|
|
281
285
|
function mapDispatchToProps(dispatch) {
|
package/.npmrc copy
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, { Component } from "react";
|
|
2
|
-
import { injectIntl } from "react-intl";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import { render, getByText, screen } from "../../../utils/test-utils";
|
|
5
|
-
import Ckeditor from "../index";
|
|
6
|
-
|
|
7
|
-
const initializeComponent = () => {
|
|
8
|
-
const Component = injectIntl(Ckeditor);
|
|
9
|
-
|
|
10
|
-
//const originalComponentDidMount = Ckeditor.prototype.componentDidMount;
|
|
11
|
-
Ckeditor.prototype.componentDidMount = jest.fn();
|
|
12
|
-
Ckeditor.prototype.handleContentChange = jest.fn();
|
|
13
|
-
|
|
14
|
-
//Render with default props.
|
|
15
|
-
return render(<Component />);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
describe("Load Ckeditor", () => {
|
|
19
|
-
it("Test if Ckeditor Mounts", () => {
|
|
20
|
-
initializeComponent();
|
|
21
|
-
|
|
22
|
-
expect(Ckeditor.prototype.componentDidMount).toHaveBeenCalled();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("Test if Ckeditor un-Mounts", () => {
|
|
26
|
-
// Spy on the componentWillUnmount method
|
|
27
|
-
const componentWillUnmountSpy = jest.spyOn(
|
|
28
|
-
Ckeditor.prototype,
|
|
29
|
-
"componentWillUnmount"
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
// Render the component
|
|
33
|
-
const { unmount } = initializeComponent();
|
|
34
|
-
|
|
35
|
-
// Manually unmount the component (simulate unmounting)
|
|
36
|
-
unmount();
|
|
37
|
-
|
|
38
|
-
// Assert that componentWillUnmount has been called
|
|
39
|
-
expect(componentWillUnmountSpy).toHaveBeenCalled();
|
|
40
|
-
|
|
41
|
-
// Clean up the spy
|
|
42
|
-
componentWillUnmountSpy.mockRestore();
|
|
43
|
-
});
|
|
44
|
-
});
|