"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const actions_core_1 = require("@segment/actions-core");
const identifyUser_1 = __importDefault(require("./identifyUser"));
const trackEvent_1 = __importDefault(require("./trackEvent"));
const destination = {
    name: 'Sprig Cloud (Actions)',
    slug: 'actions-sprig',
    mode: 'cloud',
    description: 'Send Segment analytics events and user profile data to Sprig.',
    authentication: {
        scheme: 'custom',
        fields: {
            apiKey: {
                label: 'API Key',
                description: 'Sprig API key.',
                type: 'password',
                required: true
            }
        }
    },
    presets: [
        {
            name: 'Track Event',
            subscribe: 'type = "track"',
            partnerAction: 'trackEvent',
            mapping: (0, actions_core_1.defaultValues)(trackEvent_1.default.fields),
            type: 'automatic'
        },
        {
            name: 'Identify User',
            subscribe: 'type = "identify"',
            partnerAction: 'identifyUser',
            mapping: (0, actions_core_1.defaultValues)(identifyUser_1.default.fields),
            type: 'automatic'
        },
        {
            name: 'Screen Event',
            subscribe: 'type = "screen"',
            partnerAction: 'trackEvent',
            mapping: {
                ...(0, actions_core_1.defaultValues)(trackEvent_1.default.fields),
                eventName: {
                    '@path': '$.name'
                }
            },
            type: 'automatic'
        }
    ],
    actions: {
        identifyUser: identifyUser_1.default,
        trackEvent: trackEvent_1.default
    }
};
exports.default = destination;
//# sourceMappingURL=index.js.map