@capillarytech/creatives-library 7.17.218 → 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,13 +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
|
-
|
|
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, " ");
|
|
115
|
+
const searchStringLower = _.toLower(value);
|
|
116
|
+
if (_.has(val, "subtags")) {
|
|
117
|
+
if (
|
|
118
|
+
val?.name &&
|
|
119
|
+
(tagName.includes(searchStringLower) ||
|
|
120
|
+
tagNameWithoutUnderscore.includes(searchStringLower))
|
|
121
|
+
) {
|
|
111
122
|
list.push(key);
|
|
112
123
|
}
|
|
113
|
-
const temp = this.getSearchedExpandedKeys(val
|
|
124
|
+
const temp = this.getSearchedExpandedKeys(val?.subtags, value);
|
|
114
125
|
list = list.concat(temp);
|
|
115
|
-
} else if (
|
|
126
|
+
} else if (
|
|
127
|
+
val?.name &&
|
|
128
|
+
(tagName.includes(searchStringLower) ||
|
|
129
|
+
tagNameWithoutUnderscore.includes(searchStringLower))
|
|
130
|
+
) {
|
|
116
131
|
list.push(key);
|
|
117
132
|
}
|
|
118
133
|
});
|
|
@@ -185,7 +200,8 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
185
200
|
this.setState({showModal: true, visible: false});
|
|
186
201
|
};
|
|
187
202
|
|
|
188
|
-
renderTags(tags
|
|
203
|
+
renderTags(tags) {
|
|
204
|
+
const searchString = this.state.searchValue || '';
|
|
189
205
|
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags } = this?.props?.disableTagsDetails;
|
|
190
206
|
const { accessibleFeatures = [] } = this?.props?.currentOrgDetails || {};
|
|
191
207
|
const hideDateTagsForJpLocale = accessibleFeatures.includes(JP_LOCALE_HIDE_FEATURE);
|
|
@@ -210,40 +226,110 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
210
226
|
supportedTagsString += `${supportedTag} ,`;
|
|
211
227
|
});
|
|
212
228
|
supportedTagsString = supportedTagsString.replace(/,\s*$/, "");
|
|
213
|
-
const
|
|
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, " ");
|
|
214
234
|
const searchStringLower = _.toLower(searchString);
|
|
215
|
-
const tagContainsSearchedString =
|
|
235
|
+
const tagContainsSearchedString =
|
|
236
|
+
searchStringLower &&
|
|
237
|
+
(tagName.includes(searchStringLower) ||
|
|
238
|
+
tagNameWithoutUnderscore.includes(searchStringLower));
|
|
216
239
|
if (_.has(val, 'subtags')) {
|
|
217
240
|
const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
|
|
218
|
-
const temp = this.renderTags(val
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
241
|
+
const temp = this.renderTags(val?.subtags);
|
|
242
|
+
if (temp?.length) {
|
|
243
|
+
const tagValue = (
|
|
244
|
+
<CapTreeNode
|
|
245
|
+
title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val?.name}</CapTooltip> : val?.name}
|
|
246
|
+
tag={val}
|
|
247
|
+
key={val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`}
|
|
248
|
+
disabled={disabled}
|
|
249
|
+
>
|
|
250
|
+
{temp}
|
|
251
|
+
</CapTreeNode>
|
|
252
|
+
);
|
|
253
|
+
hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tagValue);
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
231
256
|
let childDisabled = true;
|
|
232
257
|
if (key === CUSTOMER_BARCODE_TAG && !hasCustomerBarcodeFeatureEnabled()) {
|
|
233
258
|
childDisabled = true;
|
|
234
259
|
} else {
|
|
235
260
|
childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
|
|
236
261
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
262
|
+
if (searchString) {
|
|
263
|
+
if (tagContainsSearchedString) {
|
|
264
|
+
const tempNode = (
|
|
265
|
+
<CapTreeNode
|
|
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
|
+
}
|
|
281
|
+
tag={val}
|
|
282
|
+
isLeaf
|
|
283
|
+
key={
|
|
284
|
+
val?.incentiveSeriesId
|
|
285
|
+
? `${key}(${val?.incentiveSeriesId})`
|
|
286
|
+
: `${key}`
|
|
287
|
+
}
|
|
288
|
+
disabled={childDisabled}
|
|
289
|
+
></CapTreeNode>
|
|
290
|
+
);
|
|
291
|
+
hidingDateTagsForJpLocale(
|
|
292
|
+
hideDateTagsForJpLocale,
|
|
293
|
+
val,
|
|
294
|
+
list,
|
|
295
|
+
tempNode
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
} else {
|
|
299
|
+
const tempNode = (
|
|
300
|
+
<CapTreeNode
|
|
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
|
+
}
|
|
316
|
+
tag={val}
|
|
317
|
+
isLeaf
|
|
318
|
+
key={
|
|
319
|
+
val?.incentiveSeriesId
|
|
320
|
+
? `${key}(${val?.incentiveSeriesId})`
|
|
321
|
+
: `${key}`
|
|
322
|
+
}
|
|
323
|
+
disabled={childDisabled}
|
|
324
|
+
></CapTreeNode>
|
|
325
|
+
);
|
|
326
|
+
hidingDateTagsForJpLocale(
|
|
327
|
+
hideDateTagsForJpLocale,
|
|
328
|
+
val,
|
|
329
|
+
list,
|
|
330
|
+
tempNode
|
|
331
|
+
);
|
|
332
|
+
}
|
|
247
333
|
}
|
|
248
334
|
});
|
|
249
335
|
return list;
|