"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: 'Begin Checkout',
    description: 'This event signifies that a user has begun a checkout.',
    defaultSubscription: 'type = "track" and event = "Checkout Started"',
    platform: 'web',
    fields: {
        user_id: ga4_properties_1.user_id,
        coupon: { ...ga4_properties_1.coupon, default: { '@path': '$.properties.coupon' } },
        currency: ga4_properties_1.currency,
        items: {
            ...ga4_properties_1.items_multi_products,
            required: true
        },
        value: ga4_properties_1.value,
        params: ga4_properties_1.params,
        user_properties: ga4_properties_1.user_properties
    },
    perform: (gtag, { payload }) => {
        ga4_functions_1.updateUser(payload.user_id, payload.user_properties, gtag);
        gtag('event', 'begin_checkout', {
            currency: payload.currency,
            value: payload.value,
            coupon: payload.coupon,
            items: payload.items,
            ...payload.params
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map