@ludo.ninja/components 2.2.37 → 2.2.38

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 (51) 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/entities/creation/collectionCreationBuilder.d.ts +2 -2
  15. package/build/entities/creation/collectionCreationBuilder.js +4 -3
  16. package/build/hooks/favorites/useGetFavoriteGallaryCreations/index.d.ts +2 -3
  17. package/build/hooks/favorites/useGetFavoriteGallaryCreations/index.js +7 -9
  18. package/build/hooks/favorites/useGetUserFevoritesCreations/index.d.ts +3 -4
  19. package/build/hooks/favorites/useGetUserFevoritesCreations/index.js +6 -9
  20. package/build/hooks/galleries/useGetUserGalleriesCreations/index.d.ts +3 -4
  21. package/build/hooks/galleries/useGetUserGalleriesCreations/index.js +6 -9
  22. package/build/hooks/likes/dynamic/useFindCollectionsAndLikes.d.ts +6 -6
  23. package/build/hooks/likes/dynamic/useFindCollectionsAndLikes.js +15 -17
  24. package/build/hooks/likes/dynamic/useFindCreationsAndLikes.d.ts +4 -4
  25. package/build/hooks/likes/dynamic/useFindCreationsAndLikes.js +12 -15
  26. package/build/hooks/likes/dynamic/useGetCollectionInfoAndLikes.d.ts +4 -4
  27. package/build/hooks/likes/dynamic/useGetCollectionInfoAndLikes.js +11 -18
  28. package/build/hooks/likes/dynamic/useGetCreationsAndLikes.d.ts +4 -5
  29. package/build/hooks/likes/dynamic/useGetCreationsAndLikes.js +12 -17
  30. package/build/hooks/likes/dynamic/useGetCreationsAndLikesByType.d.ts +4 -4
  31. package/build/hooks/likes/dynamic/useGetCreationsAndLikesByType.js +16 -19
  32. package/build/hooks/likes/dynamic/useGetMixedLikesFavoriteList.d.ts +4 -5
  33. package/build/hooks/likes/dynamic/useGetMixedLikesFavoriteList.js +9 -10
  34. package/build/hooks/likes/dynamic/useGetTableLikes.d.ts +4 -5
  35. package/build/hooks/likes/dynamic/useGetTableLikes.js +14 -21
  36. package/build/modules/gallery/api/useGetAssetsAndCollectionForFavorite.d.ts +2 -2
  37. package/build/modules/gallery/api/useGetAssetsAndCollectionForFavorite.js +7 -10
  38. package/build/modules/gallery/ui/itemsPreview/index.d.ts +2 -3
  39. package/build/modules/gallery/ui/itemsPreview/index.js +9 -4
  40. package/build/modules/gallery/useToGalleryAsset.d.ts +5 -5
  41. package/build/modules/gallery/useToGalleryAsset.js +7 -7
  42. package/build/modules/virtuoso/types.d.ts +0 -3
  43. package/build/system/Cards/CreationCard/CardHead.d.ts +2 -3
  44. package/build/system/Cards/CreationCard/CardHead.js +5 -14
  45. package/build/system/Cards/CreationCard/index.d.ts +2 -2
  46. package/build/system/Cards/CreationCard/index.js +7 -6
  47. package/build/system/Cards/MultiMediaCard/index.d.ts +3 -4
  48. package/build/system/Cards/MultiMediaCard/index.js +5 -4
  49. package/build/utils/extractItemIds.d.ts +2 -2
  50. package/build/utils/extractItemIds.js +1 -7
  51. 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;
@@ -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;
@@ -6,10 +6,10 @@ const types_1 = require("../labelCreationType/types");
6
6
  const utils_1 = require("@ludo.ninja/utils");
7
7
  const buildCollectionCreation = (creation, type) => (0, builder_1.buildCreation)({
8
8
  itemId: creation.collectionId || "",
9
- id: creation.id || "",
9
+ id: "id" in creation ? creation.id || "" : "",
10
10
  itemType: type ?? types_1.LabelKeys.asset,
11
11
  blockchain: creation.blockchain,
12
- address: creation.address,
12
+ address: "address" in creation ? creation.address : null,
13
13
  tokenId: creation.tokenId,
14
14
  originalUrls: creation.originalUrls
15
15
  ? creation.originalUrls.map((el) => (0, utils_1.checkGltfUrl)(el || ""))
@@ -17,9 +17,10 @@ const buildCollectionCreation = (creation, type) => (0, builder_1.buildCreation)
17
17
  rank: creation.rank,
18
18
  likes: creation.likes,
19
19
  liked: creation.liked,
20
- name: creation.name,
20
+ name: "name" in creation ? creation.name : null,
21
21
  creatorsAddresses: creation.creatorsAddresses,
22
22
  media: creation?.medias?.[0]?.url || null,
23
23
  mimeType: creation?.medias?.[0]?.mimeType,
24
24
  });
25
25
  exports.buildCollectionCreation = buildCollectionCreation;
26
+ //todo: update collectionCreationId to new field in TCreation
@@ -1,5 +1,4 @@
1
- import CollectionCreationEntity from '../../../dto/Collection/CollectionCreationEntity';
2
- import CreationEntity from '../../../dto/CreationEntity';
1
+ import { TCreation } from '../../../entities/creation/types';
3
2
  import { TGallery } from '../../../entities/gallery/types';
4
3
  import { IQueryFetchGalleryV2Args } from "@ludo.ninja/api/build/graphql_tools/__generated__/galleriesHost/schema";
5
4
  declare const useGetFavoriteGallaryCreations: ({ galleryId, itemsCount, }: {
@@ -8,7 +7,7 @@ declare const useGetFavoriteGallaryCreations: ({ galleryId, itemsCount, }: {
8
7
  }) => {
9
8
  gallery: TGallery[] | null;
10
9
  loading: boolean;
11
- creationsList: (CreationEntity | CollectionCreationEntity)[];
10
+ creationsList: TCreation[];
12
11
  loadingAssets: boolean;
13
12
  loadingGallery: boolean;
14
13
  loadingCollections: boolean;
@@ -1,13 +1,11 @@
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.useGetFavoriteGallaryCreations = void 0;
7
4
  const useGetUserFevoritesCreations_1 = require("../useGetUserFevoritesCreations");
8
- const CollectionCreationEntity_1 = __importDefault(require("../../../dto/Collection/CollectionCreationEntity"));
9
- const CreationEntity_1 = __importDefault(require("../../../dto/CreationEntity"));
10
- const builder_1 = require("../../../entities/gallery/builder");
5
+ const builder_1 = require("../../../entities/creation/builder");
6
+ const collectionCreationBuilder_1 = require("../../../entities/creation/collectionCreationBuilder");
7
+ const builder_2 = require("../../../entities/gallery/builder");
8
+ const types_1 = require("../../../entities/labelCreationType/types");
11
9
  const ui_1 = require("../../../store/ui");
12
10
  const client_1 = require("@apollo/client");
13
11
  const api_1 = require("@ludo.ninja/api");
@@ -32,7 +30,7 @@ const useGetFavoriteGallaryCreations = ({ galleryId, itemsCount, }) => {
32
30
  notifyOnNetworkStatusChange: true,
33
31
  fetchPolicy: "no-cache",
34
32
  onCompleted: ({ fetchGalleryV2 }) => {
35
- setGallery([(0, builder_1.buildGallery)(fetchGalleryV2)]);
33
+ setGallery([(0, builder_2.buildGallery)(fetchGalleryV2)]);
36
34
  setAllResults(fetchGalleryV2.items);
37
35
  },
38
36
  onError: () => {
@@ -48,7 +46,7 @@ const useGetFavoriteGallaryCreations = ({ galleryId, itemsCount, }) => {
48
46
  onCompleted: ({ fetchAssets: data }) => {
49
47
  setAssets((prevAssets) => [
50
48
  ...(prevAssets || []),
51
- ...data.map((asset) => new CreationEntity_1.default({
49
+ ...data.map((asset) => (0, builder_1.buildCreation)({
52
50
  ...asset,
53
51
  itemType: "asset",
54
52
  itemId: asset.assetId,
@@ -70,7 +68,7 @@ const useGetFavoriteGallaryCreations = ({ galleryId, itemsCount, }) => {
70
68
  onCompleted: ({ fetchCollectionsByIds: data }) => {
71
69
  setCollections((prevCollections) => [
72
70
  ...(prevCollections || []),
73
- ...data.map((collection) => new CollectionCreationEntity_1.default(collection, "collection")),
71
+ ...data.map((collection) => (0, collectionCreationBuilder_1.buildCollectionCreation)(collection, types_1.LabelKeys.collection)),
74
72
  ]);
75
73
  },
76
74
  onError: () => {