@masa-finance/analytics-sdk
Advanced tools
Comparing version 0.5.12 to 0.5.13
{ | ||
"name": "@masa-finance/analytics-sdk", | ||
"version": "0.5.12", | ||
"version": "0.5.13", | ||
"main": "dist/src/index.js", | ||
@@ -18,6 +18,6 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "^20.11.30", | ||
"@types/node": "^20.12.5", | ||
"@types/uuid": "^9.0.8", | ||
"@typescript-eslint/eslint-plugin": "^7.3.1", | ||
"@typescript-eslint/parser": "^7.3.1", | ||
"@typescript-eslint/eslint-plugin": "^7.6.0", | ||
"@typescript-eslint/parser": "^7.6.0", | ||
"eslint": "^8.57.0", | ||
@@ -29,5 +29,5 @@ "eslint-plugin-import": "^2.29.1", | ||
"ts-loader": "^9.5.1", | ||
"typedoc": "^0.25.12", | ||
"typedoc": "^0.25.13", | ||
"typedoc-plugin-markdown": "^3.17.1", | ||
"typescript": "^5.4.3", | ||
"typescript": "^5.4.4", | ||
"webpack": "^5.91.0", | ||
@@ -34,0 +34,0 @@ "webpack-cli": "^5.1.4" |
@@ -6,7 +6,7 @@ import type { BaseEvent, BaseEventData, EventType } from "./interfaces/EventData"; | ||
type: EventType; | ||
user_address?: string | undefined; | ||
user_address?: string; | ||
event_data: BaseEventData; | ||
endpoint: string; | ||
client_id?: string | undefined; | ||
client_id?: string; | ||
}) => Promise<BaseEvent | undefined>; | ||
//# sourceMappingURL=event-logger.d.ts.map |
@@ -11,2 +11,4 @@ export type EventType = "pageView" | "customEvent" | "login" | "mint" | "connectWallet" | "swap" | "bridge" | "addLiquidity" | "removeLiquidity" | "farm" | "trade" | "claim"; | ||
additionalEventData?: Record<string, unknown>; | ||
referrer?: string; | ||
historyLength?: number; | ||
} | ||
@@ -13,0 +15,0 @@ export interface BaseArgs { |
@@ -0,1 +1,2 @@ | ||
export * from "./BridgeEvent"; | ||
export * from "./EventData"; | ||
@@ -6,4 +7,5 @@ export * from "./FireEvent"; | ||
export * from "./PageView"; | ||
export * from "./ReferrerInfo"; | ||
export * from "./TrackCustomEvent"; | ||
export * from "./WalletConnect"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -17,2 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./BridgeEvent"), exports); | ||
__exportStar(require("./EventData"), exports); | ||
@@ -23,4 +24,5 @@ __exportStar(require("./FireEvent"), exports); | ||
__exportStar(require("./PageView"), exports); | ||
__exportStar(require("./ReferrerInfo"), exports); | ||
__exportStar(require("./TrackCustomEvent"), exports); | ||
__exportStar(require("./WalletConnect"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -9,7 +9,3 @@ import { BaseArgs, BaseEventData } from "./EventData"; | ||
} | ||
export interface ReferrerInfo { | ||
referrer: string; | ||
historyLength: number; | ||
} | ||
export interface PageViewEventData extends BaseEventData, UTMParams, ReferrerInfo { | ||
export interface PageViewEventData extends BaseEventData, UTMParams { | ||
page: string; | ||
@@ -16,0 +12,0 @@ } |
import { FireConnectWalletEventArgs, FireEventArgs, FireLoginEventArgs, FireMintEventArgs, FirePageViewEventArgs, FireTrackCustomEventArgs } from "./interfaces"; | ||
import { FireBridgeEventArgs } from "./interfaces/BridgeEvent"; | ||
import { MasaAnalyticsClient } from "./masa-analytics-client"; | ||
@@ -49,2 +50,6 @@ export declare class MasaAnalytics { | ||
/** | ||
* Fire a bridge event | ||
*/ | ||
fireBridgeEvent({ network, balance, receiving_network, receiving_balance, amount_of_tokens_sent, amount_of_tokens_received, gas_fee, slippage_fee, user_address, additionalEventData, }: FireBridgeEventArgs): Promise<void>; | ||
/** | ||
* Fire a flexible event | ||
@@ -51,0 +56,0 @@ * It can use any of the EventTypes |
@@ -119,3 +119,3 @@ "use strict"; | ||
return __awaiter(this, arguments, void 0, function (_b) { | ||
var event_data, error_1; | ||
var referrerInfo, event_data, error_1; | ||
var user_address = _b.user_address, additionalEventData = _b.additionalEventData; | ||
@@ -125,6 +125,9 @@ return __generator(this, function (_c) { | ||
case 0: | ||
event_data = { | ||
description: "User logged in", | ||
additionalEventData: additionalEventData, | ||
referrerInfo = { | ||
referrer: document.referrer.length > 0 | ||
? document.referrer | ||
: "No referrer available", | ||
historyLength: window.history.length, | ||
}; | ||
event_data = __assign({ description: "User logged in", additionalEventData: additionalEventData }, referrerInfo); | ||
_c.label = 1; | ||
@@ -230,3 +233,3 @@ case 1: | ||
return __awaiter(this, arguments, void 0, function (_b) { | ||
var event_data, error_3; | ||
var referrerInfo, event_data, error_3; | ||
var page_url = _b.page_url, page_title = _b.page_title, event_name = _b.event_name, user_address = _b.user_address, additionalEventData = _b.additionalEventData; | ||
@@ -236,2 +239,8 @@ return __generator(this, function (_c) { | ||
case 0: | ||
referrerInfo = { | ||
referrer: document.referrer.length > 0 | ||
? document.referrer | ||
: "No referrer available", | ||
historyLength: window.history.length, | ||
}; | ||
event_data = { | ||
@@ -252,3 +261,3 @@ page_url: page_url, | ||
client_id: this.config.clientId, | ||
event_data: __assign(__assign({}, event_data), { additionalEventData: additionalEventData }), | ||
event_data: __assign(__assign(__assign({}, event_data), { additionalEventData: additionalEventData }), referrerInfo), | ||
endpoint: "tracking", | ||
@@ -274,3 +283,3 @@ })]; | ||
return __awaiter(this, arguments, void 0, function (_b) { | ||
var event_data, error_4; | ||
var referrerInfo, event_data, error_4; | ||
var user_address = _b.user_address, token_name = _b.token_name, ticker = _b.ticker, token_type = _b.token_type, network = _b.network, contract_address = _b.contract_address, mint_fee = _b.mint_fee, mint_currency = _b.mint_currency, fee_asset = _b.fee_asset, asset_amount = _b.asset_amount, additionalEventData = _b.additionalEventData; | ||
@@ -280,2 +289,8 @@ return __generator(this, function (_c) { | ||
case 0: | ||
referrerInfo = { | ||
referrer: document.referrer.length > 0 | ||
? document.referrer | ||
: "No referrer available", | ||
historyLength: window.history.length, | ||
}; | ||
event_data = { | ||
@@ -300,3 +315,3 @@ token_name: token_name, | ||
client_id: this.config.clientId, | ||
event_data: __assign(__assign({}, event_data), additionalEventData), | ||
event_data: __assign(__assign(__assign({}, event_data), additionalEventData), referrerInfo), | ||
endpoint: "tracking", | ||
@@ -322,3 +337,3 @@ })]; | ||
return __awaiter(this, arguments, void 0, function (_b) { | ||
var event_data, error_5; | ||
var referrerInfo, event_data, error_5; | ||
var user_address = _b.user_address, wallet_type = _b.wallet_type, additionalEventData = _b.additionalEventData; | ||
@@ -328,6 +343,9 @@ return __generator(this, function (_c) { | ||
case 0: | ||
event_data = { | ||
wallet_type: wallet_type, | ||
additionalEventData: additionalEventData, | ||
referrerInfo = { | ||
referrer: document.referrer.length > 0 | ||
? document.referrer | ||
: "No referrer available", | ||
historyLength: window.history.length, | ||
}; | ||
event_data = __assign({ wallet_type: wallet_type, additionalEventData: additionalEventData }, referrerInfo); | ||
_c.label = 1; | ||
@@ -358,2 +376,51 @@ case 1: | ||
/** | ||
* Fire a bridge event | ||
*/ | ||
MasaAnalytics.prototype.fireBridgeEvent = function (_a) { | ||
return __awaiter(this, arguments, void 0, function (_b) { | ||
var referrerInfo, event_data, error_6; | ||
var network = _b.network, balance = _b.balance, receiving_network = _b.receiving_network, receiving_balance = _b.receiving_balance, amount_of_tokens_sent = _b.amount_of_tokens_sent, amount_of_tokens_received = _b.amount_of_tokens_received, gas_fee = _b.gas_fee, slippage_fee = _b.slippage_fee, user_address = _b.user_address, additionalEventData = _b.additionalEventData; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
referrerInfo = { | ||
referrer: document.referrer.length > 0 | ||
? document.referrer | ||
: "No referrer available", | ||
historyLength: window.history.length, | ||
}; | ||
event_data = { | ||
balance: balance, | ||
network: network, | ||
receiving_network: receiving_network, | ||
receiving_balance: receiving_balance, | ||
amount_of_tokens_sent: amount_of_tokens_sent, | ||
amount_of_tokens_received: amount_of_tokens_received, | ||
gas_fee: gas_fee, | ||
slippage_fee: slippage_fee, | ||
}; | ||
_c.label = 1; | ||
case 1: | ||
_c.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, (0, event_logger_1.logEvent)({ | ||
client: this.client, | ||
type: "bridge", | ||
user_address: user_address, | ||
client_id: this.config.clientId, | ||
event_data: __assign(__assign(__assign({}, event_data), additionalEventData), referrerInfo), | ||
endpoint: "tracking", | ||
})]; | ||
case 2: | ||
_c.sent(); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
error_6 = _c.sent(); | ||
console.error("fireBridgeEvent():", error_6); | ||
return [3 /*break*/, 4]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Fire a flexible event | ||
@@ -364,3 +431,3 @@ * It can use any of the EventTypes | ||
return __awaiter(this, arguments, void 0, function (type, _b) { | ||
var event_data, error_6; | ||
var referrerInfo, event_data, error_7; | ||
var user_address = _b.user_address, network = _b.network, contract_address = _b.contract_address, asset_amount = _b.asset_amount, asset_ticker = _b.asset_ticker, additionalEventData = _b.additionalEventData; | ||
@@ -370,2 +437,8 @@ return __generator(this, function (_c) { | ||
case 0: | ||
referrerInfo = { | ||
referrer: document.referrer.length > 0 | ||
? document.referrer | ||
: "No referrer available", | ||
historyLength: window.history.length, | ||
}; | ||
event_data = { | ||
@@ -386,3 +459,3 @@ user_address: user_address, | ||
client_id: this.config.clientId, | ||
event_data: __assign(__assign({}, event_data), additionalEventData), | ||
event_data: __assign(__assign(__assign({}, event_data), additionalEventData), referrerInfo), | ||
endpoint: "tracking", | ||
@@ -394,5 +467,5 @@ })]; | ||
case 3: | ||
error_6 = _c.sent(); | ||
error_7 = _c.sent(); | ||
// eslint-disable-next-line no-console | ||
console.error("fireEvent():", error_6); | ||
console.error("fireEvent():", error_7); | ||
return [3 /*break*/, 4]; | ||
@@ -399,0 +472,0 @@ case 4: return [2 /*return*/]; |
{ | ||
"name": "@masa-finance/analytics-sdk", | ||
"version": "0.5.12", | ||
"version": "0.5.13", | ||
"main": "dist/src/index.js", | ||
@@ -18,6 +18,6 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "^20.11.30", | ||
"@types/node": "^20.12.5", | ||
"@types/uuid": "^9.0.8", | ||
"@typescript-eslint/eslint-plugin": "^7.3.1", | ||
"@typescript-eslint/parser": "^7.3.1", | ||
"@typescript-eslint/eslint-plugin": "^7.6.0", | ||
"@typescript-eslint/parser": "^7.6.0", | ||
"eslint": "^8.57.0", | ||
@@ -29,5 +29,5 @@ "eslint-plugin-import": "^2.29.1", | ||
"ts-loader": "^9.5.1", | ||
"typedoc": "^0.25.12", | ||
"typedoc": "^0.25.13", | ||
"typedoc-plugin-markdown": "^3.17.1", | ||
"typescript": "^5.4.3", | ||
"typescript": "^5.4.4", | ||
"webpack": "^5.91.0", | ||
@@ -34,0 +34,0 @@ "webpack-cli": "^5.1.4" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
551362
77
1119