UNPKG

@shopware-ag/meteor-admin-sdk

Version:

The Meteor SDK for the Shopware Administration.

45 lines 2.04 kB
(function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports", "../channel", "../_internals/utils"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.trackLinkVisited = exports.trackPageView = exports.getSourceExtensionName = exports.dispatch = void 0; const channel_1 = require("../channel"); const utils_1 = require("../_internals/utils"); /** * Dispatch a telemetry event to the Admin. * The source (technical name of the extension) is automatically * resolved by the Admin SDK from the message origin and cannot be * set manually by the extension. */ exports.dispatch = (0, channel_1.createSender)('telemetryDispatch'); /** * Resolves the technical name of the extension for the given origin URL. * Used on the Admin side when handling a telemetry event to inject the * source before forwarding the event to the tracking system. */ exports.getSourceExtensionName = utils_1.findExtensionNameByBaseUrl; /** * Track a page view, matching the `page_viewed` event emitted by the Admin. * Use this instead of `dispatch` to ensure consistent property names. */ function trackPageView(properties) { return (0, exports.dispatch)({ event: 'page_viewed', data: properties }); } exports.trackPageView = trackPageView; /** * Track a link visit, matching the `link_visited` event emitted by the Admin. * Use this instead of `dispatch` to ensure consistent property names. */ function trackLinkVisited(properties) { return (0, exports.dispatch)({ event: 'link_visited', data: properties }); } exports.trackLinkVisited = trackLinkVisited; }); //# sourceMappingURL=index.js.map