"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const types_1 = require("../types");
const action = {
    title: 'Identify User',
    description: 'Sets user identity',
    platform: 'web',
    defaultSubscription: 'type = "identify"',
    fields: {
        userId: {
            type: 'string',
            required: false,
            description: "The user's identity.",
            label: 'Identity',
            default: {
                '@path': '$.userId'
            }
        },
        traits: {
            type: 'object',
            required: false,
            description: 'The Segment traits to be forwarded to Iterate.',
            label: 'Traits',
            default: {
                '@path': '$.traits'
            }
        }
    },
    perform: (Iterate, event) => {
        const traits = event.payload.traits || {};
        if (event.payload.userId) {
            traits['external_id'] = event.payload.userId;
        }
        Iterate(types_1.Command.Identify, traits);
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map