1/*************************** 2 * About This File 3 ***************************/ 4 5/** 6 * @module services/internal-event-service 7 * @description Sends events to the Urban Plates internal tracking API. 8 */ 9 10/*************************** 11 * Imports 12 ***************************/ 13 14import {Logger} from "../utils/logger.js"; 15 16/*************************** 17 * Contents 18 ***************************/ 19 20/** 21 * @class InternalEventService 22 * @description Sends events to the Urban Plates internal tracking endpoint. 23 */ 24export class InternalEventService { 25 /** 26 * Sends an event to the internal tracking API. 27 * @param {string} name - The event name 28 * @param {Object} payload - Event parameters 29 */ 30 static async track(name, payload = {}) { 31 try { 32 await fetch(`https://api.urbanplates.com/track/ecommerce-event.php`, { 33 method: "POST", 34 body: JSON.stringify({ 35 event_name: name, 36 event_data: payload 37 }), 38 }); 39 } catch (e) { 40 Logger.error(`[Internal Event Service] Failed to track event:`, name, e); 41 } 42 } 43}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.