text: "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.query = exports.useAsyncProduct = void 0;
  const gatsby_plugin_graphql_1 = require("@vtex/gatsby-plugin-graphql");
  const AsyncProductQuery_graphql_1 = require("./__generated__/AsyncProductQuery.graphql");
  const useQuery_1 = require("../../sdk/graphql/useQuery");
  exports.useAsyncProduct = (variables, options) => {
      var _a;
      const { data } = useQuery_1.useQuery(Object.assign(Object.assign(Object.assign({}, AsyncProductQuery_graphql_1.AsyncProductQuery), { variables, suspense: true }), options));
      const product = (_a = data === null || data === void 0 ? void 0 : data.vtex.product) !== null && _a !== void 0 ? _a : null;
      return { product };
  };
  exports.query = gatsby_plugin_graphql_1.gql `
    query AsyncProductQuery($slug: String) {
      vtex {
        product(slug: $slug) {
          productId
          productName
          productReference
          description
          linkText
          specificationGroups {
            name
            specifications {
              name
              values
            }
          }
          items {
            itemId
            images {
              imageUrl
              imageText
            }
            sellers {
              sellerId
              commercialOffer: commertialOffer {
                maxInstallments: Installments(criteria: MAX_WITHOUT_INTEREST) {
                  value: Value
                  numberOfInstallments: NumberOfInstallments
                }
                installments: Installments(criteria: ALL) {
                  value: Value
                  numberOfInstallments: NumberOfInstallments
                  interestRate: InterestRate
                }
                availableQuantity: AvailableQuantity
                price: Price
                listPrice: ListPrice
                gifts {
                  skuName
                  images {
                    imageUrl
                  }
                }
                spotPrice
                teasers {
                  name
                }
              }
            }
          }
        }
      }
    }
  `;
  