@capillarytech/creatives-library 7.17.219-alpha.0 → 7.17.219
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
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
GET_TRANSLATION_MAPPED,
|
|
38
38
|
JAPANESE_HELP_TEXT,
|
|
39
39
|
TAG_TRANSLATION_DOC,
|
|
40
|
+
STRING,
|
|
40
41
|
} from "../../containers/TagList/constants";
|
|
41
42
|
import { EMAIL, JP_LOCALE_HIDE_FEATURE } from '../../v2Containers/App/constants';
|
|
42
43
|
import { hidingDateTagsForJpLocale } from '../../v2Containers/TagList/utils';
|
|
@@ -106,16 +107,27 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
106
107
|
getSearchedExpandedKeys(tags, value = '') {
|
|
107
108
|
let list = [];
|
|
108
109
|
_.forEach(tags, (val = {}, key) => {
|
|
109
|
-
const tagName =
|
|
110
|
-
|
|
110
|
+
const tagName =
|
|
111
|
+
typeof val?.name === STRING
|
|
112
|
+
? _.toLower(_.get(val, "name", ""))
|
|
113
|
+
: _.toLower(_.get(val, "name.props.defaultMessage", ""));
|
|
114
|
+
const tagNameWithoutUnderscore = tagName.replace(/_/g, " ");
|
|
111
115
|
const searchStringLower = _.toLower(value);
|
|
112
|
-
if (_.has(val,
|
|
113
|
-
if (
|
|
116
|
+
if (_.has(val, "subtags")) {
|
|
117
|
+
if (
|
|
118
|
+
val?.name &&
|
|
119
|
+
(tagName.includes(searchStringLower) ||
|
|
120
|
+
tagNameWithoutUnderscore.includes(searchStringLower))
|
|
121
|
+
) {
|
|
114
122
|
list.push(key);
|
|
115
123
|
}
|
|
116
|
-
const temp = this.getSearchedExpandedKeys(val
|
|
124
|
+
const temp = this.getSearchedExpandedKeys(val?.subtags, value);
|
|
117
125
|
list = list.concat(temp);
|
|
118
|
-
} else if (
|
|
126
|
+
} else if (
|
|
127
|
+
val?.name &&
|
|
128
|
+
(tagName.includes(searchStringLower) ||
|
|
129
|
+
tagNameWithoutUnderscore.includes(searchStringLower))
|
|
130
|
+
) {
|
|
119
131
|
list.push(key);
|
|
120
132
|
}
|
|
121
133
|
});
|
|
@@ -214,10 +226,16 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
214
226
|
supportedTagsString += `${supportedTag} ,`;
|
|
215
227
|
});
|
|
216
228
|
supportedTagsString = supportedTagsString.replace(/,\s*$/, "");
|
|
217
|
-
const tagName =
|
|
218
|
-
|
|
229
|
+
const tagName =
|
|
230
|
+
typeof val?.name === STRING
|
|
231
|
+
? _.toLower(_.get(val, "name", ""))
|
|
232
|
+
: _.toLower(_.get(val, "name.props.defaultMessage", ""));
|
|
233
|
+
const tagNameWithoutUnderscore = tagName.replace(/_/g, " ");
|
|
219
234
|
const searchStringLower = _.toLower(searchString);
|
|
220
|
-
const tagContainsSearchedString =
|
|
235
|
+
const tagContainsSearchedString =
|
|
236
|
+
searchStringLower &&
|
|
237
|
+
(tagName.includes(searchStringLower) ||
|
|
238
|
+
tagNameWithoutUnderscore.includes(searchStringLower));
|
|
221
239
|
if (_.has(val, 'subtags')) {
|
|
222
240
|
const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
|
|
223
241
|
const temp = this.renderTags(val?.subtags);
|
|
@@ -245,26 +263,72 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
245
263
|
if (tagContainsSearchedString) {
|
|
246
264
|
const tempNode = (
|
|
247
265
|
<CapTreeNode
|
|
248
|
-
title={
|
|
266
|
+
title={
|
|
267
|
+
childDisabled ? (
|
|
268
|
+
<CapTooltip
|
|
269
|
+
title={
|
|
270
|
+
key === CUSTOMER_BARCODE_TAG
|
|
271
|
+
? customerBarcodeDisableText
|
|
272
|
+
: loyaltyAttrDisableText
|
|
273
|
+
}
|
|
274
|
+
>
|
|
275
|
+
{val?.desc || val?.name}
|
|
276
|
+
</CapTooltip>
|
|
277
|
+
) : (
|
|
278
|
+
val?.desc || val?.name
|
|
279
|
+
)
|
|
280
|
+
}
|
|
249
281
|
tag={val}
|
|
250
282
|
isLeaf
|
|
251
|
-
key={
|
|
283
|
+
key={
|
|
284
|
+
val?.incentiveSeriesId
|
|
285
|
+
? `${key}(${val?.incentiveSeriesId})`
|
|
286
|
+
: `${key}`
|
|
287
|
+
}
|
|
252
288
|
disabled={childDisabled}
|
|
253
|
-
>
|
|
254
|
-
|
|
255
|
-
hidingDateTagsForJpLocale(
|
|
289
|
+
></CapTreeNode>
|
|
290
|
+
);
|
|
291
|
+
hidingDateTagsForJpLocale(
|
|
292
|
+
hideDateTagsForJpLocale,
|
|
293
|
+
val,
|
|
294
|
+
list,
|
|
295
|
+
tempNode
|
|
296
|
+
);
|
|
256
297
|
}
|
|
257
298
|
} else {
|
|
258
299
|
const tempNode = (
|
|
259
300
|
<CapTreeNode
|
|
260
|
-
title={
|
|
301
|
+
title={
|
|
302
|
+
childDisabled ? (
|
|
303
|
+
<CapTooltip
|
|
304
|
+
title={
|
|
305
|
+
key === CUSTOMER_BARCODE_TAG
|
|
306
|
+
? customerBarcodeDisableText
|
|
307
|
+
: loyaltyAttrDisableText
|
|
308
|
+
}
|
|
309
|
+
>
|
|
310
|
+
{val?.desc || val?.name}
|
|
311
|
+
</CapTooltip>
|
|
312
|
+
) : (
|
|
313
|
+
val?.desc || val?.name
|
|
314
|
+
)
|
|
315
|
+
}
|
|
261
316
|
tag={val}
|
|
262
317
|
isLeaf
|
|
263
|
-
key={
|
|
318
|
+
key={
|
|
319
|
+
val?.incentiveSeriesId
|
|
320
|
+
? `${key}(${val?.incentiveSeriesId})`
|
|
321
|
+
: `${key}`
|
|
322
|
+
}
|
|
264
323
|
disabled={childDisabled}
|
|
265
|
-
>
|
|
266
|
-
|
|
267
|
-
hidingDateTagsForJpLocale(
|
|
324
|
+
></CapTreeNode>
|
|
325
|
+
);
|
|
326
|
+
hidingDateTagsForJpLocale(
|
|
327
|
+
hideDateTagsForJpLocale,
|
|
328
|
+
val,
|
|
329
|
+
list,
|
|
330
|
+
tempNode
|
|
331
|
+
);
|
|
268
332
|
}
|
|
269
333
|
}
|
|
270
334
|
});
|