@capillarytech/creatives-library 7.17.7 → 7.17.9

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.
@@ -5,3 +5,15 @@
5
5
  */
6
6
 
7
7
  export const DEFAULT_ACTION = 'app/TagList/DEFAULT_ACTION';
8
+
9
+ export const JAPANESE_HELP_TEXT = 'ヘルプ :トークンの定義';
10
+
11
+ export const TAG_TRANSLATION_DOC = 'https://docs.capillarytech.com/docs/tags-translation';
12
+
13
+ export const GET_TRANSLATION_MAPPED = {
14
+ 'en': 'en-US',
15
+ 'zh-cn': 'zh',
16
+ 'zh': 'zh',
17
+ 'en-US': 'en-US',
18
+ 'ja-JP': 'ja-JP',
19
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.7",
4
+ "version": "7.17.9",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
8
8
  import React from 'react';
9
9
  import { connect } from 'react-redux';
10
10
  // import styled from 'styled-components';
11
- import { CapSpin, CapModal, CapButton, CapPopover, CapInput, CapTree, CapSelect, CapTooltip } from '@capillarytech/cap-ui-library';
11
+ import { CapSpin, CapModal, CapButton, CapPopover, CapInput, CapTree, CapSelect, CapTooltip, CapLink, CapIcon } from '@capillarytech/cap-ui-library';
12
12
 
13
13
  import _ from 'lodash';
14
14
  import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
@@ -17,6 +17,9 @@ import messages from './messages';
17
17
  import { makeSelectLoyaltyPromotionDisplay } from '../../v2Containers/Cap/selectors';
18
18
  import { CARD_RELATED_TAGS } from '../../containers/App/constants';
19
19
  import { hasCardBasedScope } from '../../utils/common';
20
+ import moment from 'moment';
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';
20
23
 
21
24
  const {Search} = CapInput;
22
25
  const {CapTreeNode} = CapTree;
@@ -32,10 +35,26 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
32
35
  visible: false,
33
36
  dynamicDateValue: '',
34
37
  showModal: false,
38
+ translationLang: '',
35
39
  };
36
40
  this.renderTags = this.renderTags.bind(this);
37
41
  this.getSearchedExpandedKeys = this.getSearchedExpandedKeys.bind(this);
38
42
  }
43
+ getTranslationMappedLocale(locale) {
44
+ return GET_TRANSLATION_MAPPED?.[locale];
45
+ }
46
+ componentDidMount() {
47
+ const user = localStorage.getItem('user');
48
+ let locale = 'en';
49
+ moment.locale(locale);
50
+ if (user) {
51
+ locale = JSON.parse(user).lang || locale;
52
+ }
53
+ locale = this.getTranslationMappedLocale(locale);
54
+ this.setState({
55
+ translationLang: locale,
56
+ });
57
+ }
39
58
 
40
59
  onChange = (e) => {
41
60
  const value = e.target.value;
@@ -178,12 +197,14 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
178
197
  });
179
198
  return list;
180
199
  }
181
-
200
+ openTranslationLink = () => {
201
+ window.open(TAG_TRANSLATION_DOC, '_blank');
202
+ }
182
203
  render() {
183
204
  const { hidePopover = false, tags = {}, intl = {}, moduleFilterEnabled, label, modalProps } = this.props;
184
205
  const tg = tags;
185
206
  const {formatMessage} = intl;
186
- const { tagValue, expandedKeys, autoExpandParent, searchValue, visible } = this.state;
207
+ const { tagValue, expandedKeys, autoExpandParent, searchValue, visible, translationLang } = this.state;
187
208
  const options = [
188
209
  {
189
210
  value: "All",
@@ -225,6 +246,27 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
225
246
  >
226
247
  {this.renderTags(tg, searchValue)}
227
248
  </CapTree>
249
+ {translationLang === "ja-JP" &&
250
+ <div className="tag-list-footer">
251
+ <CapIcon
252
+ type="help"
253
+ size="s"
254
+ />
255
+ <CapLink>
256
+ <CapButton id="translationtagfooter" type="flat" onClick={this.openTranslationLink} >
257
+ <div className="tag-list-footer-icon">
258
+ <div>{JAPANESE_HELP_TEXT}</div>
259
+ <CapIcon
260
+ type="open-in-new-light"
261
+ size="s"
262
+ svgProps={{ color: FONT_COLOR_05 }}
263
+ />
264
+ </div>
265
+ </CapButton>
266
+ </CapLink>
267
+ </div>
268
+ }
269
+
228
270
  </CapSpin>
229
271
  </div>);
230
272
  return (
@@ -351,7 +351,7 @@ export const response = {
351
351
  fontFamily: "open-sans, sans-serif",
352
352
  fontStyle: "normal",
353
353
  fontWeight: "600",
354
- justifyContent: "flex-end",
354
+ marginLeft: "5px",
355
355
  },
356
356
  customComponent: true,
357
357
  width: 2,
@@ -1,3 +1,4 @@
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
1
2
  .ant-tree li span.ant-tree-switcher {
2
3
  margin-left: 0 !important ;
3
4
  }
@@ -6,3 +7,20 @@
6
7
  max-height: 300px;
7
8
  overflow-y: auto;
8
9
  }
10
+
11
+ .tag-list-footer {
12
+ display: flex;
13
+ align-items: center;
14
+ }
15
+ .tag-list-footer-icon {
16
+ display: flex;
17
+ align-items: center;
18
+ padding: 0rem 0.625rem;
19
+ }
20
+ .tag-list-footer-icon > div {
21
+ color: $FONT_COLOR_05;
22
+ padding: 0rem 0.313rem;
23
+ }
24
+ #translationtagfooter {
25
+ padding: 0rem;
26
+ }