@ludo.ninja/components 2.1.41 → 2.1.42
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.
- package/build/api/server-search/queries/useFetchFindAllTopEntitiesByName/index.d.ts +1 -1
- package/build/api/server-search/queries/useFetchFindAllTopEntitiesByName/index.js +2 -2
- package/build/components/search/searchSuggestions/index.d.ts +2 -2
- package/build/dto/AssetSearchEntity/index.d.ts +60 -0
- package/build/dto/AssetSearchEntity/index.js +181 -0
- package/build/dto/AssetSearchEntity/interface.d.ts +36 -0
- package/build/dto/AssetSearchEntity/interface.js +2 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
|
|
2
2
|
import { searchSchema as schema } from '@ludo.ninja/api';
|
|
3
3
|
import { ProfileEntity } from '@ludo.ninja/core';
|
|
4
|
-
import AssetEntity from '../../../../dto/
|
|
4
|
+
import AssetEntity from '../../../../dto/AssetSearchEntity';
|
|
5
5
|
export declare const prefetchFindAllTopEntitiesByName: ({ name, pageSize }: schema.IQueryFindAllTopEntitiesByNameArgs, apolloClient: ApolloClient<NormalizedCacheObject>) => Promise<import("@apollo/client").ApolloQueryResult<any> | {
|
|
6
6
|
data: {
|
|
7
7
|
findAllTopEntitiesByName: null;
|
|
@@ -7,7 +7,7 @@ exports.useFetchFindAllTopEntitiesByName = exports.prefetchFindAllTopEntitiesByN
|
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const api_1 = require("@ludo.ninja/api");
|
|
9
9
|
const core_1 = require("@ludo.ninja/core");
|
|
10
|
-
const
|
|
10
|
+
const AssetSearchEntity_1 = __importDefault(require("../../../../dto/AssetSearchEntity"));
|
|
11
11
|
const prefetchFindAllTopEntitiesByName = ({ name, pageSize }, apolloClient) => {
|
|
12
12
|
return apolloClient
|
|
13
13
|
.query({
|
|
@@ -30,7 +30,7 @@ const useFetchFindAllTopEntitiesByName = () => {
|
|
|
30
30
|
uri: api_1.hosts.searchHost,
|
|
31
31
|
},
|
|
32
32
|
onCompleted: ({ findAllTopEntitiesByName }) => {
|
|
33
|
-
const assets = findAllTopEntitiesByName.assets.map((asset) => new
|
|
33
|
+
const assets = findAllTopEntitiesByName.assets.map((asset) => new AssetSearchEntity_1.default(asset)) || [];
|
|
34
34
|
const profiles = findAllTopEntitiesByName.profiles.map((profile) => new core_1.ProfileEntity(profile)) || [];
|
|
35
35
|
setTopEntities({
|
|
36
36
|
assets,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { collectionsSchema as schema } from '@ludo.ninja/api';
|
|
3
3
|
import { ProfileEntity } from '@ludo.ninja/core';
|
|
4
|
-
import
|
|
4
|
+
import AssetSearchEntity from '../../../dto/AssetSearchEntity';
|
|
5
5
|
interface Props {
|
|
6
|
-
assets:
|
|
6
|
+
assets: AssetSearchEntity[];
|
|
7
7
|
profiles: ProfileEntity[];
|
|
8
8
|
collections: schema.ICollection[];
|
|
9
9
|
searchTerm: string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { assetSchema as schema } from "@ludo.ninja/api";
|
|
2
|
+
import { BlockChainEntity, MarketPlaceEntity } from "@ludo.ninja/core";
|
|
3
|
+
import { LabelKeys } from '../common/ItemType';
|
|
4
|
+
import IAssetSearchEntity from './interface';
|
|
5
|
+
declare class AssetSearchEntity implements IAssetSearchEntity {
|
|
6
|
+
private assetId;
|
|
7
|
+
private blockchain;
|
|
8
|
+
private ownersProfiles;
|
|
9
|
+
private ownersAddresses;
|
|
10
|
+
private itemType;
|
|
11
|
+
private address;
|
|
12
|
+
private tokenId;
|
|
13
|
+
private medias;
|
|
14
|
+
private name;
|
|
15
|
+
private description;
|
|
16
|
+
private creatorsProfiles;
|
|
17
|
+
private creatorsAddresses;
|
|
18
|
+
private markets;
|
|
19
|
+
private originalUrls;
|
|
20
|
+
private rank;
|
|
21
|
+
private collection;
|
|
22
|
+
private category;
|
|
23
|
+
private categoryLabel;
|
|
24
|
+
private attributes;
|
|
25
|
+
private blockTimestamp;
|
|
26
|
+
private price;
|
|
27
|
+
constructor(asset: schema.IAsset);
|
|
28
|
+
getAssetId(): string;
|
|
29
|
+
getIsSlider(): boolean;
|
|
30
|
+
getSplitedAssetId(): string;
|
|
31
|
+
getName(): null | string;
|
|
32
|
+
getMarkets(): MarketPlaceEntity[] | null;
|
|
33
|
+
getBlockchain(): BlockChainEntity;
|
|
34
|
+
getPrice(): {
|
|
35
|
+
latestPriceAmount: number | null;
|
|
36
|
+
latestPriceCurrency: string | null;
|
|
37
|
+
};
|
|
38
|
+
getBlockTimestamp(): number;
|
|
39
|
+
getAttributes(): schema.IAttribute[];
|
|
40
|
+
getDescription(): null | string;
|
|
41
|
+
getTokenId(): string | null;
|
|
42
|
+
getCollection(): {
|
|
43
|
+
collectionId: string | null;
|
|
44
|
+
collectionTitle: string | null;
|
|
45
|
+
collectionMedias: schema.IMedia[];
|
|
46
|
+
};
|
|
47
|
+
getCategory(): string | null;
|
|
48
|
+
getCategoryLabel(): string | null;
|
|
49
|
+
getOriginalUrls(): schema.IMedia[] | null;
|
|
50
|
+
getItemType(): LabelKeys;
|
|
51
|
+
getRank(): number;
|
|
52
|
+
getAddress(): string | null;
|
|
53
|
+
getAssetLink(): string;
|
|
54
|
+
getOwnersProfiles(): schema.IProfile[];
|
|
55
|
+
getAssetMedias(): schema.IMedia[];
|
|
56
|
+
getCreatorsProfiles(): schema.IProfile[];
|
|
57
|
+
getOwnersAddresses(): string[] | null;
|
|
58
|
+
getCreatorsAddresses(): string[] | null;
|
|
59
|
+
}
|
|
60
|
+
export default AssetSearchEntity;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@ludo.ninja/core");
|
|
4
|
+
const utils_1 = require("@ludo.ninja/utils");
|
|
5
|
+
const ItemType_1 = require("../common/ItemType");
|
|
6
|
+
class AssetSearchEntity {
|
|
7
|
+
assetId;
|
|
8
|
+
blockchain;
|
|
9
|
+
ownersProfiles;
|
|
10
|
+
ownersAddresses;
|
|
11
|
+
itemType;
|
|
12
|
+
address;
|
|
13
|
+
tokenId;
|
|
14
|
+
medias;
|
|
15
|
+
name;
|
|
16
|
+
description;
|
|
17
|
+
creatorsProfiles;
|
|
18
|
+
creatorsAddresses;
|
|
19
|
+
markets;
|
|
20
|
+
originalUrls;
|
|
21
|
+
rank;
|
|
22
|
+
collection;
|
|
23
|
+
category;
|
|
24
|
+
categoryLabel;
|
|
25
|
+
attributes;
|
|
26
|
+
blockTimestamp;
|
|
27
|
+
price;
|
|
28
|
+
constructor(asset) {
|
|
29
|
+
this.assetId = asset.assetId;
|
|
30
|
+
this.blockchain = new core_1.BlockChainEntity(asset?.blockchain);
|
|
31
|
+
this.markets =
|
|
32
|
+
asset.markets?.map((market) => new core_1.MarketPlaceEntity({
|
|
33
|
+
marketName: market?.marketName,
|
|
34
|
+
marketUrl: market?.marketUrl,
|
|
35
|
+
marketId: market?.marketUrl,
|
|
36
|
+
})) || [];
|
|
37
|
+
this.ownersProfiles = asset.ownersProfiles || null;
|
|
38
|
+
this.ownersAddresses = asset.ownersAddresses;
|
|
39
|
+
this.itemType = ItemType_1.LabelKeys.asset;
|
|
40
|
+
this.address = asset.address;
|
|
41
|
+
this.tokenId = asset.tokenId;
|
|
42
|
+
this.medias = asset.medias;
|
|
43
|
+
this.name = asset.name;
|
|
44
|
+
this.description = asset.description;
|
|
45
|
+
this.creatorsProfiles = asset.creatorsProfiles || null;
|
|
46
|
+
this.creatorsAddresses = asset.creatorsAddresses;
|
|
47
|
+
this.originalUrls = asset.originalUrls;
|
|
48
|
+
this.rank = asset.rank;
|
|
49
|
+
this.collection = {
|
|
50
|
+
collectionId: asset.collectionId,
|
|
51
|
+
collectionTitle: asset.collectionTitle,
|
|
52
|
+
collectionMedias: asset.collectionMedias,
|
|
53
|
+
};
|
|
54
|
+
this.category = asset.category;
|
|
55
|
+
this.categoryLabel = asset.categoryLabel;
|
|
56
|
+
this.price = {
|
|
57
|
+
latestPriceAmount: asset.latestPriceAmount,
|
|
58
|
+
latestPriceCurrency: asset.latestPriceCurrency,
|
|
59
|
+
};
|
|
60
|
+
this.attributes = asset.attributes;
|
|
61
|
+
this.blockTimestamp = asset.blockTimestamp;
|
|
62
|
+
}
|
|
63
|
+
// accessors
|
|
64
|
+
getAssetId() {
|
|
65
|
+
return this.assetId;
|
|
66
|
+
}
|
|
67
|
+
getIsSlider() {
|
|
68
|
+
return this.getAssetMedias()
|
|
69
|
+
? this.getAssetMedias()?.length > 1
|
|
70
|
+
: false;
|
|
71
|
+
}
|
|
72
|
+
getSplitedAssetId() {
|
|
73
|
+
return this.getAssetId().split(".")[1] || this.getAssetId();
|
|
74
|
+
}
|
|
75
|
+
getName() {
|
|
76
|
+
return this.name ? this.name : null;
|
|
77
|
+
}
|
|
78
|
+
getMarkets() {
|
|
79
|
+
return this.markets ? this.markets : null;
|
|
80
|
+
}
|
|
81
|
+
getBlockchain() {
|
|
82
|
+
return this.blockchain;
|
|
83
|
+
}
|
|
84
|
+
getPrice() {
|
|
85
|
+
return {
|
|
86
|
+
latestPriceAmount: this.price.latestPriceAmount
|
|
87
|
+
? this.price.latestPriceAmount
|
|
88
|
+
: null,
|
|
89
|
+
latestPriceCurrency: this.price.latestPriceCurrency
|
|
90
|
+
? this.price.latestPriceCurrency
|
|
91
|
+
: null,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
getBlockTimestamp() {
|
|
95
|
+
return this.blockTimestamp;
|
|
96
|
+
}
|
|
97
|
+
getAttributes() {
|
|
98
|
+
return this.attributes?.length
|
|
99
|
+
? this.attributes
|
|
100
|
+
: [];
|
|
101
|
+
}
|
|
102
|
+
getDescription() {
|
|
103
|
+
return this.description ? this.description : null;
|
|
104
|
+
}
|
|
105
|
+
getTokenId() {
|
|
106
|
+
return this.tokenId ? this.tokenId : null;
|
|
107
|
+
}
|
|
108
|
+
getCollection() {
|
|
109
|
+
return {
|
|
110
|
+
collectionId: this.collection.collectionId
|
|
111
|
+
? this.collection.collectionId
|
|
112
|
+
: null,
|
|
113
|
+
collectionTitle: this.collection.collectionTitle
|
|
114
|
+
? this.collection.collectionTitle
|
|
115
|
+
: null,
|
|
116
|
+
collectionMedias: this.collection.collectionMedias?.length
|
|
117
|
+
? this.collection.collectionMedias
|
|
118
|
+
: [],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
getCategory() {
|
|
122
|
+
return this.category ? this.category : null;
|
|
123
|
+
}
|
|
124
|
+
getCategoryLabel() {
|
|
125
|
+
return this.categoryLabel ? this.categoryLabel : null;
|
|
126
|
+
}
|
|
127
|
+
getOriginalUrls() {
|
|
128
|
+
if (!this.originalUrls)
|
|
129
|
+
return null;
|
|
130
|
+
const convertedOriginalUrlsArray = [];
|
|
131
|
+
for (let i = 0; i < this.originalUrls?.length; i++) {
|
|
132
|
+
convertedOriginalUrlsArray.push({
|
|
133
|
+
url: (0, utils_1.checkGltfUrl)(this.originalUrls[i] || ""),
|
|
134
|
+
mimeType: null,
|
|
135
|
+
originalMime: null,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return convertedOriginalUrlsArray;
|
|
139
|
+
}
|
|
140
|
+
getItemType() {
|
|
141
|
+
return this.itemType;
|
|
142
|
+
}
|
|
143
|
+
getRank() {
|
|
144
|
+
return this.rank ? Math.round(this.rank) : 0;
|
|
145
|
+
}
|
|
146
|
+
getAddress() {
|
|
147
|
+
return this.address ? this.address : null;
|
|
148
|
+
}
|
|
149
|
+
getAssetLink() {
|
|
150
|
+
if (this.getItemType() === ItemType_1.LabelKeys.asset) {
|
|
151
|
+
if (this.getBlockchain().getBlockChainPrivateLabel() ===
|
|
152
|
+
(core_1.BlockChainKeys.elrond || core_1.BlockChainKeys.solana)) {
|
|
153
|
+
return `/${this.getItemType()}/${this.getBlockchain().getBlockChainPrivateLabel()}/${this.getAssetId()}`;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
return `/${this.getItemType()}/${this.getBlockchain().getBlockChainPrivateLabel()}/${this.getAddress()}/${this.getTokenId()}`;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return `/${this.getItemType()}/${this.getAssetId()}`;
|
|
160
|
+
}
|
|
161
|
+
getOwnersProfiles() {
|
|
162
|
+
return this.ownersProfiles
|
|
163
|
+
? this.ownersProfiles
|
|
164
|
+
: [];
|
|
165
|
+
}
|
|
166
|
+
getAssetMedias() {
|
|
167
|
+
return this.medias ? this.medias : [];
|
|
168
|
+
}
|
|
169
|
+
getCreatorsProfiles() {
|
|
170
|
+
return this.creatorsProfiles
|
|
171
|
+
? this.creatorsProfiles
|
|
172
|
+
: [];
|
|
173
|
+
}
|
|
174
|
+
getOwnersAddresses() {
|
|
175
|
+
return this.ownersAddresses ? this.ownersAddresses : null;
|
|
176
|
+
}
|
|
177
|
+
getCreatorsAddresses() {
|
|
178
|
+
return this.creatorsAddresses ? this.creatorsAddresses : null;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
exports.default = AssetSearchEntity;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { assetSchema as schema } from '@ludo.ninja/api';
|
|
2
|
+
import { BlockChainEntity, MarketPlaceEntity } from '@ludo.ninja/core';
|
|
3
|
+
import { LabelKeys } from '../common/ItemType';
|
|
4
|
+
interface IAssetSearchEntity {
|
|
5
|
+
getAssetId(): string;
|
|
6
|
+
getBlockchain(): BlockChainEntity;
|
|
7
|
+
getOwnersProfiles(): schema.IProfile[];
|
|
8
|
+
getBlockTimestamp(): number;
|
|
9
|
+
getCreatorsProfiles(): schema.IProfile[];
|
|
10
|
+
getSplitedAssetId(): string;
|
|
11
|
+
getAttributes(): schema.IAttribute[];
|
|
12
|
+
getOwnersAddresses(): string[] | null;
|
|
13
|
+
getCreatorsAddresses(): string[] | null;
|
|
14
|
+
getIsSlider(): boolean;
|
|
15
|
+
getMarkets(): MarketPlaceEntity[] | null;
|
|
16
|
+
getPrice(): {
|
|
17
|
+
latestPriceAmount: number | null;
|
|
18
|
+
latestPriceCurrency: string | null;
|
|
19
|
+
};
|
|
20
|
+
getAssetMedias(): schema.IMedia[];
|
|
21
|
+
getItemType(): LabelKeys;
|
|
22
|
+
getName(): null | string;
|
|
23
|
+
getOriginalUrls(): schema.IMedia[] | null;
|
|
24
|
+
getAddress(): string | null;
|
|
25
|
+
getCollection(): {
|
|
26
|
+
collectionId: string | null;
|
|
27
|
+
collectionTitle: string | null;
|
|
28
|
+
collectionMedias: schema.IMedia[];
|
|
29
|
+
};
|
|
30
|
+
getCategory(): string | null;
|
|
31
|
+
getCategoryLabel(): string | null;
|
|
32
|
+
getTokenId(): string | null;
|
|
33
|
+
getDescription(): string | null;
|
|
34
|
+
getRank(): number;
|
|
35
|
+
}
|
|
36
|
+
export default IAssetSearchEntity;
|