;
{
  try {
    let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
    n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "ea0b0020-c2a2-4f82-b873-0d44c11f6d82", e._sentryDebugIdIdentifier = "sentry-dbid-ea0b0020-c2a2-4f82-b873-0d44c11f6d82");
  } catch (e) {
  }
}
;
import { useQuery } from "@tanstack/preact-query";
import { b as useApiContext, $ as httpPost, B as useSettingsContext } from "./StoreProvider-CqQrndhS.js";
import { useMemo } from "preact/hooks";
import { u as useBusinessLines } from "./useBusinessLines-Bqjsys_I.js";
import { S as SettingNames } from "./TaskVerificationStatus-C19Z4x3D.js";
const getPciStatus = async (legalEntityId, baseUrl, data) => {
  const filteredData = {
    ...data,
    additionalSalesChannels: data.additionalSalesChannels?.filter(
      (channel) => channel !== "payByLink"
    )
  };
  return httpPost(
    {
      baseUrl,
      path: `legalEntities/${legalEntityId}/pci/signingRequired`
    },
    filteredData
  );
};
const usePciStatus = (data, options) => {
  const { rootLegalEntityId, baseUrl } = useApiContext();
  return useQuery({
    queryKey: ["pciStatus", data],
    queryFn: () => getPciStatus(rootLegalEntityId.value, baseUrl.value, data),
    staleTime: 0,
    ...options
  });
};
function useSalesChannels() {
  const { isSettingEnabled } = useSettingsContext();
  const { data: existingBusinessLines } = useBusinessLines(["paymentProcessing"]);
  return useMemo(() => {
    const settings = [];
    const businessLinesSalesChannels = [
      ...new Set(existingBusinessLines?.flatMap((item) => item.salesChannels ?? []))
    ];
    if (isSettingEnabled(SettingNames.RequirePciSignEcommerce)) {
      settings.push("eCommerce");
    }
    if (isSettingEnabled(SettingNames.RequirePciSignPos)) {
      settings.push("pos");
    }
    if (isSettingEnabled(SettingNames.RequirePciSignEcomMoto)) {
      settings.push("ecomMoto");
    }
    if (isSettingEnabled(SettingNames.RequirePciSignPosMoto)) {
      settings.push("posMoto");
    }
    return isSettingEnabled("allowBusinessLines") ? businessLinesSalesChannels : settings;
  }, [existingBusinessLines, isSettingEnabled]);
}
export {
  usePciStatus as a,
  useSalesChannels as u
};
