@ludo.ninja/components 2.2.37 → 2.2.39

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 (53) hide show
  1. package/build/api/server-search/queries/useFetchAllCreations/index.d.ts +7 -7
  2. package/build/api/server-search/queries/useFetchAllCreations/index.js +7 -10
  3. package/build/api/server-search/queries/useFetchCollections/index.d.ts +6 -6
  4. package/build/api/server-search/queries/useFetchCollections/index.js +10 -12
  5. package/build/api/server-search/queries/useFetchDynamicCollectionData/index.d.ts +4 -4
  6. package/build/api/server-search/queries/useFetchDynamicCollectionData/index.js +8 -11
  7. package/build/api/server-search/queries/useFindCreations/index.d.ts +7 -7
  8. package/build/api/server-search/queries/useFindCreations/index.js +9 -12
  9. package/build/api/server-search/queries/useFindUserCreations/index.d.ts +3 -3
  10. package/build/api/server-search/queries/useFindUserCreations/index.js +7 -10
  11. package/build/api/server-search/queries/useFindUserLudoCreations/index.d.ts +3 -3
  12. package/build/api/server-search/queries/useFindUserLudoCreations/index.js +7 -10
  13. package/build/components/gallery/add/addCreationToGallery/index.js +7 -7
  14. package/build/components/search/SearchInputContainer.d.ts +1 -1
  15. package/build/components/search/SearchInputContainer.js +14 -17
  16. package/build/entities/creation/collectionCreationBuilder.d.ts +2 -2
  17. package/build/entities/creation/collectionCreationBuilder.js +4 -3
  18. package/build/hooks/favorites/useGetFavoriteGallaryCreations/index.d.ts +2 -3
  19. package/build/hooks/favorites/useGetFavoriteGallaryCreations/index.js +7 -9
  20. package/build/hooks/favorites/useGetUserFevoritesCreations/index.d.ts +3 -4
  21. package/build/hooks/favorites/useGetUserFevoritesCreations/index.js +6 -9
  22. package/build/hooks/galleries/useGetUserGalleriesCreations/index.d.ts +3 -4
  23. package/build/hooks/galleries/useGetUserGalleriesCreations/index.js +6 -9
  24. package/build/hooks/likes/dynamic/useFindCollectionsAndLikes.d.ts +6 -6
  25. package/build/hooks/likes/dynamic/useFindCollectionsAndLikes.js +15 -17
  26. package/build/hooks/likes/dynamic/useFindCreationsAndLikes.d.ts +4 -4
  27. package/build/hooks/likes/dynamic/useFindCreationsAndLikes.js +12 -15
  28. package/build/hooks/likes/dynamic/useGetCollectionInfoAndLikes.d.ts +4 -4
  29. package/build/hooks/likes/dynamic/useGetCollectionInfoAndLikes.js +11 -18
  30. package/build/hooks/likes/dynamic/useGetCreationsAndLikes.d.ts +4 -5
  31. package/build/hooks/likes/dynamic/useGetCreationsAndLikes.js +12 -17
  32. package/build/hooks/likes/dynamic/useGetCreationsAndLikesByType.d.ts +4 -4
  33. package/build/hooks/likes/dynamic/useGetCreationsAndLikesByType.js +16 -19
  34. package/build/hooks/likes/dynamic/useGetMixedLikesFavoriteList.d.ts +4 -5
  35. package/build/hooks/likes/dynamic/useGetMixedLikesFavoriteList.js +9 -10
  36. package/build/hooks/likes/dynamic/useGetTableLikes.d.ts +4 -5
  37. package/build/hooks/likes/dynamic/useGetTableLikes.js +14 -21
  38. package/build/modules/gallery/api/useGetAssetsAndCollectionForFavorite.d.ts +2 -2
  39. package/build/modules/gallery/api/useGetAssetsAndCollectionForFavorite.js +7 -10
  40. package/build/modules/gallery/ui/itemsPreview/index.d.ts +2 -3
  41. package/build/modules/gallery/ui/itemsPreview/index.js +9 -4
  42. package/build/modules/gallery/useToGalleryAsset.d.ts +5 -5
  43. package/build/modules/gallery/useToGalleryAsset.js +7 -7
  44. package/build/modules/virtuoso/types.d.ts +0 -3
  45. package/build/system/Cards/CreationCard/CardHead.d.ts +2 -3
  46. package/build/system/Cards/CreationCard/CardHead.js +5 -14
  47. package/build/system/Cards/CreationCard/index.d.ts +2 -2
  48. package/build/system/Cards/CreationCard/index.js +7 -6
  49. package/build/system/Cards/MultiMediaCard/index.d.ts +3 -4
  50. package/build/system/Cards/MultiMediaCard/index.js +5 -4
  51. package/build/utils/extractItemIds.d.ts +2 -2
  52. package/build/utils/extractItemIds.js +1 -7
  53. package/package.json +1 -1
@@ -1,26 +1,26 @@
1
- import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
2
- import { searchSchema as schema } from '@ludo.ninja/api';
3
- import CreationEntity from '../../../../dto/CreationEntity';
1
+ import { TCreation } from '../../../../entities/creation/types';
2
+ import { ApolloClient, NormalizedCacheObject } from "@apollo/client";
3
+ import { searchSchema as schema } from "@ludo.ninja/api";
4
4
  export declare const prefetchAllCreations: ({ page }: schema.IQueryFetchAllCreationsArgs, apolloClient: ApolloClient<NormalizedCacheObject>) => Promise<import("@apollo/client").ApolloQueryResult<any> | {
5
5
  data: {
6
6
  fetchAllCreations: null;
7
7
  };
8
8
  }>;
9
- export declare const useFetchAllCreations: ({ page, }: schema.IQueryFetchAllCreationsArgs) => {
9
+ export declare const useFetchAllCreations: ({ page }: schema.IQueryFetchAllCreationsArgs) => {
10
10
  loadMore: (pageToken: string | null) => Promise<void>;
11
11
  loading: boolean;
12
12
  refetchQuery: () => Promise<void>;
13
13
  error: import("@apollo/client").ApolloError | undefined;
14
- allCreations: CreationEntity[];
14
+ allCreations: TCreation[];
15
15
  nextPageToken: string | null;
16
16
  };
17
17
  declare const _default: {
18
- useFetchAllCreations: ({ page, }: schema.IQueryFetchAllCreationsArgs) => {
18
+ useFetchAllCreations: ({ page }: schema.IQueryFetchAllCreationsArgs) => {
19
19
  loadMore: (pageToken: string | null) => Promise<void>;
20
20
  loading: boolean;
21
21
  refetchQuery: () => Promise<void>;
22
22
  error: import("@apollo/client").ApolloError | undefined;
23
- allCreations: CreationEntity[];
23
+ allCreations: TCreation[];
24
24
  nextPageToken: string | null;
25
25
  };
26
26
  prefetchAllCreations: ({ page }: schema.IQueryFetchAllCreationsArgs, apolloClient: ApolloClient<NormalizedCacheObject>) => Promise<import("@apollo/client").ApolloQueryResult<any> | {
@@ -1,13 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.useFetchAllCreations = exports.prefetchAllCreations = void 0;
7
- const react_1 = require("react");
4
+ const builder_1 = require("../../../../entities/creation/builder");
8
5
  const client_1 = require("@apollo/client");
9
6
  const api_1 = require("@ludo.ninja/api");
10
- const CreationEntity_1 = __importDefault(require("../../../../dto/CreationEntity"));
7
+ const react_1 = require("react");
11
8
  const prefetchAllCreations = ({ page }, apolloClient) => {
12
9
  return apolloClient
13
10
  .query({
@@ -16,7 +13,7 @@ const prefetchAllCreations = ({ page }, apolloClient) => {
16
13
  page,
17
14
  },
18
15
  context: { uri: api_1.hosts.serverSearchHost },
19
- fetchPolicy: 'network-only',
16
+ fetchPolicy: "network-only",
20
17
  })
21
18
  .catch(() => {
22
19
  return {
@@ -26,7 +23,7 @@ const prefetchAllCreations = ({ page }, apolloClient) => {
26
23
  };
27
24
  exports.prefetchAllCreations = prefetchAllCreations;
28
25
  const maxCreationLength = 1000;
29
- const useFetchAllCreations = ({ page, }) => {
26
+ const useFetchAllCreations = ({ page }) => {
30
27
  const [allCreations, setCreations] = (0, react_1.useState)([]);
31
28
  const [nextPageToken, setNextPageToken] = (0, react_1.useState)(null);
32
29
  const { error, loading, fetchMore, networkStatus, refetch } = api_1.searchSchema.useFetchAllCreationsQuery({
@@ -37,7 +34,7 @@ const useFetchAllCreations = ({ page, }) => {
37
34
  uri: api_1.hosts.searchHost,
38
35
  },
39
36
  onCompleted: ({ fetchAllCreations }) => {
40
- setCreations(fetchAllCreations.creations.map((creation) => new CreationEntity_1.default(creation)));
37
+ setCreations(fetchAllCreations.creations.map((creation) => (0, builder_1.buildCreation)(creation)));
41
38
  setNextPageToken(fetchAllCreations.nextPage?.token || null);
42
39
  },
43
40
  onError: () => {
@@ -64,14 +61,14 @@ const useFetchAllCreations = ({ page, }) => {
64
61
  variables: {
65
62
  page: {
66
63
  token: pageToken,
67
- ...(page && 'size' in page ? { size: page.size } : {}),
64
+ ...(page && "size" in page ? { size: page.size } : {}),
68
65
  },
69
66
  },
70
67
  updateQuery: (prev, { fetchMoreResult }) => {
71
68
  if (!fetchMoreResult)
72
69
  return prev;
73
70
  const { creations: nextCreations, ...response } = fetchMoreResult.fetchAllCreations;
74
- if (prev !== null && prev.hasOwnProperty('fetchAllCreations')) {
71
+ if (prev !== null && prev.hasOwnProperty("fetchAllCreations")) {
75
72
  const { creations: prevCreations } = prev.fetchAllCreations;
76
73
  return {
77
74
  fetchAllCreations: {
@@ -1,21 +1,21 @@
1
- import { searchSchema as schema } from '@ludo.ninja/api';
2
- import CollectionCreationEntity from '../../../../dto/Collection/CollectionCreationEntity';
3
- export declare const useFindCollections: ({ term, input, page, }: schema.IQueryFindCollectionsArgs) => {
1
+ import { TCreation } from '../../../../entities/creation/types';
2
+ import { searchSchema as schema } from "@ludo.ninja/api";
3
+ export declare const useFindCollections: ({ term, input, page }: schema.IQueryFindCollectionsArgs) => {
4
4
  loadMore: (pageToken: string) => Promise<void>;
5
5
  loading: boolean;
6
6
  error: import("@apollo/client").ApolloError | undefined;
7
7
  results: number;
8
- collections: CollectionCreationEntity[];
8
+ collections: TCreation[];
9
9
  nextPageToken: string | null;
10
10
  refetchQuery: () => Promise<void>;
11
11
  };
12
12
  declare const _default: {
13
- useFindCollections: ({ term, input, page, }: schema.IQueryFindCollectionsArgs) => {
13
+ useFindCollections: ({ term, input, page }: schema.IQueryFindCollectionsArgs) => {
14
14
  loadMore: (pageToken: string) => Promise<void>;
15
15
  loading: boolean;
16
16
  error: import("@apollo/client").ApolloError | undefined;
17
17
  results: number;
18
- collections: CollectionCreationEntity[];
18
+ collections: TCreation[];
19
19
  nextPageToken: string | null;
20
20
  refetchQuery: () => Promise<void>;
21
21
  };
@@ -1,15 +1,13 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.useFindCollections = void 0;
7
- const react_1 = require("react");
4
+ const collectionCreationBuilder_1 = require("../../../../entities/creation/collectionCreationBuilder");
5
+ const types_1 = require("../../../../entities/labelCreationType/types");
6
+ const ui_1 = require("../../../../store/ui");
8
7
  const client_1 = require("@apollo/client");
9
8
  const api_1 = require("@ludo.ninja/api");
10
9
  const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
11
- const ui_1 = require("../../../../store/ui");
12
- const CollectionCreationEntity_1 = __importDefault(require("../../../../dto/Collection/CollectionCreationEntity"));
10
+ const react_1 = require("react");
13
11
  // export const prefetchFindCollections = (
14
12
  // { term, input, pageSize, pageToken }: schema.IQueryFindCollectionsArgs,
15
13
  // apolloClient: ApolloClient<NormalizedCacheObject>
@@ -28,7 +26,7 @@ const CollectionCreationEntity_1 = __importDefault(require("../../../../dto/Coll
28
26
  // });
29
27
  // };
30
28
  const maxCollectionsLength = 1000;
31
- const useFindCollections = ({ term, input, page, }) => {
29
+ const useFindCollections = ({ term, input, page }) => {
32
30
  const [collections, setCollections] = (0, react_1.useState)([]);
33
31
  const [nextPageToken, setNextPageToken] = (0, react_1.useState)(null);
34
32
  const [results, setResults] = (0, react_1.useState)(0);
@@ -38,18 +36,18 @@ const useFindCollections = ({ term, input, page, }) => {
38
36
  uri: api_1.hosts.searchHost,
39
37
  },
40
38
  variables: { term, input, page },
41
- onCompleted: ({ findCollections: { collections, nextPageToken, results }, }) => {
42
- setCollections(collections.map((collection) => new CollectionCreationEntity_1.default({
39
+ onCompleted: ({ findCollections: { collections, nextPageToken, results } }) => {
40
+ setCollections(collections.map((collection) => (0, collectionCreationBuilder_1.buildCollectionCreation)({
43
41
  ...collection,
44
42
  name: collection.collectionTitle,
45
- }, 'collection')));
43
+ }, types_1.LabelKeys.collection)));
46
44
  setResults(results);
47
45
  setNextPageToken(nextPageToken);
48
46
  },
49
47
  onError: () => {
50
48
  openAlert({
51
49
  type: type_1.alertVariants.error,
52
- caption: 'Oops, something went wrong.',
50
+ caption: "Oops, something went wrong.",
53
51
  });
54
52
  setCollections([]);
55
53
  setNextPageToken(null);
@@ -76,7 +74,7 @@ const useFindCollections = ({ term, input, page, }) => {
76
74
  if (!fetchMoreResult)
77
75
  return prev;
78
76
  const { collections: nextCollections, ...rest } = fetchMoreResult.findCollections;
79
- if (prev !== null && prev.hasOwnProperty('findCollections')) {
77
+ if (prev !== null && prev.hasOwnProperty("findCollections")) {
80
78
  const { collections: prevCollections } = prev.findCollections;
81
79
  return {
82
80
  findCollections: {
@@ -1,11 +1,11 @@
1
- import { searchSchema as schema } from '@ludo.ninja/api';
2
- import CollectionCreationEntity from '../../../../dto/Collection/CollectionCreationEntity';
3
- declare const useFetchDynamicCollectionData: ({ input, }: schema.IQueryFetchDynamicCollectionDataArgs) => {
1
+ import { TCreation } from '../../../../entities/creation/types';
2
+ import { searchSchema as schema } from "@ludo.ninja/api";
3
+ declare const useFetchDynamicCollectionData: ({ input }: schema.IQueryFetchDynamicCollectionDataArgs) => {
4
4
  loadMore: (pageToken: string | null) => Promise<void>;
5
5
  loading: boolean;
6
6
  error: import("@apollo/client").ApolloError | undefined;
7
7
  refetchQuery: () => Promise<void>;
8
- collectionAssetsList: CollectionCreationEntity[];
8
+ collectionAssetsList: TCreation[];
9
9
  nextPageToken: string | null;
10
10
  likesCount: number;
11
11
  isLikedByUser: boolean;
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.useFetchDynamicCollectionData = void 0;
7
- const react_1 = require("react");
4
+ const collectionCreationBuilder_1 = require("../../../../entities/creation/collectionCreationBuilder");
5
+ const ui_1 = require("../../../../store/ui");
8
6
  const client_1 = require("@apollo/client");
9
7
  const api_1 = require("@ludo.ninja/api");
10
8
  const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
11
- const ui_1 = require("../../../../store/ui");
12
- const CollectionCreationEntity_1 = __importDefault(require("../../../../dto/Collection/CollectionCreationEntity"));
9
+ const react_1 = require("react");
13
10
  const maxCollectionListLength = 1000;
14
- const useFetchDynamicCollectionData = ({ input, }) => {
11
+ const useFetchDynamicCollectionData = ({ input }) => {
15
12
  const [collectionAssetsList, setCollectionAssetsList] = (0, react_1.useState)([]);
16
13
  const { page, collectionId } = input;
17
14
  const openAlert = (0, ui_1.useUiStore)((state) => state.openAlert);
@@ -27,7 +24,7 @@ const useFetchDynamicCollectionData = ({ input, }) => {
27
24
  setLikesCount(likesNum);
28
25
  setIslikedByUser(isLikedByUser);
29
26
  setNextPageToken(nextPage.token);
30
- setCollectionAssetsList(collectionAssets.map((collectionAsset) => new CollectionCreationEntity_1.default({
27
+ setCollectionAssetsList(collectionAssets.map((collectionAsset) => (0, collectionCreationBuilder_1.buildCollectionCreation)({
31
28
  ...collectionAsset,
32
29
  collectionId: collectionAsset.assetId,
33
30
  })));
@@ -35,7 +32,7 @@ const useFetchDynamicCollectionData = ({ input, }) => {
35
32
  onError: () => {
36
33
  openAlert({
37
34
  type: type_1.alertVariants.error,
38
- caption: 'Oops, something went wrong.',
35
+ caption: "Oops, something went wrong.",
39
36
  });
40
37
  setCollectionAssetsList([]);
41
38
  setNextPageToken(null);
@@ -64,10 +61,10 @@ const useFetchDynamicCollectionData = ({ input, }) => {
64
61
  input: { page: { token: pageToken, size: page?.size }, collectionId },
65
62
  },
66
63
  });
67
- const { collectionAssetsPage: { nextPage, collectionAssets: nextCollectionAssetsList, }, } = data.fetchDynamicCollectionData;
64
+ const { collectionAssetsPage: { nextPage, collectionAssets: nextCollectionAssetsList }, } = data.fetchDynamicCollectionData;
68
65
  setCollectionAssetsList((prevCollection) => [
69
66
  ...prevCollection,
70
- ...nextCollectionAssetsList.map((collectionAsset) => new CollectionCreationEntity_1.default({
67
+ ...nextCollectionAssetsList.map((collectionAsset) => (0, collectionCreationBuilder_1.buildCollectionCreation)({
71
68
  ...collectionAsset,
72
69
  collectionId: collectionAsset.assetId,
73
70
  })),
@@ -1,27 +1,27 @@
1
- import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
2
- import { searchSchema as schema } from '@ludo.ninja/api';
3
- import CreationEntity from '../../../../dto/CreationEntity';
1
+ import { TCreation } from '../../../../entities/creation/types';
2
+ import { ApolloClient, NormalizedCacheObject } from "@apollo/client";
3
+ import { searchSchema as schema } from "@ludo.ninja/api";
4
4
  export declare const prefetchFindCreations: ({ term, input, page }: schema.IQueryFindCreationsArgs, apolloClient: ApolloClient<NormalizedCacheObject>) => Promise<import("@apollo/client").ApolloQueryResult<any> | {
5
5
  data: {
6
6
  findCreations: null;
7
7
  };
8
8
  }>;
9
- export declare const useFindCreations: ({ term, input, page, }: schema.IQueryFindCreationsArgs) => {
9
+ export declare const useFindCreations: ({ term, input, page }: schema.IQueryFindCreationsArgs) => {
10
10
  loadMore: (pageToken: string | null) => Promise<void>;
11
11
  loading: boolean;
12
12
  error: import("@apollo/client").ApolloError | undefined;
13
13
  results: number;
14
- creations: CreationEntity[];
14
+ creations: TCreation[];
15
15
  nextPageToken: string | null;
16
16
  refetchQuery: () => Promise<void>;
17
17
  };
18
18
  declare const _default: {
19
- useFindCreations: ({ term, input, page, }: schema.IQueryFindCreationsArgs) => {
19
+ useFindCreations: ({ term, input, page }: schema.IQueryFindCreationsArgs) => {
20
20
  loadMore: (pageToken: string | null) => Promise<void>;
21
21
  loading: boolean;
22
22
  error: import("@apollo/client").ApolloError | undefined;
23
23
  results: number;
24
- creations: CreationEntity[];
24
+ creations: TCreation[];
25
25
  nextPageToken: string | null;
26
26
  refetchQuery: () => Promise<void>;
27
27
  };
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.useFindCreations = exports.prefetchFindCreations = void 0;
7
- const react_1 = require("react");
4
+ const builder_1 = require("../../../../entities/creation/builder");
5
+ const ui_1 = require("../../../../store/ui");
8
6
  const client_1 = require("@apollo/client");
9
7
  const api_1 = require("@ludo.ninja/api");
10
8
  const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
11
- const ui_1 = require("../../../../store/ui");
12
- const CreationEntity_1 = __importDefault(require("../../../../dto/CreationEntity"));
9
+ const react_1 = require("react");
13
10
  const prefetchFindCreations = ({ term, input, page }, apolloClient) => {
14
11
  return apolloClient
15
12
  .query({
@@ -20,7 +17,7 @@ const prefetchFindCreations = ({ term, input, page }, apolloClient) => {
20
17
  page,
21
18
  },
22
19
  context: { uri: api_1.hosts.serverSearchHost },
23
- fetchPolicy: 'network-only',
20
+ fetchPolicy: "network-only",
24
21
  })
25
22
  .catch(() => {
26
23
  return {
@@ -30,7 +27,7 @@ const prefetchFindCreations = ({ term, input, page }, apolloClient) => {
30
27
  };
31
28
  exports.prefetchFindCreations = prefetchFindCreations;
32
29
  const maxCreationLength = 1000;
33
- const useFindCreations = ({ term, input, page, }) => {
30
+ const useFindCreations = ({ term, input, page }) => {
34
31
  const [creations, setCreations] = (0, react_1.useState)([]);
35
32
  const [nextPageToken, setNextPageToken] = (0, react_1.useState)(null);
36
33
  const [results, setResults] = (0, react_1.useState)(0);
@@ -45,14 +42,14 @@ const useFindCreations = ({ term, input, page, }) => {
45
42
  page,
46
43
  },
47
44
  onCompleted: ({ findCreations: { creations, ...nextPage } }) => {
48
- setCreations(creations.map((creation) => new CreationEntity_1.default(creation)));
45
+ setCreations(creations.map((creation) => (0, builder_1.buildCreation)(creation)));
49
46
  setResults(nextPage.nextPage?.elements || 0);
50
47
  setNextPageToken(nextPage.nextPage?.token || null);
51
48
  },
52
49
  onError: () => {
53
50
  openAlert({
54
51
  type: type_1.alertVariants.error,
55
- caption: 'Oops, something went wrong.',
52
+ caption: "Oops, something went wrong.",
56
53
  });
57
54
  setCreations([]);
58
55
  setNextPageToken(null);
@@ -78,14 +75,14 @@ const useFindCreations = ({ term, input, page, }) => {
78
75
  variables: {
79
76
  page: {
80
77
  token: pageToken,
81
- ...(page && 'size' in page ? { size: page.size } : {}),
78
+ ...(page && "size" in page ? { size: page.size } : {}),
82
79
  },
83
80
  },
84
81
  updateQuery: (prev, { fetchMoreResult }) => {
85
82
  if (!fetchMoreResult)
86
83
  return prev;
87
84
  const { creations: nextCreations, ...page } = fetchMoreResult.findCreations;
88
- if (prev !== null && prev.hasOwnProperty('findCreations')) {
85
+ if (prev !== null && prev.hasOwnProperty("findCreations")) {
89
86
  const { creations: prevCreations } = prev.findCreations;
90
87
  return {
91
88
  findCreations: {
@@ -1,5 +1,5 @@
1
- import { searchSchema as schema } from '@ludo.ninja/api';
2
- import CreationEntity from '../../../../dto/CreationEntity';
1
+ import { TCreation } from '../../../../entities/creation/types';
2
+ import { searchSchema as schema } from "@ludo.ninja/api";
3
3
  declare const useFindUserCreations: ({ ownerId, input, scrollTab, }: {
4
4
  scrollTab: string | undefined;
5
5
  ownerId: schema.IQueryFindUserCreationsArgs["ownerId"];
@@ -8,7 +8,7 @@ declare const useFindUserCreations: ({ ownerId, input, scrollTab, }: {
8
8
  isLoading: boolean;
9
9
  error: import("@apollo/client").ApolloError | undefined;
10
10
  totalResults: number;
11
- creations: CreationEntity[];
11
+ creations: TCreation[];
12
12
  refetchQuery: () => Promise<void>;
13
13
  loadMore: () => Promise<void>;
14
14
  isNextLoading: boolean;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = require("react");
7
- const api_1 = require("@ludo.ninja/api");
3
+ const builder_1 = require("../../../../entities/creation/builder");
8
4
  const getPageSizeAssets_1 = require("../../../../utils/getPageSizeAssets");
9
- const CreationEntity_1 = __importDefault(require("../../../../dto/CreationEntity"));
5
+ const api_1 = require("@ludo.ninja/api");
6
+ const react_1 = require("react");
10
7
  const limit = 20;
11
8
  const useFindUserCreations = ({ ownerId, input, scrollTab, }) => {
12
9
  const [creations, setCreations] = (0, react_1.useState)([]);
@@ -19,9 +16,9 @@ const useFindUserCreations = ({ ownerId, input, scrollTab, }) => {
19
16
  context: {
20
17
  uri: api_1.hosts.searchHost,
21
18
  },
22
- fetchPolicy: 'no-cache',
19
+ fetchPolicy: "no-cache",
23
20
  onCompleted: ({ findUserCreations: { creations, ...nextPage } }) => {
24
- setCreations(creations.map((creation) => new CreationEntity_1.default(creation)));
21
+ setCreations(creations.map((creation) => (0, builder_1.buildCreation)(creation)));
25
22
  setResults(nextPage.nextPage?.elements || 0);
26
23
  setIsLoading(false);
27
24
  nextPageToken.current = nextPage.nextPage?.token || null;
@@ -43,7 +40,7 @@ const useFindUserCreations = ({ ownerId, input, scrollTab, }) => {
43
40
  scrollTab,
44
41
  limit,
45
42
  }),
46
- token: '',
43
+ token: "",
47
44
  },
48
45
  },
49
46
  });
@@ -72,7 +69,7 @@ const useFindUserCreations = ({ ownerId, input, scrollTab, }) => {
72
69
  const { creations: nextCreations, ...nextPage } = data.findUserCreations;
73
70
  setCreations((prevCreations) => [
74
71
  ...prevCreations,
75
- ...nextCreations.map((creation) => new CreationEntity_1.default(creation)),
72
+ ...nextCreations.map((creation) => (0, builder_1.buildCreation)(creation)),
76
73
  ]);
77
74
  setResults(nextPage.nextPage?.elements || 0);
78
75
  nextPageToken.current = nextPage.nextPage?.token || null;
@@ -1,5 +1,5 @@
1
- import { searchSchema as schema } from '@ludo.ninja/api';
2
- import CreationEntity from '../../../../dto/CreationEntity';
1
+ import { TCreation } from '../../../../entities/creation/types';
2
+ import { searchSchema as schema } from "@ludo.ninja/api";
3
3
  declare const useFindUserLudoCreations: ({ ownerId, scrollTab, }: {
4
4
  scrollTab: string | undefined;
5
5
  ownerId: schema.IQueryFindUserLudoCreationsArgs["ownerId"];
@@ -7,7 +7,7 @@ declare const useFindUserLudoCreations: ({ ownerId, scrollTab, }: {
7
7
  isLoading: boolean;
8
8
  error: import("@apollo/client").ApolloError | undefined;
9
9
  totalResults: number;
10
- creations: CreationEntity[];
10
+ creations: TCreation[];
11
11
  refetchQuery: () => Promise<void>;
12
12
  loadMore: () => Promise<void>;
13
13
  isNextLoading: boolean;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = require("react");
7
- const api_1 = require("@ludo.ninja/api");
3
+ const builder_1 = require("../../../../entities/creation/builder");
8
4
  const getPageSizeAssets_1 = require("../../../../utils/getPageSizeAssets");
9
- const CreationEntity_1 = __importDefault(require("../../../../dto/CreationEntity"));
5
+ const api_1 = require("@ludo.ninja/api");
6
+ const react_1 = require("react");
10
7
  const limit = 20;
11
8
  const useFindUserLudoCreations = ({ ownerId, scrollTab, }) => {
12
9
  const [creations, setCreations] = (0, react_1.useState)([]);
@@ -19,9 +16,9 @@ const useFindUserLudoCreations = ({ ownerId, scrollTab, }) => {
19
16
  context: {
20
17
  uri: api_1.hosts.searchHost,
21
18
  },
22
- fetchPolicy: 'no-cache',
19
+ fetchPolicy: "no-cache",
23
20
  onCompleted: ({ findUserLudoCreations: { creations, ...nextPage } }) => {
24
- setCreations(creations.map((creation) => new CreationEntity_1.default(creation)));
21
+ setCreations(creations.map((creation) => (0, builder_1.buildCreation)(creation)));
25
22
  setResults(nextPage.nextPage?.elements || 0);
26
23
  setIsLoading(false);
27
24
  nextPageToken.current = nextPage.nextPage?.token || null;
@@ -42,7 +39,7 @@ const useFindUserLudoCreations = ({ ownerId, scrollTab, }) => {
42
39
  scrollTab,
43
40
  limit,
44
41
  }),
45
- token: '',
42
+ token: "",
46
43
  },
47
44
  },
48
45
  });
@@ -70,7 +67,7 @@ const useFindUserLudoCreations = ({ ownerId, scrollTab, }) => {
70
67
  const { creations: nextCreations, ...nextPage } = data.findUserLudoCreations;
71
68
  setCreations((prevCreations) => [
72
69
  ...prevCreations,
73
- ...nextCreations.map((creation) => new CreationEntity_1.default(creation)),
70
+ ...nextCreations.map((creation) => (0, builder_1.buildCreation)(creation)),
74
71
  ]);
75
72
  setResults(nextPage.nextPage?.elements || 0);
76
73
  nextPageToken.current = nextPage.nextPage?.token || null;
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
- const react_1 = require("react");
8
- const styled_components_1 = __importDefault(require("styled-components"));
7
+ const useAddCreationsToGallery_1 = require("../../../../api/server-galleries/mutations/useAddCreationsToGallery");
8
+ const useCreateGallery_1 = require("../../../../api/server-galleries/mutations/useCreateGallery");
9
9
  const chooseGalleryItems_1 = __importDefault(require("../../../../modules/gallery/ui/chooseGalleryItems"));
10
10
  const createGalleryForm_1 = __importDefault(require("../../../../modules/gallery/ui/createGalleryForm"));
11
11
  const itemsPreview_1 = __importDefault(require("../../../../modules/gallery/ui/itemsPreview"));
12
12
  const useToGalleryAsset_1 = require("../../../../modules/gallery/useToGalleryAsset");
13
13
  const ui_1 = require("../../../../store/ui");
14
- const useAddCreationsToGallery_1 = require("../../../../api/server-galleries/mutations/useAddCreationsToGallery");
15
- const useCreateGallery_1 = require("../../../../api/server-galleries/mutations/useCreateGallery");
14
+ const react_1 = require("react");
15
+ const styled_components_1 = __importDefault(require("styled-components"));
16
16
  // Styles
17
17
  const StyledAddGallery = styled_components_1.default.div `
18
18
  display: flex;
@@ -37,12 +37,12 @@ const AddCreationToGallery = () => {
37
37
  actionResetCheckboxes();
38
38
  closeModalSidebarPortal();
39
39
  };
40
- const ids = creationsToGallery.map((creations) => creations.getCreationId());
41
- return ((0, jsx_runtime_1.jsxs)(StyledAddGallery, { children: [(0, jsx_runtime_1.jsx)(itemsPreview_1.default, { creations: creationsToGallery, title: 'Add to Gallery', deleteMethod: (itemId) => {
40
+ const ids = creationsToGallery.map((creations) => creations.creationId);
41
+ return ((0, jsx_runtime_1.jsxs)(StyledAddGallery, { children: [(0, jsx_runtime_1.jsx)(itemsPreview_1.default, { creations: creationsToGallery, title: "Add to Gallery", deleteMethod: (itemId) => {
42
42
  removeCreationFromGalleryWithCallback(itemId, closeModalSidebarPortal);
43
43
  } }), isNeedAddGallery ? ((0, jsx_runtime_1.jsx)(createGalleryForm_1.default, { setAddGallery: setAddGallery,
44
44
  // ids={ids as string[]}
45
- title: 'Create Gallery', createMethod: createGallery, inputPlaceHolderText: 'Gallery Name', error: errorCreateGallery })) : ((0, jsx_runtime_1.jsx)(chooseGalleryItems_1.default, { setAddGallery: setAddGallery, title: 'Choose Gallery', titleBtn: '+ New Gallery', ids: ids, addMethod: addMethod, isAdded: isAdded, error: error, isGetMyGalleries: true }))] }));
45
+ title: "Create Gallery", createMethod: createGallery, inputPlaceHolderText: "Gallery Name", error: errorCreateGallery })) : ((0, jsx_runtime_1.jsx)(chooseGalleryItems_1.default, { setAddGallery: setAddGallery, title: "Choose Gallery", titleBtn: "+ New Gallery", ids: ids, addMethod: addMethod, isAdded: isAdded, error: error, isGetMyGalleries: true }))] }));
46
46
  };
47
47
  // Export
48
48
  exports.default = AddCreationToGallery;
@@ -22,5 +22,5 @@ interface IUseSearch {
22
22
  searchCloseButton: ReactNode;
23
23
  }) => ReactNode;
24
24
  }
25
- export declare const SearchInputContainer: ({ onFocusHandler, isClearOnBlur, initializeInputComponent, }: IUseSearch) => import("react/jsx-runtime").JSX.Element;
25
+ export declare const SearchInputContainer: ({ onFocusHandler, isClearOnBlur, initializeInputComponent }: IUseSearch) => import("react/jsx-runtime").JSX.Element;
26
26
  export {};
@@ -28,25 +28,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.SearchInputContainer = void 0;
30
30
  const jsx_runtime_1 = require("react/jsx-runtime");
31
- const react_1 = __importStar(require("react"));
32
- // import { useRouter } from "next/router";
33
- const lodash_debounce_1 = __importDefault(require("lodash.debounce"));
34
- const styled_components_1 = __importStar(require("styled-components"));
35
- const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
36
- const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
37
- const utils_1 = require("@ludo.ninja/utils");
38
31
  const useFetchFindAllTopEntitiesByName_1 = require("../../api/server-search/queries/useFetchFindAllTopEntitiesByName");
39
32
  const searchCloseMoreButtons_1 = __importDefault(require("./searchCloseMoreButtons"));
40
33
  const searchSuggestions_1 = __importDefault(require("./searchSuggestions"));
34
+ const back_svg_1 = __importDefault(require("../../public/search/back"));
41
35
  const env_1 = require("../../store/env");
42
36
  const ui_1 = require("../../store/ui");
43
37
  const ScreenWidth_1 = require("../../styles/ScreenWidth");
44
38
  const screen_1 = require("../../utils/screen");
45
39
  const seacrhTabs_1 = require("../../utils/seacrhTabs");
46
- const back_svg_1 = __importDefault(require("../../public/search/back"));
47
40
  const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
41
+ const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
42
+ const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
43
+ const utils_1 = require("@ludo.ninja/utils");
44
+ // import { useRouter } from "next/router";
45
+ const lodash_debounce_1 = __importDefault(require("lodash.debounce"));
46
+ const react_1 = __importStar(require("react"));
47
+ const styled_components_1 = __importStar(require("styled-components"));
48
48
  const enterKey = "Enter";
49
- const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputComponent, }) => {
49
+ const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputComponent }) => {
50
50
  const NEXT_PUBLIC_ENV_VALUE = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_ENV_VALUE);
51
51
  const inputSearch = (0, react_1.useRef)(null);
52
52
  const [searchValue, setSearchValue] = (0, react_1.useState)("");
@@ -84,10 +84,8 @@ const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputCo
84
84
  }, [debouncedValue]);
85
85
  const [isMobileOpen, setIsMobileOpen] = (0, react_1.useState)(false);
86
86
  const Container = isMobileOpen ? SMobileContainer : react_1.default.Fragment;
87
- const SearchContainer = isMobileOpen
88
- ? SMobileSearchContainer
89
- : react_1.default.Fragment;
90
- const searchSuggestion = ((0, jsx_runtime_1.jsx)(searchSuggestions_1.default, { isLoading: loading || isDebounceLoading, searchTerm: debouncedValue, assets: topEntities?.assets || [], profiles: topEntities?.profiles || [], collections: topEntities?.collections || [] }));
87
+ const SearchContainer = isMobileOpen ? SMobileSearchContainer : react_1.default.Fragment;
88
+ const searchSuggestion = () => ((0, jsx_runtime_1.jsx)(searchSuggestions_1.default, { isLoading: loading || isDebounceLoading, searchTerm: debouncedValue, assets: topEntities?.assets || [], profiles: topEntities?.profiles || [], collections: topEntities?.collections || [] }));
91
89
  return ((0, jsx_runtime_1.jsxs)(Container, { children: [(0, jsx_runtime_1.jsxs)(SearchContainer, { children: [isMobileOpen && ((0, jsx_runtime_1.jsx)(back_svg_1.default, { onClick: () => {
92
90
  setIsMobileOpen(false);
93
91
  (0, utils_1.rootRemoveOverflow)();
@@ -145,8 +143,7 @@ const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputCo
145
143
  const newSearchValue = value.length ? searchValue : "";
146
144
  const searchDomain = ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["search"];
147
145
  const currentPath = window.location.pathname;
148
- if (searchDomain === window.origin &&
149
- seacrhTabs_1.searchTabs.find((el) => currentPath.includes(el.link))) {
146
+ if (searchDomain === window.origin && seacrhTabs_1.searchTabs.find((el) => currentPath.includes(el.link))) {
150
147
  // await router.replace(
151
148
  // {
152
149
  // query: { ...router.query, term: newSearchValue },
@@ -174,13 +171,13 @@ const SearchInputContainer = ({ onFocusHandler, isClearOnBlur, initializeInputCo
174
171
  }
175
172
  },
176
173
  },
177
- searchSuggestion: !isMobile && searchValue && ((0, jsx_runtime_1.jsx)("div", { className: "suggestionBar", children: searchSuggestion })),
174
+ searchSuggestion: !isMobile && searchValue && (0, jsx_runtime_1.jsx)("div", { className: "suggestionBar", children: searchSuggestion() }),
178
175
  searchCloseButton: ((0, jsx_runtime_1.jsx)(searchCloseMoreButtons_1.default, { isNeedToShow: Boolean(searchValue.length), position: {
179
176
  top: "50%",
180
177
  right: "0",
181
178
  transform: "translate(-50%, -50%)",
182
179
  }, clearSearchValue: setSearchValue })),
183
- })] }), isMobileOpen && searchValue && ((0, jsx_runtime_1.jsx)(SSuggestions, { children: searchSuggestion }))] }));
180
+ })] }), isMobileOpen && searchValue && (0, jsx_runtime_1.jsx)(SSuggestions, { children: searchSuggestion() })] }));
184
181
  };
185
182
  exports.SearchInputContainer = SearchInputContainer;
186
183
  const show = (0, styled_components_1.keyframes) `
@@ -1,3 +1,3 @@
1
1
  import { LabelKeys } from '../labelCreationType/types';
2
- import { collectionsSchema as schema } from "@ludo.ninja/api";
3
- export declare const buildCollectionCreation: (creation: schema.ICollectionAsset, type?: LabelKeys) => import("./types").TCreation;
2
+ import { collectionsSchema, searchSchema } from "@ludo.ninja/api";
3
+ export declare const buildCollectionCreation: (creation: collectionsSchema.ICollectionAsset | searchSchema.ICollection, type?: LabelKeys) => import("./types").TCreation;