Skip to content

Commit

Permalink
🔀 Merge #1888 into deploy/rinkeby
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Oct 11, 2024
2 parents 53717a9 + acc6cdb commit 1b8ce85
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/components/NFTBook/CrossSellDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ export default {
});
} else {
// NOTE: Only support single edition for now
const edition = this.getEditionByIndex(0);
const priceIndex = 0;
const edition = this.getEditionByIndex(priceIndex);
const hasStock = edition?.stock;
if (!hasStock || !this.nftIsCollectable || edition.price === 0) {
this.handleReject();
Expand All @@ -250,6 +251,7 @@ export default {
name: this.NFTName,
price: edition.price,
classId: this.classId,
priceIndex,
quantity: 1,
},
],
Expand Down
4 changes: 4 additions & 0 deletions src/constant/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ export const NFT_BOOK_WITH_SIGN_IMAGE_SET = new Map(
'likenft1nekez4y50uk0dmgxuxql7v2vnhy3wqa24ld46hk4frlwcvwpr88selunrr',
['陳健民'],
],
[
'likenft1gp28fe9uzqdadrps67hz20035m0hh9zu9m8kzvz6gdawvms5xtts5m6qds',
['賴佩霞'],
],
]
: [
['likenft154xhw0qyds5pgvsyc7379lnkyvwqkvv2zvmmh2gn5qrewljeqwys2sju6x'],
Expand Down
2 changes: 2 additions & 0 deletions src/mixins/nft.js
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,7 @@ export default {
items: [
{
classId: this.classId,
priceIndex: this.editionPriceIndex,
price: this.NFTPriceUSD,
name: this.NFTName,
},
Expand Down Expand Up @@ -1131,6 +1132,7 @@ export default {
{
name: this.NFTName,
price: this.NFTPriceUSD,
priceIndex: this.editionPriceIndex,
classId,
},
],
Expand Down
13 changes: 11 additions & 2 deletions src/pages/nft/claim/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -798,14 +798,15 @@ export default {
return;
}
let price;
let priceIndex;
if (this.cartId) {
const { data } = await this.$api.get(
getNFTBookCartStatusEndpoint({
cartId: this.cartId,
token: this.token,
})
);
({ price } = data);
({ price, priceIndex } = data);
const {
classIdsWithPrice = [],
collectionIdsWithPrice = [],
Expand Down Expand Up @@ -908,7 +909,13 @@ export default {
if (!free && !this.giftInfo && redirect && query.type === 'nft_book') {
const items = this.cartItems.length
? this.cartItems.map(item => {
const { classId, collectionId, price, quantity = 1 } = item;
const {
classId,
collectionId,
price,
priceIndex,
quantity = 1,
} = item;
const name = classId
? this.getNFTClassMetadataById(classId)?.name
: this.getNFTCollectionInfoByCollectionId(collectionId)?.name[
Expand All @@ -918,6 +925,7 @@ export default {
name,
classId,
collectionId,
priceIndex,
price,
quantity,
};
Expand All @@ -927,6 +935,7 @@ export default {
name: this.productName,
classId: this.classId,
collectionId: this.collectionId,
priceIndex,
price,
quantity: this.quantity,
},
Expand Down
1 change: 1 addition & 0 deletions src/pages/nft/class/_classId/_nftId.vue
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ export default {
{
name: this.NFTName,
price: this.NFTPriceUSD,
priceIndex: this.editionPriceIndex,
classId: this.classId,
},
],
Expand Down
16 changes: 15 additions & 1 deletion src/pages/nft/class/_classId/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ export default {
inLanguage: this.iscnData?.contentMetadata?.inLanguage,
bookFormat: 'https://schema.org/EBook',
bookEdition: e.name,
description: `${e.description}${'\n'}${description}`,
description: `${e.description}\n${description}`,
brand: {
'@context': 'http://www.schema.org',
'@type': 'Brand',
Expand Down Expand Up @@ -891,6 +891,7 @@ export default {
{
name: this.NFTName,
classId: this.classId,
priceIndex: this.editionPriceIndex,
price: this.NFTPriceUSD,
},
],
Expand Down Expand Up @@ -940,6 +941,7 @@ export default {
name: this.NFTName,
price: customPriceInDecimal || edition.price,
classId: this.classId,
priceIndex: edition.index,
quantity: this.quantity,
},
],
Expand Down Expand Up @@ -1357,6 +1359,18 @@ export default {
this.classId,
1
);
logPurchaseFlowEvent(this, 'view_item', {
items: [
{
name: this.NFTName,
classId: this.classId,
priceIndex: this.editionPriceIndex,
price: this.NFTPriceUSD,
},
],
price: this.NFTPriceUSD,
currency: 'USD',
});
},
handleInputCustomPrice(price) {
this.customPrice = Number(price);
Expand Down
1 change: 1 addition & 0 deletions src/pages/nft/fiat/stripe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export default {
name: this.NFTName,
price: this.result.fiatPrice,
classId: this.classId,
priceIndex: this.editionPriceIndex,
},
],
price: this.result.fiatPrice,
Expand Down
4 changes: 3 additions & 1 deletion src/pages/nft/gift/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export default {
return;
}
let price;
let priceIndex;
if (this.cartId) {
const { data } = await this.$api.get(
Expand Down Expand Up @@ -147,7 +148,7 @@ export default {
paymentId: this.paymentId,
})
);
({ price } = data);
({ price, priceIndex } = data);
}
try {
if (this.cartItems.length) {
Expand Down Expand Up @@ -212,6 +213,7 @@ export default {
name: this.productName,
classId: this.classId,
collectionId: this.collectionId,
priceIndex,
price,
quantity: this.quantity,
},
Expand Down

0 comments on commit 1b8ce85

Please sign in to comment.