@bynder/compact-view 5.0.2 → 5.0.3

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 (149) hide show
  1. package/App.d.ts +27 -0
  2. package/Components.d.ts +20 -0
  3. package/Dat/Dat.d.ts +12 -0
  4. package/Dat/DatContext.d.ts +12 -0
  5. package/Dat/DatDropdownItem.d.ts +9 -0
  6. package/Dat/index.d.ts +3 -0
  7. package/Dat/types.d.ts +7 -0
  8. package/Main.d.ts +1 -0
  9. package/__tests__/utils/index.d.ts +116 -0
  10. package/accesibility/helpers.d.ts +3 -0
  11. package/api/__tests__/utils.d.ts +10 -0
  12. package/api/filterAssets.d.ts +42 -0
  13. package/api/getAsset.d.ts +15 -0
  14. package/api/getAssets.d.ts +10 -0
  15. package/api/getCollections.d.ts +18 -0
  16. package/api/getFilters.d.ts +33 -0
  17. package/api/graphql.types.d.ts +17 -0
  18. package/api/index.d.ts +7 -0
  19. package/api/rest/autocomplete.d.ts +22 -0
  20. package/api/rest/getAssetCounts.d.ts +15 -0
  21. package/api/rest/getInitialFilters.d.ts +7 -0
  22. package/api/rest/getMetapropertiesOptions.d.ts +12 -0
  23. package/api/rest/handlers.d.ts +7 -0
  24. package/api/rest/index.d.ts +6 -0
  25. package/api/rest/types.d.ts +66 -0
  26. package/app-config/ConfigContext.d.ts +13 -0
  27. package/app-config/appConfig.type.d.ts +46 -0
  28. package/app-config/appConfig.type.guard.d.ts +2 -0
  29. package/auth/auth.d.ts +7 -0
  30. package/auth/crypto.d.ts +3 -0
  31. package/auth/loginwindow.d.ts +7 -0
  32. package/auth/oauth2.d.ts +16 -0
  33. package/auth/result.type.d.ts +13 -0
  34. package/auth/useAuthInformation.d.ts +18 -0
  35. package/common/components/CardSkeleton.d.ts +8 -0
  36. package/common/components/Checkbox.styles.d.ts +11 -0
  37. package/common/components/Chip.d.ts +10 -0
  38. package/common/components/DocumentIcon.d.ts +2 -0
  39. package/common/components/DragSelect.d.ts +28 -0
  40. package/common/components/HorizontalScroll.d.ts +8 -0
  41. package/common/components/InfiniteScroll.d.ts +9 -0
  42. package/common/components/LeftArrow.d.ts +5 -0
  43. package/common/components/Modal.d.ts +12 -0
  44. package/common/components/NoResults.d.ts +6 -0
  45. package/common/components/RightArrow.d.ts +5 -0
  46. package/common/components/Skeleton.d.ts +6 -0
  47. package/common/components/Spinner.d.ts +9 -0
  48. package/common/components/__tests__/utils.d.ts +34 -0
  49. package/common/components/dropdown/Dropdown.d.ts +16 -0
  50. package/common/components/dropdown/DropdownContent.d.ts +12 -0
  51. package/common/components/dropdown/DropdownListItem.d.ts +10 -0
  52. package/common/hooks/useClickOutside.d.ts +2 -0
  53. package/common/hooks/useDimensions.d.ts +9 -0
  54. package/constants.d.ts +7 -0
  55. package/error-handling/ErrorIcon.d.ts +2 -0
  56. package/error-handling/ErrorMessage.d.ts +6 -0
  57. package/error-handling/Oops.d.ts +9 -0
  58. package/error-handling/ReportModal.d.ts +8 -0
  59. package/error-handling/Shield.d.ts +17 -0
  60. package/error-handling/__tests__/utils.d.ts +56 -0
  61. package/filter/AssetFilter.d.ts +2 -0
  62. package/filter/AssetFilterContext.d.ts +39 -0
  63. package/filter/__tests__/utils.d.ts +13 -0
  64. package/filter/active-filters/ActiveFilter.d.ts +6 -0
  65. package/filter/active-filters/ActiveFilters.d.ts +2 -0
  66. package/filter/assetFilter.type.d.ts +10 -0
  67. package/filter/filters/advanced/Advanced.d.ts +14 -0
  68. package/filter/filters/advanced/AssetTypeItem.d.ts +7 -0
  69. package/filter/filters/metaproperty/Metaproperty.d.ts +9 -0
  70. package/filter/filters/metaproperty/MetapropertyFilterContent.d.ts +25 -0
  71. package/filter/filters/metaproperty/MetapropertyOption.d.ts +15 -0
  72. package/filter/filters/metaproperty/SmartFilterContent.d.ts +20 -0
  73. package/filter/filters/smartfilters/Metaproperties/Autocomplete.d.ts +14 -0
  74. package/filter/filters/smartfilters/Metaproperties/Option.d.ts +13 -0
  75. package/filter/filters/smartfilters/Metaproperties/SmartFilterSelect.d.ts +11 -0
  76. package/filter/filters/smartfilters/Smartfilters.d.ts +8 -0
  77. package/filter/filters/tags/TagItem.d.ts +6 -0
  78. package/filter/filters/tags/Tags.d.ts +8 -0
  79. package/index.js +77 -77
  80. package/index.mjs +1060 -0
  81. package/localization/index.d.ts +2 -0
  82. package/login/LoginComponent.d.ts +12 -0
  83. package/login/LoginContext.d.ts +19 -0
  84. package/login/__tests__/mocks.d.ts +1 -0
  85. package/login/__tests__/utils.d.ts +41 -0
  86. package/login/components/ConnectButton.d.ts +6 -0
  87. package/login/components/Container.d.ts +4 -0
  88. package/login/components/DomainInput.d.ts +11 -0
  89. package/login/components/Header.d.ts +2 -0
  90. package/login/components/RefreshingSpinner.d.ts +2 -0
  91. package/login/useAccountDomain.d.ts +2 -0
  92. package/order/DirectionSelect.d.ts +2 -0
  93. package/order/FieldSelect.d.ts +7 -0
  94. package/order/OrderingContext.d.ts +19 -0
  95. package/package.json +1 -7
  96. package/router/RouterContext.d.ts +19 -0
  97. package/search/SearchContext.d.ts +25 -0
  98. package/search/SearchInput.d.ts +2 -0
  99. package/select/FileSelector.d.ts +9 -0
  100. package/select/SelectionContext.d.ts +30 -0
  101. package/select/SelectionFooter.d.ts +2 -0
  102. package/select/__tests__/utils.d.ts +10 -0
  103. package/select/add-media/AddMedia.d.ts +7 -0
  104. package/select/add-media/ButtonAction.d.ts +6 -0
  105. package/select/add-media/addMedia.type.d.ts +15 -0
  106. package/select/current-selection/AssetItem.d.ts +5 -0
  107. package/select/current-selection/CollectionItem.d.ts +5 -0
  108. package/select/current-selection/SelectedItemContainer.d.ts +6 -0
  109. package/select/current-selection/SelectedItems.d.ts +5 -0
  110. package/select/file.type.d.ts +7 -0
  111. package/select/utils.d.ts +5 -0
  112. package/style/DesignSystemContext.d.ts +4 -0
  113. package/style/RootElementContext.d.ts +3 -0
  114. package/style/Theming.d.ts +27 -0
  115. package/style/shadowroot/ShadowRoot.d.ts +13 -0
  116. package/style/shadowroot/ShadowRootInternal.d.ts +12 -0
  117. package/style/shadowroot/__mocks__/ShadowRoot.d.ts +4 -0
  118. package/toolbar/Toolbar.d.ts +2 -0
  119. package/toolbar/ViewSwitch.d.ts +2 -0
  120. package/utils/__mocks__/logger.d.ts +4 -0
  121. package/utils/asyncDebounce.d.ts +1 -0
  122. package/utils/base64Converter.d.ts +2 -0
  123. package/utils/chunk.d.ts +1 -0
  124. package/utils/class.d.ts +25 -0
  125. package/utils/combineFilters.d.ts +8 -0
  126. package/utils/combineMetaproperties.d.ts +9 -0
  127. package/utils/filterEmptyMetaproperties.d.ts +2 -0
  128. package/utils/getMetaPropertiesForFilter.d.ts +2 -0
  129. package/utils/isObjectEmpty.d.ts +1 -0
  130. package/utils/logger.d.ts +6 -0
  131. package/utils/normalizeResponse.d.ts +3 -0
  132. package/utils/text.d.ts +2 -0
  133. package/utils/trimMetapropertyValue.d.ts +1 -0
  134. package/utils/url.d.ts +13 -0
  135. package/views/asset/AssetList.d.ts +20 -0
  136. package/views/asset/AssetsView.d.ts +2 -0
  137. package/views/asset/StatefulAssetList.d.ts +18 -0
  138. package/views/asset/__tests__/utils.d.ts +7 -0
  139. package/views/asset/asset-card/AssetCard.d.ts +13 -0
  140. package/views/asset/asset-card/AssetCardMetaproperties.d.ts +9 -0
  141. package/views/asset/asset-card/ContextAction.d.ts +8 -0
  142. package/views/asset/asset-card/utils.d.ts +5 -0
  143. package/views/asset/asset.type.d.ts +41 -0
  144. package/views/collection/CollectionView.d.ts +7 -0
  145. package/views/collection/collection.types.d.ts +7 -0
  146. package/views/collections/CollectionCard.d.ts +10 -0
  147. package/views/collections/CollectionList.d.ts +8 -0
  148. package/views/collections/CollectionsView.d.ts +2 -0
  149. package/views/collections/__tests__/utils.d.ts +5 -0
package/App.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { AssetFilterJson } from './filter/assetFilter.type';
3
+ import { AssetType } from './views/asset/asset.type';
4
+ import { SelectionMode } from './app-config/appConfig.type';
5
+ import { Theme } from './style/Theming';
6
+ import { File } from './select/file.type';
7
+ export interface Props {
8
+ assetFieldSelection?: string;
9
+ assetFilter?: AssetFilterJson;
10
+ assetTypes?: AssetType[];
11
+ defaultSearchTerm?: string;
12
+ language?: string;
13
+ mode?: SelectionMode;
14
+ onSuccess?: (assets: unknown[], additionalInformation: {
15
+ selectedFile?: File;
16
+ }) => void;
17
+ theme?: Theme;
18
+ hideExternalAccess?: boolean;
19
+ selectedAssets?: string[];
20
+ hideLimitedUse?: boolean;
21
+ isContainerMode?: boolean;
22
+ __shouldAddOriginal__?: boolean;
23
+ hideSwitch?: boolean;
24
+ noCache?: boolean;
25
+ selectAllOption?: boolean;
26
+ }
27
+ export declare function App({ assetFieldSelection, assetFilter, assetTypes, defaultSearchTerm, language, mode, onSuccess, theme, hideExternalAccess, selectedAssets, hideLimitedUse, isContainerMode, __shouldAddOriginal__, hideSwitch, noCache, selectAllOption, }: Props): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ export { AssetCard as Asset } from './views/asset/asset-card/AssetCard';
2
+ export { type Asset as displayAsset } from './views/asset/asset.type';
3
+ export { AssetList } from './views/asset/AssetList';
4
+ export { Button } from '@bynder/design-system';
5
+ export { Card } from '@bynder/design-system';
6
+ export { Checkbox } from '@bynder/design-system';
7
+ export { Chip } from './common/components/Chip';
8
+ export { Dropdown } from './common/components/dropdown/Dropdown';
9
+ export { DropdownListItem } from './common/components/dropdown/DropdownListItem';
10
+ export { MetaPropertyFilterContent as Metaproperty, type MetapropertyType as metaproperty, } from './filter/filters/metaproperty/MetapropertyFilterContent';
11
+ export { MetapropertyOptionComponent as MetapropertyOption, type MetapropertyOptionType as metapropertyOption, } from './filter/filters/metaproperty/MetapropertyOption';
12
+ export { SmartFilterContent as Smartfilter, type SmartfilterType as smartfilter, } from './filter/filters/metaproperty/SmartFilterContent';
13
+ export { HorizontalScroll } from './common/components/HorizontalScroll';
14
+ export { InfiniteScroll } from './common/components/InfiniteScroll';
15
+ export { Modal } from './common/components/Modal';
16
+ export { NoResults } from './common/components/NoResults';
17
+ export { Oops } from './error-handling/Oops';
18
+ export { ShadowRoot } from './style/shadowroot/ShadowRoot';
19
+ export { Skeleton } from './common/components/Skeleton';
20
+ export { Spinner } from './common/components/Spinner';
package/Dat/Dat.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Transformation } from './types';
3
+ interface Props {
4
+ transformBaseUrl: string;
5
+ assetName: string;
6
+ extension: string;
7
+ transformation?: Transformation;
8
+ setTransformation: (transformation?: Transformation) => void;
9
+ closeDat: () => void;
10
+ }
11
+ export declare function Dat({ transformBaseUrl, assetName, extension, transformation, setTransformation, closeDat, }: Props): React.ReactPortal | null;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Asset } from '../views/asset/asset.type';
3
+ import { Transformation } from './types';
4
+ export declare function DatProvider(props: {
5
+ children: React.ReactNode;
6
+ }): React.JSX.Element;
7
+ export declare function useTransformations(): {
8
+ transformation?: Transformation | undefined;
9
+ setTransformation: (transformation?: Transformation | undefined) => void;
10
+ openDat: (url: string, asset: Asset, name: string) => void;
11
+ closeDat: () => void;
12
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { Asset } from '../views/asset/asset.type';
3
+ interface Props {
4
+ transformBaseUrl?: string;
5
+ asset: Asset;
6
+ toggleDropdown: () => void;
7
+ }
8
+ export declare function DatDropdownItem({ transformBaseUrl, asset, toggleDropdown }: Props): React.JSX.Element | null;
9
+ export {};
package/Dat/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { Dat } from './Dat';
2
+ export { DatDropdownItem } from './DatDropdownItem';
3
+ export { DatProvider, useTransformations } from './DatContext';
package/Dat/types.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { Preset } from '@bynder/js-components-lib';
2
+ import { Asset } from '../views/asset/asset.type';
3
+ export interface Transformation {
4
+ url: string;
5
+ preset?: Preset;
6
+ asset: Asset;
7
+ }
package/Main.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function open(options: Record<string, unknown>): void;
@@ -0,0 +1,116 @@
1
+ import { Collection } from '../../views/collection/collection.types';
2
+ import { Asset } from '../../views/asset/asset.type';
3
+ import { MetapropertyType as Metaproperty, Tag } from '../../filter/filters/metaproperty/MetapropertyFilterContent';
4
+ import { MetapropertyOptionType as MetapropertyOption } from '../../filter/filters/metaproperty/MetapropertyOption';
5
+ import { SmartfilterType as Smartfilter } from '../../filter/filters/metaproperty/SmartFilterContent';
6
+ import { File } from '../../select/file.type';
7
+ export declare function mockLocalisation(): void;
8
+ export declare function makeFilterAssetsResponse(...assets: Asset[]): {
9
+ data: {
10
+ tag: string;
11
+ value: {
12
+ searchAssets: {
13
+ assets: {
14
+ nodes: Asset[];
15
+ totalCount: number;
16
+ };
17
+ };
18
+ };
19
+ };
20
+ };
21
+ export declare function makeAsset(properties: {
22
+ id: string;
23
+ } & Partial<Asset>): Asset;
24
+ export declare function makeFetchFiltersResponse({ assetTypeCounts, metaproperties, tags, isLoading, }: {
25
+ assetTypeCounts?: {
26
+ audio?: number;
27
+ document?: number;
28
+ image?: number;
29
+ video?: number;
30
+ archive?: number;
31
+ };
32
+ metaproperties?: (Metaproperty | Smartfilter)[];
33
+ tags?: Tag[];
34
+ isLoading?: boolean;
35
+ }): {
36
+ data: {
37
+ tag: string;
38
+ value: {
39
+ searchAssets: {
40
+ count: {
41
+ assetType: {
42
+ audio: number;
43
+ document: number;
44
+ image: number;
45
+ video: number;
46
+ archive: number;
47
+ };
48
+ };
49
+ metapropertyFilters: {
50
+ nodes: (Metaproperty | Smartfilter)[];
51
+ };
52
+ tags: {
53
+ nodes: Tag[];
54
+ };
55
+ };
56
+ };
57
+ };
58
+ isLoading: boolean;
59
+ };
60
+ export declare function makeMetapropertyFilter(properties: {
61
+ id: string;
62
+ } & Partial<Metaproperty>): {
63
+ id: string;
64
+ __typename: "Metaproperty";
65
+ label: string;
66
+ zIndex?: number | undefined;
67
+ options: MetapropertyOption[];
68
+ showInGridView: boolean;
69
+ showInListView: boolean;
70
+ };
71
+ export declare function makeMetapropertyOption(properties: {
72
+ id: string;
73
+ } & Partial<MetapropertyOption>): {
74
+ id: string;
75
+ label: string;
76
+ assetCount: number;
77
+ };
78
+ export declare function makeSmartFilter(properties: {
79
+ id: string;
80
+ } & Partial<Smartfilter>): Smartfilter;
81
+ export declare function makeTag(properties: {
82
+ id: string;
83
+ } & Partial<Tag>): {
84
+ id: string;
85
+ name: string;
86
+ assetCount: number;
87
+ };
88
+ export declare function makeFetchCollectionsResponse(...collections: Collection[]): {
89
+ data: {
90
+ tag: string;
91
+ value: {
92
+ collections: {
93
+ nodes: Collection[];
94
+ totalCount: number;
95
+ };
96
+ };
97
+ };
98
+ };
99
+ export declare function makeCollection(properties: {
100
+ id: string;
101
+ } & Partial<Collection>): Collection;
102
+ export declare function makeGetAssetResponse(asset: {
103
+ files: Record<string, File>;
104
+ id?: string;
105
+ }): Promise<import("../../auth/result.type").Ok<{
106
+ files: Record<string, File>;
107
+ id?: string | undefined;
108
+ }>>;
109
+ export declare function makeGetAssetsResponse(...assets: Array<{
110
+ files: Record<string, File>;
111
+ id?: string;
112
+ }>): Promise<import("../../auth/result.type").Ok<{
113
+ files: Record<string, File>;
114
+ id?: string | undefined;
115
+ }[]>>;
116
+ export declare function clickCard(card: HTMLElement, options?: any): void;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare function handleEnter(e: React.KeyboardEvent<Element>, fn?: (e?: any) => void): void;
3
+ export declare function handleSpace(e: React.KeyboardEvent<Element>, fn?: (e?: any) => void): void;
@@ -0,0 +1,10 @@
1
+ import { AuthInformationState } from '../../auth/useAuthInformation';
2
+ export declare const mockAuth: AuthInformationState;
3
+ export declare const errorResponse: {
4
+ errors: {
5
+ message: string;
6
+ }[];
7
+ };
8
+ export declare const getSuccessfulResponse: (data: any) => {
9
+ data: any;
10
+ };
@@ -0,0 +1,42 @@
1
+ import { Result } from '../auth/result.type';
2
+ import { Ordering } from '../order/OrderingContext';
3
+ import { Collection } from '../views/collection/collection.types';
4
+ import { AssetType, Asset } from '../views/asset/asset.type';
5
+ import { Connection } from './graphql.types';
6
+ import { Filter } from '../filter/AssetFilterContext';
7
+ import { AssetFilterJson } from '../filter/assetFilter.type';
8
+ import { MetapropertyType } from '../filter/filters/metaproperty/MetapropertyFilterContent';
9
+ import { AuthInformationState } from '../auth/useAuthInformation';
10
+ interface GraphqlResponse {
11
+ searchAssets: {
12
+ assets: Assets;
13
+ };
14
+ }
15
+ export interface Assets {
16
+ nodes: Asset[];
17
+ totalCount: number;
18
+ pageInfo: {
19
+ endCursor: string;
20
+ hasNextPage: boolean;
21
+ };
22
+ metaproperties: {
23
+ nodes: MetapropertyType[];
24
+ };
25
+ }
26
+ interface Options {
27
+ allAssetTypes?: AssetType[];
28
+ collection?: Collection;
29
+ searchTerm?: string;
30
+ filter?: Omit<Filter, 'metaproperties' | 'existingFilters'>;
31
+ predefinedFilter?: AssetFilterJson;
32
+ orderBy: Ordering;
33
+ language: string;
34
+ }
35
+ export declare function useFilterAssets(options: Options, noCache?: boolean): Connection<GraphqlResponse>;
36
+ export declare function getAssetsByMediaId(options: {
37
+ ids: string[];
38
+ auth: AuthInformationState | null;
39
+ language: string;
40
+ noCache?: boolean;
41
+ }): Promise<Result<Asset[], string>>;
42
+ export {};
@@ -0,0 +1,15 @@
1
+ import { Result } from '../auth/result.type';
2
+ import { File } from '../select/file.type';
3
+ import { AuthInformationState } from '../auth/useAuthInformation';
4
+ export declare const defaultAssetFieldSelection = "\n id\n name\n description\n databaseId\n createdAt\n originalUrl\n publishedAt\n tags\n type\n updatedAt\n url\n extensions\n metaproperties {\n nodes {\n name\n type\n options {\n name\n displayLabel\n }\n }\n }\n textMetaproperties {\n name\n value\n }\n derivatives {\n thumbnail\n webImage\n }\n ... on Video {\n previewUrls\n }\n";
5
+ export interface Asset {
6
+ id: string;
7
+ files: Record<string, File>;
8
+ databaseId?: string;
9
+ }
10
+ export declare function getAsset(options: {
11
+ assetId: string;
12
+ auth: AuthInformationState | null;
13
+ assetFieldSelection?: string;
14
+ noCache?: boolean;
15
+ }): Promise<Result<Asset, string>>;
@@ -0,0 +1,10 @@
1
+ import { Result } from '../auth/result.type';
2
+ import { SelectedItem } from '../select/SelectionContext';
3
+ import { Asset } from './getAsset';
4
+ import { AuthInformationState } from '../auth/useAuthInformation';
5
+ export declare function getAssets(options: {
6
+ selectedItems: SelectedItem[];
7
+ auth: AuthInformationState | null;
8
+ assetFieldSelection?: string;
9
+ noCache?: boolean;
10
+ }): Promise<Result<Asset[], string>>;
@@ -0,0 +1,18 @@
1
+ import { Ordering } from '../order/OrderingContext';
2
+ import { Collection } from '../views/collection/collection.types';
3
+ import { Connection } from './graphql.types';
4
+ export interface GraphqlResponse {
5
+ collections: Collections;
6
+ }
7
+ export interface Collections {
8
+ nodes: Collection[];
9
+ totalCount: number;
10
+ pageInfo: {
11
+ endCursor: string;
12
+ hasNextPage: boolean;
13
+ };
14
+ }
15
+ export declare function useGetCollections(options: {
16
+ searchTerm?: string;
17
+ orderBy: Ordering;
18
+ }, noCache?: boolean): Connection<GraphqlResponse>;
@@ -0,0 +1,33 @@
1
+ import { Data } from './graphql.types';
2
+ import { Tag } from '../filter/filters/metaproperty/MetapropertyFilterContent';
3
+ import { Filter } from '../filter/AssetFilterContext';
4
+ import { AssetType } from '../views/asset/asset.type';
5
+ import { AssetFilterJson } from '@src/filter/assetFilter.type';
6
+ export interface GraphqlFiltersResponse {
7
+ searchAssets: {
8
+ count: {
9
+ assetType: {
10
+ audio: number;
11
+ document: number;
12
+ image: number;
13
+ video: number;
14
+ archive: number;
15
+ };
16
+ };
17
+ tags?: {
18
+ nodes: Tag[];
19
+ };
20
+ };
21
+ }
22
+ export declare const query = "\nquery searchAssets($filter: AssetFilter!, $language: String!) {\n searchAssets(filter: $filter) {\n tags {\n nodes {\n id\n name\n assetCount\n }\n }\n count {\n assetType {\n image\n video\n audio\n document\n archive\n }\n }\n }\n }";
23
+ export declare function useGetFilters(options: {
24
+ filter: Filter;
25
+ searchTerm: null | undefined | string;
26
+ allAssetTypes: AssetType[];
27
+ language: string;
28
+ predefinedFilter?: AssetFilterJson;
29
+ collectionId: string | null;
30
+ }, noCache?: boolean): {
31
+ data: Data<GraphqlFiltersResponse>;
32
+ isLoading: boolean;
33
+ };
@@ -0,0 +1,17 @@
1
+ export type Data<T> = {
2
+ tag: 'Loading';
3
+ value: null | undefined | T;
4
+ } | {
5
+ tag: 'Loaded';
6
+ value: T;
7
+ } | {
8
+ tag: 'Failure';
9
+ value: string;
10
+ };
11
+ export interface Connection<T> {
12
+ data: Data<T>;
13
+ executeQuery: () => void;
14
+ isLoading: boolean;
15
+ loadMore: () => void;
16
+ hasNextPage: boolean;
17
+ }
package/api/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { AuthInformationState } from '@src/auth/useAuthInformation';
2
+ export declare function fetchWithGraphql(options: {
3
+ query: string;
4
+ variables: Record<string, unknown>;
5
+ auth: AuthInformationState | null;
6
+ noCache?: boolean;
7
+ }): Promise<import("@src/auth/result.type").Err<any> | import("@src/auth/result.type").Ok<unknown>>;
@@ -0,0 +1,22 @@
1
+ import { AuthInformationState } from '@src/auth/useAuthInformation';
2
+ type AutocompleteOption = {
3
+ icon: string;
4
+ id: string;
5
+ isSelected: boolean;
6
+ label: string;
7
+ name: string;
8
+ };
9
+ interface Response {
10
+ hasNextPage?: boolean;
11
+ metapropertyOptions?: Array<AutocompleteOption>;
12
+ }
13
+ export interface AutocompleteOptions extends Response {
14
+ id?: string;
15
+ }
16
+ export declare const getAutocompleteOptions: ({ metapropertyId, auth, searchTerm, page, }: {
17
+ metapropertyId: string;
18
+ auth: AuthInformationState | null;
19
+ searchTerm: string;
20
+ page?: number | undefined;
21
+ }) => Promise<AutocompleteOptions>;
22
+ export {};
@@ -0,0 +1,15 @@
1
+ import { AssetType } from '@src/views/asset/asset.type';
2
+ import { AuthInformationState } from '@src/auth/useAuthInformation';
3
+ import { selectedSmartfilterOptionsType, AssetCountType } from './types';
4
+ export interface AssetFilter {
5
+ searchTerm?: string;
6
+ tagNames?: string[];
7
+ assetTypes?: AssetType[];
8
+ collectionId?: string;
9
+ metaproperties?: selectedSmartfilterOptionsType;
10
+ isLimitedUse?: boolean;
11
+ }
12
+ export declare const getAssetCounts: ({ auth, filter, }: {
13
+ auth: AuthInformationState | null;
14
+ filter: AssetFilter;
15
+ }) => Promise<AssetCountType>;
@@ -0,0 +1,7 @@
1
+ import { AuthInformationState } from '@src/auth/useAuthInformation';
2
+ export declare const getInitialFilters: ({ auth }: {
3
+ auth: AuthInformationState | null;
4
+ }) => Promise<{
5
+ filters: import("./types").Smartfilter[];
6
+ metaproperties: {};
7
+ }>;
@@ -0,0 +1,12 @@
1
+ import { AuthInformationState } from '@src/auth/useAuthInformation';
2
+ import { SmartfilterMetaproperty } from './types';
3
+ type OptionsRequestType = {
4
+ auth: AuthInformationState | null;
5
+ metapropertyId: string;
6
+ smartfilterId: string;
7
+ labelKeyset: string;
8
+ zindexKeyset: number;
9
+ mpoKeyset: string;
10
+ };
11
+ export declare const getMetapropertiesOptions: ({ auth, smartfilterId, metapropertyId, labelKeyset, zindexKeyset, mpoKeyset, }: OptionsRequestType) => Promise<SmartfilterMetaproperty>;
12
+ export {};
@@ -0,0 +1,7 @@
1
+ export declare const handlers: {
2
+ smartfilters: string;
3
+ metaproperties: string;
4
+ autocomplete: string;
5
+ options: (id: string) => string;
6
+ metapropertiesWithOptions: (smartfilterId: string, metapropertyId: string) => string;
7
+ };
@@ -0,0 +1,6 @@
1
+ import { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
2
+ export declare const onSuccess: <T>(response: AxiosResponse<T, any>) => T;
3
+ export declare const onError: (error: AxiosError) => never;
4
+ declare const getRequest: <T>(endpoint: string, params?: AxiosRequestConfig) => Promise<T>;
5
+ declare const postRequest: <T>(endpoint: string, data: unknown, config?: AxiosRequestConfig) => Promise<T>;
6
+ export { getRequest, postRequest };
@@ -0,0 +1,66 @@
1
+ export type Smartfilter = {
2
+ icon: string;
3
+ labels: Record<string, string>;
4
+ zindex: number;
5
+ id: string;
6
+ metaproperties: string[];
7
+ };
8
+ export type SmartfilterResponse = Smartfilter[];
9
+ export type SmartfilterOption = {
10
+ count: number;
11
+ zindex: number;
12
+ name: string;
13
+ id: string;
14
+ isSelected: boolean;
15
+ label: string;
16
+ icon?: string;
17
+ };
18
+ export type SmartfilterSelectedOptionType = Pick<SmartfilterOption, 'id' | 'label'> & {
19
+ metapropertyName: string;
20
+ };
21
+ export type SmartfilterMetaproperty = {
22
+ dependencyId: string;
23
+ isMultifilter: number;
24
+ options: SmartfilterOption[];
25
+ showImage: boolean;
26
+ isMainFilter: boolean;
27
+ zindex: number;
28
+ showCounter: boolean;
29
+ name: string;
30
+ id: string;
31
+ showFilterToGetAssetsWithoutMetaproperty: boolean;
32
+ type: string;
33
+ label: string;
34
+ numberOfOptions: number;
35
+ };
36
+ export type AutocompleteOption = {
37
+ count: number;
38
+ zindex: number;
39
+ name: string;
40
+ id: string;
41
+ isSelected: boolean;
42
+ label: string;
43
+ icon?: string;
44
+ };
45
+ export type AutcompleteResponseOption = {
46
+ dependencyId: string;
47
+ isMultifilter: number;
48
+ options: AutocompleteOption[];
49
+ showImage: boolean;
50
+ isMainFilter: boolean;
51
+ zindex: number;
52
+ showCounter: boolean;
53
+ name: string;
54
+ id: string;
55
+ showFilterToGetAssetsWithoutMetaproperty: boolean;
56
+ type: string;
57
+ label: string;
58
+ numberOfOptions: number;
59
+ };
60
+ export type selectedSmartfilterOptionsType = Record<string, Record<string, SmartfilterSelectedOptionType>>;
61
+ type Count = Record<string, number>;
62
+ export type AssetCountType = {
63
+ count: Record<string, Count>;
64
+ media: string[];
65
+ };
66
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { Config as ProvidedConfig, SelectionMode } from './appConfig.type';
3
+ type Config = Required<Pick<ProvidedConfig, 'language' | 'onSuccess' | 'assetTypes'>> & Pick<ProvidedConfig, 'assetFieldSelection' | 'assetFilter' | 'hideExternalAccess' | 'theme' | 'mode' | 'hideSwitch' | '__shouldAddOriginal__' | 'noCache' | 'selectAllOption'> & {
4
+ selectionMode: SelectionMode;
5
+ };
6
+ export declare const defaultConfig: Config;
7
+ export declare const ConfigProvider: import("react").Provider<Config>;
8
+ export declare const useConfig: () => Config;
9
+ export declare const useTheme: () => import("..").theme | undefined;
10
+ export declare const useAssetFilter: () => import("..").assetFilter | undefined;
11
+ export declare const useSelectionMode: () => SelectionMode;
12
+ export declare const useHideSwitch: () => boolean | undefined;
13
+ export {};
@@ -0,0 +1,46 @@
1
+ import { Theme } from '../style/Theming';
2
+ import { File } from '../select/file.type';
3
+ import { AssetFilterJson } from '../filter/assetFilter.type';
4
+ import { AssetType } from '../views/asset/asset.type';
5
+ export type AdditionalInfo = {
6
+ selectedFile?: File;
7
+ };
8
+ export type OnSuccessCallback = (assets: unknown[], additionalInfo: AdditionalInfo) => void;
9
+ export type SelectionMode = 'SingleSelect' | 'SingleSelectFile' | 'MultiSelect';
10
+ export interface PortalConfig {
11
+ url: string;
12
+ editable?: boolean;
13
+ }
14
+ /**
15
+ * When starting the app or tests a .guard.ts file will be generated. This file
16
+ * will contain a method which is able to validate if a variable is consistent
17
+ * with the Config type.
18
+ */
19
+ /** @see {validateConfig} ts-auto-guard:type-guard */
20
+ export interface Config {
21
+ assetFieldSelection?: string;
22
+ assetFilter?: AssetFilterJson;
23
+ assetTypes?: AssetType[];
24
+ container?: HTMLElement;
25
+ language?: string;
26
+ onSuccess?: OnSuccessCallback;
27
+ mode?: SelectionMode;
28
+ portal?: PortalConfig;
29
+ defaultSearchTerm?: string;
30
+ theme?: Theme;
31
+ hideExternalAccess?: boolean;
32
+ selectedAssets?: string[];
33
+ authentication?: {
34
+ getAccessToken: () => string;
35
+ hideLogout?: boolean;
36
+ };
37
+ onLogout?: () => void;
38
+ hideLimitedUse?: boolean;
39
+ modalStyles?: {
40
+ [key: string]: string;
41
+ };
42
+ hideSwitch?: boolean;
43
+ __shouldAddOriginal__?: boolean;
44
+ noCache?: boolean;
45
+ selectAllOption?: boolean;
46
+ }
@@ -0,0 +1,2 @@
1
+ import { Config } from "./appConfig.type";
2
+ export declare function validateConfig(obj: any, argumentName?: string): obj is Config;
package/auth/auth.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { Result } from './result.type';
2
+ export interface AuthenticationResponse {
3
+ accessToken: string;
4
+ refreshToken: string;
5
+ expiresIn: number;
6
+ }
7
+ export declare function authenticate(accountDomain: string): Promise<Result<AuthenticationResponse, string>>;
@@ -0,0 +1,3 @@
1
+ export declare function base64URLEncode(str: ArrayBuffer): string;
2
+ export declare function sha256(s: string): Promise<ArrayBuffer>;
3
+ export declare function randomString(): string;
@@ -0,0 +1,7 @@
1
+ import { Result } from './result.type';
2
+ interface LoginWindowResponse {
3
+ state: string | null;
4
+ code: string | null;
5
+ }
6
+ export declare function waitForAuthorizationFromLoginWindow(url: string): Promise<Result<LoginWindowResponse, string>>;
7
+ export {};
@@ -0,0 +1,16 @@
1
+ import { Result } from './result.type';
2
+ export declare const redirectOrigin: string;
3
+ export type AuthPlatform = 'bynder' | 'webdam' | 'invalid';
4
+ export declare function makeAuthorizeRequestUrl(codeChallenge: string, state: string, accountDomain: string): string;
5
+ interface TokenRequest {
6
+ refreshToken: string;
7
+ accessToken: string;
8
+ expiresIn: string;
9
+ }
10
+ export declare function postTokenRequest(code: string, code_verifier: string, accountDomain: string): Promise<Result<TokenRequest, string>>;
11
+ interface RefreshTokenRequest {
12
+ accessToken: string;
13
+ expiresIn: number;
14
+ }
15
+ export declare function postRefreshTokenRequest(refreshToken: string, accountDomain: string): Promise<Result<RefreshTokenRequest, string>>;
16
+ export {};
@@ -0,0 +1,13 @@
1
+ export type Ok<T> = {
2
+ tag: 'ok';
3
+ value: T;
4
+ };
5
+ export interface Err<E> {
6
+ tag: 'error';
7
+ error: E;
8
+ }
9
+ export type Result<T, E> = Ok<T> | Err<E>;
10
+ export declare function ok<T>(value: T): Ok<T>;
11
+ export declare function err<E>(error: E): Err<E>;
12
+ export declare function isOk<T, E = unknown>(result: Result<T, E>): result is Ok<T>;
13
+ export declare function isErr<E, T = unknown>(result: Result<T, E>): result is Err<E>;