{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/RQmwNhiXBnC3ih0Jrs6h/H9wgEFGsAJGYNXDOkSnM/TrackPixel.js"],
  "sourcesContent": ["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useMemo, useEffect, useState, useRef } from \"react\";\nimport { addPropertyControls, ControlType } from \"framer\";\nfunction useIsInViewport(ref) {\n  const [isIntersecting, setIsIntersecting] = useState(false);\n  const observer = useMemo(() => {\n    if (!window || !window.IntersectionObserver) return;\n    return new IntersectionObserver(([entry]) => setIsIntersecting(entry.isIntersecting));\n  }, []);\n  useEffect(() => {\n    if (!window || !window.IntersectionObserver) return;\n    observer.observe(ref.current);\n    return () => {\n      observer.disconnect();\n    };\n  }, [ref, observer]);\n  return isIntersecting;\n}\nfunction TrackPixel(props) {\n  const {\n    country,\n    track\n  } = props;\n  const ref = useRef(null);\n  const [isIntersecting, setIsIntersecting] = useState(false);\n  const observer = useMemo(() => {\n    if (!window || !window.IntersectionObserver) return;\n    return new IntersectionObserver(([entry]) => {\n      if (!isIntersecting && entry.isIntersecting) {\n        setIsIntersecting(entry.isIntersecting);\n        observer.disconnect();\n      }\n    });\n  }, []);\n  useEffect(() => {\n    if (!window || !window.IntersectionObserver) return;\n    observer.observe(ref.current);\n    return () => {\n      observer.disconnect();\n    };\n  }, [ref, observer]);\n  useEffect(() => {\n    if (props.country !== \"ANY\" && props.country !== country) {\n      // Tracker is country specific and the current visitor's country\n      // does not match that of this user.\n      return;\n    }\n    if (isIntersecting && ref.current) {\n      try {\n        const scrollHeight = document.body.scrollHeight;\n        const bodyRect = document.body.getBoundingClientRect();\n        const elemRect = ref.current.getBoundingClientRect();\n        const offset = elemRect.top - bodyRect.top;\n        const pageProgress = Math.round(offset / scrollHeight * 100); // Relative scroll position.\n        track(\"tag\", {\n          pageProgress: pageProgress,\n          tag: props.tag,\n          type: props.type,\n          country: props.country,\n          score: props.score\n        });\n      } catch (e) {// Swallow error\n      }\n    }\n  }, [isIntersecting]);\n  return /*#__PURE__*/_jsx(\"div\", {\n    ref: ref\n  });\n}\nexport default function _TrackPixel(props) {\n  return /*#__PURE__*/_jsx(TrackPixel, {\n    ...props\n  });\n}\n;\n_TrackPixel.defaultProps = {\n  tag: null,\n  type: \"INTEREST_AND_ENGAGEMENT\",\n  country: \"ANY\",\n  score: 0\n};\naddPropertyControls(_TrackPixel, {\n  type: {\n    type: ControlType.Enum,\n    defaultValue: \"Type\",\n    options: [\"DEMOGRAPHIC_AND_COMPANY\", \"BEHAVIORAL\", \"INTEREST_AND_ENGAGEMENT\", \"FIT_AND_READINESS\"],\n    optionTitles: [\"Demographic & Company Information\", \"Behavioral\", \"Interest and Engagement\", \"Fit and Readiness\"],\n    description: \"Which category do you want this score to attribute to\"\n  },\n  tag: {\n    type: ControlType.String,\n    title: \"Tag\",\n    description: \"The tag of the score\"\n  },\n  score: {\n    type: ControlType.Number,\n    title: \"Score\",\n    description: \"The score you want to attach to the track event\"\n  },\n  country: {\n    type: ControlType.Enum,\n    defaultValue: \"Country\",\n    options: [\"ANY\", \"US\", \"NL\", \"IN\", \"ES\", \"UK\"],\n    optionTitles: [\"Any\", \"United States\", \"The Netherlands\", \"India\", \"Spain\", \"United Kingdom\"],\n    description: \"Specify if this is a country specific tracker or should to apply to every visitor\"\n  }\n});\nexport const __FramerMetadata__ = {\n  \"exports\": {\n    \"default\": {\n      \"type\": \"reactComponent\",\n      \"name\": \"_TrackPixel\",\n      \"slots\": [],\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"__FramerMetadata__\": {\n      \"type\": \"variable\"\n    }\n  }\n};\n//# sourceMappingURL=./TrackPixel.map"],
  "mappings": "8JAkBA,SAASA,EAAWC,EAAO,CACzB,GAAM,CACJ,QAAAC,EACA,MAAAC,CACF,EAAIF,EACEG,EAAMC,EAAO,IAAI,EACjB,CAACC,EAAgBC,CAAiB,EAAIC,EAAS,EAAK,EACpDC,EAAWC,EAAQ,IAAM,CAC7B,GAAI,GA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,EACA,MAAO,CACL,KAAMA,EAAY,OAClB,MAAO,QACP,YAAa,iDACf,EACA,QAAS,CACP,KAAMA,EAAY,KAClB,aAAc,UACd,QAAS,CAAC,MAAO,KAAM,KAAM,KAAM,KAAM,IAAI,EAC7C,aAAc,CAAC,MAAO,gBAAiB,kBAAmB,QAAS,QAAS,gBAAgB,EAC5F,YAAa,mFACf,CACF,CAAC",
  "names": ["TrackPixel", "props", "country", "track", "ref", "pe", "isIntersecting", "setIsIntersecting", "ye", "observer", "se", "window", "entry", "ue", "scrollHeight", "bodyRect", "offset", "pageProgress", "p", "_TrackPixel", "addPropertyControls", "ControlType"]
}
