"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const action = {
    title: 'Alias',
    description: 'Update user identity with new user ID.',
    platform: 'web',
    defaultSubscription: 'type = "alias"',
    fields: {
        userId: {
            type: 'string',
            required: false,
            description: 'New unique identifier for the user',
            label: 'User ID',
            default: {
                '@path': '$.userId'
            }
        },
        anonymousId: {
            type: 'string',
            required: false,
            description: 'New anonymous identifier for the user',
            label: 'Anonymous ID',
            default: {
                '@path': '$.anonymousId'
            }
        }
    },
    perform: (Screeb, event) => {
        const payload = event.payload;
        if (!payload || typeof payload !== 'object' || !(payload.userId || payload.anonymousId)) {
            console.warn('[Screeb] received invalid payload (expected userId or anonymousId to be present); skipping alias', payload);
            return;
        }
        Screeb('identity', payload.userId ?? payload.anonymousId);
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map