"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.destination = void 0;
const tslib_1 = require("tslib");
const shim_1 = require("../../runtime/shim");
const actions_core_1 = require("@segment/actions-core");
const init_script_1 = require("./init-script");
const trackEvent_1 = tslib_1.__importStar(require("./trackEvent"));
const trackPage_1 = tslib_1.__importStar(require("./trackPage"));
exports.destination = {
    name: 'StackAdapt (Actions)',
    slug: 'actions-stackadapt',
    mode: 'device',
    presets: [
        {
            name: 'Track Event',
            subscribe: trackEvent_1.trackEventDefaultSubscription,
            partnerAction: 'trackEvent',
            mapping: actions_core_1.defaultValues(trackEvent_1.default.fields)
        },
        {
            name: 'Track Page',
            subscribe: trackPage_1.trackPageDefaultSubscription,
            partnerAction: 'trackPage',
            mapping: actions_core_1.defaultValues(trackPage_1.default.fields)
        }
    ],
    settings: {
        universalPixelId: {
            description: 'The universal pixel id for StackAdapt.',
            label: 'Universal Pixel Id',
            type: 'string',
            required: true
        }
    },
    initialize: async (_, dependencies) => {
        init_script_1.initScript();
        await dependencies.loadScript('https://tags.srv.stackadapt.com/events.js');
        return window.saq;
    },
    actions: {
        trackEvent: trackEvent_1.default,
        trackPage: trackPage_1.default
    }
};
exports.default = shim_1.browserDestination(exports.destination);
//# sourceMappingURL=index.js.map