import { useProgramId, useUserIdentity, useQuery, } from "@saasquatch/component-boilerplate";
import { gql } from "graphql-request";
const GET_USER_DETAILS = gql `
  query getUser($programId: ID) {
    viewer {
      ... on User {
        referralCode(programId: $programId)
      }
    }
  }
`;
export function useReferralIframe(props) {
  var _a;
  const programId = useProgramId();
  const user = useUserIdentity();
  const { data } = useQuery(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
  return {
    states: {
      content: props,
    },
    data: {
      shareCode: (_a = data === null || data === void 0 ? void 0 : data.viewer) === null || _a === void 0 ? void 0 : _a.referralCode,
    },
  };
}
