// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { CrLitElement } from 'chrome://resources/lit/v3_0/lit.rollup.js';
import { CommerceInternalsApiProxy } from '../commerce_internals_api_proxy.js';
import { getCss } from './app.css.js';
import { getHtml } from './app.html.js';
export class ProductViewerAppElement extends CrLitElement {
    static get is() {
        return 'product-viewer-app';
    }
    static get styles() {
        return getCss();
    }
    render() {
        return getHtml.bind(this)();
    }
    static get properties() {
        return {
            product_: { type: Object },
        };
    }
    #product__accessor_storage = null;
    get product_() { return this.#product__accessor_storage; }
    set product_(value) { this.#product__accessor_storage = value; }
    commerceInternalsApi_ = CommerceInternalsApiProxy.getInstance();
    async onLoadProductClick_() {
        const productInfo = (await this.commerceInternalsApi_.getProductInfoForUrl(this.$.productUrl.value))
            .info;
        if (!productInfo) {
            return;
        }
        this.product_ = productInfo;
    }
}
customElements.define(ProductViewerAppElement.is, ProductViewerAppElement);
