@ludo.ninja/components 2.2.35 → 2.2.37

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 (90) 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/useFetchFindAllTopEntitiesByName/index.d.ts +6 -6
  10. package/build/api/server-search/queries/useFetchFindAllTopEntitiesByName/index.js +4 -7
  11. package/build/components/assetPage/assetLikes/index.js +7 -7
  12. package/build/components/search/searchSuggestions/index.d.ts +2 -2
  13. package/build/components/search/searchSuggestions/index.js +4 -46
  14. package/build/dto/AssetEntity/index.d.ts +3 -3
  15. package/build/dto/AssetEntity/index.js +16 -33
  16. package/build/dto/AssetSearchEntity/index.d.ts +2 -2
  17. package/build/dto/AssetSearchEntity/index.js +12 -29
  18. package/build/dto/Collection/CollectionCreationEntity/index.d.ts +3 -3
  19. package/build/dto/Collection/CollectionCreationEntity/index.js +13 -13
  20. package/build/dto/Collection/CollectionCreationEntity/interface.d.ts +2 -2
  21. package/build/dto/Collection/CollectionEntity/index.d.ts +2 -2
  22. package/build/dto/Collection/CollectionEntity/index.js +1 -1
  23. package/build/dto/CreationEntity/index.d.ts +3 -3
  24. package/build/dto/CreationEntity/index.js +9 -9
  25. package/build/dto/GalleryEntityV2/index.d.ts +4 -4
  26. package/build/dto/GalleryEntityV2/index.js +6 -8
  27. package/build/dto/common/ItemType/data.d.ts +1 -1
  28. package/build/dto/common/ItemType/data.js +25 -25
  29. package/build/entities/asset/AssetMediasViews.js +6 -6
  30. package/build/entities/asset/builder.js +2 -2
  31. package/build/entities/asset/{assetMediasOpengraph.d.ts → getAssetMediasOpengraph.d.ts} +1 -1
  32. package/build/entities/asset/{assetMediasOpengraph.js → getAssetMediasOpengraph.js} +7 -7
  33. package/build/entities/asset/getAssetMiniatureUrl.d.ts +4 -0
  34. package/build/entities/asset/getAssetMiniatureUrl.js +37 -0
  35. package/build/entities/asset/types.d.ts +1 -1
  36. package/build/entities/collection/builder.d.ts +3 -0
  37. package/build/entities/collection/builder.js +31 -0
  38. package/build/entities/collection/types.d.ts +17 -0
  39. package/build/entities/collection/types.js +2 -0
  40. package/build/entities/creation/CreationMediaView.d.ts +4 -0
  41. package/build/entities/creation/CreationMediaView.js +46 -0
  42. package/build/entities/creation/builder.d.ts +3 -0
  43. package/build/entities/creation/builder.js +63 -0
  44. package/build/entities/creation/collectionCreationBuilder.d.ts +3 -0
  45. package/build/entities/creation/collectionCreationBuilder.js +25 -0
  46. package/build/entities/creation/types.d.ts +23 -0
  47. package/build/entities/creation/types.js +2 -0
  48. package/build/entities/gallery/builder.d.ts +3 -0
  49. package/build/entities/gallery/builder.js +35 -0
  50. package/build/entities/gallery/types.d.ts +18 -0
  51. package/build/entities/gallery/types.js +2 -0
  52. package/build/entities/labelCreationType/data.d.ts +3 -0
  53. package/build/entities/labelCreationType/data.js +36 -0
  54. package/build/entities/labelCreationType/types.d.ts +45 -0
  55. package/build/entities/labelCreationType/types.js +42 -0
  56. package/build/entities/media/builder.d.ts +4 -0
  57. package/build/entities/media/builder.js +11 -1
  58. package/build/entities/media/types.d.ts +1 -1
  59. package/build/entities/media/urls.d.ts +31 -0
  60. package/build/entities/media/urls.js +125 -0
  61. package/build/hooks/favorites/useGetFavoriteGallaryCreations/index.d.ts +4 -4
  62. package/build/hooks/favorites/useGetFavoriteGallaryCreations/index.js +17 -19
  63. package/build/hooks/favorites/useGetUserFevoritesCreations/index.d.ts +5 -5
  64. package/build/hooks/favorites/useGetUserFevoritesCreations/index.js +23 -33
  65. package/build/hooks/galleries/useGetUserGalleriesCreations/index.d.ts +5 -5
  66. package/build/hooks/galleries/useGetUserGalleriesCreations/index.js +23 -33
  67. package/build/hooks/likes/dynamic/useGetMixedLikesFavoriteList.d.ts +1 -1
  68. package/build/hooks/likes/index.d.ts +1 -1
  69. package/build/hooks/likes/index.js +12 -12
  70. package/build/modules/gallery/api/useGetAssetsAndCollectionForFavorite.d.ts +4 -4
  71. package/build/modules/gallery/api/useGetAssetsAndCollectionForFavorite.js +35 -40
  72. package/build/modules/gallery/store.d.ts +3 -3
  73. package/build/modules/gallery/store.js +7 -11
  74. package/build/modules/gallery/ui/EditGallery.d.ts +2 -2
  75. package/build/modules/gallery/ui/EditGallery.js +11 -11
  76. package/build/modules/gallery/ui/chooseGalleryItems/chooseGalleryItem/index.d.ts +3 -3
  77. package/build/modules/gallery/ui/chooseGalleryItems/chooseGalleryItem/index.js +1 -1
  78. package/build/modules/gallery/ui/chooseGalleryItems/index.d.ts +1 -1
  79. package/build/modules/gallery/ui/chooseGalleryItems/index.js +19 -20
  80. package/build/modules/opportunity/OpportunityCard.js +25 -27
  81. package/build/system/Cards/CardContent/CardCategory/CardCategory.test.d.ts +1 -1
  82. package/build/system/Cards/CardContent/CardCategory/CardCategory.test.js +9 -9
  83. package/build/system/Cards/CardContent/CardCategory/index.d.ts +1 -1
  84. package/build/system/Cards/CardContent/CardCategory/index.js +3 -3
  85. package/build/system/Cards/CreationCard/CardHead.js +16 -21
  86. package/build/system/Cards/CreationCard/index.d.ts +2 -2
  87. package/build/system/Cards/CreationCard/index.js +5 -5
  88. package/build/system/Cards/MultiMediaCard/index.d.ts +2 -2
  89. package/build/system/Cards/MultiMediaCard/index.js +3 -3
  90. 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,7 +1,7 @@
1
- import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
2
- import { searchSchema } from '@ludo.ninja/api';
3
- import { ProfileEntity } from '@ludo.ninja/core';
4
- import AssetEntity from '../../../../dto/AssetSearchEntity';
1
+ import { TAsset } from '../../../../entities/asset/types';
2
+ import { ApolloClient, NormalizedCacheObject } from "@apollo/client";
3
+ import { searchSchema } from "@ludo.ninja/api";
4
+ import { ProfileEntity } from "@ludo.ninja/core";
5
5
  export declare const prefetchFindAllTopEntitiesByName: ({ name, pageSize }: searchSchema.IQueryFindAllTopEntitiesByNameArgs, apolloClient: ApolloClient<NormalizedCacheObject>) => Promise<import("@apollo/client").ApolloQueryResult<any> | {
6
6
  data: {
7
7
  findAllTopEntitiesByName: null;
@@ -16,7 +16,7 @@ export declare const useFetchFindAllTopEntitiesByName: () => {
16
16
  pageSize: number;
17
17
  }>>>;
18
18
  topEntities: {
19
- assets: AssetEntity[];
19
+ assets: TAsset[];
20
20
  collections: searchSchema.ICollection[];
21
21
  profiles: ProfileEntity[];
22
22
  } | null;
@@ -32,7 +32,7 @@ declare const _default: {
32
32
  pageSize: number;
33
33
  }>>>;
34
34
  topEntities: {
35
- assets: AssetEntity[];
35
+ assets: TAsset[];
36
36
  collections: searchSchema.ICollection[];
37
37
  profiles: ProfileEntity[];
38
38
  } | null;
@@ -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.useFetchFindAllTopEntitiesByName = exports.prefetchFindAllTopEntitiesByName = void 0;
7
- const react_1 = require("react");
4
+ const builder_1 = require("../../../../entities/asset/builder");
8
5
  const api_1 = require("@ludo.ninja/api");
9
6
  const core_1 = require("@ludo.ninja/core");
10
- const AssetSearchEntity_1 = __importDefault(require("../../../../dto/AssetSearchEntity"));
7
+ const react_1 = require("react");
11
8
  const prefetchFindAllTopEntitiesByName = ({ name, pageSize }, apolloClient) => {
12
9
  return apolloClient
13
10
  .query({
14
11
  query: api_1.searchSchema.FindAllTopEntitiesByNameDocument,
15
12
  context: { uri: api_1.hosts.serverSearchHost },
16
13
  variables: { name, pageSize },
17
- fetchPolicy: 'network-only',
14
+ fetchPolicy: "network-only",
18
15
  })
19
16
  .catch(() => {
20
17
  return {
@@ -30,7 +27,7 @@ const useFetchFindAllTopEntitiesByName = () => {
30
27
  uri: api_1.hosts.searchHost,
31
28
  },
32
29
  onCompleted: ({ findAllTopEntitiesByName }) => {
33
- const assets = findAllTopEntitiesByName.assets.map((asset) => new AssetSearchEntity_1.default(asset)) || [];
30
+ const assets = findAllTopEntitiesByName.assets.map((asset) => (0, builder_1.buildAsset)(asset)) || [];
34
31
  const profiles = findAllTopEntitiesByName.profiles.map((profile) => new core_1.ProfileEntity(profile)) || [];
35
32
  setTopEntities({
36
33
  assets,
@@ -4,23 +4,23 @@ 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_loading_skeleton_1 = __importDefault(require("react-loading-skeleton"));
8
- const ItemType_1 = require("../../../dto/common/ItemType");
7
+ const types_1 = require("../../../entities/labelCreationType/types");
8
+ const likes_1 = __importDefault(require("../../../hooks/likes"));
9
9
  const store_1 = require("../../../modules/user/store");
10
+ const heart_svg_1 = __importDefault(require("../../../public/showCaseIcons/heart"));
10
11
  const IconWithButton_1 = __importDefault(require("../../../system/Buttons/IconWithButton"));
11
12
  const check4k_1 = require("../../../utils/adaptive/check4k");
12
13
  const scale_1 = require("../../../utils/adaptive/scale");
13
14
  const auth_1 = require("../../../utils/auth");
14
15
  const screen_1 = require("../../../utils/screen");
15
- const likes_1 = __importDefault(require("../../../hooks/likes"));
16
- const heart_svg_1 = __importDefault(require("../../../public/showCaseIcons/heart"));
16
+ const react_loading_skeleton_1 = __importDefault(require("react-loading-skeleton"));
17
17
  const AssetLikes = ({ assetId, likesByUser, isLikedByUser, }) => {
18
18
  const redirectToLoginWindow = (0, auth_1.useRedirectToLoginWindow)();
19
19
  const isSignedIn = (0, store_1.useUserStore)((state) => state.isSignedIn);
20
20
  const { likes, addLike, deleteLike, isLoading } = (0, likes_1.default)({
21
21
  defaultLikesCount: likesByUser,
22
22
  defaultIsLiked: isLikedByUser,
23
- itemType: ItemType_1.LabelKeys.asset,
23
+ itemType: types_1.LabelKeys.asset,
24
24
  });
25
25
  const handleLikes = (isLiked) => {
26
26
  if (!isSignedIn) {
@@ -44,7 +44,7 @@ const AssetLikes = ({ assetId, likesByUser, isLikedByUser, }) => {
44
44
  }, height: "100%", width: `${(0, check4k_1.getAdaptiveValueWithCheck4k)({
45
45
  windowDimensions,
46
46
  currentSize: 30,
47
- })}px` })) : ((0, jsx_runtime_1.jsx)(IconWithButton_1.default, { variant: 'figcaption', text: likes.likesCount, onClick: onLikeBtnClick, children: (0, jsx_runtime_1.jsx)("div", { style: {
47
+ })}px` })) : ((0, jsx_runtime_1.jsx)(IconWithButton_1.default, { variant: "figcaption", text: likes.likesCount, onClick: onLikeBtnClick, children: (0, jsx_runtime_1.jsx)("div", { style: {
48
48
  width: `${(0, check4k_1.getAdaptiveValueWithCheck4k)({
49
49
  windowDimensions,
50
50
  currentSize: 18,
@@ -53,6 +53,6 @@ const AssetLikes = ({ assetId, likesByUser, isLikedByUser, }) => {
53
53
  windowDimensions,
54
54
  currentSize: 18,
55
55
  })}px`,
56
- }, children: (0, jsx_runtime_1.jsx)(heart_svg_1.default, { className: `icon ${likes.isLiked ? 'liked' : ''}`, style: (0, scale_1.getAdaptiveScale)({ windowDimensions, currentSize: 1 }) }) }) })) }));
56
+ }, children: (0, jsx_runtime_1.jsx)(heart_svg_1.default, { className: `icon ${likes.isLiked ? "liked" : ""}`, style: (0, scale_1.getAdaptiveScale)({ windowDimensions, currentSize: 1 }) }) }) })) }));
57
57
  };
58
58
  exports.default = AssetLikes;
@@ -1,9 +1,9 @@
1
- import AssetSearchEntity from '../../../dto/AssetSearchEntity';
1
+ import { TAsset } from '../../../entities/asset/types';
2
2
  import { collectionsSchema as schema } from "@ludo.ninja/api";
3
3
  import { ProfileEntity } from "@ludo.ninja/core";
4
4
  import React from "react";
5
5
  interface Props {
6
- assets: AssetSearchEntity[];
6
+ assets: TAsset[];
7
7
  profiles: ProfileEntity[];
8
8
  collections: schema.ICollection[];
9
9
  searchTerm: string;
@@ -9,12 +9,11 @@ const searchSuggestionsFooter_1 = __importDefault(require("./searchSuggestionsFo
9
9
  const searchSuggestionsItem_1 = __importDefault(require("./searchSuggestionsItem"));
10
10
  const searchSuggestionsItemSkeleton_1 = require("./searchSuggestionsItem/searchSuggestionsItemSkeleton");
11
11
  const searchSuggestionsNotFound_1 = __importDefault(require("./searchSuggestionsNotFound"));
12
- const ItemType_1 = require("../../../dto/common/ItemType");
13
- const Urls_1 = require("../../../dto/common/Media/Urls");
12
+ const getAssetMiniatureUrl_1 = require("../../../entities/asset/getAssetMiniatureUrl");
13
+ const types_1 = require("../../../entities/labelCreationType/types");
14
14
  const env_1 = require("../../../store/env");
15
15
  const ScreenWidth_1 = require("../../../styles/ScreenWidth");
16
16
  const Badge_1 = __importDefault(require("../../../system/Badge"));
17
- const _3d_1 = require("../../../utils/3d");
18
17
  const constants_1 = require("@ludo.ninja/core/build/constants");
19
18
  const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
20
19
  const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
@@ -73,11 +72,8 @@ const StyledSearchSuggestions = styled_components_1.default.div `
73
72
  // Components
74
73
  const SearchSuggestions = ({ searchTerm, assets, profiles, collections, isLoading }) => {
75
74
  const isNotFound = !assets?.length && !profiles?.length && !collections?.length;
76
- const { getMediaENVDomain, getVideoENVDomain, getAudioENVDomain, NEXT_PUBLIC_STATIC_DOMAIN, NEXT_PUBLIC_ENV_VALUE } = (0, env_1.useEnvStore)((state) => ({
75
+ const { getMediaENVDomain, NEXT_PUBLIC_ENV_VALUE } = (0, env_1.useEnvStore)((state) => ({
77
76
  getMediaENVDomain: state.getMediaDomain,
78
- getVideoENVDomain: state.getVideoDomain,
79
- getAudioENVDomain: state.getAudioDomain,
80
- NEXT_PUBLIC_STATIC_DOMAIN: state.NEXT_PUBLIC_STATIC_DOMAIN,
81
77
  NEXT_PUBLIC_ENV_VALUE: state.NEXT_PUBLIC_ENV_VALUE,
82
78
  }));
83
79
  return ((0, jsx_runtime_1.jsx)(StyledSearchSuggestions, { children: (0, jsx_runtime_1.jsxs)("div", { className: "content", children: [isLoading && (0, jsx_runtime_1.jsx)(searchSuggestionsItemSkeleton_1.SearchSuggestionsItemsSkeleton, {}), !isLoading &&
@@ -86,45 +82,7 @@ const SearchSuggestions = ({ searchTerm, assets, profiles, collections, isLoadin
86
82
  ? [
87
83
  {
88
84
  caption: "NFTs",
89
- children: assets.map((asset) => {
90
- // if (
91
- // asset?.getName()?.toLowerCase() ===
92
- // 'Concerto Para Piano e Pandemia May 5, 2021 at 3pm GMT +1'.toLowerCase()
93
- // ) {
94
- // console.log(
95
- // 'asset?.getAssetMedias()',
96
- // asset?.getAssetMedias()
97
- // );
98
- // console.log('asset', asset);
99
- // }
100
- const currentMedia = asset?.getAssetMedias()[0];
101
- // console.log('currentMedia', currentMedia);
102
- let miniatureUrl = "";
103
- const mimeType = currentMedia?.mimeType;
104
- if (mimeType?.includes("video")) {
105
- miniatureUrl = (0, Urls_1.isExternalMediaVideo)(currentMedia?.previewUrl || null, getVideoENVDomain);
106
- }
107
- if (mimeType?.includes("audio")) {
108
- miniatureUrl = (0, Urls_1.isExternalMediaAudio)(currentMedia?.previewUrl || null, getAudioENVDomain);
109
- }
110
- if ((0, _3d_1.isObject3D)({
111
- media: currentMedia?.url,
112
- mimeType: currentMedia?.mimeType,
113
- })) {
114
- // todo: add for 3d preview
115
- // miniatureUrl = isExternalMediaAudio(
116
- // currentMedia?.previewUrl || null
117
- // );
118
- miniatureUrl = `${constants_1.staticLink}/public/noContent/noContentObject.svg`;
119
- }
120
- if (!miniatureUrl) {
121
- // image and screenshots
122
- miniatureUrl = (0, Urls_1.getAssetImage)(currentMedia?.url, `${constants_1.staticLink}/public/noContent/noContent.svg`, Urls_1.mediaSizes.small, NEXT_PUBLIC_STATIC_DOMAIN);
123
- }
124
- return ((0, jsx_runtime_1.jsx)(searchSuggestionsItem_1.default, { name: asset?.getName(), link: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["asset"]}${asset
125
- .getAssetLink()
126
- .replace(`${ItemType_1.LabelKeys.asset}/`, "")}`, imgUrl: miniatureUrl, searchTerm: searchTerm }, `${asset?.getAssetId()}.${Math.random()}`));
127
- }),
85
+ children: assets.map((asset) => ((0, jsx_runtime_1.jsx)(searchSuggestionsItem_1.default, { name: asset?.name, link: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["asset"]}${asset.assetLink.replace(`${types_1.LabelKeys.asset}/`, "")}`, imgUrl: (0, getAssetMiniatureUrl_1.getAssetMiniatureUrl)({ asset }), searchTerm: searchTerm }, `${asset?.assetId}.${Math.random()}`))),
128
86
  },
129
87
  ]
130
88
  : []),
@@ -1,8 +1,8 @@
1
- import { assetSchema as schema } from '@ludo.ninja/api';
2
- import { BlockChainEntity, MarketPlaceEntity } from '@ludo.ninja/core';
3
1
  import IAssetEntity from './interface';
4
- import { LabelKeys } from '../common/ItemType';
5
2
  import Media from '../common/Media';
3
+ import { LabelKeys } from '../../entities/labelCreationType/types';
4
+ import { assetSchema as schema } from "@ludo.ninja/api";
5
+ import { BlockChainEntity, MarketPlaceEntity } from "@ludo.ninja/core";
6
6
  declare class AssetEntity implements IAssetEntity {
7
7
  private assetId;
8
8
  private blockchain;
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const core_1 = require("@ludo.ninja/core");
7
- const utils_1 = require("@ludo.ninja/utils");
8
6
  const views_1 = require("./views");
9
7
  const AssetObject_1 = __importDefault(require("./views/AssetObject"));
10
- const ItemType_1 = require("../common/ItemType");
8
+ const types_1 = require("../../entities/labelCreationType/types");
9
+ const core_1 = require("@ludo.ninja/core");
10
+ const utils_1 = require("@ludo.ninja/utils");
11
11
  class AssetEntity {
12
12
  assetId;
13
13
  blockchain;
@@ -41,7 +41,7 @@ class AssetEntity {
41
41
  })) || [];
42
42
  this.ownersProfiles = asset.ownersProfiles || null;
43
43
  this.ownersAddresses = asset.ownersAddresses;
44
- this.itemType = ItemType_1.LabelKeys.asset;
44
+ this.itemType = types_1.LabelKeys.asset;
45
45
  this.address = asset.address;
46
46
  this.tokenId = asset.tokenId;
47
47
  this.medias = asset.medias;
@@ -77,7 +77,7 @@ class AssetEntity {
77
77
  return hasMoreThanOneMedia || hasMoreThanOneOriginalUrl;
78
78
  }
79
79
  getSplitedAssetId() {
80
- return this.getAssetId().split('.')[1] || this.getAssetId();
80
+ return this.getAssetId().split(".")[1] || this.getAssetId();
81
81
  }
82
82
  getName() {
83
83
  return this.name ? this.name : null;
@@ -90,21 +90,15 @@ class AssetEntity {
90
90
  }
91
91
  getPrice() {
92
92
  return {
93
- latestPriceAmount: this.price.latestPriceAmount
94
- ? this.price.latestPriceAmount
95
- : null,
96
- latestPriceCurrency: this.price.latestPriceCurrency
97
- ? this.price.latestPriceCurrency
98
- : null,
93
+ latestPriceAmount: this.price.latestPriceAmount ? this.price.latestPriceAmount : null,
94
+ latestPriceCurrency: this.price.latestPriceCurrency ? this.price.latestPriceCurrency : null,
99
95
  };
100
96
  }
101
97
  getBlockTimestamp() {
102
98
  return this.blockTimestamp;
103
99
  }
104
100
  getAttributes() {
105
- return this.attributes?.length
106
- ? this.attributes
107
- : [];
101
+ return this.attributes?.length ? this.attributes : [];
108
102
  }
109
103
  getDescription() {
110
104
  return this.description ? this.description : null;
@@ -114,12 +108,8 @@ class AssetEntity {
114
108
  }
115
109
  getCollection() {
116
110
  return {
117
- collectionId: this.collection.collectionId
118
- ? this.collection.collectionId
119
- : null,
120
- collectionTitle: this.collection.collectionTitle
121
- ? this.collection.collectionTitle
122
- : null,
111
+ collectionId: this.collection.collectionId ? this.collection.collectionId : null,
112
+ collectionTitle: this.collection.collectionTitle ? this.collection.collectionTitle : null,
123
113
  collectionMedias: this.collection.collectionMedias?.length
124
114
  ? this.collection.collectionMedias
125
115
  : [],
@@ -137,7 +127,7 @@ class AssetEntity {
137
127
  const convertedOriginalUrlsArray = [];
138
128
  for (let i = 0; i < this.originalUrls?.length; i++) {
139
129
  convertedOriginalUrlsArray.push({
140
- url: (0, utils_1.checkGltfUrl)(this.originalUrls[i] || ''),
130
+ url: (0, utils_1.checkGltfUrl)(this.originalUrls[i] || ""),
141
131
  mimeType: null,
142
132
  originalMime: null,
143
133
  });
@@ -154,9 +144,8 @@ class AssetEntity {
154
144
  return this.address ? this.address : null;
155
145
  }
156
146
  getAssetLink() {
157
- if (this.getItemType() === ItemType_1.LabelKeys.asset) {
158
- if (this.getBlockchain().getBlockChainPrivateLabel() ===
159
- (core_1.BlockChainKeys.elrond || core_1.BlockChainKeys.solana)) {
147
+ if (this.getItemType() === types_1.LabelKeys.asset) {
148
+ if (this.getBlockchain().getBlockChainPrivateLabel() === (core_1.BlockChainKeys.elrond || core_1.BlockChainKeys.solana)) {
160
149
  return `/${this.getItemType()}/${this.getBlockchain().getBlockChainPrivateLabel()}/${this.getAssetId()}`;
161
150
  }
162
151
  else {
@@ -166,17 +155,13 @@ class AssetEntity {
166
155
  return `/${this.getItemType()}/${this.getAssetId()}`;
167
156
  }
168
157
  getOwnersProfiles() {
169
- return this.ownersProfiles
170
- ? this.ownersProfiles
171
- : [];
158
+ return this.ownersProfiles ? this.ownersProfiles : [];
172
159
  }
173
160
  getAssetMedias() {
174
161
  return this.medias ? this.medias : [];
175
162
  }
176
163
  getAssetMediaType() {
177
- const medias = this.getAssetMedias().length
178
- ? this.getAssetMedias()
179
- : this.getOriginalUrls();
164
+ const medias = this.getAssetMedias().length ? this.getAssetMedias() : this.getOriginalUrls();
180
165
  const detectedMedias = [];
181
166
  medias?.forEach((media) => {
182
167
  detectedMedias.push(this.detectMediaType(media.url, media.mimeType, media.originalUrl, media.originalMime));
@@ -211,9 +196,7 @@ class AssetEntity {
211
196
  return currentMedia;
212
197
  }
213
198
  getCreatorsProfiles() {
214
- return this.creatorsProfiles
215
- ? this.creatorsProfiles
216
- : [];
199
+ return this.creatorsProfiles ? this.creatorsProfiles : [];
217
200
  }
218
201
  getOwnersAddresses() {
219
202
  return this.ownersAddresses ? this.ownersAddresses : null;
@@ -1,7 +1,7 @@
1
+ import IAssetSearchEntity from './interface';
2
+ import { LabelKeys } from '../../entities/labelCreationType/types';
1
3
  import { assetSchema as schema } from "@ludo.ninja/api";
2
4
  import { BlockChainEntity, MarketPlaceEntity } from "@ludo.ninja/core";
3
- import { LabelKeys } from '../common/ItemType';
4
- import IAssetSearchEntity from './interface';
5
5
  declare class AssetSearchEntity implements IAssetSearchEntity {
6
6
  private assetId;
7
7
  private blockchain;