"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const t1_properties_1 = require("../t1-properties");
const action = {
    title: '[Deprecated] Upsert customer profile V2',
    description: `You do not have to create attributes or audiences before using this Action. **Important:** This Action is deprecated. Use the **Update customer profile** Action instead.`,
    fields: {
        customerProfileId: { ...t1_properties_1.customerProfileId },
        audiencesToAdd: { ...t1_properties_1.audiencesToAdd },
        audiencesToDelete: { ...t1_properties_1.audiencesToDelete },
        runRuleEngine: {
            label: 'Run rule engine',
            description: 'This runs rule engine in Talon.One upon updating customer profile. Set to true to trigger rules.',
            type: 'boolean',
            default: true
        },
        attributes: { ...t1_properties_1.attribute },
        attributesInfo: { ...t1_properties_1.attributesInfo }
    },
    perform: (request, { payload }) => {
        return request(`https://integration.talon.one/segment/customer_profile_v2/${payload.customerProfileId}`, {
            method: 'put',
            json: {
                audiencesChanges: {
                    adds: payload.audiencesToAdd,
                    deletes: payload.audiencesToDelete
                },
                runRuleEngine: payload.runRuleEngine,
                attributes: payload.attributes,
                attributesInfo: payload.attributesInfo
            }
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map