@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
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { IMedia } from '../media/types';
2
+ export declare const CreationMediaView: ({ media }: {
3
+ media: IMedia;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CreationMediaView = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const getMediaVariant_1 = require("../media/getMediaVariant");
9
+ const types_1 = require("../media/types");
10
+ const urls_1 = require("../media/urls");
11
+ const env_1 = require("../../store/env");
12
+ const CardAudio_1 = __importDefault(require("../../system/Cards/CardMedia/CardAudio"));
13
+ const CardImage_1 = __importDefault(require("../../system/Cards/CardMedia/CardImage"));
14
+ const CardVideo_1 = __importDefault(require("../../system/Cards/CardMedia/CardVideo"));
15
+ const constants_1 = require("@ludo.ninja/core/build/constants");
16
+ const CreationMediaView = ({ media }) => {
17
+ const mediaVariant = (0, getMediaVariant_1.getMediaVariant)({ media });
18
+ switch (mediaVariant) {
19
+ case types_1.EMediaVariants.other:
20
+ case types_1.EMediaVariants.screenshot:
21
+ case types_1.EMediaVariants.image:
22
+ return (0, jsx_runtime_1.jsx)(ImageMediaView, { media: media });
23
+ case types_1.EMediaVariants.audio:
24
+ return (0, jsx_runtime_1.jsx)(AudioMediaView, { media: media });
25
+ case types_1.EMediaVariants.video:
26
+ return (0, jsx_runtime_1.jsx)(VideoMediaView, { media: media });
27
+ case types_1.EMediaVariants.object3d:
28
+ //todo: add previewUrl 3d
29
+ return ((0, jsx_runtime_1.jsx)(CardImage_1.default, { alt: media.alt, imgSrc: `${constants_1.staticLink}/public/noContent/noContentObject.svg`, errorImg: `${constants_1.staticLink}/public/noContent/noContentObject.svg` }));
30
+ default:
31
+ return ((0, jsx_runtime_1.jsx)(CardImage_1.default, { alt: media.alt, imgSrc: `${constants_1.staticLink}/public/noContent/noContent.svg`, errorImg: `${constants_1.staticLink}/public/noContent/noContent.svg` }));
32
+ }
33
+ };
34
+ exports.CreationMediaView = CreationMediaView;
35
+ const ImageMediaView = ({ media }) => {
36
+ const NEXT_PUBLIC_STATIC_DOMAIN = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_STATIC_DOMAIN);
37
+ return ((0, jsx_runtime_1.jsx)(CardImage_1.default, { alt: media.alt, imgSrc: (0, urls_1.isExternalMediaImage)(media.media, urls_1.mediaSizes.small, NEXT_PUBLIC_STATIC_DOMAIN), errorImg: `${constants_1.staticLink}/public/noContent/noContent.svg` }));
38
+ };
39
+ const AudioMediaView = ({ media }) => {
40
+ const getAudioENVDomain = (0, env_1.useEnvStore)((state) => state.getAudioDomain);
41
+ return ((0, jsx_runtime_1.jsx)(CardAudio_1.default, { alt: media.alt, audioSrc: (0, urls_1.isExternalMediaAudio)(media.media, getAudioENVDomain), imgSrc: `${constants_1.staticLink}/public/noContent/noContentAudio.svg`, errorImg: `${constants_1.staticLink}/public/noContent/noContentAudio.svg` }));
42
+ };
43
+ const VideoMediaView = ({ media }) => {
44
+ const getVideoENVDomain = (0, env_1.useEnvStore)((state) => state.getVideoDomain);
45
+ return ((0, jsx_runtime_1.jsx)(CardVideo_1.default, { alt: media.alt, videoSrc: (0, urls_1.isExternalMediaVideo)(media.media, getVideoENVDomain), errorImg: `${constants_1.staticLink}/public/noContent/noContent.svg` }));
46
+ };
@@ -0,0 +1,3 @@
1
+ import { TCreation } from './types';
2
+ import { searchSchema as schema } from "@ludo.ninja/api";
3
+ export declare const buildCreation: (creation: schema.ICreation) => TCreation;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildCreation = void 0;
7
+ const data_1 = __importDefault(require("../labelCreationType/data"));
8
+ const types_1 = require("../labelCreationType/types");
9
+ const builder_1 = require("../media/builder");
10
+ const core_1 = require("@ludo.ninja/core");
11
+ const buildCreation = (creation) => {
12
+ const newCreation = {
13
+ itemId: creation.itemId || "",
14
+ id: creation.id || "",
15
+ itemType: creation.itemType,
16
+ blockchain: new core_1.BlockChainEntity(creation.blockchain),
17
+ address: creation.address || "",
18
+ tokenId: creation.tokenId || "",
19
+ // creatorsProfiles : creation.creatorsProfiles,
20
+ // ownersAddresses : creation.ownersAddresses,
21
+ // ownersProfiles : creation.ownersProfiles,
22
+ originalUrls: creation.originalUrls ? creation.originalUrls : null,
23
+ rank: creation.rank ? Math.round(creation.rank) : 0,
24
+ likes: creation.likes || 0,
25
+ isLiked: !!creation.liked,
26
+ name: creation.name || null,
27
+ creatorsAddresses: creation.creatorsAddresses ? creation.creatorsAddresses : null,
28
+ };
29
+ return {
30
+ ...newCreation,
31
+ creationId: `${newCreation.itemType}.${newCreation.itemId}`,
32
+ creationLink: (() => {
33
+ if (newCreation.itemType === types_1.LabelKeys.asset) {
34
+ const blockChainPrivateLabel = newCreation.blockchain.getBlockChainPrivateLabel();
35
+ const link = `/${newCreation.itemType}/${blockChainPrivateLabel}`;
36
+ if (blockChainPrivateLabel === core_1.BlockChainKeys.elrond) {
37
+ return `/${link}/${newCreation.id}`;
38
+ }
39
+ if (blockChainPrivateLabel === core_1.BlockChainKeys.solana) {
40
+ return `/${link}/${newCreation.tokenId}`;
41
+ }
42
+ return `/${link}/${newCreation.address}/${newCreation.tokenId}`;
43
+ }
44
+ return `/${newCreation.itemType}/${newCreation.itemId}`;
45
+ })(),
46
+ label: data_1.default[newCreation.itemType],
47
+ media: (0, builder_1.createCreationMedia)({ creation }),
48
+ creatorAddress: newCreation.creatorsAddresses ? newCreation.creatorsAddresses[0] : null,
49
+ getCuttedSecondName: (isMobileView) => {
50
+ // todo: remove this method from usage, replace to css text-overflow:ellipsis
51
+ if (!newCreation.name)
52
+ return null;
53
+ return isMobileView
54
+ ? newCreation.name && newCreation.name.length >= 20
55
+ ? newCreation.name.substring(0, 22).concat("...")
56
+ : newCreation.name
57
+ : newCreation.name && newCreation.name.length >= 11
58
+ ? newCreation.name?.substring(0, 13).concat("...")
59
+ : newCreation.name;
60
+ },
61
+ };
62
+ };
63
+ exports.buildCreation = buildCreation;
@@ -0,0 +1,3 @@
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;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildCollectionCreation = void 0;
4
+ const builder_1 = require("./builder");
5
+ const types_1 = require("../labelCreationType/types");
6
+ const utils_1 = require("@ludo.ninja/utils");
7
+ const buildCollectionCreation = (creation, type) => (0, builder_1.buildCreation)({
8
+ itemId: creation.collectionId || "",
9
+ id: creation.id || "",
10
+ itemType: type ?? types_1.LabelKeys.asset,
11
+ blockchain: creation.blockchain,
12
+ address: creation.address,
13
+ tokenId: creation.tokenId,
14
+ originalUrls: creation.originalUrls
15
+ ? creation.originalUrls.map((el) => (0, utils_1.checkGltfUrl)(el || ""))
16
+ : null,
17
+ rank: creation.rank,
18
+ likes: creation.likes,
19
+ liked: creation.liked,
20
+ name: creation.name,
21
+ creatorsAddresses: creation.creatorsAddresses,
22
+ media: creation?.medias?.[0]?.url || null,
23
+ mimeType: creation?.medias?.[0]?.mimeType,
24
+ });
25
+ exports.buildCollectionCreation = buildCollectionCreation;
@@ -0,0 +1,23 @@
1
+ import { LabelKeys, LabelType } from '../labelCreationType/types';
2
+ import { IMedia } from '../media/types';
3
+ import { BlockChainEntity } from "@ludo.ninja/core";
4
+ export type TCreation = {
5
+ itemId: string;
6
+ id: string;
7
+ itemType: LabelKeys;
8
+ blockchain: BlockChainEntity;
9
+ address: string;
10
+ tokenId: string;
11
+ originalUrls: string[] | null;
12
+ rank: number;
13
+ likes: number;
14
+ isLiked: boolean;
15
+ name: string | null;
16
+ creatorsAddresses: string[] | null;
17
+ creatorAddress: string | null;
18
+ creationId: string;
19
+ creationLink: string;
20
+ label: LabelType;
21
+ media: IMedia;
22
+ getCuttedSecondName: (isMobileView: boolean) => string;
23
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { TGallery } from './types';
2
+ import { galleriesSchema } from "@ludo.ninja/api";
3
+ export declare const buildGallery: (gallery: galleriesSchema.IGalleryV2) => TGallery;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildGallery = void 0;
7
+ const data_1 = __importDefault(require("../labelCreationType/data"));
8
+ const core_1 = require("@ludo.ninja/core");
9
+ const buildGallery = (gallery) => {
10
+ const newGallery = {
11
+ galleryId: gallery.galleryId,
12
+ galleryType: gallery.galleryType,
13
+ description: gallery.description || "",
14
+ banner: gallery.banner || null,
15
+ profile: new core_1.ProfileEntity({
16
+ userpic: gallery.userpic,
17
+ username: gallery.username,
18
+ userId: gallery.userId,
19
+ }),
20
+ name: gallery.name,
21
+ username: gallery.username || "",
22
+ userpic: gallery.userpic || "",
23
+ itemsCount: gallery.items ? `${gallery.items > 1 ? `${gallery.items} items` : `${gallery.items} item`}` : "0 items",
24
+ userWallets: (gallery.userWallets || []),
25
+ creationIds: (gallery.creationIds || []),
26
+ };
27
+ return {
28
+ ...newGallery,
29
+ label: data_1.default[newGallery.galleryType],
30
+ creationLink: gallery.galleryType === "likelist"
31
+ ? `/favorites/${gallery.galleryId}`
32
+ : `/${gallery.galleryType}/${gallery.galleryId}`,
33
+ };
34
+ };
35
+ exports.buildGallery = buildGallery;
@@ -0,0 +1,18 @@
1
+ import { LabelKeys, LabelType } from '../labelCreationType/types';
2
+ import { galleriesSchema } from "@ludo.ninja/api";
3
+ import { ProfileEntity } from "@ludo.ninja/core";
4
+ export type TGallery = {
5
+ galleryId: string;
6
+ galleryType: LabelKeys;
7
+ description: string;
8
+ banner: string | null;
9
+ profile: ProfileEntity;
10
+ name: string;
11
+ username: string;
12
+ userpic: string;
13
+ itemsCount: string;
14
+ userWallets: galleriesSchema.IWallet[];
15
+ creationIds: string[];
16
+ label: LabelType;
17
+ creationLink: string;
18
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { LabelItem } from "./types";
2
+ declare const labelsData: LabelItem;
3
+ export default labelsData;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const types_1 = require("./types");
4
+ const labelsData = {
5
+ [types_1.LabelKeys.asset]: {
6
+ backgroundColor: types_1.LabelBackground.asset,
7
+ color: types_1.LabelColor.asset,
8
+ text: types_1.LabelText.asset,
9
+ },
10
+ [types_1.LabelKeys.collection]: {
11
+ backgroundColor: types_1.LabelBackground.collection,
12
+ color: types_1.LabelColor.collection,
13
+ text: types_1.LabelText.collection,
14
+ },
15
+ [types_1.LabelKeys.gallery]: {
16
+ backgroundColor: types_1.LabelBackground.gallery,
17
+ color: types_1.LabelColor.gallery,
18
+ text: types_1.LabelText.gallery,
19
+ },
20
+ [types_1.LabelKeys.favorites]: {
21
+ backgroundColor: types_1.LabelBackground.favorites,
22
+ color: types_1.LabelColor.favorites,
23
+ text: types_1.LabelText.favorites,
24
+ },
25
+ [types_1.LabelKeys.likelist]: {
26
+ backgroundColor: types_1.LabelBackground.likelist,
27
+ color: types_1.LabelColor.likelist,
28
+ text: types_1.LabelText.likelist,
29
+ },
30
+ [types_1.LabelKeys.opportunity]: {
31
+ backgroundColor: types_1.LabelBackground.opportunity,
32
+ color: types_1.LabelColor.opportunity,
33
+ text: types_1.LabelText.opportunity,
34
+ },
35
+ };
36
+ exports.default = labelsData;
@@ -0,0 +1,45 @@
1
+ declare enum LabelKeys {
2
+ asset = "asset",
3
+ collection = "collection",
4
+ gallery = "gallery",
5
+ favorites = "favorites",
6
+ likelist = "likelist",
7
+ opportunity = "opportunity"
8
+ }
9
+ declare enum LabelBackground {
10
+ asset = "#F3D6FD",
11
+ collection = "#CDE4FF",
12
+ event = "#CDF8D9",
13
+ gallery = "#FFDFCD",
14
+ favorites = "#CDCFF8",
15
+ likelist = "#CDCFF8",
16
+ opportunity = "#CDF8D9"
17
+ }
18
+ declare enum LabelColor {
19
+ asset = "#9177B1",
20
+ collection = "#6E86C3",
21
+ event = "#77B179",
22
+ gallery = "#B19077",
23
+ favorites = "#7779B1",
24
+ likelist = "#7779B1",
25
+ opportunity = "#77B179"
26
+ }
27
+ declare enum LabelText {
28
+ asset = "nft",
29
+ collection = "collection",
30
+ event = "event",
31
+ gallery = "gallery",
32
+ favorites = "favorites",
33
+ likelist = "liked",
34
+ opportunity = "opportunity"
35
+ }
36
+ type LabelType = {
37
+ backgroundColor: LabelBackground;
38
+ text: LabelText;
39
+ color: LabelColor;
40
+ };
41
+ type LabelItem = {
42
+ [key in LabelKeys]: LabelType;
43
+ };
44
+ export { LabelBackground, LabelText, LabelColor, LabelKeys };
45
+ export type { LabelItem, LabelType };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LabelKeys = exports.LabelColor = exports.LabelText = exports.LabelBackground = void 0;
4
+ var LabelKeys;
5
+ (function (LabelKeys) {
6
+ LabelKeys["asset"] = "asset";
7
+ LabelKeys["collection"] = "collection";
8
+ LabelKeys["gallery"] = "gallery";
9
+ LabelKeys["favorites"] = "favorites";
10
+ LabelKeys["likelist"] = "likelist";
11
+ LabelKeys["opportunity"] = "opportunity";
12
+ })(LabelKeys || (exports.LabelKeys = LabelKeys = {}));
13
+ var LabelBackground;
14
+ (function (LabelBackground) {
15
+ LabelBackground["asset"] = "#F3D6FD";
16
+ LabelBackground["collection"] = "#CDE4FF";
17
+ LabelBackground["event"] = "#CDF8D9";
18
+ LabelBackground["gallery"] = "#FFDFCD";
19
+ LabelBackground["favorites"] = "#CDCFF8";
20
+ LabelBackground["likelist"] = "#CDCFF8";
21
+ LabelBackground["opportunity"] = "#CDF8D9";
22
+ })(LabelBackground || (exports.LabelBackground = LabelBackground = {}));
23
+ var LabelColor;
24
+ (function (LabelColor) {
25
+ LabelColor["asset"] = "#9177B1";
26
+ LabelColor["collection"] = "#6E86C3";
27
+ LabelColor["event"] = "#77B179";
28
+ LabelColor["gallery"] = "#B19077";
29
+ LabelColor["favorites"] = "#7779B1";
30
+ LabelColor["likelist"] = "#7779B1";
31
+ LabelColor["opportunity"] = "#77B179";
32
+ })(LabelColor || (exports.LabelColor = LabelColor = {}));
33
+ var LabelText;
34
+ (function (LabelText) {
35
+ LabelText["asset"] = "nft";
36
+ LabelText["collection"] = "collection";
37
+ LabelText["event"] = "event";
38
+ LabelText["gallery"] = "gallery";
39
+ LabelText["favorites"] = "favorites";
40
+ LabelText["likelist"] = "liked";
41
+ LabelText["opportunity"] = "opportunity";
42
+ })(LabelText || (exports.LabelText = LabelText = {}));
@@ -1,7 +1,11 @@
1
1
  import { IMedia } from './types';
2
2
  import assetSchema from "@ludo.ninja/api/build/graphql_tools/__generated__/assetsHost/schema";
3
+ import searchSchema from "@ludo.ninja/api/build/graphql_tools/__generated__/searchHost/schema";
3
4
  export declare const createMedia: (media: IMedia) => IMedia;
4
5
  export declare const createAssetMedia: ({ media, asset }: {
5
6
  media: assetSchema.IMedia;
6
7
  asset: assetSchema.IAsset;
7
8
  }) => IMedia;
9
+ export declare const createCreationMedia: ({ creation }: {
10
+ creation: searchSchema.ICreation;
11
+ }) => IMedia;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAssetMedia = exports.createMedia = void 0;
3
+ exports.createCreationMedia = exports.createAssetMedia = exports.createMedia = void 0;
4
4
  const utils_1 = require("@ludo.ninja/utils");
5
5
  const createMedia = (media) => ({
6
6
  ...media,
@@ -17,3 +17,13 @@ const createAssetMedia = ({ media, asset }) => (0, exports.createMedia)({
17
17
  originalMime: media?.originalMime || null,
18
18
  });
19
19
  exports.createAssetMedia = createAssetMedia;
20
+ const createCreationMedia = ({ creation }) => (0, exports.createMedia)({
21
+ media: creation?.media || creation?.originalUrls?.[0] || "",
22
+ nsfw: null,
23
+ mimeType: creation?.mimeType || null,
24
+ previewUrl: null,
25
+ originalUrl: creation?.originalUrls?.[0] || null,
26
+ alt: `${creation.name || ""} ${creation.address || ""}`,
27
+ originalMime: null,
28
+ });
29
+ exports.createCreationMedia = createCreationMedia;
@@ -2,7 +2,7 @@ export interface IMedia {
2
2
  media: string;
3
3
  mimeType: null | string;
4
4
  nsfw: number | null;
5
- previewUrl: string[] | null;
5
+ previewUrl: string | null;
6
6
  originalUrl?: string | null;
7
7
  alt: string;
8
8
  originalMime: null | string;
@@ -0,0 +1,31 @@
1
+ export declare enum mediaSizes {
2
+ small = "252",
3
+ regular = "510"
4
+ }
5
+ export declare const getUserPicImage: (getMediaDomain: (env?: string) => string, userPic: string, fallbackImage: string, dimensions?: {
6
+ w: number;
7
+ h: number;
8
+ }) => string;
9
+ export declare const getAssetImage: (media: string | null | undefined, fallbackImage: string, dimension: mediaSizes, NEXT_PUBLIC_STATIC_DOMAIN: string) => string;
10
+ export declare const getGalleryBannerImage: (getMediaDomain: (env?: string) => string, galleryId: string | null | undefined, fallbackImage: string, dimensions?: {
11
+ w: number;
12
+ h: number;
13
+ }) => string;
14
+ export declare const getAssetVideoOrigins: (getVideoENVDomain: (env?: string) => string, media: string | null | undefined, fallbackImage: string) => string;
15
+ export declare const getAssetAudioOrigins: (getAudioENVDomain: (env?: string) => string, media: string | null | undefined, fallbackImage: string) => string;
16
+ export declare const getAssetVideoPreviews: (getMediaDomain: (env?: string) => string, assetId: string | null | undefined, fallbackImage: string, dimensions?: {
17
+ w: number;
18
+ h: number;
19
+ }) => string;
20
+ export declare const getAssetObjectOrigins: (getMediaDomain: (env?: string) => string, assetId: string | null | undefined, fallbackImage: string, dimensions?: {
21
+ w: number;
22
+ h: number;
23
+ }) => string;
24
+ export declare const getAssetObjectPreviews: (getMediaDomain: (env?: string) => string, assetId: string | null | undefined, fallbackImage: string, dimensions?: {
25
+ w: number;
26
+ h: number;
27
+ }) => string;
28
+ export declare const isExternalMediaImage: (media: string | null, mediaSize: mediaSizes, NEXT_PUBLIC_STATIC_DOMAIN: string) => string;
29
+ export declare const isExternalMediaVideo: (media: string | null, getVideoENVDomain: (env?: string) => string) => string;
30
+ export declare const isExternalMediaAudio: (media: string | null, getAudioENVDomain: (env?: string) => string) => string;
31
+ export declare const isExternalMediaObject: (media: string | null, getMediaDomain: (env?: string) => string) => string;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isExternalMediaObject = exports.isExternalMediaAudio = exports.isExternalMediaVideo = exports.isExternalMediaImage = exports.getAssetObjectPreviews = exports.getAssetObjectOrigins = exports.getAssetVideoPreviews = exports.getAssetAudioOrigins = exports.getAssetVideoOrigins = exports.getGalleryBannerImage = exports.getAssetImage = exports.getUserPicImage = exports.mediaSizes = void 0;
4
+ const constants_1 = require("@ludo.ninja/core/build/constants");
5
+ const utils_1 = require("@ludo.ninja/utils");
6
+ var mediaType;
7
+ (function (mediaType) {
8
+ mediaType["ASSETS"] = "assets/";
9
+ mediaType["USER_PICKS"] = "userpics/";
10
+ mediaType["GALLERY_BANNERS"] = "gallery-banners/";
11
+ })(mediaType || (mediaType = {}));
12
+ var mediaFoldersType;
13
+ (function (mediaFoldersType) {
14
+ mediaFoldersType["IMAGES"] = "images/";
15
+ mediaFoldersType["VIDEOS"] = "videos/";
16
+ mediaFoldersType["OBJECT"] = "models/";
17
+ })(mediaFoldersType || (mediaFoldersType = {}));
18
+ var mediaObjectsFoldersType;
19
+ (function (mediaObjectsFoldersType) {
20
+ mediaObjectsFoldersType["ORIGINS"] = "origins/";
21
+ mediaObjectsFoldersType["PREVIEWS"] = "previews/";
22
+ })(mediaObjectsFoldersType || (mediaObjectsFoldersType = {}));
23
+ var mediaVideosFoldersType;
24
+ (function (mediaVideosFoldersType) {
25
+ mediaVideosFoldersType["ORIGINS"] = "origins/";
26
+ mediaVideosFoldersType["PREVIEWS"] = "previews/";
27
+ })(mediaVideosFoldersType || (mediaVideosFoldersType = {}));
28
+ var mediaSizes;
29
+ (function (mediaSizes) {
30
+ mediaSizes["small"] = "252";
31
+ mediaSizes["regular"] = "510";
32
+ })(mediaSizes || (exports.mediaSizes = mediaSizes = {}));
33
+ const getUserPicImage = (getMediaDomain, userPic, fallbackImage, dimensions) => {
34
+ if (!userPic) {
35
+ return fallbackImage;
36
+ }
37
+ return `${getMediaDomain()}/${mediaType.USER_PICKS}${userPic}${getDimensions(dimensions)}`;
38
+ };
39
+ exports.getUserPicImage = getUserPicImage;
40
+ const getDimensions = (dimensions) => {
41
+ return dimensions ? `?d=${dimensions.w}x${dimensions.h}` : "";
42
+ };
43
+ const getAssetImage = (media, fallbackImage, dimension, NEXT_PUBLIC_STATIC_DOMAIN) => {
44
+ if (!media) {
45
+ return fallbackImage;
46
+ }
47
+ return `https://${dimension}.${NEXT_PUBLIC_STATIC_DOMAIN}/assets/images/${media}`;
48
+ };
49
+ exports.getAssetImage = getAssetImage;
50
+ const getGalleryBannerImage = (getMediaDomain, galleryId, fallbackImage, dimensions) => {
51
+ if (!galleryId) {
52
+ return fallbackImage;
53
+ }
54
+ return `${getMediaDomain()}/${mediaType.GALLERY_BANNERS}${galleryId}${getDimensions(dimensions)}`;
55
+ };
56
+ exports.getGalleryBannerImage = getGalleryBannerImage;
57
+ const getAssetVideoOrigins = (getVideoENVDomain, media, fallbackImage) => {
58
+ if (!media) {
59
+ return fallbackImage;
60
+ }
61
+ return `${getVideoENVDomain()}/${media}`;
62
+ };
63
+ exports.getAssetVideoOrigins = getAssetVideoOrigins;
64
+ const getAssetAudioOrigins = (getAudioENVDomain, media, fallbackImage) => {
65
+ if (!media) {
66
+ return fallbackImage;
67
+ }
68
+ return `${getAudioENVDomain()}/${media}`;
69
+ };
70
+ exports.getAssetAudioOrigins = getAssetAudioOrigins;
71
+ const getAssetVideoPreviews = (getMediaDomain, assetId, fallbackImage, dimensions) => {
72
+ if (!assetId) {
73
+ return fallbackImage;
74
+ }
75
+ return `${getMediaDomain()}/${mediaType.ASSETS}${mediaFoldersType.VIDEOS}${mediaVideosFoldersType.PREVIEWS}${assetId}${getDimensions(dimensions)}`;
76
+ };
77
+ exports.getAssetVideoPreviews = getAssetVideoPreviews;
78
+ const getAssetObjectOrigins = (getMediaDomain, assetId, fallbackImage, dimensions) => {
79
+ if (!assetId) {
80
+ return fallbackImage;
81
+ }
82
+ return `${getMediaDomain()}/${mediaType.ASSETS}${mediaFoldersType.OBJECT}${mediaObjectsFoldersType.ORIGINS}${assetId}${getDimensions(dimensions)}`;
83
+ };
84
+ exports.getAssetObjectOrigins = getAssetObjectOrigins;
85
+ const getAssetObjectPreviews = (getMediaDomain, assetId, fallbackImage, dimensions) => {
86
+ if (!assetId) {
87
+ return fallbackImage;
88
+ }
89
+ return `${getMediaDomain()}/${mediaType.ASSETS}${mediaFoldersType.OBJECT}${mediaObjectsFoldersType.PREVIEWS}${assetId}${getDimensions(dimensions)}`;
90
+ };
91
+ exports.getAssetObjectPreviews = getAssetObjectPreviews;
92
+ const isExternalMediaImage = (media, mediaSize, NEXT_PUBLIC_STATIC_DOMAIN) => {
93
+ if (media == null || !media.length)
94
+ return `${constants_1.staticLink}/public/noContent/noContent.svg`;
95
+ if (media.includes("base64"))
96
+ return media;
97
+ if (media.includes("https" || "http"))
98
+ return (0, utils_1.checkGltfUrl)(media);
99
+ return (0, exports.getAssetImage)(media, `${constants_1.staticLink}/public/noContent/noContent.svg`, mediaSize, NEXT_PUBLIC_STATIC_DOMAIN);
100
+ };
101
+ exports.isExternalMediaImage = isExternalMediaImage;
102
+ const isExternalMediaVideo = (media, getVideoENVDomain) => {
103
+ if (media == null)
104
+ return `${constants_1.staticLink}/public/noContent/noContent.svg`;
105
+ if (media.includes("https" || "http"))
106
+ return (0, utils_1.checkGltfUrl)(media);
107
+ return (0, exports.getAssetVideoOrigins)(getVideoENVDomain, media, `${constants_1.staticLink}/public/noContent/noContent.svg`);
108
+ };
109
+ exports.isExternalMediaVideo = isExternalMediaVideo;
110
+ const isExternalMediaAudio = (media, getAudioENVDomain) => {
111
+ if (media == null)
112
+ return `${constants_1.staticLink}/public/noContent/noContentAudio.svg`;
113
+ if (media.includes("https" || "http"))
114
+ return (0, utils_1.checkGltfUrl)(media);
115
+ return (0, exports.getAssetAudioOrigins)(getAudioENVDomain, media, `${constants_1.staticLink}/public/noContent/noContentAudio.svg`);
116
+ };
117
+ exports.isExternalMediaAudio = isExternalMediaAudio;
118
+ const isExternalMediaObject = (media, getMediaDomain) => {
119
+ if (media == null)
120
+ return `${constants_1.staticLink}/public/noContent/noContentObject.svg`;
121
+ if (media.includes("https" || "http"))
122
+ return (0, utils_1.checkGltfUrl)(media);
123
+ return (0, exports.getAssetObjectOrigins)(getMediaDomain, media, `${constants_1.staticLink}/public/noContent/noContentObject.svg`);
124
+ };
125
+ exports.isExternalMediaObject = isExternalMediaObject;
@@ -1,12 +1,12 @@
1
- import { IQueryFetchGalleryV2Args } from '@ludo.ninja/api/build/graphql_tools/__generated__/galleriesHost/schema';
2
1
  import CollectionCreationEntity from '../../../dto/Collection/CollectionCreationEntity';
3
2
  import CreationEntity from '../../../dto/CreationEntity';
4
- import GalleryEntityV2 from '../../../dto/GalleryEntityV2';
3
+ import { TGallery } from '../../../entities/gallery/types';
4
+ import { IQueryFetchGalleryV2Args } from "@ludo.ninja/api/build/graphql_tools/__generated__/galleriesHost/schema";
5
5
  declare const useGetFavoriteGallaryCreations: ({ galleryId, itemsCount, }: {
6
6
  galleryId: string;
7
7
  itemsCount: number | null;
8
8
  }) => {
9
- gallery: GalleryEntityV2[] | null;
9
+ gallery: TGallery[] | null;
10
10
  loading: boolean;
11
11
  creationsList: (CreationEntity | CollectionCreationEntity)[];
12
12
  loadingAssets: boolean;
@@ -17,7 +17,7 @@ declare const useGetFavoriteGallaryCreations: ({ galleryId, itemsCount, }: {
17
17
  errorGallery: import("@apollo/client").ApolloError | undefined;
18
18
  fetchError: boolean;
19
19
  allResults: number | null;
20
- refetchQueryGalleryCreation: ({ galleryId, }: IQueryFetchGalleryV2Args) => Promise<void>;
20
+ refetchQueryGalleryCreation: ({ galleryId }: IQueryFetchGalleryV2Args) => Promise<void>;
21
21
  loadMore: () => void;
22
22
  };
23
23
  export { useGetFavoriteGallaryCreations };