"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ga4_properties_1 = require("../ga4-properties");
const ga4_functions_1 = require("../ga4-functions");
const action = {
    title: 'Refund',
    description: 'This event signifies when one or more items is refunded to a user.',
    defaultSubscription: 'type = "track" and event = "Order Refunded"',
    platform: 'web',
    fields: {
        user_id: ga4_properties_1.user_id,
        currency: ga4_properties_1.currency,
        transaction_id: { ...ga4_properties_1.transaction_id, required: true },
        value: { ...ga4_properties_1.value, default: { '@path': '$.properties.total' } },
        affiliation: ga4_properties_1.affiliation,
        coupon: ga4_properties_1.coupon,
        shipping: ga4_properties_1.shipping,
        tax: ga4_properties_1.tax,
        items: {
            ...ga4_properties_1.items_multi_products
        },
        user_properties: ga4_properties_1.user_properties,
        params: ga4_properties_1.params
    },
    perform: (gtag, { payload }) => {
        ga4_functions_1.updateUser(payload.user_id, payload.user_properties, gtag);
        gtag('event', 'refund', {
            currency: payload.currency,
            transaction_id: payload.transaction_id,
            value: payload.value,
            affiliation: payload.affiliation,
            coupon: payload.coupon,
            shipping: payload.shipping,
            tax: payload.tax,
            items: payload.items,
            ...payload.params
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map