@bynder/compact-view 5.1.4 → 5.2.0

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/App.d.ts +3 -1
  2. package/App.js +60 -56
  3. package/App.js.map +1 -1
  4. package/AssetFilter.js +80 -100
  5. package/AssetFilter.js.map +1 -1
  6. package/AssetFilterContext.js.map +1 -1
  7. package/{Autocomplete.js → Autocomplete_new.js} +41 -41
  8. package/Autocomplete_new.js.map +1 -0
  9. package/ConfigContext.js.map +1 -1
  10. package/FileSelector.js +138 -111
  11. package/FileSelector.js.map +1 -1
  12. package/Option_new.js +50 -0
  13. package/Option_new.js.map +1 -0
  14. package/SmartFilterSelect_new.js +86 -0
  15. package/SmartFilterSelect_new.js.map +1 -0
  16. package/Smartfilters_new.js +190 -0
  17. package/Smartfilters_new.js.map +1 -0
  18. package/api/getFilterOptions.d.ts +9 -0
  19. package/api/getFilters.d.ts +1 -1
  20. package/api/getFilters_new.d.ts +7 -0
  21. package/api/index.d.ts +1 -1
  22. package/api/types/getFilters_new.d.ts +56 -0
  23. package/app-config/ConfigContext.d.ts +1 -1
  24. package/app-config/appConfig.type.d.ts +2 -0
  25. package/{autocomplete2.js → autocomplete.js} +1 -1
  26. package/autocomplete.js.map +1 -0
  27. package/filter/filters/smartfilters/Metaproperties/Autocomplete_new.d.ts +15 -0
  28. package/filter/filters/smartfilters/Metaproperties/Option_new.d.ts +13 -0
  29. package/filter/filters/smartfilters/Metaproperties/SmartFilterSelect_new.d.ts +13 -0
  30. package/filter/filters/smartfilters/Smartfilters_new.d.ts +7 -0
  31. package/filterAssets.js +14 -12
  32. package/filterAssets.js.map +1 -1
  33. package/getCollections.js +4 -3
  34. package/getCollections.js.map +1 -1
  35. package/getFilterOptions.js +57 -0
  36. package/getFilterOptions.js.map +1 -0
  37. package/getFilters.js +33 -32
  38. package/getFilters.js.map +1 -1
  39. package/getFilters_new.js +73 -0
  40. package/getFilters_new.js.map +1 -0
  41. package/getLimitedUseThumbnails.js +26 -0
  42. package/getLimitedUseThumbnails.js.map +1 -0
  43. package/handlers.js +3 -7
  44. package/handlers.js.map +1 -1
  45. package/index3.js +44 -24
  46. package/index3.js.map +1 -1
  47. package/package.json +1 -1
  48. package/utils/getLimitedUseThumbnails.d.ts +2 -0
  49. package/Autocomplete.js.map +0 -1
  50. package/Option.js +0 -50
  51. package/Option.js.map +0 -1
  52. package/SmartFilterSelect.js +0 -91
  53. package/SmartFilterSelect.js.map +0 -1
  54. package/Smartfilters.js +0 -186
  55. package/Smartfilters.js.map +0 -1
  56. package/autocomplete2.js.map +0 -1
  57. package/filterEmptyMetaproperties.js +0 -11
  58. package/filterEmptyMetaproperties.js.map +0 -1
  59. package/getInitialFilters.js +0 -51
  60. package/getInitialFilters.js.map +0 -1
  61. package/getMetapropertiesOptions.js +0 -31
  62. package/getMetapropertiesOptions.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"getInitialFilters.js","sources":["../../src/api/rest/getInitialFilters.ts"],"sourcesContent":["import { RawAxiosResponseHeaders } from 'axios';\nimport { getRequest } from '.';\nimport { handlers } from './handlers';\nimport { AuthInformationState } from '@src/auth/useAuthInformation';\nimport { ensureValidUrl } from '@src/utils/url';\nimport { filterEmptyMetaproperties } from '@src/utils/filterEmptyMetaproperties';\nimport { SmartfilterResponse, SmartfilterMetaproperty } from './types';\n\nexport const getInitialFilters = async ({ auth }: { auth: AuthInformationState | null }) => {\n\tif (!auth) throw new Error('No authentication provided');\n\n\tlet host =\n\t\tauth.accountDomain !== undefined\n\t\t\t? ensureValidUrl(auth.accountDomain.trim())\n\t\t\t: `https://${window.location.host}`;\n\n\t// For the sake of consistency, check if last char is a slash\n\t// and remove it\n\tif (host.charAt(host.length - 1) === '/') {\n\t\thost = host.slice(0, -1);\n\t}\n\n\tconst accessToken = auth.getAccessToken && auth.getAccessToken();\n\n\tconst headers = accessToken === undefined ? {} : { Authorization: `Bearer ${accessToken}` };\n\n\ttry {\n\t\tconst smartfilters: SmartfilterResponse = await getRequest<SmartfilterResponse>(\n\t\t\t`${host}${handlers.smartfilters}`,\n\t\t\t{ headers },\n\t\t);\n\t\tconst validSmartfilters = smartfilters.filter((filter) => filter.metaproperties.length > 0);\n\t\tconst metaproperties = await getMetapropertiesWithOptions(validSmartfilters, host, headers);\n\t\tconst validMetaproperties = filterEmptyMetaproperties(metaproperties);\n\n\t\treturn {\n\t\t\tfilters: validSmartfilters,\n\t\t\tmetaproperties: validMetaproperties,\n\t\t};\n\t} catch (error) {\n\t\tthrow new Error(`Error fetching initial filters: ${error}`);\n\t}\n};\n\nconst getMetapropertiesWithOptions = async (\n\tsmartfilters: SmartfilterResponse,\n\thost: string,\n\theaders: RawAxiosResponseHeaders,\n): Promise<Record<string, Record<string, SmartfilterMetaproperty>>> => {\n\tconst metapropertyPromises: Array<\n\t\tPromise<{ id: string; smartfilterID: string; response: SmartfilterMetaproperty } | null>\n\t> = [];\n\n\tfor (const smartfilter of smartfilters) {\n\t\tfor (const metapropertyId of smartfilter.metaproperties) {\n\t\t\tconst url = `${host}${handlers.metapropertiesWithOptions(\n\t\t\t\tsmartfilter.id,\n\t\t\t\tmetapropertyId,\n\t\t\t)}?filterKey=savedFilters&limit=30`;\n\n\t\t\tmetapropertyPromises.push(\n\t\t\t\tgetRequest<SmartfilterMetaproperty>(url, {\n\t\t\t\t\theaders,\n\t\t\t\t})\n\t\t\t\t\t.then((response) => ({\n\t\t\t\t\t\tid: metapropertyId,\n\t\t\t\t\t\tsmartfilterID: smartfilter.id,\n\t\t\t\t\t\tresponse,\n\t\t\t\t\t}))\n\t\t\t\t\t.catch(() => null),\n\t\t\t);\n\t\t}\n\t}\n\n\tconst settledResults = await Promise.allSettled(metapropertyPromises);\n\n\tconst fetchedMetaproperties: Record<string, Record<string, SmartfilterMetaproperty>> = {};\n\n\tfor (const result of settledResults) {\n\t\tif (result.status === 'fulfilled' && result.value !== null) {\n\t\t\tconst { id, response, smartfilterID } = result.value;\n\t\t\tfetchedMetaproperties[smartfilterID] = fetchedMetaproperties[smartfilterID] || {};\n\t\t\tfetchedMetaproperties[smartfilterID][id] = response;\n\t\t}\n\t}\n\n\treturn fetchedMetaproperties;\n};\n"],"names":["getInitialFilters","auth","host","ensureValidUrl","accessToken","headers","validSmartfilters","getRequest","handlers","filter","metaproperties","getMetapropertiesWithOptions","validMetaproperties","filterEmptyMetaproperties","error","smartfilters","metapropertyPromises","smartfilter","metapropertyId","url","response","settledResults","fetchedMetaproperties","result","id","smartfilterID"],"mappings":";;;;AAQO,MAAMA,IAAoB,OAAO,EAAE,MAAAC,QAAkD;AAC3F,MAAI,CAACA,EAAM,OAAM,IAAI,MAAM,4BAA4B;AAEvD,MAAIC,IACHD,EAAK,kBAAkB,SACpBE,EAAeF,EAAK,cAAc,KAAA,CAAM,IACxC,WAAW,OAAO,SAAS,IAAI;AAInC,EAAIC,EAAK,OAAOA,EAAK,SAAS,CAAC,MAAM,QACpCA,IAAOA,EAAK,MAAM,GAAG,EAAE;AAGxB,QAAME,IAAcH,EAAK,kBAAkBA,EAAK,eAAA,GAE1CI,IAAUD,MAAgB,SAAY,CAAA,IAAK,EAAE,eAAe,UAAUA,CAAW,GAAA;AAEvF,MAAI;AAKH,UAAME,KAJoC,MAAMC;AAAA,MAC/C,GAAGL,CAAI,GAAGM,EAAS,YAAY;AAAA,MAC/B,EAAE,SAAAH,EAAA;AAAA,IAAQ,GAE4B,OAAO,CAACI,MAAWA,EAAO,eAAe,SAAS,CAAC,GACpFC,IAAiB,MAAMC,EAA6BL,GAAmBJ,GAAMG,CAAO,GACpFO,IAAsBC,EAA0BH,CAAc;AAEpE,WAAO;AAAA,MACN,SAASJ;AAAA,MACT,gBAAgBM;AAAA,IAAA;AAAA,EAElB,SAASE,GAAO;AACf,UAAM,IAAI,MAAM,mCAAmCA,CAAK,EAAE;AAAA,EAC3D;AACD,GAEMH,IAA+B,OACpCI,GACAb,GACAG,MACsE;AACtE,QAAMW,IAEF,CAAA;AAEJ,aAAWC,KAAeF;AACzB,eAAWG,KAAkBD,EAAY,gBAAgB;AACxD,YAAME,IAAM,GAAGjB,CAAI,GAAGM,EAAS;AAAA,QAC9BS,EAAY;AAAA,QACZC;AAAA,MAAA,CACA;AAED,MAAAF,EAAqB;AAAA,QACpBT,EAAoCY,GAAK;AAAA,UACxC,SAAAd;AAAA,QAAA,CACA,EACC,KAAK,CAACe,OAAc;AAAA,UACpB,IAAIF;AAAA,UACJ,eAAeD,EAAY;AAAA,UAC3B,UAAAG;AAAA,QAAA,EACC,EACD,MAAM,MAAM,IAAI;AAAA,MAAA;AAAA,IAEpB;AAGD,QAAMC,IAAiB,MAAM,QAAQ,WAAWL,CAAoB,GAE9DM,IAAiF,CAAA;AAEvF,aAAWC,KAAUF;AACpB,QAAIE,EAAO,WAAW,eAAeA,EAAO,UAAU,MAAM;AAC3D,YAAM,EAAE,IAAAC,GAAI,UAAAJ,GAAU,eAAAK,EAAA,IAAkBF,EAAO;AAC/C,MAAAD,EAAsBG,CAAa,IAAIH,EAAsBG,CAAa,KAAK,CAAA,GAC/EH,EAAsBG,CAAa,EAAED,CAAE,IAAIJ;AAAA,IAC5C;AAGD,SAAOE;AACR;"}
@@ -1,31 +0,0 @@
1
- import { getRequest as l } from "./index4.js";
2
- import { handlers as m } from "./handlers.js";
3
- import { ensureValidUrl as d } from "./url.js";
4
- const w = async ({
5
- auth: e,
6
- smartfilterId: i,
7
- metapropertyId: s,
8
- labelKeyset: n,
9
- zindexKeyset: c,
10
- mpoKeyset: a
11
- }) => {
12
- if (!e) throw new Error("No authentication provided");
13
- let t = e.accountDomain !== void 0 ? d(e.accountDomain.trim()) : `https://${window.location.host}`;
14
- t.charAt(t.length - 1) === "/" && (t = t.slice(0, -1));
15
- const o = e.getAccessToken && e.getAccessToken(), p = o === void 0 ? {} : { Authorization: `Bearer ${o}` };
16
- try {
17
- return await l(
18
- `${t}${m.metapropertiesWithOptions(
19
- i,
20
- s
21
- )}?filterKey=savedFilters&limit=30&labelKeyset=${n}&zindexKeyset=${c}&mpoKeyset=${a}`,
22
- { headers: p }
23
- );
24
- } catch (r) {
25
- throw new Error(`Error fetching initial filters: ${r}`);
26
- }
27
- };
28
- export {
29
- w as getMetapropertiesOptions
30
- };
31
- //# sourceMappingURL=getMetapropertiesOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getMetapropertiesOptions.js","sources":["../../src/api/rest/getMetapropertiesOptions.ts"],"sourcesContent":["import { getRequest } from '.';\nimport { handlers } from './handlers';\nimport { AuthInformationState } from '@src/auth/useAuthInformation';\nimport { ensureValidUrl } from '@src/utils/url';\nimport { SmartfilterMetaproperty } from './types';\n\ntype OptionsRequestType = {\n\tauth: AuthInformationState | null;\n\tmetapropertyId: string;\n\tsmartfilterId: string;\n\tlabelKeyset: string;\n\tzindexKeyset: number;\n\tmpoKeyset: string;\n};\n\nexport const getMetapropertiesOptions = async ({\n\tauth,\n\tsmartfilterId,\n\tmetapropertyId,\n\tlabelKeyset,\n\tzindexKeyset,\n\tmpoKeyset,\n}: OptionsRequestType) => {\n\tif (!auth) throw new Error('No authentication provided');\n\n\tlet host =\n\t\tauth.accountDomain !== undefined\n\t\t\t? ensureValidUrl(auth.accountDomain.trim())\n\t\t\t: `https://${window.location.host}`;\n\n\t// For the sake of consistency, check if last char is a slash\n\t// and remove it\n\tif (host.charAt(host.length - 1) === '/') {\n\t\thost = host.slice(0, -1);\n\t}\n\n\tconst accessToken = auth.getAccessToken && auth.getAccessToken();\n\n\tconst headers = accessToken === undefined ? {} : { Authorization: `Bearer ${accessToken}` };\n\n\ttry {\n\t\tconst options = await getRequest<SmartfilterMetaproperty>(\n\t\t\t`${host}${handlers.metapropertiesWithOptions(\n\t\t\t\tsmartfilterId,\n\t\t\t\tmetapropertyId,\n\t\t\t)}?filterKey=savedFilters&limit=30&labelKeyset=${labelKeyset}&zindexKeyset=${zindexKeyset}&mpoKeyset=${mpoKeyset}`,\n\t\t\t{ headers },\n\t\t);\n\n\t\treturn options;\n\t} catch (error) {\n\t\tthrow new Error(`Error fetching initial filters: ${error}`);\n\t}\n};\n"],"names":["getMetapropertiesOptions","auth","smartfilterId","metapropertyId","labelKeyset","zindexKeyset","mpoKeyset","host","ensureValidUrl","accessToken","headers","getRequest","handlers","error"],"mappings":";;;AAeO,MAAMA,IAA2B,OAAO;AAAA,EAC9C,MAAAC;AAAA,EACA,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AACD,MAA0B;AACzB,MAAI,CAACL,EAAM,OAAM,IAAI,MAAM,4BAA4B;AAEvD,MAAIM,IACHN,EAAK,kBAAkB,SACpBO,EAAeP,EAAK,cAAc,KAAA,CAAM,IACxC,WAAW,OAAO,SAAS,IAAI;AAInC,EAAIM,EAAK,OAAOA,EAAK,SAAS,CAAC,MAAM,QACpCA,IAAOA,EAAK,MAAM,GAAG,EAAE;AAGxB,QAAME,IAAcR,EAAK,kBAAkBA,EAAK,eAAA,GAE1CS,IAAUD,MAAgB,SAAY,CAAA,IAAK,EAAE,eAAe,UAAUA,CAAW,GAAA;AAEvF,MAAI;AASH,WARgB,MAAME;AAAA,MACrB,GAAGJ,CAAI,GAAGK,EAAS;AAAA,QAClBV;AAAA,QACAC;AAAA,MAAA,CACA,gDAAgDC,CAAW,iBAAiBC,CAAY,cAAcC,CAAS;AAAA,MAChH,EAAE,SAAAI,EAAA;AAAA,IAAQ;AAAA,EAIZ,SAASG,GAAO;AACf,UAAM,IAAI,MAAM,mCAAmCA,CAAK,EAAE;AAAA,EAC3D;AACD;"}