mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-21 07:09:15 +02:00
Bugfixes; enable purchase asset from marketplace screen raise
This commit is contained in:
parent
8df5db4239
commit
31f7d747c8
4 changed files with 124 additions and 95 deletions
|
@ -19,6 +19,7 @@ import controlsUit 1.0 as HifiControlsUit
|
||||||
import "../../../controls" as HifiControls
|
import "../../../controls" as HifiControls
|
||||||
import "../wallet" as HifiWallet
|
import "../wallet" as HifiWallet
|
||||||
import "../common" as HifiCommerceCommon
|
import "../common" as HifiCommerceCommon
|
||||||
|
import "../.." as HifiCommon
|
||||||
|
|
||||||
// references XXX from root context
|
// references XXX from root context
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ Rectangle {
|
||||||
property bool ownershipStatusReceived: false;
|
property bool ownershipStatusReceived: false;
|
||||||
property bool balanceReceived: false;
|
property bool balanceReceived: false;
|
||||||
property bool availableUpdatesReceived: false;
|
property bool availableUpdatesReceived: false;
|
||||||
|
property bool itemInfoReceived: false;
|
||||||
property string baseItemName: "";
|
property string baseItemName: "";
|
||||||
property string itemName;
|
property string itemName;
|
||||||
property string itemId;
|
property string itemId;
|
||||||
|
@ -181,11 +183,14 @@ Rectangle {
|
||||||
|
|
||||||
onItemIdChanged: {
|
onItemIdChanged: {
|
||||||
root.ownershipStatusReceived = false;
|
root.ownershipStatusReceived = false;
|
||||||
|
root.itemInfoReceived = false;
|
||||||
Commerce.alreadyOwned(root.itemId);
|
Commerce.alreadyOwned(root.itemId);
|
||||||
root.availableUpdatesReceived = false;
|
root.availableUpdatesReceived = false;
|
||||||
root.currentUpdatesPage = 1;
|
root.currentUpdatesPage = 1;
|
||||||
Commerce.getAvailableUpdates(root.itemId);
|
Commerce.getAvailableUpdates(root.itemId);
|
||||||
itemPreviewImage.source = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/previews/" + itemId + "/thumbnail/hifi-mp-" + itemId + ".jpg";
|
|
||||||
|
var MARKETPLACE_API_URL = Account.metaverseServerURL + "/api/v1/marketplace/items/";
|
||||||
|
http.request({uri: MARKETPLACE_API_URL + root.itemId}, updateCheckoutQMLFromHTTP);
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemTypeChanged: {
|
onItemTypeChanged: {
|
||||||
|
@ -279,6 +284,7 @@ Rectangle {
|
||||||
ownershipStatusReceived = false;
|
ownershipStatusReceived = false;
|
||||||
balanceReceived = false;
|
balanceReceived = false;
|
||||||
availableUpdatesReceived = false;
|
availableUpdatesReceived = false;
|
||||||
|
itemInfoReceived = false;
|
||||||
Commerce.getWalletStatus();
|
Commerce.getWalletStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,7 +361,7 @@ Rectangle {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: loading;
|
id: loading;
|
||||||
z: 997;
|
z: 997;
|
||||||
visible: !root.ownershipStatusReceived || !root.balanceReceived || !root.availableUpdatesReceived;
|
visible: !root.ownershipStatusReceived || !root.balanceReceived || !root.availableUpdatesReceived || !root.itemInfoReceived;
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
color: hifi.colors.white;
|
color: hifi.colors.white;
|
||||||
|
|
||||||
|
@ -1064,9 +1070,26 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HifiCommon.RootHttpRequest {
|
||||||
|
id: http;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// FUNCTION DEFINITIONS START
|
// FUNCTION DEFINITIONS START
|
||||||
//
|
//
|
||||||
|
|
||||||
|
function updateCheckoutQMLFromHTTP(error, result) {
|
||||||
|
root.itemInfoReceived = true;
|
||||||
|
root.itemName = result.data.title;
|
||||||
|
root.itemPrice = result.data.cost;
|
||||||
|
root.itemHref = Account.metaverseServerURL + result.data.path;
|
||||||
|
root.itemAuthor = result.data.creator;
|
||||||
|
root.itemType = result.data.item_type || "unknown";
|
||||||
|
itemPreviewImage.source = result.data.thumbnail_url;
|
||||||
|
refreshBuyUI();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function Name: fromScript()
|
// Function Name: fromScript()
|
||||||
//
|
//
|
||||||
|
@ -1080,18 +1103,24 @@ Rectangle {
|
||||||
// Description:
|
// Description:
|
||||||
// Called when a message is received from a script.
|
// Called when a message is received from a script.
|
||||||
//
|
//
|
||||||
|
|
||||||
function fromScript(message) {
|
function fromScript(message) {
|
||||||
switch (message.method) {
|
switch (message.method) {
|
||||||
case 'updateCheckoutQML':
|
case 'updateCheckoutQMLItemID':
|
||||||
root.itemId = message.params.itemId;
|
if (!message.params.itemId) {
|
||||||
root.itemName = message.params.itemName.trim();
|
console.log("A message with method 'updateCheckoutQMLItemID' was sent without an itemId!");
|
||||||
root.itemPrice = message.params.itemPrice;
|
return;
|
||||||
root.itemHref = message.params.itemHref;
|
}
|
||||||
root.referrer = message.params.referrer;
|
|
||||||
root.itemAuthor = message.params.itemAuthor;
|
// If we end up following the referrer (i.e. in case the wallet "isn't set up" or the user cancels),
|
||||||
|
// we want the user to be placed back on the individual item's page - thus we set the
|
||||||
|
// default of the referrer in this case to "itemPage".
|
||||||
|
root.referrer = message.params.referrer || "itemPage";
|
||||||
root.itemEdition = message.params.itemEdition || -1;
|
root.itemEdition = message.params.itemEdition || -1;
|
||||||
root.itemType = message.params.itemType || "unknown";
|
root.itemId = message.params.itemId;
|
||||||
refreshBuyUI();
|
break;
|
||||||
|
case 'http.response':
|
||||||
|
http.handleHttpResponse(message);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log('Checkout.qml: Unrecognized message from marketplaces.js');
|
console.log('Checkout.qml: Unrecognized message from marketplaces.js');
|
||||||
|
|
|
@ -56,7 +56,7 @@ Item {
|
||||||
// Background
|
// Background
|
||||||
Rectangle {
|
Rectangle {
|
||||||
z: 1;
|
z: 1;
|
||||||
visible: root.assetName !== "" && sendAssetStep.visible;
|
visible: root.assetCertID !== "" && sendAssetStep.referrer !== "payIn" && sendAssetStep.visible;
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: root.parentAppTitleBarHeight;
|
anchors.topMargin: root.parentAppTitleBarHeight;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -84,7 +84,6 @@ Item {
|
||||||
if (sendPubliclyCheckbox.checked && sendAssetStep.referrer === "nearby") {
|
if (sendPubliclyCheckbox.checked && sendAssetStep.referrer === "nearby") {
|
||||||
sendSignalToParent({
|
sendSignalToParent({
|
||||||
method: 'sendAsset_sendPublicly',
|
method: 'sendAsset_sendPublicly',
|
||||||
assetName: root.assetName,
|
|
||||||
recipient: sendAssetStep.selectedRecipientNodeID,
|
recipient: sendAssetStep.selectedRecipientNodeID,
|
||||||
amount: parseInt(amountTextField.text),
|
amount: parseInt(amountTextField.text),
|
||||||
effectImage: root.sendingPubliclyEffectImage
|
effectImage: root.sendingPubliclyEffectImage
|
||||||
|
@ -155,7 +154,7 @@ Item {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: userInfoContainer;
|
id: userInfoContainer;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "";
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
|
@ -251,7 +250,7 @@ Item {
|
||||||
|
|
||||||
LinearGradient {
|
LinearGradient {
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "";
|
||||||
start: Qt.point(0, 0);
|
start: Qt.point(0, 0);
|
||||||
end: Qt.point(0, height);
|
end: Qt.point(0, height);
|
||||||
gradient: Gradient {
|
gradient: Gradient {
|
||||||
|
@ -262,7 +261,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: sendAssetText;
|
id: sendAssetText;
|
||||||
text: root.assetName === "" ? "Send Money To:" : "Gift \"" + root.assetName + "\" To:";
|
text: root.assetCertID === "" ? "Send Money To:" : "Gift \"" + root.assetName + "\" To:";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
|
@ -441,7 +440,7 @@ Item {
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: closeGlyphButton_connections;
|
id: closeGlyphButton_connections;
|
||||||
text: hifi.glyphs.close;
|
text: hifi.glyphs.close;
|
||||||
color: root.assetName === "" ? hifi.colors.lightGrayText : hifi.colors.baseGray;
|
color: root.assetCertID === "" ? hifi.colors.lightGrayText : hifi.colors.baseGray;
|
||||||
size: 26;
|
size: 26;
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 10;
|
anchors.topMargin: 10;
|
||||||
|
@ -684,7 +683,7 @@ Item {
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: closeGlyphButton_nearby;
|
id: closeGlyphButton_nearby;
|
||||||
text: hifi.glyphs.close;
|
text: hifi.glyphs.close;
|
||||||
color: root.assetName === "" ? hifi.colors.lightGrayText : hifi.colors.baseGray;
|
color: root.assetCertID === "" ? hifi.colors.lightGrayText : hifi.colors.baseGray;
|
||||||
size: 26;
|
size: 26;
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 10;
|
anchors.topMargin: 10;
|
||||||
|
@ -760,7 +759,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: sendToText;
|
id: sendToText;
|
||||||
text: root.assetName === "" ? "Send to:" : "Gift to:";
|
text: root.assetCertID === "" ? "Send to:" : "Gift to:";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 36;
|
anchors.topMargin: 36;
|
||||||
|
@ -865,7 +864,8 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: sendAssetText_sendAssetStep;
|
id: sendAssetText_sendAssetStep;
|
||||||
text: root.assetName === "" ? "Send Money" : "Gift \"" + root.assetName + "\"";
|
text: sendAssetStep.referrer === "payIn" && root.assetCertID !== "" ? "Send Item:" :
|
||||||
|
(root.assetCertID === "" ? "Send Money To:" : "Gift \"" + root.assetName + "\" To:");
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
|
@ -878,7 +878,7 @@ Item {
|
||||||
// Text size
|
// Text size
|
||||||
size: 22;
|
size: 22;
|
||||||
// Style
|
// Style
|
||||||
color: root.assetName === "" ? hifi.colors.white : hifi.colors.black;
|
color: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.white : hifi.colors.black;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -893,7 +893,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: sendToText_sendAssetStep;
|
id: sendToText_sendAssetStep;
|
||||||
text: root.assetName === "" ? "Send to:" : "Gift to:";
|
text: (root.assetCertID === "" || sendAssetStep.referrer === "payIn") ? "Send to:" : "Gift to:";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -902,7 +902,7 @@ Item {
|
||||||
// Text size
|
// Text size
|
||||||
size: 18;
|
size: 18;
|
||||||
// Style
|
// Style
|
||||||
color: root.assetName === "" ? hifi.colors.white : hifi.colors.black;
|
color: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.white : hifi.colors.black;
|
||||||
verticalAlignment: Text.AlignVCenter;
|
verticalAlignment: Text.AlignVCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,7 +912,7 @@ Item {
|
||||||
anchors.right: changeButton.left;
|
anchors.right: changeButton.left;
|
||||||
anchors.rightMargin: 12;
|
anchors.rightMargin: 12;
|
||||||
height: parent.height;
|
height: parent.height;
|
||||||
textColor: root.assetName === "" ? hifi.colors.white : hifi.colors.black;
|
textColor: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.white : hifi.colors.black;
|
||||||
|
|
||||||
displayName: sendAssetStep.selectedRecipientDisplayName;
|
displayName: sendAssetStep.selectedRecipientDisplayName;
|
||||||
userName: sendAssetStep.selectedRecipientUserName;
|
userName: sendAssetStep.selectedRecipientUserName;
|
||||||
|
@ -924,7 +924,7 @@ Item {
|
||||||
// "CHANGE" button
|
// "CHANGE" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: changeButton;
|
id: changeButton;
|
||||||
color: root.assetName === "" ? hifi.buttons.none : hifi.buttons.white;
|
color: root.assetCertID === "" ? hifi.buttons.none : hifi.buttons.white;
|
||||||
colorScheme: hifi.colorSchemes.dark;
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
@ -945,7 +945,7 @@ Item {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: amountContainer;
|
id: amountContainer;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "";
|
||||||
anchors.top: sendToContainer.bottom;
|
anchors.top: sendToContainer.bottom;
|
||||||
anchors.topMargin: 2;
|
anchors.topMargin: 2;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -972,8 +972,8 @@ Item {
|
||||||
HifiControlsUit.TextField {
|
HifiControlsUit.TextField {
|
||||||
id: amountTextField;
|
id: amountTextField;
|
||||||
readOnly: sendAssetStep.referrer === "payIn";
|
readOnly: sendAssetStep.referrer === "payIn";
|
||||||
text: root.assetName === "" ? "" : "1";
|
text: root.assetCertID === "" ? "" : "1";
|
||||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||||
inputMethodHints: Qt.ImhDigitsOnly;
|
inputMethodHints: Qt.ImhDigitsOnly;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
@ -1084,12 +1084,13 @@ Item {
|
||||||
// Style
|
// Style
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
color: root.assetName === "" ? (optionalMessage.activeFocus && !optionalMessage.readOnly ? hifi.colors.black : hifi.colors.baseGrayShadow) :
|
color: (root.assetCertID === "" || sendAssetStep.referrer === "payIn") ?
|
||||||
(optionalMessage.activeFocus && !optionalMessage.readOnly ? "#EFEFEF" : "#EEEEEE");
|
(optionalMessage.activeFocus && !optionalMessage.readOnly ? hifi.colors.black : hifi.colors.baseGrayShadow) :
|
||||||
|
(optionalMessage.activeFocus ? "#EFEFEF" : "#EEEEEE");
|
||||||
border.width: optionalMessage.activeFocus && !optionalMessage.readOnly ? 1 : 0;
|
border.width: optionalMessage.activeFocus && !optionalMessage.readOnly ? 1 : 0;
|
||||||
border.color: optionalMessage.activeFocus && !optionalMessage.readOnly ? hifi.colors.primaryHighlight : hifi.colors.textFieldLightBackground;
|
border.color: optionalMessage.activeFocus && !optionalMessage.readOnly ? hifi.colors.primaryHighlight : hifi.colors.textFieldLightBackground;
|
||||||
}
|
}
|
||||||
color: root.assetName === "" ? hifi.colors.white : hifi.colors.black;
|
color: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.white : hifi.colors.black;
|
||||||
textFormat: TextEdit.PlainText;
|
textFormat: TextEdit.PlainText;
|
||||||
wrapMode: TextEdit.Wrap;
|
wrapMode: TextEdit.Wrap;
|
||||||
activeFocusOnPress: true;
|
activeFocusOnPress: true;
|
||||||
|
@ -1125,7 +1126,8 @@ Item {
|
||||||
// Text size
|
// Text size
|
||||||
size: 16;
|
size: 16;
|
||||||
// Style
|
// Style
|
||||||
color: optionalMessage.text.length === optionalMessage.maximumLength ? "#ea89a5" : (root.assetName === "" ? hifi.colors.lightGrayText : hifi.colors.baseGrayHighlight);
|
color: optionalMessage.text.length === optionalMessage.maximumLength ? "#ea89a5" :
|
||||||
|
(root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.lightGrayText : hifi.colors.baseGrayHighlight);
|
||||||
verticalAlignment: Text.AlignTop;
|
verticalAlignment: Text.AlignTop;
|
||||||
horizontalAlignment: Text.AlignRight;
|
horizontalAlignment: Text.AlignRight;
|
||||||
}
|
}
|
||||||
|
@ -1170,7 +1172,7 @@ Item {
|
||||||
parent.color = hifi.colors.blueAccent;
|
parent.color = hifi.colors.blueAccent;
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
lightboxPopup.titleText = (root.assetName === "" ? "Send Effect" : "Gift Effect");
|
lightboxPopup.titleText = (root.assetCertID === "" ? "Send Effect" : "Gift Effect");
|
||||||
lightboxPopup.bodyImageSource = "sendAsset/images/send-money-effect-sm.jpg"; // Path relative to CommerceLightbox.qml
|
lightboxPopup.bodyImageSource = "sendAsset/images/send-money-effect-sm.jpg"; // Path relative to CommerceLightbox.qml
|
||||||
lightboxPopup.bodyText = "Enabling this option will create a particle effect between you and " +
|
lightboxPopup.bodyText = "Enabling this option will create a particle effect between you and " +
|
||||||
"your recipient that is visible to everyone nearby.";
|
"your recipient that is visible to everyone nearby.";
|
||||||
|
@ -1199,7 +1201,7 @@ Item {
|
||||||
// "CANCEL" button
|
// "CANCEL" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: cancelButton_sendAssetStep;
|
id: cancelButton_sendAssetStep;
|
||||||
color: root.assetName === "" ? hifi.buttons.noneBorderlessWhite : hifi.buttons.noneBorderlessGray;
|
color: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.buttons.noneBorderlessWhite : hifi.buttons.noneBorderlessGray;
|
||||||
colorScheme: hifi.colorSchemes.dark;
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
anchors.right: sendButton.left;
|
anchors.right: sendButton.left;
|
||||||
anchors.rightMargin: 24;
|
anchors.rightMargin: 24;
|
||||||
|
@ -1221,7 +1223,7 @@ Item {
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: sendButton;
|
id: sendButton;
|
||||||
color: hifi.buttons.blue;
|
color: hifi.buttons.blue;
|
||||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 0;
|
anchors.rightMargin: 0;
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
@ -1229,11 +1231,11 @@ Item {
|
||||||
width: 100;
|
width: 100;
|
||||||
text: "SUBMIT";
|
text: "SUBMIT";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.assetName === "" && parseInt(amountTextField.text) > parseInt(balanceText.text)) {
|
if (root.assetCertID === "" && parseInt(amountTextField.text) > parseInt(balanceText.text)) {
|
||||||
amountTextField.focus = true;
|
amountTextField.focus = true;
|
||||||
amountTextField.error = true;
|
amountTextField.error = true;
|
||||||
amountTextFieldError.text = "<i>amount exceeds available funds</i>";
|
amountTextFieldError.text = "<i>amount exceeds available funds</i>";
|
||||||
} else if (root.assetName === "" && (amountTextField.text === "" || parseInt(amountTextField.text) < 1)) {
|
} else if (root.assetCertID === "" && (amountTextField.text === "" || parseInt(amountTextField.text) < 1)) {
|
||||||
amountTextField.focus = true;
|
amountTextField.focus = true;
|
||||||
amountTextField.error = true;
|
amountTextField.error = true;
|
||||||
amountTextFieldError.text = "<i>invalid amount</i>";
|
amountTextFieldError.text = "<i>invalid amount</i>";
|
||||||
|
@ -1324,18 +1326,18 @@ Item {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: root.assetName === "" ? 15 : 125;
|
anchors.topMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 125;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.leftMargin: root.assetName === "" ? 15 : 50;
|
anchors.leftMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 50;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: root.assetName === "" ? 15 : 50;
|
anchors.rightMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 50;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: root.assetName === "" ? 15 : 125;
|
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 125;
|
||||||
color: "#FFFFFF";
|
color: "#FFFFFF";
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: paymentSentText;
|
id: paymentSentText;
|
||||||
text: root.assetName === "" ? "Payment Sent" : "Gift Sent";
|
text: root.assetCertID === "" ? "Payment Sent" : (sendAssetStep.referrer === "payIn" ? "Item Sent" : "Gift Sent");
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
|
@ -1353,7 +1355,7 @@ Item {
|
||||||
|
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: closeGlyphButton_paymentSuccess;
|
id: closeGlyphButton_paymentSuccess;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "" && sendAssetStep.referrer !== "payIn";
|
||||||
text: hifi.glyphs.close;
|
text: hifi.glyphs.close;
|
||||||
color: hifi.colors.lightGrayText;
|
color: hifi.colors.lightGrayText;
|
||||||
size: 26;
|
size: 26;
|
||||||
|
@ -1427,7 +1429,7 @@ Item {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: giftContainer_paymentSuccess;
|
id: giftContainer_paymentSuccess;
|
||||||
visible: root.assetName !== "";
|
visible: root.assetCertID !== "" && sendAssetStep.referrer !== "payIn";
|
||||||
anchors.top: sendToContainer_paymentSuccess.bottom;
|
anchors.top: sendToContainer_paymentSuccess.bottom;
|
||||||
anchors.topMargin: 8;
|
anchors.topMargin: 8;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -1469,7 +1471,7 @@ Item {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: amountContainer_paymentSuccess;
|
id: amountContainer_paymentSuccess;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "";
|
||||||
anchors.top: sendToContainer_paymentSuccess.bottom;
|
anchors.top: sendToContainer_paymentSuccess.bottom;
|
||||||
anchors.topMargin: 16;
|
anchors.topMargin: 16;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -1524,7 +1526,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: optionalMessage_paymentSuccess;
|
id: optionalMessage_paymentSuccess;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "" || sendAssetStep.referrer === "payIn";
|
||||||
text: optionalMessage.text;
|
text: optionalMessage.text;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: amountContainer_paymentSuccess.visible ? amountContainer_paymentSuccess.bottom : sendToContainer_paymentSuccess.bottom;
|
anchors.top: amountContainer_paymentSuccess.visible ? amountContainer_paymentSuccess.bottom : sendToContainer_paymentSuccess.bottom;
|
||||||
|
@ -1546,14 +1548,17 @@ Item {
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: closeButton;
|
id: closeButton;
|
||||||
color: hifi.buttons.blue;
|
color: hifi.buttons.blue;
|
||||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||||
anchors.horizontalCenter: parent.horizontalCenter;
|
anchors.horizontalCenter: parent.horizontalCenter;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: root.assetName === "" ? 80 : 30;
|
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 80 : 30;
|
||||||
height: 50;
|
height: 50;
|
||||||
width: 120;
|
width: 120;
|
||||||
text: "Close";
|
text: "Close";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (sendAssetStep.referrer === "payIn") {
|
||||||
|
sendToScript({method: "closeSendAsset"});
|
||||||
|
} else {
|
||||||
root.nextActiveView = "sendAssetHome";
|
root.nextActiveView = "sendAssetHome";
|
||||||
resetSendAssetData();
|
resetSendAssetData();
|
||||||
if (root.assetName !== "") {
|
if (root.assetName !== "") {
|
||||||
|
@ -1563,6 +1568,7 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Payment Success END
|
// Payment Success END
|
||||||
|
|
||||||
// Payment Failure BEGIN
|
// Payment Failure BEGIN
|
||||||
|
@ -1585,18 +1591,18 @@ Item {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: root.assetName === "" ? 15 : 150;
|
anchors.topMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 150;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.leftMargin: root.assetName === "" ? 15 : 50;
|
anchors.leftMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 50;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: root.assetName === "" ? 15 : 50;
|
anchors.rightMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 50;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: root.assetName === "" ? 15 : 300;
|
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 300;
|
||||||
color: "#FFFFFF";
|
color: "#FFFFFF";
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: paymentFailureText;
|
id: paymentFailureText;
|
||||||
text: root.assetName === "" ? "Payment Failed" : "Failed";
|
text: root.assetCertID === "" && sendAssetStep.referrer !== "payIn" ? "Payment Failed" : "Failed";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
|
@ -1614,7 +1620,7 @@ Item {
|
||||||
|
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: closeGlyphButton_paymentFailure;
|
id: closeGlyphButton_paymentFailure;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "" && sendAssetStep.referrer !== "payIn";
|
||||||
text: hifi.glyphs.close;
|
text: hifi.glyphs.close;
|
||||||
color: hifi.colors.lightGrayText;
|
color: hifi.colors.lightGrayText;
|
||||||
size: 26;
|
size: 26;
|
||||||
|
@ -1643,7 +1649,8 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: paymentFailureDetailText;
|
id: paymentFailureDetailText;
|
||||||
text: "The recipient you specified was unable to receive your " + (root.assetName === "" ? "payment." : "gift.");
|
text: "The recipient you specified was unable to receive your " +
|
||||||
|
(root.assetCertID === "" ? "payment." : (sendAssetStep.referrer === "payIn" ? "item." : "gift."));
|
||||||
anchors.top: paymentFailureText.bottom;
|
anchors.top: paymentFailureText.bottom;
|
||||||
anchors.topMargin: 20;
|
anchors.topMargin: 20;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -1661,7 +1668,7 @@ Item {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: sendToContainer_paymentFailure;
|
id: sendToContainer_paymentFailure;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "" || sendAssetStep.referrer === "payIn";
|
||||||
anchors.top: paymentFailureDetailText.bottom;
|
anchors.top: paymentFailureDetailText.bottom;
|
||||||
anchors.topMargin: 8;
|
anchors.topMargin: 8;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -1702,7 +1709,7 @@ Item {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: amountContainer_paymentFailure;
|
id: amountContainer_paymentFailure;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "";
|
||||||
anchors.top: sendToContainer_paymentFailure.bottom;
|
anchors.top: sendToContainer_paymentFailure.bottom;
|
||||||
anchors.topMargin: 16;
|
anchors.topMargin: 16;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -1757,7 +1764,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: optionalMessage_paymentFailure;
|
id: optionalMessage_paymentFailure;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "" || sendAssetStep.referrer === "payIn";
|
||||||
text: optionalMessage.text;
|
text: optionalMessage.text;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: amountContainer_paymentFailure.visible ? amountContainer_paymentFailure.bottom : sendToContainer_paymentFailure.bottom;
|
anchors.top: amountContainer_paymentFailure.visible ? amountContainer_paymentFailure.bottom : sendToContainer_paymentFailure.bottom;
|
||||||
|
@ -1779,15 +1786,18 @@ Item {
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: closeButton_paymentFailure;
|
id: closeButton_paymentFailure;
|
||||||
color: hifi.buttons.noneBorderless;
|
color: hifi.buttons.noneBorderless;
|
||||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||||
anchors.right: retryButton_paymentFailure.left;
|
anchors.right: retryButton_paymentFailure.left;
|
||||||
anchors.rightMargin: 12;
|
anchors.rightMargin: 12;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: root.assetName === "" ? 80 : 30;
|
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 80 : 30;
|
||||||
height: 50;
|
height: 50;
|
||||||
width: 120;
|
width: 120;
|
||||||
text: "Cancel";
|
text: "Cancel";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (sendAssetStep.referrer === "payIn") {
|
||||||
|
sendToScript({method: "closeSendAsset"});
|
||||||
|
} else {
|
||||||
root.nextActiveView = "sendAssetHome";
|
root.nextActiveView = "sendAssetHome";
|
||||||
resetSendAssetData();
|
resetSendAssetData();
|
||||||
if (root.assetName !== "") {
|
if (root.assetName !== "") {
|
||||||
|
@ -1795,22 +1805,23 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// "Retry" button
|
// "Retry" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: retryButton_paymentFailure;
|
id: retryButton_paymentFailure;
|
||||||
color: hifi.buttons.blue;
|
color: hifi.buttons.blue;
|
||||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 12;
|
anchors.rightMargin: 12;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: root.assetName === "" ? 80 : 30;
|
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 80 : 30;
|
||||||
height: 50;
|
height: 50;
|
||||||
width: 120;
|
width: 120;
|
||||||
text: "Retry";
|
text: "Retry";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.isCurrentlySendingAsset = true;
|
root.isCurrentlySendingAsset = true;
|
||||||
if (sendAssetStep.referrer === "connections") {
|
if (sendAssetStep.referrer === "connections" || sendAssetStep.referrer === "payIn") {
|
||||||
Commerce.transferAssetToUsername(sendAssetStep.selectedRecipientUserName,
|
Commerce.transferAssetToUsername(sendAssetStep.selectedRecipientUserName,
|
||||||
root.assetCertID,
|
root.assetCertID,
|
||||||
parseInt(amountTextField.text),
|
parseInt(amountTextField.text),
|
||||||
|
@ -1878,9 +1889,13 @@ Item {
|
||||||
sendAssetStep.selectedRecipientUserName = message.userName;
|
sendAssetStep.selectedRecipientUserName = message.userName;
|
||||||
break;
|
break;
|
||||||
case 'updateSendAssetQML':
|
case 'updateSendAssetQML':
|
||||||
root.assetName = message.assetName || "";
|
root.assetName = "";
|
||||||
root.assetCertID = message.assetCertID || "";
|
root.assetCertID = message.assetCertID || "";
|
||||||
|
if (root.assetCertID === "") {
|
||||||
amountTextField.text = message.amount || 1;
|
amountTextField.text = message.amount || 1;
|
||||||
|
} else {
|
||||||
|
amountTextField.text = "";
|
||||||
|
}
|
||||||
sendAssetStep.referrer = "payIn";
|
sendAssetStep.referrer = "payIn";
|
||||||
sendAssetStep.selectedRecipientNodeID = "";
|
sendAssetStep.selectedRecipientNodeID = "";
|
||||||
sendAssetStep.selectedRecipientDisplayName = 'Secure Payment';
|
sendAssetStep.selectedRecipientDisplayName = 'Secure Payment';
|
||||||
|
|
|
@ -219,17 +219,12 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function buyButtonClicked(id, name, author, price, href, referrer, edition, type) {
|
function buyButtonClicked(id, referrer, edition) {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
type: "CHECKOUT",
|
type: "CHECKOUT",
|
||||||
itemId: id,
|
itemId: id,
|
||||||
itemName: name,
|
|
||||||
itemPrice: price ? parseInt(price, 10) : 0,
|
|
||||||
itemHref: href,
|
|
||||||
referrer: referrer,
|
referrer: referrer,
|
||||||
itemAuthor: author,
|
itemEdition: edition
|
||||||
itemEdition: edition,
|
|
||||||
itemType: type.trim()
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,13 +308,8 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
buyButtonClicked($(this).closest('.grid-item').attr('data-item-id'),
|
buyButtonClicked($(this).closest('.grid-item').attr('data-item-id'),
|
||||||
$(this).closest('.grid-item').find('.item-title').text(),
|
|
||||||
$(this).closest('.grid-item').find('.creator').find('.value').text(),
|
|
||||||
$(this).closest('.grid-item').find('.item-cost').text(),
|
|
||||||
$(this).attr('data-href'),
|
|
||||||
"mainPage",
|
"mainPage",
|
||||||
-1,
|
-1);
|
||||||
$(this).closest('.grid-item').find('.item-type').text());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,13 +417,8 @@
|
||||||
purchaseButton.on('click', function () {
|
purchaseButton.on('click', function () {
|
||||||
if ('available' === availability || isUpdating) {
|
if ('available' === availability || isUpdating) {
|
||||||
buyButtonClicked(window.location.pathname.split("/")[3],
|
buyButtonClicked(window.location.pathname.split("/")[3],
|
||||||
$('#top-center').find('h1').text(),
|
|
||||||
$('#creator').find('.value').text(),
|
|
||||||
cost,
|
|
||||||
href,
|
|
||||||
"itemPage",
|
"itemPage",
|
||||||
urlParams.get('edition'),
|
urlParams.get('edition'));
|
||||||
type);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -471,7 +471,7 @@ function onWebEventReceived(message) {
|
||||||
wireQmlEventBridge(true);
|
wireQmlEventBridge(true);
|
||||||
ui.open(MARKETPLACE_CHECKOUT_QML_PATH);
|
ui.open(MARKETPLACE_CHECKOUT_QML_PATH);
|
||||||
ui.tablet.sendToQml({
|
ui.tablet.sendToQml({
|
||||||
method: 'updateCheckoutQML',
|
method: 'updateCheckoutQMLItemID',
|
||||||
params: message
|
params: message
|
||||||
});
|
});
|
||||||
} else if (message.type === "REQUEST_SETTING") {
|
} else if (message.type === "REQUEST_SETTING") {
|
||||||
|
|
Loading…
Reference in a new issue