@capillarytech/creatives-library 7.17.14 → 7.17.16

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.
@@ -17,3 +17,14 @@ export const GET_TRANSLATION_MAPPED = {
17
17
  'en-US': 'en-US',
18
18
  'ja-JP': 'ja-JP',
19
19
  };
20
+
21
+ export const JAPANESE_HIDE_DATE_TAGS = [
22
+ "mm/dd/yyyy",
23
+ "dd/mm/yyyy",
24
+ "mm/dd/yy",
25
+ "dd Mon yyyy",
26
+ "Day, Mon dd, yy",
27
+ "dd.mm.yy",
28
+ "dd Mon",
29
+ "dd/m/yyyy",
30
+ ];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.14",
4
+ "version": "7.17.16",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/utils/common.js CHANGED
@@ -262,11 +262,3 @@ export const isTraiDLTEnable = (isFullMode, smsRegister) => {
262
262
  const isTraiDltFeature = isTraiDltFeatureForOrg && isTraiEnableforLib;
263
263
  return isTraiDltFeature;
264
264
  };
265
-
266
- export const intlKeyGenerator = (value = "") => {
267
- if (value && value.typeOf === "string") {
268
- const key = value.replace(/[^a-zA-Z0-9_]/g, "");
269
- return key;
270
- }
271
- return value;
272
- }
@@ -19,7 +19,14 @@ 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 {
23
+ GET_TRANSLATION_MAPPED,
24
+ JAPANESE_HELP_TEXT,
25
+ TAG_TRANSLATION_DOC,
26
+ } from "../../containers/TagList/constants";
27
+ import { HIDE_ENGAGEMENT_CHANNELS } from '../../v2Containers/App/constants';
28
+ import { hidingDateTagsForJpLocale } from '../../v2Containers/TagList/utils';
29
+
23
30
 
24
31
  const {Search} = CapInput;
25
32
  const {CapTreeNode} = CapTree;
@@ -155,7 +162,9 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
155
162
  };
156
163
 
157
164
  renderTags(tags, searchString = '') {
158
- const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags} = this.props.disableTagsDetails;
165
+ const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags } = this?.props?.disableTagsDetails;
166
+ const { accessibleFeatures = [] } = this?.props?.currentOrgDetails || {};
167
+ const hideDateTagsForJpLocale = accessibleFeatures.includes(HIDE_ENGAGEMENT_CHANNELS);
159
168
  const list = [];
160
169
  const loyaltyAttrDisableText = <FormattedMessage {...messages.loyaltyAttributeDisable} />;
161
170
  let clonedTags = _.cloneDeep(tags);
@@ -171,7 +180,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
171
180
  if (_.has(val, 'subtags')) {
172
181
  const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
173
182
  const temp = this.renderTags(val.subtags, '', disabled);
174
- list.push((
183
+ const tagValue = (
175
184
  <CapTreeNode
176
185
  title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val.name}</CapTooltip> : val.name}
177
186
  tag={val}
@@ -180,7 +189,8 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
180
189
  >
181
190
  {temp}
182
191
  </CapTreeNode>
183
- ));
192
+ );
193
+ hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tagValue);
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,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
192
202
  disabled={childDisabled}
193
203
  >
194
204
  </CapTreeNode>);
195
- list.push(tempNode);
205
+ hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tempNode);
196
206
  }
197
207
  });
198
208
  return list;
@@ -201,7 +211,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
201
211
  window.open(TAG_TRANSLATION_DOC, '_blank');
202
212
  }
203
213
  render() {
204
- const { hidePopover = false, tags = {}, intl = {}, moduleFilterEnabled, label, modalProps } = this.props;
214
+ const { hidePopover = false, tags = {}, intl = {}, moduleFilterEnabled, label, modalProps, channel } = this.props;
205
215
  const tg = tags;
206
216
  const {formatMessage} = intl;
207
217
  const { tagValue, expandedKeys, autoExpandParent, searchValue, visible, translationLang } = this.state;
@@ -243,7 +253,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
243
253
  expandedKeys={expandedKeys}
244
254
  autoExpandParent={autoExpandParent}
245
255
  onExpand={this.onExpand}
246
- >
256
+ >
247
257
  {this.renderTags(tg, searchValue)}
248
258
  </CapTree>
249
259
  {translationLang === "ja-JP" &&
@@ -251,7 +261,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
251
261
  <CapIcon
252
262
  type="help"
253
263
  size="s"
254
- />
264
+ />
255
265
  <CapLink>
256
266
  <CapButton id="translationtagfooter" type="flat" onClick={this.openTranslationLink} >
257
267
  <div className="tag-list-footer-icon">
@@ -264,8 +274,8 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
264
274
  </div>
265
275
  </CapButton>
266
276
  </CapLink>
267
- </div>
268
- }
277
+ </div>
278
+ }
269
279
 
270
280
  </CapSpin>
271
281
  </div>);
@@ -275,7 +285,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
275
285
  visible={this.props.visibleTaglist}
276
286
  footer={[]}
277
287
  {...modalProps}
278
- >
288
+ >
279
289
  {contentSection}
280
290
  </CapModal> :
281
291
  <CapPopover
@@ -283,7 +293,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
283
293
  onVisibleChange={this.togglePopoverVisibility}
284
294
  content={contentSection}
285
295
  trigger="click"
286
- placement="rightTop"
296
+ placement={channel === 'EMAIL' ? "bottom" : "rightTop"}
287
297
  >
288
298
  <CapButton isAddBtn type="flat">{label || ''}</CapButton>
289
299
  </CapPopover>
@@ -320,6 +330,8 @@ CapTagList.propTypes = {
320
330
  hidePopover: PropTypes.bool,
321
331
  modalProps: PropTypes.any,
322
332
  disableTagsDetails: PropTypes.object,
333
+ currentOrgDetails: PropTypes.object,
334
+ channel: PropTypes.string,
323
335
  };
324
336
 
325
337
  CapTagList.defaultValue = {
@@ -337,4 +349,3 @@ const mapStateToProps = createStructuredSelector({
337
349
 
338
350
 
339
351
  export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(CapTagList));
340
-
@@ -52,6 +52,8 @@ import { validateIfTagClosed } from '../../utils/tagValidations';
52
52
  import globalMessages from '../../v2Containers/Cap/messages';
53
53
  import { convert } from 'html-to-text';
54
54
  import { AI_SUGGESTION_API_URL } from './constants';
55
+ import { GET_TRANSLATION_MAPPED } from '../../containers/TagList/constants';
56
+ import moment from 'moment';
55
57
  const TabPane = Tabs.TabPane;
56
58
  const {Column} = Table;
57
59
  const {TextArea} = CapInput;
@@ -94,6 +96,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
94
96
  popoverVisible: false,
95
97
  customPopoverVisible: false,
96
98
  isDrawerVisible: false,
99
+ translationLang: 'en',
97
100
  };
98
101
  this.renderForm = this.renderForm.bind(this);
99
102
  this.updateFormData = this.updateFormData.bind(this);
@@ -3063,6 +3066,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3063
3066
  id={val.id}
3064
3067
  userLocale={this.props.userLocale}
3065
3068
  selectedOfferDetails={this.props.selectedOfferDetails}
3069
+ channel={this.props.schema.channel}
3066
3070
  />
3067
3071
  </CapColumn>
3068
3072
  );
@@ -3427,6 +3431,23 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3427
3431
  return fields;
3428
3432
  }
3429
3433
 
3434
+ //To Find from which locale user is loggedin
3435
+ getTranslationMappedLocale(locale) {
3436
+ return GET_TRANSLATION_MAPPED?.[locale];
3437
+ }
3438
+ componentDidMount() {
3439
+ const user = localStorage.getItem('user');
3440
+ let locale = 'en';
3441
+ if (user) {
3442
+ locale = JSON.parse(user).lang || locale;
3443
+ }
3444
+ locale = this.getTranslationMappedLocale(locale);
3445
+ moment.locale(locale);
3446
+ this.setState({
3447
+ translationLang: locale,
3448
+ });
3449
+ }
3450
+
3430
3451
  renderContainer(container) {
3431
3452
  const containerType = container.type;
3432
3453
  const renderedPanes = [];
@@ -3473,13 +3494,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3473
3494
  forceRender
3474
3495
  tab={
3475
3496
  <div className="form-tab-header" onInput={(e) => e.stopPropagation()}>
3476
- {
3497
+ { this.state.translationLang !== 'ja-JP' && (
3477
3498
  _.forEach(renderedContentSections, (value) => {
3478
3499
  if (value) {
3479
3500
  return value;
3480
3501
  }
3481
3502
  return value;
3482
- })
3503
+ }))
3483
3504
  }
3484
3505
  </div>
3485
3506
  }
@@ -15,9 +15,9 @@ export const GET_USER_DATA_REQUEST = 'cap/GET_USER_DATA_REQUEST_V2';
15
15
  export const GET_USER_DATA_SUCCESS = 'cap/GET_USER_DATA_SUCCESS_V2';
16
16
  export const GET_USER_DATA_FAILURE = 'cap/GET_USER_DATA_FAILURE_V2';
17
17
 
18
- export const GET_SCHEMA_FOR_ENTITY_FAILURE = 'cap/GET_SCHEMA_FOR_ENTITY_FAILURE_V2';
19
- export const GET_SCHEMA_FOR_ENTITY_REQUEST = 'cap/GET_SCHEMA_FOR_ENTITY_REQUEST_V2';
20
- export const GET_SCHEMA_FOR_ENTITY_SUCCESS = 'cap/GET_SCHEMA_FOR_ENTITY_SUCCESS_V2';
18
+ export const GET_SCHEMA_FOR_ENTITY_FAILURE = 'cap/GET_SCHEMA_FOR_ENTITY_FAILURE';
19
+ export const GET_SCHEMA_FOR_ENTITY_REQUEST = 'cap/GET_SCHEMA_FOR_ENTITY_REQUEST';
20
+ export const GET_SCHEMA_FOR_ENTITY_SUCCESS = 'cap/GET_SCHEMA_FOR_ENTITY_SUCCESS';
21
21
  export const CLEAR_META_ENTITIES = 'cap/CLEAR_META_ENTITIES';
22
22
  export const HIDE_TAGS = 'cap/HIDE_TAGS';
23
23
 
@@ -56,7 +56,7 @@ export function SlideBoxHeader(props) {
56
56
  const getChannelLabel = (currentChannel = '') => {
57
57
  const labels = {
58
58
  sms: 'SMS',
59
- email: 'Email',
59
+ email: <FormattedMessage {...messages.emailHeader} />,
60
60
  mobilepush: 'Push notification',
61
61
  wechat: 'Wechat',
62
62
  no_communication: 'NO_COMMUNICATION',
@@ -17,9 +17,7 @@ const initialState = fromJS({
17
17
  function languageProviderReducer(state = initialState, action) {
18
18
  switch (action.type) {
19
19
  case types.GET_LOCIZ_MESSAGE_REQUEST:
20
- return state
21
- .set('localeLoading', true)
22
- .set('locale', action.locale);
20
+ return state.set('localeLoading', true);
23
21
  case types.GET_LOCIZ_MESSAGE_SUCCESS:
24
22
  return state
25
23
  .set('localeLoading', false)
@@ -3,7 +3,6 @@ import { fromJS } from 'immutable';
3
3
  import languageProviderReducer from '../reducer';
4
4
  import {
5
5
  CHANGE_LOCALE,
6
- GET_LOCIZ_MESSAGE_REQUEST,
7
6
  } from '../constants';
8
7
 
9
8
  describe('languageProviderReducer', () => {
@@ -22,12 +21,4 @@ describe('languageProviderReducer', () => {
22
21
  messages: {},
23
22
  });
24
23
  });
25
-
26
- it('make locize message request', () => {
27
- expect(languageProviderReducer(undefined, { type: GET_LOCIZ_MESSAGE_REQUEST, locale: 'de' }).toJS()).toEqual({
28
- locale: "de",
29
- localeLoading: true,
30
- messages: {},
31
- });
32
- });
33
24
  });
@@ -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('en');
57
60
 
58
61
  useEffect(() => {
59
62
  const { messageTitle = '', messageContent = '', type, isInit } = content;
@@ -71,6 +74,18 @@ export const LineText = ({
71
74
  }
72
75
  }, [content]);
73
76
 
77
+ //To Find from which locale user is loggedin
78
+ useEffect(() => {
79
+ const user = localStorage.getItem("user");
80
+ let locale = "en";
81
+ if (user) {
82
+ locale = JSON.parse(user)?.lang || locale;
83
+ }
84
+ locale = GET_TRANSLATION_MAPPED?.[locale];
85
+ moment.locale(locale);
86
+ updateTranslationLang(locale);
87
+ }, []);
88
+
74
89
  useEffect(() => {
75
90
  if (messageContent && (isFullMode ? messageTitle : true)) {
76
91
  updateMessageState({
@@ -260,7 +275,7 @@ export const LineText = ({
260
275
  injectedTags={injectedTags || {}}
261
276
  // className={val.className ? val.className : ''}
262
277
  id={`${id}_tags`}
263
- userLocale={localStorage.getItem('jlocale') || 'en'}
278
+ userLocale={translationLang}
264
279
  selectedOfferDetails={selectedOfferDetails}
265
280
  />
266
281
  </>
@@ -23058,7 +23058,7 @@ new message content.",
23058
23058
  </div>
23059
23059
  </ComponentWithLabelHOC__CapComponentStyled>
23060
23060
  </_class>
23061
- <Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))
23061
+ <Connect(UserIsAuthenticated(Connect(TagList)))
23062
23062
  id="undefined_tags"
23063
23063
  injectedTags={Object {}}
23064
23064
  key="undefined_tags"
@@ -23077,9 +23077,9 @@ 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
- <UserIsAuthenticated(Connect(InjectIntl(TagList)))
23082
+ <UserIsAuthenticated(Connect(TagList))
23083
23083
  authData={
23084
23084
  Object {
23085
23085
  "app": Object {},
@@ -23123,9 +23123,9 @@ 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
- </Connect(UserIsAuthenticated(Connect(InjectIntl(TagList))))>
23128
+ </Connect(UserIsAuthenticated(Connect(TagList)))>
23129
23129
  <CapDrawer
23130
23130
  content={
23131
23131
  <React.Fragment>