Skip to content

Commit

Permalink
🔀 Merge #1866 updates to deploy/rinkeby
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Oct 6, 2024
2 parents fb98c88 + 69cca51 commit 26040b7
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 69 deletions.
28 changes: 20 additions & 8 deletions src/components/NFTBook/CrossSellDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@ export default {
1
);
},
async gotoCheckoutPage({ link, customPriceInDecimal }) {
async gotoCheckoutPage({
link,
customPriceInDecimal,
purchaseEventParams,
}) {
try {
const { url } = await this.$axios.$post(link, {
const { url, paymentId } = await this.$axios.$post(link, {
gaClientId: this.getGaClientId,
gaSessionId: this.getGaSessionId,
coupon: this.$route.query.coupon,
Expand All @@ -155,6 +159,10 @@ export default {
gadSource: this.gadSource,
fbClickId: this.fbClickId,
});
logPurchaseFlowEvent(this, 'begin_checkout', {
...purchaseEventParams,
paymentId,
});
if (url) {
window.location.href = url;
} else {
Expand Down Expand Up @@ -208,13 +216,15 @@ export default {
logPurchaseFlowEvent(this, 'add_to_cart', purchaseEventParams);
if (this.shoppingCartBookItems.length < 1) {
logPurchaseFlowEvent(this, 'begin_checkout', purchaseEventParams);
const link = getNFTBookPurchaseLink({
collectionId: this.collectionId,
platform: this.platform,
});
await this.gotoCheckoutPage({ link, customPriceInDecimal });
await this.gotoCheckoutPage({
link,
customPriceInDecimal,
purchaseEventParams,
});
return;
}
Expand Down Expand Up @@ -254,14 +264,16 @@ export default {
logPurchaseFlowEvent(this, 'add_to_cart', purchaseEventParams);
if (this.shoppingCartBookItems.length < 1) {
logPurchaseFlowEvent(this, 'begin_checkout', purchaseEventParams);
const link = getNFTBookPurchaseLink({
classId: this.classId,
priceIndex: edition.index,
platform: this.platform,
});
await this.gotoCheckoutPage({ link, customPriceInDecimal });
await this.gotoCheckoutPage({
link,
customPriceInDecimal,
purchaseEventParams,
});
return;
}
Expand Down
25 changes: 7 additions & 18 deletions src/mixins/nft.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
getNFTCountByClassId,
getNftBookBuyerMessage,
getNFTBookPurchaseLink,
postNFTBookLIKEPurchaseEndpoint,
} from '~/util/api';
import { logTrackerEvent, logPurchaseFlowEvent } from '~/util/EventLogger';
import { sleep, catchAxiosError } from '~/util/misc';
Expand Down Expand Up @@ -1048,23 +1047,13 @@ export default {
result = { data: { nftId: this.listingInfo.nftId } };
} else {
this.uiSetTxStatus(TX_STATUS.PROCESSING_NON_BLOCKING);
if (this.nftIsNFTBook) {
result = await this.$api.post(
postNFTBookLIKEPurchaseEndpoint({
classId,
priceIndex: this.editionPriceIndex,
}),
{ txHash, email }
);
} else {
result = await this.$api.post(
postNFTPurchase({
txHash,
classId,
ts: Date.now(),
})
);
}
result = await this.$api.post(
postNFTPurchase({
txHash,
classId,
ts: Date.now(),
})
);
}
logTrackerEvent(
this,
Expand Down
8 changes: 6 additions & 2 deletions src/pages/nft/class/_classId/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1176,8 +1176,8 @@ export default {
this.isOpeningCheckoutPage = true;
const purchaseEventParams = this.getPurchaseEventParams(edition);
logPurchaseFlowEvent(this, 'add_to_cart', purchaseEventParams);
logPurchaseFlowEvent(this, 'begin_checkout', purchaseEventParams);
if (edition.price === 0 && !this.customPrice) {
logPurchaseFlowEvent(this, 'begin_checkout', purchaseEventParams);
this.$router.push(
this.localeLocation({
name: 'nft-claim',
Expand All @@ -1201,7 +1201,7 @@ export default {
priceIndex: edition.index,
platform: this.platform,
});
const { url } = await this.$axios.$post(link, {
const { url, paymentId } = await this.$axios.$post(link, {
gaClientId,
gaSessionId,
giftInfo,
Expand All @@ -1216,6 +1216,10 @@ export default {
fbClickId: this.fbClickId,
email: this.walletEmail,
});
logPurchaseFlowEvent(this, 'begin_checkout', {
...purchaseEventParams,
paymentId,
});
if (url) {
window.location.href = url;
} else {
Expand Down
16 changes: 10 additions & 6 deletions src/pages/nft/collection/_collectionId/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,12 @@ export default {
try {
this.isOpeningCheckoutPage = true;
logPurchaseFlowEvent(this, 'add_to_cart', this.purchaseEventParams);
logPurchaseFlowEvent(
this,
'begin_checkout',
this.purchaseEventParams
);
if (this.collectionPrice === 0 && !this.customPrice) {
logPurchaseFlowEvent(
this,
'begin_checkout',
this.purchaseEventParams
);
this.$router.push(
this.localeLocation({
name: 'nft-claim',
Expand All @@ -344,7 +344,7 @@ export default {
collectionId: this.collectionId,
platform: this.platform,
});
const { url } = await this.$axios.$post(link, {
const { url, paymentId } = await this.$axios.$post(link, {
gaClientId,
giftInfo,
gaSessionId,
Expand All @@ -359,6 +359,10 @@ export default {
fbClickId: this.fbClickId,
email: this.walletEmail,
});
logPurchaseFlowEvent(this, 'begin_checkout', {
...this.purchaseEventParams,
paymentId,
});
if (url) {
window.location.href = url;
} else {
Expand Down
7 changes: 5 additions & 2 deletions src/pages/shopping-cart/book.vue
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,10 @@ export default {
this.productIdList,
1
);
logPurchaseFlowEvent(this, 'begin_checkout', this.purchaseEventParams);
const gaClientId = this.getGaClientId;
const gaSessionId = this.getGaSessionId;
const link = getNFTBookCartPurchaseLink();
const { url } = await this.$axios.$post(link, {
const { url, paymentId } = await this.$axios.$post(link, {
gaClientId,
gaSessionId,
utmCampaign: this.utmCampaign,
Expand All @@ -354,6 +353,10 @@ export default {
coupon: this.coupon,
giftInfo,
});
logPurchaseFlowEvent(this, 'begin_checkout', {
...this.purchaseEventParams,
paymentId,
});
if (url) {
window.location.href = url;
} else {
Expand Down
33 changes: 0 additions & 33 deletions src/util/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,39 +379,6 @@ export const getFreeNFTBookPurchaseEndpoint = ({
)}`;
};

export const postNFTBookLIKEPurchaseEndpoint = ({
classId,
collectionId,
priceIndex,
coupon,
gaClientId,
gaSessionId,
utmCampaign,
utmSource,
utmMedium,
referrer,
platform = NFT_BOOK_PLATFORM_LIKER_LAND,
}) => {
const qsPayload = {
price_index: priceIndex,
from: platform,
coupon,
ga_client_id: gaClientId,
ga_session_id: gaSessionId,
utm_campaign: utmCampaign,
utm_source: utmSource,
utm_medium: utmMedium,
referrer,
};
return collectionId
? `${LIKECOIN_API_BASE}/likernft/book/collection/purchase/${collectionId}/new/like?${querystring.stringify(
qsPayload
)}`
: `${LIKECOIN_API_BASE}/likernft/book/purchase/${classId}/new/like?${querystring.stringify(
qsPayload
)}`;
};

export const getNFTCollectionInfo = ({ wallet, classId, type }) => {
const qsPayload = {
class_id: classId,
Expand Down

0 comments on commit 26040b7

Please sign in to comment.