"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const cordial_client_1 = __importDefault(require("../cordial-client"));
const identities_fields_1 = __importDefault(require("../identities-fields"));
const action = {
    title: 'Upsert Contact',
    description: 'Create or update a contact in Cordial.',
    defaultSubscription: 'type = "identify"',
    fields: {
        ...identities_fields_1.default,
        attributes: {
            label: 'Contact Attributes',
            description: 'Contact attributes to update. Optional. Contact attributes must exist in Cordial prior to updating. Attributes that do not exist in Cordial will be ignored. Complex attribute types to be mapped via dot notation, for example, `cordialPerson.first_name -> traits.segmentPerson.firstName`, `cordialPerson.last_name -> traits.segmentPerson.lastName`. Segment trait address can be mapped directly to geo Cordial attribute: `geo_cordial_attribute -> traits.address`.',
            type: 'object',
            required: false,
            defaultObjectUI: 'keyvalue:only'
        }
    },
    perform: async (request, { settings, payload }) => {
        const client = new cordial_client_1.default(settings, request);
        return client.upsertContact(payload);
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map