@capillarytech/creatives-library 7.17.21-alpha.2 → 7.17.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.21-alpha.2",
4
+ "version": "7.17.21",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/utils/common.js CHANGED
@@ -8,7 +8,6 @@ import {
8
8
  HOSPITALITY_RELATED_TAGS,
9
9
  HOSPITALITY_BASED_SCOPE,
10
10
  } from '../containers/App/constants';
11
- import { apiMessageFormatHandler } from './commonUtils';
12
11
 
13
12
  export function getUserNameById(userId, allUserList) {
14
13
  let userName = "";
@@ -277,61 +276,3 @@ export const isTraiDLTEnable = (isFullMode, smsRegister) => {
277
276
  const isTraiDltFeature = isTraiDltFeatureForOrg && isTraiEnableforLib;
278
277
  return isTraiDltFeature;
279
278
  };
280
-
281
- export const intlKeyGenerator = (value = "") => {
282
- return value.replace(/[^a-zA-Z0-9_]/g, "");
283
- };
284
-
285
- export const handleInjectedData = (data, scope) => {
286
- let temp = _.cloneDeep(data);
287
- let tagType;
288
- for (const tagKey in temp) {
289
- if (temp.hasOwnProperty(tagKey)) {
290
- const tag = temp[tagKey];
291
-
292
- if (tag?.name === "Registration custom fields") {
293
- tagType = "CustomTagMessage";
294
- } else if (tag?.name === "Customer extended fields") {
295
- tagType = "ExtendedTagMessage";
296
- }
297
-
298
- if (tag?.name) {
299
- const name = tag?.name;
300
- const key = intlKeyGenerator(name);
301
- const id = tagType
302
- ? `${scope}.${key}_name.${tagType}`
303
- : `${scope}.${key}`;
304
-
305
- tag["name"] = apiMessageFormatHandler(id, name);
306
- }
307
-
308
- if (tag["subtags"]) {
309
- for (const subtagKey in tag["subtags"]) {
310
- if (tag["subtags"].hasOwnProperty(subtagKey)) {
311
- const subtag = tag["subtags"][subtagKey];
312
- if (subtag?.name) {
313
- const name = subtag?.name;
314
- const key = intlKeyGenerator(name);
315
- const id = tagType
316
- ? `${scope}.${key}_name.${tagType}`
317
- : `${scope}.${key}`;
318
-
319
- subtag["name"] = apiMessageFormatHandler(id, name);
320
- }
321
- if (subtag?.desc) {
322
- const desc = subtag?.desc;
323
- const key = intlKeyGenerator(desc);
324
- const id = tagType
325
- ? `${scope}.${key}_desc.${tagType}`
326
- : `${scope}.${key}`;
327
-
328
- subtag["desc"] = apiMessageFormatHandler(id, desc);
329
- }
330
- }
331
- }
332
- }
333
- tagType="";
334
- }
335
- }
336
- return temp;
337
- };
@@ -1,7 +1,5 @@
1
- import React from 'react';
2
- import { FormattedMessage } from 'react-intl';
3
1
  import "@testing-library/jest-dom";
4
- import { filterTags, getTreeStructuredTags, handleInjectedData } from "../common";
2
+ import { filterTags, getTreeStructuredTags } from "../common";
5
3
  import * as mockdata from "./common.mockdata";
6
4
 
7
5
  describe("getTreeStructuredTags test", () => {
@@ -18,81 +16,3 @@ describe("getTreeStructuredTags test", () => {
18
16
  expect(filterTags([], [])).toEqual([]);
19
17
  });
20
18
  });
21
-
22
- describe("handleInjectedData", () => {
23
- it("replaces name with intl key for top level tag", () => {
24
- const data = {
25
- tag1: {
26
- name: "Registration Fields",
27
- },
28
- };
29
-
30
- const result = handleInjectedData(data, "scope");
31
-
32
- expect(result.tag1.name).toEqual(<FormattedMessage defaultMessage="Registration Fields" id="scope.RegistrationFields" values={{}} />);
33
- });
34
-
35
- it("adds tagType for Registration custom fields", () => {
36
- const data = {
37
- tag1: {
38
- name: "Registration custom fields",
39
- },
40
- };
41
-
42
- const result = handleInjectedData(data, "scope");
43
-
44
- expect(result.tag1.name).toEqual(
45
- <FormattedMessage defaultMessage="Registration custom fields" id="scope.Registrationcustomfields_name.CustomTagMessage" values={{}} />
46
- );
47
- });
48
-
49
- it("adds tagType for Customer extended fields fields", () => {
50
- const data = {
51
- tag1: {
52
- name: "Customer extended fields",
53
- },
54
- };
55
-
56
- const result = handleInjectedData(data, "scope");
57
-
58
- expect(result.tag1.name).toEqual(
59
- <FormattedMessage defaultMessage="Customer extended fields" id="scope.Customerextendedfields_name.ExtendedTagMessage" values={{}} />
60
- );
61
- });
62
-
63
-
64
- it("replaces subtag name with intl key", () => {
65
- const data = {
66
- tag1: {
67
- subtags: {
68
- subtag1: {
69
- name: "First Name",
70
- },
71
- },
72
- },
73
- };
74
-
75
- const result = handleInjectedData(data, "scope");
76
-
77
- expect(result.tag1.subtags.subtag1.name).toEqual(<FormattedMessage defaultMessage="First Name" id="scope.FirstName" values={{}} />);
78
- });
79
-
80
- it("replaces subtag desc with intl key", () => {
81
- const data = {
82
- tag1: {
83
- subtags: {
84
- subtag1: {
85
- desc: "Enter your first name",
86
- },
87
- },
88
- },
89
- };
90
-
91
- const result = handleInjectedData(data, "scope");
92
-
93
- expect(result.tag1.subtags.subtag1.desc).toEqual(
94
- <FormattedMessage defaultMessage="Enter your first name" id="scope.Enteryourfirstname" values={{}} />
95
- );
96
- });
97
- });
98
-
@@ -44,7 +44,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
44
44
  dynamicDateValue: '',
45
45
  showModal: false,
46
46
  translationLang: '',
47
- tagsList: []
48
47
  };
49
48
  this.renderTags = this.renderTags.bind(this);
50
49
  this.getSearchedExpandedKeys = this.getSearchedExpandedKeys.bind(this);
@@ -65,15 +64,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
65
64
  });
66
65
  }
67
66
 
68
- componentDidUpdate(prevProps, prevState){
69
- if (this.props.tags !== prevProps.tags || this.state.searchValue !== prevState.searchValue) {
70
- let temp = this.renderTags(this.props.tags, this.state.searchValue);
71
- this.setState({
72
- tagsList: temp
73
- });
74
- }
75
- }
76
-
77
67
  onChange = (e) => {
78
68
  const value = e.target.value;
79
69
  let expandedKeys = this.getSearchedExpandedKeys(this.props.tags, value);
@@ -94,12 +84,12 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
94
84
  let list = [];
95
85
  _.forEach(tags, (val = {}, key) => {
96
86
  if (_.has(val, 'subtags')) {
97
- if (val.name && typeof val.name === 'string' && (val.name || '').toLowerCase().indexOf(value.toLowerCase()) !== -1) {
87
+ if ((val.name || '').toLowerCase().indexOf(value.toLowerCase()) !== -1) {
98
88
  list.push(key);
99
89
  }
100
90
  const temp = this.getSearchedExpandedKeys(val.subtags, value);
101
91
  list = list.concat(temp);
102
- } else if (val.name && typeof val.name === 'string' && (val.name || '').toLowerCase().indexOf(value.toLowerCase()) !== -1) {
92
+ } else if ((val.name || '').toLowerCase().indexOf(value.toLowerCase()) !== -1) {
103
93
  list.push(key);
104
94
  }
105
95
  });
@@ -269,8 +259,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
269
259
  autoExpandParent={autoExpandParent}
270
260
  onExpand={this.onExpand}
271
261
  >
272
- {/* {this.renderTags(tg, searchValue)} */}
273
- {this.state.tagsList}
262
+ {this.renderTags(tg, searchValue)}
274
263
  </CapTree>
275
264
  {translationLang === "ja-JP" &&
276
265
  <div className="tag-list-footer">
@@ -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
 
@@ -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
  });
@@ -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"
@@ -23079,7 +23079,7 @@ new message content.",
23079
23079
  tags={Array []}
23080
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 {},
@@ -23125,7 +23125,7 @@ new message content.",
23125
23125
  tags={Array []}
23126
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>