box-ui-elements 24.0.0-beta.6 → 24.0.0-beta.8

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.
Files changed (62) hide show
  1. package/dist/explorer.js +1 -1
  2. package/dist/picker.js +1 -1
  3. package/es/elements/content-explorer/ContentExplorer.js +1 -1
  4. package/es/elements/content-explorer/ContentExplorer.js.map +1 -1
  5. package/es/elements/content-explorer/MetadataQueryAPIHelper.js +3 -11
  6. package/es/elements/content-explorer/MetadataQueryAPIHelper.js.map +1 -1
  7. package/es/elements/content-explorer/MetadataQueryBuilder.js +37 -8
  8. package/es/elements/content-explorer/MetadataQueryBuilder.js.map +1 -1
  9. package/es/elements/content-explorer/constants.js +3 -2
  10. package/es/elements/content-explorer/constants.js.map +1 -1
  11. package/es/elements/content-explorer/utils.js +7 -0
  12. package/es/elements/content-explorer/utils.js.map +1 -1
  13. package/es/src/elements/content-explorer/constants.d.ts +3 -2
  14. package/es/src/elements/content-explorer/utils.d.ts +1 -0
  15. package/i18n/bn-IN.js +1 -1
  16. package/i18n/bn-IN.properties +1 -1
  17. package/i18n/da-DK.js +1 -1
  18. package/i18n/da-DK.properties +1 -1
  19. package/i18n/de-DE.js +2 -2
  20. package/i18n/de-DE.properties +2 -2
  21. package/i18n/es-419.js +2 -2
  22. package/i18n/es-419.properties +2 -2
  23. package/i18n/es-ES.js +2 -2
  24. package/i18n/es-ES.properties +2 -2
  25. package/i18n/fi-FI.js +1 -1
  26. package/i18n/fi-FI.properties +1 -1
  27. package/i18n/fr-CA.js +1 -1
  28. package/i18n/fr-CA.properties +1 -1
  29. package/i18n/fr-FR.js +1 -1
  30. package/i18n/fr-FR.properties +1 -1
  31. package/i18n/hi-IN.js +1 -1
  32. package/i18n/hi-IN.properties +1 -1
  33. package/i18n/it-IT.js +1 -1
  34. package/i18n/it-IT.properties +1 -1
  35. package/i18n/ko-KR.js +1 -1
  36. package/i18n/ko-KR.properties +1 -1
  37. package/i18n/nb-NO.js +1 -1
  38. package/i18n/nb-NO.properties +1 -1
  39. package/i18n/nl-NL.js +1 -1
  40. package/i18n/nl-NL.properties +1 -1
  41. package/i18n/pl-PL.js +1 -1
  42. package/i18n/pl-PL.properties +1 -1
  43. package/i18n/pt-BR.js +1 -1
  44. package/i18n/pt-BR.properties +1 -1
  45. package/i18n/ru-RU.js +2 -2
  46. package/i18n/ru-RU.properties +2 -2
  47. package/i18n/sv-SE.js +1 -1
  48. package/i18n/sv-SE.properties +1 -1
  49. package/i18n/tr-TR.js +2 -2
  50. package/i18n/tr-TR.properties +2 -2
  51. package/i18n/zh-CN.js +1 -1
  52. package/i18n/zh-CN.properties +1 -1
  53. package/i18n/zh-TW.js +1 -1
  54. package/i18n/zh-TW.properties +1 -1
  55. package/package.json +1 -1
  56. package/src/elements/content-explorer/ContentExplorer.tsx +1 -1
  57. package/src/elements/content-explorer/MetadataQueryAPIHelper.ts +3 -9
  58. package/src/elements/content-explorer/MetadataQueryBuilder.ts +41 -18
  59. package/src/elements/content-explorer/__tests__/MetadataQueryAPIHelper.test.ts +49 -16
  60. package/src/elements/content-explorer/__tests__/MetadataQueryBuilder.test.ts +168 -39
  61. package/src/elements/content-explorer/constants.ts +37 -2
  62. package/src/elements/content-explorer/utils.ts +8 -0
@@ -977,7 +977,7 @@ boxui.classification.add = Ajouter
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
978
  boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = Box AI sur {modifiedAt}
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = Classement
983
983
  # Classification label color name as dark blue
package/i18n/hi-IN.js CHANGED
@@ -488,7 +488,7 @@ export default {
488
488
  "boxui.checkboxTooltip.iconInfoText": "जानकारी",
489
489
  "boxui.classification.add": "जोड़ें",
490
490
  "boxui.classification.appliedByBoxAi": "Box AI",
491
- "boxui.classification.appliedByBoxAiOnDate": "Box AI on {modifiedAt}",
491
+ "boxui.classification.appliedByBoxAiOnDate": "{modifiedAt} पर Box AI",
492
492
  "boxui.classification.classification": "वर्गीकरण",
493
493
  "boxui.classification.classificationDarkBlue": "गहरा नीला",
494
494
  "boxui.classification.classificationGreen": "हरा",
@@ -977,7 +977,7 @@ boxui.classification.add = जोड़ें
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
978
  boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = {modifiedAt} पर Box AI
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = वर्गीकरण
983
983
  # Classification label color name as dark blue
package/i18n/it-IT.js CHANGED
@@ -488,7 +488,7 @@ export default {
488
488
  "boxui.checkboxTooltip.iconInfoText": "Informazioni",
489
489
  "boxui.classification.add": "Aggiungi",
490
490
  "boxui.classification.appliedByBoxAi": "Box AI",
491
- "boxui.classification.appliedByBoxAiOnDate": "Box AI on {modifiedAt}",
491
+ "boxui.classification.appliedByBoxAiOnDate": "Box AI su {modifiedAt}",
492
492
  "boxui.classification.classification": "Classificazione",
493
493
  "boxui.classification.classificationDarkBlue": "Blu scuro",
494
494
  "boxui.classification.classificationGreen": "Verde",
@@ -977,7 +977,7 @@ boxui.classification.add = Aggiungi
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
978
  boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = Box AI su {modifiedAt}
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = Classificazione
983
983
  # Classification label color name as dark blue
package/i18n/ko-KR.js CHANGED
@@ -488,7 +488,7 @@ export default {
488
488
  "boxui.checkboxTooltip.iconInfoText": "정보",
489
489
  "boxui.classification.add": "추가",
490
490
  "boxui.classification.appliedByBoxAi": "Box AI",
491
- "boxui.classification.appliedByBoxAiOnDate": "Box AI on {modifiedAt}",
491
+ "boxui.classification.appliedByBoxAiOnDate": "{modifiedAt}의 Box AI 분류 사유",
492
492
  "boxui.classification.classification": "분류",
493
493
  "boxui.classification.classificationDarkBlue": "진한 파란색",
494
494
  "boxui.classification.classificationGreen": "녹색",
@@ -977,7 +977,7 @@ boxui.classification.add = 추가
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
978
  boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = {modifiedAt}의 Box AI 분류 사유
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = 분류
983
983
  # Classification label color name as dark blue
package/i18n/nb-NO.js CHANGED
@@ -488,7 +488,7 @@ export default {
488
488
  "boxui.checkboxTooltip.iconInfoText": "Informasjon",
489
489
  "boxui.classification.add": "Legg til",
490
490
  "boxui.classification.appliedByBoxAi": "Box AI",
491
- "boxui.classification.appliedByBoxAiOnDate": "Box AI on {modifiedAt}",
491
+ "boxui.classification.appliedByBoxAiOnDate": "Box AI {modifiedAt}",
492
492
  "boxui.classification.classification": "Klassifisering",
493
493
  "boxui.classification.classificationDarkBlue": "Mørkeblå",
494
494
  "boxui.classification.classificationGreen": "Grønn",
@@ -977,7 +977,7 @@ boxui.classification.add = Legg til
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
978
  boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = Box AI {modifiedAt}
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = Klassifisering
983
983
  # Classification label color name as dark blue
package/i18n/nl-NL.js CHANGED
@@ -488,7 +488,7 @@ export default {
488
488
  "boxui.checkboxTooltip.iconInfoText": "Info",
489
489
  "boxui.classification.add": "Toevoegen",
490
490
  "boxui.classification.appliedByBoxAi": "Box AI",
491
- "boxui.classification.appliedByBoxAiOnDate": "Box AI on {modifiedAt}",
491
+ "boxui.classification.appliedByBoxAiOnDate": "Box AI op {modifiedAt}",
492
492
  "boxui.classification.classification": "Classificatie",
493
493
  "boxui.classification.classificationDarkBlue": "Donkerblauw",
494
494
  "boxui.classification.classificationGreen": "Groen",
@@ -977,7 +977,7 @@ boxui.classification.add = Toevoegen
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
978
  boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = Box AI op {modifiedAt}
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = Classificatie
983
983
  # Classification label color name as dark blue
package/i18n/pl-PL.js CHANGED
@@ -488,7 +488,7 @@ export default {
488
488
  "boxui.checkboxTooltip.iconInfoText": "Informacje",
489
489
  "boxui.classification.add": "Dodaj",
490
490
  "boxui.classification.appliedByBoxAi": "Box AI",
491
- "boxui.classification.appliedByBoxAiOnDate": "Box AI on {modifiedAt}",
491
+ "boxui.classification.appliedByBoxAiOnDate": "Box AI w dniu {modifiedAt}",
492
492
  "boxui.classification.classification": "Klasyfikacja",
493
493
  "boxui.classification.classificationDarkBlue": "Ciemnoniebieski",
494
494
  "boxui.classification.classificationGreen": "Zielony",
@@ -977,7 +977,7 @@ boxui.classification.add = Dodaj
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
978
  boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = Box AI w dniu {modifiedAt}
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = Klasyfikacja
983
983
  # Classification label color name as dark blue
package/i18n/pt-BR.js CHANGED
@@ -488,7 +488,7 @@ export default {
488
488
  "boxui.checkboxTooltip.iconInfoText": "Informações",
489
489
  "boxui.classification.add": "Adicionar",
490
490
  "boxui.classification.appliedByBoxAi": "Box AI",
491
- "boxui.classification.appliedByBoxAiOnDate": "Box AI on {modifiedAt}",
491
+ "boxui.classification.appliedByBoxAiOnDate": "Box AI no {modifiedAt}",
492
492
  "boxui.classification.classification": "Classificação",
493
493
  "boxui.classification.classificationDarkBlue": "Azul escuro",
494
494
  "boxui.classification.classificationGreen": "Verde",
@@ -977,7 +977,7 @@ boxui.classification.add = Adicionar
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
978
  boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = Box AI no {modifiedAt}
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = Classificação
983
983
  # Classification label color name as dark blue
package/i18n/ru-RU.js CHANGED
@@ -487,8 +487,8 @@ export default {
487
487
  "boxui.categorySelector.label.more": "Дополнительно",
488
488
  "boxui.checkboxTooltip.iconInfoText": "Информация",
489
489
  "boxui.classification.add": "Добавить",
490
- "boxui.classification.appliedByBoxAi": "ИИ Box",
491
- "boxui.classification.appliedByBoxAiOnDate": "Box AI on {modifiedAt}",
490
+ "boxui.classification.appliedByBoxAi": "Box AI",
491
+ "boxui.classification.appliedByBoxAiOnDate": "Box AI на {modifiedAt}",
492
492
  "boxui.classification.classification": "Классификация",
493
493
  "boxui.classification.classificationDarkBlue": "Темно-синий",
494
494
  "boxui.classification.classificationGreen": "Зеленый",
@@ -975,9 +975,9 @@ boxui.checkboxTooltip.iconInfoText = Информация
975
975
  # Button to add classification on an item
976
976
  boxui.classification.add = Добавить
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
- boxui.classification.appliedByBoxAi = ИИ Box
978
+ boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = Box AI на {modifiedAt}
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = Классификация
983
983
  # Classification label color name as dark blue
package/i18n/sv-SE.js CHANGED
@@ -488,7 +488,7 @@ export default {
488
488
  "boxui.checkboxTooltip.iconInfoText": "Info",
489
489
  "boxui.classification.add": "Lägg till",
490
490
  "boxui.classification.appliedByBoxAi": "Box AI",
491
- "boxui.classification.appliedByBoxAiOnDate": "Box AI on {modifiedAt}",
491
+ "boxui.classification.appliedByBoxAiOnDate": "Box AI {modifiedAt}",
492
492
  "boxui.classification.classification": "Klassificering",
493
493
  "boxui.classification.classificationDarkBlue": "Mörkblått",
494
494
  "boxui.classification.classificationGreen": "Grön",
@@ -977,7 +977,7 @@ boxui.classification.add = Lägg till
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
978
  boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = Box AI {modifiedAt}
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = Klassificering
983
983
  # Classification label color name as dark blue
package/i18n/tr-TR.js CHANGED
@@ -487,8 +487,8 @@ export default {
487
487
  "boxui.categorySelector.label.more": "Daha fazla",
488
488
  "boxui.checkboxTooltip.iconInfoText": "Bilgi",
489
489
  "boxui.classification.add": "Ekle",
490
- "boxui.classification.appliedByBoxAi": "Box IA",
491
- "boxui.classification.appliedByBoxAiOnDate": "Box AI on {modifiedAt}",
490
+ "boxui.classification.appliedByBoxAi": "Box AI",
491
+ "boxui.classification.appliedByBoxAiOnDate": "{modifiedAt} bilgisine ayarlı Box AI",
492
492
  "boxui.classification.classification": "Sınıflandırma",
493
493
  "boxui.classification.classificationDarkBlue": "Koyu Mavi",
494
494
  "boxui.classification.classificationGreen": "Yeşil",
@@ -975,9 +975,9 @@ boxui.checkboxTooltip.iconInfoText = Bilgi
975
975
  # Button to add classification on an item
976
976
  boxui.classification.add = Ekle
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
- boxui.classification.appliedByBoxAi = Box IA
978
+ boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = {modifiedAt} bilgisine ayarlı Box AI
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = Sınıflandırma
983
983
  # Classification label color name as dark blue
package/i18n/zh-CN.js CHANGED
@@ -488,7 +488,7 @@ export default {
488
488
  "boxui.checkboxTooltip.iconInfoText": "信息",
489
489
  "boxui.classification.add": "添加",
490
490
  "boxui.classification.appliedByBoxAi": "Box AI",
491
- "boxui.classification.appliedByBoxAiOnDate": "Box AI on {modifiedAt}",
491
+ "boxui.classification.appliedByBoxAiOnDate": "Box AI {modifiedAt}",
492
492
  "boxui.classification.classification": "分类",
493
493
  "boxui.classification.classificationDarkBlue": "深蓝色",
494
494
  "boxui.classification.classificationGreen": "绿色",
@@ -977,7 +977,7 @@ boxui.classification.add = 添加
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
978
  boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = Box AI {modifiedAt}
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = 分类
983
983
  # Classification label color name as dark blue
package/i18n/zh-TW.js CHANGED
@@ -488,7 +488,7 @@ export default {
488
488
  "boxui.checkboxTooltip.iconInfoText": "資訊",
489
489
  "boxui.classification.add": "新增",
490
490
  "boxui.classification.appliedByBoxAi": "Box AI",
491
- "boxui.classification.appliedByBoxAiOnDate": "Box AI on {modifiedAt}",
491
+ "boxui.classification.appliedByBoxAiOnDate": "Box AI 已修改於 {modifiedAt}",
492
492
  "boxui.classification.classification": "分類",
493
493
  "boxui.classification.classificationDarkBlue": "深藍色",
494
494
  "boxui.classification.classificationGreen": "綠色",
@@ -977,7 +977,7 @@ boxui.classification.add = 新增
977
977
  # Title of the card that shows the reason why the AI classification was applied when no date is available.
978
978
  boxui.classification.appliedByBoxAi = Box AI
979
979
  # Title of the card that shows the reason why the AI classification was applied on a specific date.
980
- boxui.classification.appliedByBoxAiOnDate = Box AI on {modifiedAt}
980
+ boxui.classification.appliedByBoxAiOnDate = Box AI 已修改於 {modifiedAt}
981
981
  # Header for classification section in sidebar
982
982
  boxui.classification.classification = 分類
983
983
  # Classification label color name as dark blue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "box-ui-elements",
3
- "version": "24.0.0-beta.6",
3
+ "version": "24.0.0-beta.8",
4
4
  "description": "Box UI Elements",
5
5
  "author": "Box (https://www.box.com/)",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -34,7 +34,7 @@ import Content from './Content';
34
34
  import { isThumbnailAvailable } from '../common/utils';
35
35
  import { isFocusableElement, isInputElement, focus } from '../../utils/dom';
36
36
  import { FILE_SHARED_LINK_FIELDS_TO_FETCH } from '../../utils/fields';
37
- import CONTENT_EXPLORER_FOLDER_FIELDS_TO_FETCH from './constants';
37
+ import { CONTENT_EXPLORER_FOLDER_FIELDS_TO_FETCH } from './constants';
38
38
  import LocalStore from '../../utils/LocalStore';
39
39
  import {
40
40
  withFeatureConsumer,
@@ -172,17 +172,11 @@ export default class MetadataQueryAPIHelper {
172
172
  };
173
173
 
174
174
  getTemplateSchemaInfo = (data: MetadataQueryResponseData): Promise<MetadataTemplateSchemaResponse | void> => {
175
- const { entries } = data;
176
175
  this.metadataQueryResponseData = data;
177
- if (!entries || entries.length === 0) {
178
- // Don't make metadata API call to get template info
179
- return Promise.resolve();
180
- }
181
176
 
182
- const metadata = getProp(entries, '[0].metadata');
183
- this.templateScope = Object.keys(metadata)[0];
184
- const instance = metadata[this.templateScope];
185
- this.templateKey = Object.keys(instance)[0];
177
+ const [scope, key] = this.metadataQuery.from.split('.');
178
+ this.templateScope = scope;
179
+ this.templateKey = key;
186
180
 
187
181
  return this.api.getMetadataAPI(true).getSchemaByTemplateKey(this.templateKey);
188
182
  };
@@ -1,4 +1,5 @@
1
1
  import isNil from 'lodash/isNil';
2
+ import { getFileExtensions } from './utils';
2
3
 
3
4
  type QueryResult = {
4
5
  queryParams: { [key: string]: number | Date | string };
@@ -115,9 +116,7 @@ export const getSelectFilter = (filterValue: string[], fieldKey: string, argInde
115
116
  return {
116
117
  queryParams: multiSelectQueryParams,
117
118
  queries: [
118
- `(${fieldKey === 'mimetype-filter' ? 'item.extension' : fieldKey} HASANY (${Object.keys(
119
- multiSelectQueryParams,
120
- )
119
+ `(${fieldKey} HASANY (${Object.keys(multiSelectQueryParams)
121
120
  .map(argKey => `:${argKey}`)
122
121
  .join(', ')}))`,
123
122
  ],
@@ -135,25 +134,49 @@ export const getMimeTypeFilter = (filterValue: string[], fieldKey: string, argIn
135
134
  }
136
135
 
137
136
  let currentArgIndex = argIndexStart;
138
-
139
- const multiSelectQueryParams = Object.fromEntries(
140
- filterValue.map(value => {
137
+ const queryParams: { [key: string]: number | Date | string } = {};
138
+ const queries: string[] = [];
139
+
140
+ // Handle specific extensions and folder type
141
+ const extensions: string[][] = [];
142
+ let hasFolder = false;
143
+ for (const extension of filterValue) {
144
+ if (extension === 'folderType' && !hasFolder) {
141
145
  currentArgIndex += 1;
142
- // the item-type-selector is returning the extensions with the suffix 'Type', so we remove it for the query
143
- return [
144
- generateArgKey(fieldKey, currentArgIndex),
145
- String(value.endsWith('Type') ? value.slice(0, -4) : value),
146
- ];
147
- }),
148
- );
146
+ const folderArgKey = generateArgKey('mime_folderType', currentArgIndex);
147
+ queryParams[folderArgKey] = 'folder';
148
+ queries.push(`(item.type = :${folderArgKey})`);
149
+ hasFolder = true;
150
+ } else {
151
+ extensions.push(getFileExtensions(extension));
152
+ }
153
+ }
149
154
 
150
- return {
151
- queryParams: multiSelectQueryParams,
152
- queries: [
153
- `(item.extension IN (${Object.keys(multiSelectQueryParams)
155
+ // flat the array of arrays
156
+ const flattenExtensions = extensions.flat();
157
+ // Handle extensions in batch if any exist
158
+ if (flattenExtensions.length > 0) {
159
+ const extensionQueryParams = Object.fromEntries(
160
+ flattenExtensions.map(extension => {
161
+ currentArgIndex += 1;
162
+ return [generateArgKey(fieldKey, currentArgIndex), extension];
163
+ }),
164
+ );
165
+
166
+ Object.assign(queryParams, extensionQueryParams);
167
+ queries.push(
168
+ `(item.extension IN (${Object.keys(extensionQueryParams)
154
169
  .map(argKey => `:${argKey}`)
155
170
  .join(', ')}))`,
156
- ],
171
+ );
172
+ }
173
+
174
+ // Combine queries with OR if multiple exist
175
+ const finalQueries = queries.length > 1 ? [`(${queries.join(' OR ')})`] : queries;
176
+
177
+ return {
178
+ queryParams,
179
+ queries: finalQueries,
157
180
  keysGenerated: currentArgIndex - argIndexStart,
158
181
  };
159
182
  };
@@ -189,14 +189,14 @@ describe('elements/content-explorer/MetadataQueryAPIHelper', () => {
189
189
  };
190
190
  const mdQuery = {
191
191
  ancestor_folder_id: '672838458',
192
- from: 'enterprise_1234.templateKey',
192
+ from: `${templateScope}.${templateKey}`,
193
193
  query: 'query',
194
194
  query_params: {},
195
195
  fields: [
196
196
  FIELD_ITEM_NAME,
197
- 'metadata.enterprise_1234.templateKey.type',
198
- 'metadata.enterprise_1234.templateKey.year',
199
- 'metadata.enterprise_1234.templateKey.approved',
197
+ `metadata.${templateScope}.${templateKey}.type`,
198
+ `metadata.${templateScope}.${templateKey}.year`,
199
+ `metadata.${templateScope}.${templateKey}.approved`,
200
200
  ],
201
201
  };
202
202
 
@@ -206,6 +206,10 @@ describe('elements/content-explorer/MetadataQueryAPIHelper', () => {
206
206
  metadataQueryAPIHelper.templateScope = templateScope;
207
207
  metadataQueryAPIHelper.metadataTemplate = template;
208
208
  metadataQueryAPIHelper.metadataQuery = mdQuery;
209
+
210
+ // Reset mocks before each test
211
+ getSchemaByTemplateKeyFunc.mockClear();
212
+ getSchemaByTemplateKeyFunc.mockResolvedValue(templateSchemaResponse);
209
213
  });
210
214
 
211
215
  describe('flattenMetadata()', () => {
@@ -267,7 +271,7 @@ describe('elements/content-explorer/MetadataQueryAPIHelper', () => {
267
271
  });
268
272
 
269
273
  describe('getTemplateSchemaInfo()', () => {
270
- test('should set instance properties and make xhr call to get template info when response has valid entries', async () => {
274
+ test('should set instance properties and make xhr call to get template info', async () => {
271
275
  const result = await metadataQueryAPIHelper.getTemplateSchemaInfo(metadataQueryResponse);
272
276
  expect(getSchemaByTemplateKeyFunc).toHaveBeenCalledWith(templateKey);
273
277
  expect(result).toEqual(templateSchemaResponse);
@@ -276,26 +280,49 @@ describe('elements/content-explorer/MetadataQueryAPIHelper', () => {
276
280
  expect(metadataQueryAPIHelper.templateKey).toEqual(templateKey);
277
281
  });
278
282
 
279
- test('should not make xhr call to get metadata template info when response has zero/invalid entries', async () => {
283
+ test('should make xhr call to get metadata template info even when response has zero entries', async () => {
280
284
  const emptyEntriesResponse = { entries: [], next_marker: nextMarker };
281
285
  const result = await metadataQueryAPIHelper.getTemplateSchemaInfo(emptyEntriesResponse);
282
- expect(getSchemaByTemplateKeyFunc).not.toHaveBeenCalled();
283
- expect(result).toBe(undefined);
286
+ expect(getSchemaByTemplateKeyFunc).toHaveBeenCalledWith(templateKey);
287
+ expect(result).toEqual(templateSchemaResponse);
284
288
  expect(metadataQueryAPIHelper.metadataQueryResponseData).toEqual(emptyEntriesResponse);
289
+ expect(metadataQueryAPIHelper.templateScope).toEqual(templateScope);
290
+ expect(metadataQueryAPIHelper.templateKey).toEqual(templateKey);
285
291
  });
286
292
 
287
- test('should handle response with null entries', async () => {
293
+ test('should make xhr call to get metadata template info even when response has null entries', async () => {
288
294
  const nullEntriesResponse = { entries: null, next_marker: nextMarker };
289
295
  const result = await metadataQueryAPIHelper.getTemplateSchemaInfo(nullEntriesResponse);
290
- expect(getSchemaByTemplateKeyFunc).not.toHaveBeenCalled();
291
- expect(result).toBe(undefined);
296
+ expect(getSchemaByTemplateKeyFunc).toHaveBeenCalledWith(templateKey);
297
+ expect(result).toEqual(templateSchemaResponse);
298
+ expect(metadataQueryAPIHelper.metadataQueryResponseData).toEqual(nullEntriesResponse);
299
+ expect(metadataQueryAPIHelper.templateScope).toEqual(templateScope);
300
+ expect(metadataQueryAPIHelper.templateKey).toEqual(templateKey);
292
301
  });
293
302
 
294
- test('should handle response with undefined entries', async () => {
303
+ test('should make xhr call to get metadata template info even when response has undefined entries', async () => {
295
304
  const undefinedEntriesResponse = { next_marker: nextMarker };
296
305
  const result = await metadataQueryAPIHelper.getTemplateSchemaInfo(undefinedEntriesResponse);
297
- expect(getSchemaByTemplateKeyFunc).not.toHaveBeenCalled();
298
- expect(result).toBe(undefined);
306
+ expect(getSchemaByTemplateKeyFunc).toHaveBeenCalledWith(templateKey);
307
+ expect(result).toEqual(templateSchemaResponse);
308
+ expect(metadataQueryAPIHelper.metadataQueryResponseData).toEqual(undefinedEntriesResponse);
309
+ expect(metadataQueryAPIHelper.templateScope).toEqual(templateScope);
310
+ expect(metadataQueryAPIHelper.templateKey).toEqual(templateKey);
311
+ });
312
+
313
+ test('should extract template scope and key from metadata query from field', async () => {
314
+ // Test with different scope and key in the query
315
+ const differentScope = 'enterprise_99999';
316
+ const differentKey = 'differentTemplate';
317
+ metadataQueryAPIHelper.metadataQuery = {
318
+ ...mdQuery,
319
+ from: `${differentScope}.${differentKey}`,
320
+ };
321
+
322
+ await metadataQueryAPIHelper.getTemplateSchemaInfo(metadataQueryResponse);
323
+ expect(getSchemaByTemplateKeyFunc).toHaveBeenCalledWith(differentKey);
324
+ expect(metadataQueryAPIHelper.templateScope).toEqual(differentScope);
325
+ expect(metadataQueryAPIHelper.templateKey).toEqual(differentKey);
299
326
  });
300
327
  });
301
328
 
@@ -673,14 +700,20 @@ describe('elements/content-explorer/MetadataQueryAPIHelper', () => {
673
700
  const filters = {
674
701
  'mimetype-filter': {
675
702
  fieldType: 'enum',
676
- value: ['pdf', 'doc'],
703
+ value: ['pdfType', 'documentType'],
677
704
  },
678
705
  };
679
706
 
680
707
  const result = metadataQueryAPIHelper.buildMetadataQueryParams(filters);
681
- expect(result.query).toBe('(item.extension IN (:arg_mimetype_filter_1, :arg_mimetype_filter_2))');
708
+ expect(result.query).toBe(
709
+ '(item.extension IN (:arg_mimetype_filter_1, :arg_mimetype_filter_2, :arg_mimetype_filter_3, :arg_mimetype_filter_4, :arg_mimetype_filter_5, :arg_mimetype_filter_6))',
710
+ );
682
711
  expect(result.queryParams.arg_mimetype_filter_1).toBe('pdf');
683
712
  expect(result.queryParams.arg_mimetype_filter_2).toBe('doc');
713
+ expect(result.queryParams.arg_mimetype_filter_3).toBe('docx');
714
+ expect(result.queryParams.arg_mimetype_filter_4).toBe('gdoc');
715
+ expect(result.queryParams.arg_mimetype_filter_5).toBe('rtf');
716
+ expect(result.queryParams.arg_mimetype_filter_6).toBe('txt');
684
717
  });
685
718
 
686
719
  test('should handle multiple filters of different types', () => {