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 Heap',
            label: 'Traits',
            default: {
                '@path': '$.traits'
            }
        }
    },
    perform: (heap, event) => {
        if (event.payload.traits) {
            heap.addUserProperties(event.payload.traits);
        }
        if (event.payload.userId) {
            heap.identify(event.payload.userId);
        }
    }
};
export default action;
//# sourceMappingURL=index.js.map