/** @odoo-module */

import { patch } from "@web/core/utils/patch";
import { ProductScreen } from "@point_of_sale/app/screens/product_screen/product_screen";
import { ChannelPanel } from "./channel_panel";

/**
 * Patch ProductScreen to:
 * 1. Register ChannelPanel as a component
 * 2. Expose showChannelPanel computed property to the template
 */
patch(ProductScreen, {
    components: {
        ...ProductScreen.components,
        ChannelPanel,
    },
});

patch(ProductScreen.prototype, {
    get showChannelPanel() {
        return this.pos?.config?.show_channel_panel !== false;
    },
});
