additionally handle item urls (marketplace links from cert inspections)

This commit is contained in:
howard-stearns 2018-09-27 19:42:01 -07:00
parent a6ef25f662
commit b45677cd02

View file

@ -118,13 +118,16 @@ function openMarketplace(optionalItemOrUrl) {
// AND... if call onMarketplaceOpen to setupWallet if we need to.
var url = optionalItemOrUrl || MARKETPLACE_URL_INITIAL;
var cta = 'marketplace cta';
var match;
// If optionalItemOrUrl contains the metaverse base, then it's a url, not an item id.
if (optionalItemOrUrl && optionalItemOrUrl.indexOf(METAVERSE_SERVER_URL) === -1) {
cta = optionalItemOrUrl; // item id
url = MARKETPLACE_URL + '/items/' + optionalItemOrUrl;
} else if (optionalItemOrUrl) {
// A specific url. Don't attempt to set up wallet because we don't have a way to come back.
// Does that ever happen without the wallet already setup?
cta = '';
// A specific url.
match = optionalItemOrUrl.match(/\/item\/(\w+)$/);
// Don't attempt to set up wallet for a non-item url because we don't have a way to come back.
cta = (match && match[1]) || '';
}
ui.open(url, MARKETPLACES_INJECT_SCRIPT_URL);
}