"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: 'Select Promotion',
    description: 'This event signifies a promotion was selected from a list.',
    defaultSubscription: 'type = "track" and event = "Promotion Clicked"',
    platform: 'web',
    fields: {
        user_id: ga4_properties_1.user_id,
        creative_name: ga4_properties_1.creative_name,
        creative_slot: { ...ga4_properties_1.creative_slot, default: { '@path': '$.properties.creative' } },
        location_id: ga4_properties_1.location_id,
        promotion_id: { ...ga4_properties_1.promotion_id, default: { '@path': '$.properties.promotion_id' } },
        promotion_name: { ...ga4_properties_1.promotion_name, default: { '@path': '$.properties.name' } },
        items: {
            ...ga4_properties_1.items_single_products,
            properties: {
                ...ga4_properties_1.minimal_items.properties,
                creative_name: {
                    ...ga4_properties_1.creative_name
                },
                creative_slot: {
                    ...ga4_properties_1.creative_slot
                },
                promotion_name: {
                    ...ga4_properties_1.promotion_name
                },
                promotion_id: {
                    ...ga4_properties_1.promotion_id
                }
            }
        },
        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', 'select_promotion', {
            creative_name: payload.creative_name,
            creative_slot: payload.creative_slot,
            location_id: payload.location_id,
            promotion_id: payload.promotion_id,
            promotion_name: payload.promotion_name,
            items: payload.items,
            ...payload.params
        });
    }
};
exports.default = action;
//# sourceMappingURL=index.js.map