@ludo.ninja/components 2.2.36 → 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 (92) hide show
  1. package/build/api/server-galleries/queries/useFetchGallery/index.d.ts +5 -5
  2. package/build/api/server-galleries/queries/useFetchGallery/index.js +5 -8
  3. package/build/api/server-galleries/queries/useFetchMyFavorites/index.d.ts +3 -3
  4. package/build/api/server-galleries/queries/useFetchMyFavorites/index.js +5 -11
  5. package/build/api/server-galleries/queries/useFetchMyGalleries/index.d.ts +3 -3
  6. package/build/api/server-galleries/queries/useFetchMyGalleries/index.js +5 -11
  7. package/build/api/server-galleries/queries/useFetchUserFavorites/index.d.ts +4 -4
  8. package/build/api/server-galleries/queries/useFetchUserFavorites/index.js +6 -9
  9. package/build/api/server-search/queries/useFetchAllCreations/index.d.ts +7 -7
  10. package/build/api/server-search/queries/useFetchAllCreations/index.js +7 -10
  11. package/build/api/server-search/queries/useFetchCollections/index.d.ts +6 -6
  12. package/build/api/server-search/queries/useFetchCollections/index.js +10 -12
  13. package/build/api/server-search/queries/useFetchDynamicCollectionData/index.d.ts +4 -4
  14. package/build/api/server-search/queries/useFetchDynamicCollectionData/index.js +8 -11
  15. package/build/api/server-search/queries/useFindCreations/index.d.ts +7 -7
  16. package/build/api/server-search/queries/useFindCreations/index.js +9 -12
  17. package/build/api/server-search/queries/useFindUserCreations/index.d.ts +3 -3
  18. package/build/api/server-search/queries/useFindUserCreations/index.js +7 -10
  19. package/build/api/server-search/queries/useFindUserLudoCreations/index.d.ts +3 -3
  20. package/build/api/server-search/queries/useFindUserLudoCreations/index.js +7 -10
  21. package/build/components/assetPage/assetLikes/index.js +7 -7
  22. package/build/components/gallery/add/addCreationToGallery/index.js +7 -7
  23. package/build/components/search/searchSuggestions/index.js +2 -2
  24. package/build/dto/AssetEntity/index.d.ts +3 -3
  25. package/build/dto/AssetEntity/index.js +16 -33
  26. package/build/dto/AssetSearchEntity/index.d.ts +2 -2
  27. package/build/dto/AssetSearchEntity/index.js +12 -29
  28. package/build/dto/Collection/CollectionCreationEntity/index.d.ts +3 -3
  29. package/build/dto/Collection/CollectionCreationEntity/index.js +13 -13
  30. package/build/dto/Collection/CollectionCreationEntity/interface.d.ts +2 -2
  31. package/build/dto/Collection/CollectionEntity/index.d.ts +2 -2
  32. package/build/dto/Collection/CollectionEntity/index.js +1 -1
  33. package/build/dto/CreationEntity/index.d.ts +3 -3
  34. package/build/dto/CreationEntity/index.js +9 -9
  35. package/build/dto/GalleryEntityV2/index.d.ts +4 -4
  36. package/build/dto/GalleryEntityV2/index.js +6 -8
  37. package/build/dto/common/ItemType/data.d.ts +1 -1
  38. package/build/dto/common/ItemType/data.js +25 -25
  39. package/build/entities/creation/collectionCreationBuilder.d.ts +2 -2
  40. package/build/entities/creation/collectionCreationBuilder.js +4 -3
  41. package/build/entities/gallery/builder.js +1 -1
  42. package/build/hooks/favorites/useGetFavoriteGallaryCreations/index.d.ts +6 -7
  43. package/build/hooks/favorites/useGetFavoriteGallaryCreations/index.js +19 -23
  44. package/build/hooks/favorites/useGetUserFevoritesCreations/index.d.ts +8 -9
  45. package/build/hooks/favorites/useGetUserFevoritesCreations/index.js +25 -38
  46. package/build/hooks/galleries/useGetUserGalleriesCreations/index.d.ts +8 -9
  47. package/build/hooks/galleries/useGetUserGalleriesCreations/index.js +25 -38
  48. package/build/hooks/likes/dynamic/useFindCollectionsAndLikes.d.ts +6 -6
  49. package/build/hooks/likes/dynamic/useFindCollectionsAndLikes.js +15 -17
  50. package/build/hooks/likes/dynamic/useFindCreationsAndLikes.d.ts +4 -4
  51. package/build/hooks/likes/dynamic/useFindCreationsAndLikes.js +12 -15
  52. package/build/hooks/likes/dynamic/useGetCollectionInfoAndLikes.d.ts +4 -4
  53. package/build/hooks/likes/dynamic/useGetCollectionInfoAndLikes.js +11 -18
  54. package/build/hooks/likes/dynamic/useGetCreationsAndLikes.d.ts +4 -5
  55. package/build/hooks/likes/dynamic/useGetCreationsAndLikes.js +12 -17
  56. package/build/hooks/likes/dynamic/useGetCreationsAndLikesByType.d.ts +4 -4
  57. package/build/hooks/likes/dynamic/useGetCreationsAndLikesByType.js +16 -19
  58. package/build/hooks/likes/dynamic/useGetMixedLikesFavoriteList.d.ts +5 -6
  59. package/build/hooks/likes/dynamic/useGetMixedLikesFavoriteList.js +9 -10
  60. package/build/hooks/likes/dynamic/useGetTableLikes.d.ts +4 -5
  61. package/build/hooks/likes/dynamic/useGetTableLikes.js +14 -21
  62. package/build/hooks/likes/index.d.ts +1 -1
  63. package/build/hooks/likes/index.js +12 -12
  64. package/build/modules/gallery/api/useGetAssetsAndCollectionForFavorite.d.ts +5 -5
  65. package/build/modules/gallery/api/useGetAssetsAndCollectionForFavorite.js +39 -47
  66. package/build/modules/gallery/store.d.ts +3 -3
  67. package/build/modules/gallery/store.js +7 -11
  68. package/build/modules/gallery/ui/EditGallery.d.ts +2 -2
  69. package/build/modules/gallery/ui/EditGallery.js +11 -11
  70. package/build/modules/gallery/ui/chooseGalleryItems/chooseGalleryItem/index.d.ts +3 -3
  71. package/build/modules/gallery/ui/chooseGalleryItems/chooseGalleryItem/index.js +1 -1
  72. package/build/modules/gallery/ui/chooseGalleryItems/index.d.ts +1 -1
  73. package/build/modules/gallery/ui/chooseGalleryItems/index.js +19 -20
  74. package/build/modules/gallery/ui/itemsPreview/index.d.ts +2 -3
  75. package/build/modules/gallery/ui/itemsPreview/index.js +9 -4
  76. package/build/modules/gallery/useToGalleryAsset.d.ts +5 -5
  77. package/build/modules/gallery/useToGalleryAsset.js +7 -7
  78. package/build/modules/opportunity/OpportunityCard.js +25 -27
  79. package/build/modules/virtuoso/types.d.ts +0 -3
  80. package/build/system/Cards/CardContent/CardCategory/CardCategory.test.d.ts +1 -1
  81. package/build/system/Cards/CardContent/CardCategory/CardCategory.test.js +9 -9
  82. package/build/system/Cards/CardContent/CardCategory/index.d.ts +1 -1
  83. package/build/system/Cards/CardContent/CardCategory/index.js +3 -3
  84. package/build/system/Cards/CreationCard/CardHead.d.ts +2 -3
  85. package/build/system/Cards/CreationCard/CardHead.js +16 -30
  86. package/build/system/Cards/CreationCard/index.d.ts +4 -4
  87. package/build/system/Cards/CreationCard/index.js +10 -9
  88. package/build/system/Cards/MultiMediaCard/index.d.ts +5 -6
  89. package/build/system/Cards/MultiMediaCard/index.js +8 -7
  90. package/build/utils/extractItemIds.d.ts +2 -2
  91. package/build/utils/extractItemIds.js +1 -7
  92. package/package.json +1 -1
@@ -1,16 +1,16 @@
1
- import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
2
- import { galleriesSchema as schema } from '@ludo.ninja/api';
3
- import GalleryEntityV2 from '../../../../dto/GalleryEntityV2';
1
+ import { TGallery } from '../../../../entities/gallery/types';
2
+ import { ApolloClient, NormalizedCacheObject } from "@apollo/client";
3
+ import { galleriesSchema as schema } from "@ludo.ninja/api";
4
4
  declare const prefetchGalleryV2: ({ galleryId }: schema.IQueryFetchGalleryV2Args, apolloClient: ApolloClient<NormalizedCacheObject>) => Promise<import("@apollo/client").ApolloQueryResult<any> | {
5
5
  data: {
6
6
  fetchGalleryV2: null;
7
7
  };
8
8
  }>;
9
- declare const useFetchGalleryV2: ({ galleryId, }: {
9
+ declare const useFetchGalleryV2: ({ galleryId }: {
10
10
  galleryId: schema.IQueryFetchGalleryV2Args;
11
11
  }) => {
12
12
  clientDataLoading: boolean;
13
13
  clientDataError: import("@apollo/client").ApolloError | undefined;
14
- clientData: GalleryEntityV2 | null;
14
+ clientData: TGallery | null;
15
15
  };
16
16
  export { prefetchGalleryV2, useFetchGalleryV2 };
@@ -1,20 +1,17 @@
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.useFetchGalleryV2 = exports.prefetchGalleryV2 = void 0;
7
- const react_1 = require("react");
4
+ const builder_1 = require("../../../../entities/gallery/builder");
8
5
  const client_1 = require("@apollo/client");
9
6
  const api_1 = require("@ludo.ninja/api");
10
- const GalleryEntityV2_1 = __importDefault(require("../../../../dto/GalleryEntityV2"));
7
+ const react_1 = require("react");
11
8
  const prefetchGalleryV2 = ({ galleryId }, apolloClient) => {
12
9
  return apolloClient
13
10
  .query({
14
11
  query: api_1.galleriesSchema.FetchGalleryV2Document,
15
12
  variables: { galleryId },
16
13
  context: { uri: api_1.hosts.serverGalleriesHost },
17
- fetchPolicy: 'network-only',
14
+ fetchPolicy: "network-only",
18
15
  })
19
16
  .catch(() => {
20
17
  return {
@@ -23,7 +20,7 @@ const prefetchGalleryV2 = ({ galleryId }, apolloClient) => {
23
20
  });
24
21
  };
25
22
  exports.prefetchGalleryV2 = prefetchGalleryV2;
26
- const useFetchGalleryV2 = ({ galleryId, }) => {
23
+ const useFetchGalleryV2 = ({ galleryId }) => {
27
24
  const [gallery, setGallery] = (0, react_1.useState)(null);
28
25
  const { error, loading } = (0, client_1.useQuery)(api_1.galleriesSchema.FetchGalleryV2Document, {
29
26
  variables: { galleryId },
@@ -31,7 +28,7 @@ const useFetchGalleryV2 = ({ galleryId, }) => {
31
28
  uri: api_1.hosts.galleriesHost,
32
29
  },
33
30
  onCompleted: ({ fetchGalleryV2 }) => {
34
- setGallery(new GalleryEntityV2_1.default(fetchGalleryV2));
31
+ setGallery((0, builder_1.buildGallery)(fetchGalleryV2));
35
32
  },
36
33
  onError: () => {
37
34
  setGallery(null);
@@ -1,7 +1,7 @@
1
- import { galleriesSchema as schema } from '@ludo.ninja/api';
2
- import GalleryEntityV2 from '../../../../dto/GalleryEntityV2';
1
+ import { TGallery } from '../../../../entities/gallery/types';
2
+ import { galleriesSchema as schema } from "@ludo.ninja/api";
3
3
  declare const useFetchMyFavoritesV2: () => {
4
- galleryItems: GalleryEntityV2[];
4
+ galleryItems: TGallery[];
5
5
  isNextLoading: boolean;
6
6
  loadMore: () => Promise<void>;
7
7
  load: ({ pageSize, pageToken }: schema.IQueryFetchMyFavoritesV2Args) => void;
@@ -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
3
  exports.useFetchMyFavoritesV2 = void 0;
7
- const react_1 = require("react");
4
+ const builder_1 = require("../../../../entities/gallery/builder");
8
5
  const api_1 = require("@ludo.ninja/api");
9
- const GalleryEntityV2_1 = __importDefault(require("../../../../dto/GalleryEntityV2"));
6
+ const react_1 = require("react");
10
7
  const maxUserFavoritesLength = 1000;
11
8
  const useFetchMyFavoritesV2 = () => {
12
9
  const [favorites, setFavorites] = (0, react_1.useState)([]);
@@ -16,12 +13,12 @@ const useFetchMyFavoritesV2 = () => {
16
13
  context: {
17
14
  uri: api_1.hosts.galleriesHost,
18
15
  },
19
- fetchPolicy: 'no-cache',
16
+ fetchPolicy: "no-cache",
20
17
  onCompleted: (data) => {
21
18
  const { fetchMyFavoritesV2: { galleries, nextPageToken }, } = data;
22
19
  if (galleries) {
23
20
  nextPageTokenRef.current = nextPageToken || null;
24
- setFavorites(galleries.map((gallery) => new GalleryEntityV2_1.default(gallery)));
21
+ setFavorites(galleries.map((gallery) => (0, builder_1.buildGallery)(gallery)));
25
22
  }
26
23
  },
27
24
  onError: () => {
@@ -52,10 +49,7 @@ const useFetchMyFavoritesV2 = () => {
52
49
  const { galleries, nextPageToken } = data.fetchMyFavoritesV2;
53
50
  if (galleries) {
54
51
  nextPageTokenRef.current = nextPageToken || null;
55
- setFavorites((prev) => [
56
- ...prev,
57
- ...galleries.map((gallery) => new GalleryEntityV2_1.default(gallery)),
58
- ]);
52
+ setFavorites((prev) => [...prev, ...galleries.map((gallery) => (0, builder_1.buildGallery)(gallery))]);
59
53
  }
60
54
  }
61
55
  finally {
@@ -1,7 +1,7 @@
1
- import { galleriesSchema as schema } from '@ludo.ninja/api';
2
- import GalleryEntityV2 from '../../../../dto/GalleryEntityV2';
1
+ import { TGallery } from '../../../../entities/gallery/types';
2
+ import { galleriesSchema as schema } from "@ludo.ninja/api";
3
3
  declare const useFetchMyGalleriesV2: () => {
4
- galleryItems: GalleryEntityV2[];
4
+ galleryItems: TGallery[];
5
5
  isNextLoading: boolean;
6
6
  loadMore: () => Promise<void>;
7
7
  load: ({ pageSize, pageToken }: schema.IQueryFetchMyGalleriesV2Args) => void;
@@ -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.useFetchMyGalleriesV2 = void 0;
7
- const react_1 = require("react");
4
+ const builder_1 = require("../../../../entities/gallery/builder");
8
5
  const client_1 = require("@apollo/client");
9
6
  const api_1 = require("@ludo.ninja/api");
10
- const GalleryEntityV2_1 = __importDefault(require("../../../../dto/GalleryEntityV2"));
7
+ const react_1 = require("react");
11
8
  const maxUserFavoritesLength = 1000;
12
9
  const useFetchMyGalleriesV2 = () => {
13
10
  const [galleries, setGalleries] = (0, react_1.useState)([]);
@@ -18,10 +15,10 @@ const useFetchMyGalleriesV2 = () => {
18
15
  context: {
19
16
  uri: api_1.hosts.galleriesHost,
20
17
  },
21
- fetchPolicy: 'no-cache',
18
+ fetchPolicy: "no-cache",
22
19
  onCompleted: ({ fetchMyGalleriesV2: { galleries, nextPageToken } }) => {
23
20
  nextPageTokenRef.current = nextPageToken || null;
24
- setGalleries(galleries.map((gallery) => new GalleryEntityV2_1.default(gallery)));
21
+ setGalleries(galleries.map((gallery) => (0, builder_1.buildGallery)(gallery)));
25
22
  },
26
23
  onError: () => {
27
24
  nextPageTokenRef.current = null;
@@ -54,10 +51,7 @@ const useFetchMyGalleriesV2 = () => {
54
51
  const { galleries, nextPageToken } = data.fetchMyGalleriesV2;
55
52
  if (galleries) {
56
53
  nextPageTokenRef.current = nextPageToken || null;
57
- setGalleries((prev) => [
58
- ...prev,
59
- ...galleries.map((gallery) => new GalleryEntityV2_1.default(gallery)),
60
- ]);
54
+ setGalleries((prev) => [...prev, ...galleries.map((gallery) => (0, builder_1.buildGallery)(gallery))]);
61
55
  }
62
56
  }
63
57
  finally {
@@ -1,9 +1,9 @@
1
- import { galleriesSchema as schema } from '@ludo.ninja/api';
2
- import GalleryEntityV2 from '../../../../dto/GalleryEntityV2';
3
- declare const useFetchUserFavoritesV2: ({ userId, pageSize, pageToken, }: schema.IQueryFetchUserFavoritesV2Args) => {
1
+ import { TGallery } from '../../../../entities/gallery/types';
2
+ import { galleriesSchema as schema } from "@ludo.ninja/api";
3
+ declare const useFetchUserFavoritesV2: ({ userId, pageSize, pageToken }: schema.IQueryFetchUserFavoritesV2Args) => {
4
4
  loadingFavorites: boolean;
5
5
  error: import("@apollo/client").ApolloError | undefined;
6
- favorites: GalleryEntityV2[];
6
+ favorites: TGallery[];
7
7
  nextPageToken: string | null;
8
8
  refetchQuery: () => Promise<void>;
9
9
  loadMore: (pageToken: string) => Promise<void>;
@@ -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.useFetchUserFavoritesV2 = void 0;
7
- const react_1 = require("react");
4
+ const builder_1 = require("../../../../entities/gallery/builder");
8
5
  const client_1 = require("@apollo/client");
9
6
  const api_1 = require("@ludo.ninja/api");
10
- const GalleryEntityV2_1 = __importDefault(require("../../../../dto/GalleryEntityV2"));
7
+ const react_1 = require("react");
11
8
  const maxUserFavoritesLength = 1000;
12
- const useFetchUserFavoritesV2 = ({ userId, pageSize, pageToken, }) => {
9
+ const useFetchUserFavoritesV2 = ({ userId, pageSize, pageToken }) => {
13
10
  const [favorites, setFavorites] = (0, react_1.useState)([]);
14
11
  const [nextPageToken, setNextPageToken] = (0, react_1.useState)(null);
15
12
  const { error, loading, refetch, fetchMore } = (0, client_1.useQuery)(api_1.galleriesSchema.FetchUserFavoritesV2Document, {
@@ -17,10 +14,10 @@ const useFetchUserFavoritesV2 = ({ userId, pageSize, pageToken, }) => {
17
14
  uri: api_1.hosts.galleriesHost,
18
15
  },
19
16
  variables: { pageSize, userId, pageToken },
20
- fetchPolicy: 'no-cache',
17
+ fetchPolicy: "no-cache",
21
18
  onCompleted: ({ fetchUserFavoritesV2: { galleries, nextPageToken } }) => {
22
19
  setNextPageToken(nextPageToken);
23
- setFavorites(galleries.map((gallery) => new GalleryEntityV2_1.default(gallery)));
20
+ setFavorites(galleries.map((gallery) => (0, builder_1.buildGallery)(gallery)));
24
21
  },
25
22
  onError: () => {
26
23
  setNextPageToken(null);
@@ -39,7 +36,7 @@ const useFetchUserFavoritesV2 = ({ userId, pageSize, pageToken, }) => {
39
36
  if (!fetchMoreResult)
40
37
  return prev;
41
38
  const { nextPageToken, favorites: nextFavorites } = fetchMoreResult.fetchUserFavoritesV2;
42
- if (prev !== null && prev.hasOwnProperty('fetchUserFavoritesV2')) {
39
+ if (prev !== null && prev.hasOwnProperty("fetchUserFavoritesV2")) {
43
40
  const { favorites: prevFavorites } = prev.fetchUserFavoritesV2;
44
41
  return {
45
42
  fetchUserFavorites: {
@@ -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;