Skip to content

Commit

Permalink
Revert entitlement purchase (#70)
Browse files Browse the repository at this point in the history
* Revert "Temporarily render bundled media property as media sections"

This reverts commit 96a1614.

* Revert "Add purchase entitlement support (#68)"

This reverts commit 5c594ea.
  • Loading branch information
elv-kevin authored Aug 24, 2024
1 parent 96a1614 commit f784e40
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 144 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"dependencies": {
"@eluvio/crypto": "^1.1.1",
"@eluvio/elv-client-js": "^4.0.80",
"@eluvio/elv-client-js": "^4.0.75",
"@eluvio/elv-embed": "git+https://github.com/eluv-io/elv-embed.git",
"@eluvio/elv-paymentgate": "^1.0.0",
"@eluvio/elv-player-js": "^1.0.117",
Expand Down
42 changes: 0 additions & 42 deletions src/components/marketplace/EntitlementClaim.js

This file was deleted.

47 changes: 0 additions & 47 deletions src/components/marketplace/MintingStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,53 +762,6 @@ export const ClaimMintingStatus = observer(() => {
);
});

export const EntitlementMintingStatus = observer(() => {
const match = useRouteMatch();
const [status, setStatus] = useState(undefined);

const marketplace = rootStore.marketplaces[match.params.marketplaceId];
const animation = MobileOption(rootStore.pageWidth, marketplace?.storefront?.purchase_animation, marketplace?.storefront?.purchase_animation_mobile);
const videoHash = LinkTargetHash(animation);

const revealAnimation = MobileOption(rootStore.pageWidth, marketplace?.storefront?.reveal_animation, marketplace?.storefront?.reveal_animation_mobile);
const revealVideoHash = LinkTargetHash(revealAnimation);

const hideText = marketplace?.storefront?.hide_text;

const Status = async () => await rootStore.EntitlementClaimStatus({
marketplaceId: match.params.marketplaceId,
purchaseId: match.params.purchaseId
});

if(!status) {
return (
<MintingStatus
key={`status-${videoHash}`}
videoHash={videoHash}
revealVideoHash={revealVideoHash}
hideText={hideText}
Status={Status}
OnFinish={({status}) => setStatus(status)}
basePath={UrlJoin("/marketplace", match.params.marketplaceId)}
backText={rootStore.l10n.status.back_to_marketplace}
/>
);
}

let items = status.items;
return (
<MintResults
skipReveal={marketplace?.storefront?.skip_reveal}
header={rootStore.l10n.status.minting.success_header}
subheader={rootStore.l10n.status.minting["received_item_single"]}
items={items}
basePath={UrlJoin("/marketplace", match.params.marketplaceId)}
nftBasePath={UrlJoin("/marketplace", match.params.marketplaceId, "users", "me", "items")}
backText={rootStore.l10n.status.back_to_marketplace}
/>
);
});

export const PackOpenStatus = observer(() => {
const [status, setStatus] = useState(undefined);

Expand Down
6 changes: 1 addition & 5 deletions src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
DropMintingStatus,
PackOpenStatus,
PurchaseMintingStatus,
DepositStatus, GiftRedemptionStatus, GiftPurchaseMintingStatus, EntitlementMintingStatus,
DepositStatus, GiftRedemptionStatus, GiftPurchaseMintingStatus
} from "Components/marketplace/MintingStatus";
import UserListings from "Components/user/UserListings";
import UserItems from "Components/user/UserItems";
Expand All @@ -21,7 +21,6 @@ import {ErrorBoundary} from "Components/common/ErrorBoundary";
import MarketplaceCollectionsSummaryPage from "Components/marketplace/MarketplaceCollectionsSummary";
import MarketplaceCollection from "Components/marketplace/MarketplaceCollection";
import MarketplaceCollectionRedemption from "Components/marketplace/MarketplaceCollectionRedemption";
import EntitlementClaim from "Components/marketplace/EntitlementClaim";
import {LoginGate} from "Components/common/LoginGate";
import {observer} from "mobx-react";
import UserProfileContainer from "Components/profile/UserProfileContainer";
Expand Down Expand Up @@ -124,9 +123,6 @@ const MarketplaceRoutes = () => {
{ name: "Redeem Collection", path: "collections/:collectionSKU/redeem", Component: MarketplaceCollectionRedemption },
{ name: "Redeem Collection", path: "collections/:collectionSKU/redeem/:confirmationId/status", Component: CollectionRedeemStatus },

{ name: "Redeem Entitlement", path: "store/:sku/entitle/:signature", Component: EntitlementClaim },
{ name: "Redeem Entitlement", path: "store/:sku/entitle/status/:purchaseId", Component: EntitlementMintingStatus },

...TokenRoutes("collections/:collectionSKU/owned"),

{ name: "Drop Event", path: "events/:tenantSlug/:eventSlug/:dropId", Component: Drop, hideNavigation: true, authed: true, ignoreLoginCapture: true },
Expand Down
19 changes: 0 additions & 19 deletions src/stores/Checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,25 +472,6 @@ class CheckoutStore {
}
});

EntitlementClaim = flow(function * ({entitlementSignature}) {
const decode = yield this.client.DecodeSignedMessageJSON({signedMessage: entitlementSignature});

const tenantId = decode?.message?.tenant_id;
const body = {"op": "nft-claim-entitlement", "signature": entitlementSignature};

const data = (yield this.client.utils.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({
path: UrlJoin("as", "wlt", "act", tenantId),
method: "POST",
body: body,
headers: {
Authorization: `Bearer ${this.walletClient.AuthToken()}`
}
})));

const splits = data?.op?.split(":");
return splits?.length > 3 ? splits[3] : "";
});

ListingCheckoutSubmit = flow(function * ({
provider="stripe",
marketplaceId,
Expand Down
25 changes: 5 additions & 20 deletions src/stores/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,32 +401,21 @@ class RootStore {
noAuth: true
});

let authParameter;
try {
const auth = searchParams.get("auth");

if(auth) {
const parsedAuth = JSON.parse(Utils.FromB64(auth));
if(parsedAuth.idToken && !parsedAuth.clientAuthToken && !parsedAuth.clientSigningToken) {
authParameter = {
idToken: parsedAuth.idToken,
signerURIs: ["https://wlt.stg.svc.eluv.io"],
user: {
name: parsedAuth.user,
verified: true,
}
};
} else {
this.SetAuthInfo(parsedAuth);
}
this.SetAuthInfo(JSON.parse(Utils.FromB64(auth)));
}
} catch(error) {
this.Log("Failed to load auth from parameter", true);
this.Log(error, true);
}

if(!this.inFlow) {
if(authParameter || this.AuthInfo()) {
yield this.Authenticate(authParameter || this.AuthInfo());
if(this.AuthInfo()) {
this.Log("Authenticating from saved session");
yield this.Authenticate(this.AuthInfo());
} else if(this.auth0) {
// Attempt to re-auth with auth0. If 'code' is present in URL params, we are returning from Auth0 callback, let the login component handle it
yield this.AuthenticateAuth0({});
Expand Down Expand Up @@ -1331,10 +1320,6 @@ class RootStore {
return yield this.walletClient.ClaimStatus({marketplaceParams: { marketplaceId }, sku});
});

EntitlementClaimStatus = flow(function * ({marketplaceId, purchaseId}) {
return yield this.walletClient.EntitlementClaimStatus({marketplaceParams: { marketplaceId }, purchaseId});
});

GiftClaimStatus = flow(function * ({marketplaceId, confirmationId}) {
return yield this.walletClient.GiftClaimStatus({marketplaceParams: { marketplaceId }, confirmationId});
});
Expand Down
2 changes: 1 addition & 1 deletion src/utils/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ const FormatAdditionalMedia = ({nft, name, metadata={}}) => {
let additionalMedia, additionalMediaType, hasAdditionalMedia;
let watchedMediaIds = [];

if(["Sections", "property"].includes(metadata?.additional_media_type)) {
if(metadata?.additional_media_type === "Sections") {
additionalMediaType = "Sections";
additionalMedia = { ...(metadata?.additional_media_sections || {}) };
hasAdditionalMedia = additionalMedia.featured_media?.length > 0 ||
Expand Down

0 comments on commit f784e40

Please sign in to comment.