Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
Latest fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ckumar03 committed Apr 26, 2023
1 parent 4c6d842 commit 3276df1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 38 deletions.
63 changes: 27 additions & 36 deletions app/services/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,25 @@ const getToken = () => {

const formRequestPayLoad = (listRows) => {
const platform = getUserPlatform();
const trackPayLoad = [];
listRows.forEach((row) => {
const {
id,
definitionId,
type,
_auction: {
buyNowPrice,
tradeId: auctionId,
expires: expiresOn,
_tradeState: tradeState,
},
} = row;

const trackPayLoad = listRows.map((row) => {
const expireDate = new Date();
expireDate.setSeconds(expireDate.getSeconds() + expiresOn);
tradeState === "active" &&
type === "player" &&
trackPayLoad.push({
definitionId,
price: buyNowPrice,
expireDate.setSeconds(expireDate.getSeconds() + row._auction.expires);
return {
assetId:
row._assetId || (row._metaData && row._metaData.id) || row.definitionId,
resourceId: row.definitionId,
auction: {
buyNowPrice: row._auction.buyNowPrice,
currentBid: row._auction.currentBid,
resourceId: row.definitionId,
expiresOn: expireDate,
id: id + "",
auctionId,
platform,
});
platform: platform.toUpperCase(),
playStyle: row.playStyle,
startingBid: row._auction.startingBid,
tradeId: parseInt(row._auction.tradeId),
tradeState: row._auction._tradeState,
},
};
});

return trackPayLoad;
Expand All @@ -76,17 +69,15 @@ export const saveSolution = (payload) => {
};

export const trackMarketPrices = (items) => {
const { id: userId } = services.User.getUser();
const requestPayload = formRequestPayLoad(items);
if (requestPayload.length && requestPayload.length <= 12) {
return sendRequest(
atob(
"aHR0cHM6Ly9xenlhZnN0ZWR1N3N0cDV3NTU2NW54bWZtaTB2bWZvbi5sYW1iZGEtdXJsLmV1LXdlc3QtMS5vbi5hd3M="
),
"POST",
`${Math.floor(+new Date())}_trackMarketPrices`,
JSON.stringify({
prices: requestPayload,
})
);
}
return sendRequest(
"https://wxls53nz2plegcvsjhco3yqyke0hqrps.lambda-url.eu-west-1.on.aws/",
"POST",
`${Math.floor(+new Date())}_trackMarketPrices`,
JSON.stringify({
userId,
marketData: requestPayload,
})
);
};
5 changes: 4 additions & 1 deletion app/services/externalRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export const initListeners = () => {
`User access level set to ${
data.response === "adBlocked"
? "Enhancer Gold"
: "Enhancer Silver"
: data.response === "tradeEnhancer"
? "Enhancer Silver"
: "Enhancer Free"
}`
);
return setValue("userAccess", data.response);
Expand Down Expand Up @@ -60,6 +62,7 @@ const sendWebRequest = (options) => {
};
if (isSbcRequest) {
headers.Authorization = `Bearer ${token}`;
headers["Content-Type"] = `application/json`;
}
GM_xmlhttpRequest({
method: options.method,
Expand Down
2 changes: 1 addition & 1 deletion tampermonkey-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
headers: {
name: "FUT Trade Enhancer",
namespace: "http://tampermonkey.net/",
version: "1.6.5",
version: "1.6.8",
description: "FUT Trade Enhancer",
author: "CK Algos",
match: [
Expand Down

0 comments on commit 3276df1

Please sign in to comment.