"use client";
const SALES_DOCUMENT_TOTALS_REFRESH_EVENT = "sales:document:totals:refresh";
function emitSalesDocumentTotalsRefresh(detail) {
  if (typeof window === "undefined" || typeof CustomEvent === "undefined") return;
  window.dispatchEvent(
    new CustomEvent(SALES_DOCUMENT_TOTALS_REFRESH_EVENT, { detail })
  );
}
function subscribeSalesDocumentTotalsRefresh(handler) {
  if (typeof window === "undefined") return () => {
  };
  const listener = (event) => {
    const detail = event.detail;
    if (!detail) return;
    handler(detail);
  };
  window.addEventListener(SALES_DOCUMENT_TOTALS_REFRESH_EVENT, listener);
  return () => window.removeEventListener(SALES_DOCUMENT_TOTALS_REFRESH_EVENT, listener);
}
export {
  SALES_DOCUMENT_TOTALS_REFRESH_EVENT,
  emitSalesDocumentTotalsRefresh,
  subscribeSalesDocumentTotalsRefresh
};
//# sourceMappingURL=documentTotalsEvents.js.map
