diff --git a/.babelrc b/.babelrc
index 7bb5482ce..48f19b72b 100644
--- a/.babelrc
+++ b/.babelrc
@@ -4,8 +4,8 @@
[
"@babel/transform-react-jsx",
{
- "pragma": "Preact.h",
- "pragmaFrag": "Preact.Fragment"
+ "runtime": "automatic",
+ "importSource": "preact"
}
]
]
diff --git a/cypress/e2e/surveys.cy.ts b/cypress/e2e/surveys.cy.ts
index a086fd26b..b17ddd5bb 100644
--- a/cypress/e2e/surveys.cy.ts
+++ b/cypress/e2e/surveys.cy.ts
@@ -525,7 +525,7 @@ describe('Surveys', () => {
type: 'popover',
start_date: '2021-01-01T00:00:00Z',
questions: [emojiRatingQuestion],
- appearance: appearanceWithThanks,
+ appearance: { ...appearanceWithThanks, backgroundColor: 'black' },
},
],
}).as('surveys')
diff --git a/src/__tests__/extensions/surveys.test.ts b/src/__tests__/extensions/surveys.test.ts
index 9953f266f..d455bf588 100644
--- a/src/__tests__/extensions/surveys.test.ts
+++ b/src/__tests__/extensions/surveys.test.ts
@@ -1,5 +1,6 @@
import 'regenerator-runtime/runtime'
-import { createShadow, generateSurveys } from '../../extensions/surveys'
+import { generateSurveys } from '../../extensions/surveys'
+import { createShadow } from '../../extensions/surveys/surveys-utils'
import { SurveyType } from '../../posthog-surveys-types'
describe('survey display logic', () => {
diff --git a/src/extensions/surveys.tsx b/src/extensions/surveys.tsx
index c44fb5f6a..b349548fe 100644
--- a/src/extensions/surveys.tsx
+++ b/src/extensions/surveys.tsx
@@ -12,30 +12,24 @@ import {
} from '../posthog-surveys-types'
import { window as _window, document as _document } from '../utils/globals'
-import { style, getTextColor, defaultSurveyAppearance, sendSurveyEvent } from './surveys/surveys-utils'
+import { style, defaultSurveyAppearance, sendSurveyEvent, createShadow } from './surveys/surveys-utils'
+import { useContrastingTextColor } from './surveys/hooks/useContrastingTextColor'
import * as Preact from 'preact'
import { createWidgetShadow } from './surveys-widget'
import { useState, useEffect, useRef } from 'preact/hooks'
-import { _isArray, _isNull, _isNumber } from '../utils/type-utils'
+import { _isNumber } from '../utils/type-utils'
+import { ConfirmationMessage } from './surveys/components/ConfirmationMessage'
+import {
+ OpenTextQuestion,
+ LinkQuestion,
+ RatingQuestion,
+ MultipleChoiceQuestion,
+} from './surveys/components/QuestionTypes'
// We cast the types here which is dangerous but protected by the top level generateSurveys call
const window = _window as Window & typeof globalThis
const document = _document as Document
-export const createShadow = (styleSheet: string, surveyId: string) => {
- const div = document.createElement('div')
- div.className = `PostHogSurvey${surveyId}`
- const shadow = div.attachShadow({ mode: 'open' })
- if (styleSheet) {
- const styleElement = Object.assign(document.createElement('style'), {
- innerText: styleSheet,
- })
- shadow.appendChild(styleElement)
- }
- document.body.appendChild(div)
- return shadow
-}
-
const handleWidget = (posthog: PostHog, survey: Survey) => {
const shadow = createWidgetShadow(survey)
const surveyStyleSheet = style(survey.appearance)
@@ -119,93 +113,6 @@ export function generateSurveys(posthog: PostHog) {
}, 3000)
}
-const defaultBackgroundColor = '#eeeded'
-
-export function QuestionHeader({
- question,
- description,
- backgroundColor,
-}: {
- question: string
- description?: string | null
- backgroundColor?: string
-}) {
- return (
-
-
{question}
- {description &&
}
-
- )
-}
-
-export function Cancel({ onClick }: { onClick: () => void }) {
- return (
-
-
-
- )
-}
-
-export function BottomSection({
- text,
- submitDisabled,
- appearance,
- onSubmit,
- link,
-}: {
- text: string
- submitDisabled: boolean
- appearance: SurveyAppearance
- onSubmit: () => void
- link?: string | null
-}) {
- const { textColor, ref } = useContrastingTextColor({ appearance })
-
- return (
-
-
-
-
- {!appearance.whiteLabel && (
-
- )}
-
- )
-}
-
-export function PostHogLogo({ backgroundColor }: { backgroundColor?: string }) {
- const { textColor, ref } = useContrastingTextColor({ appearance: { backgroundColor } })
-
- return (
- }
- style={{ backgroundColor: backgroundColor, color: textColor }}
- className="footer-branding"
- >
- Survey by {posthogLogo}
-
- )
-}
-
export function Surveys({ posthog, survey, style }: { posthog: PostHog; survey: Survey; style?: React.CSSProperties }) {
const [displayState, setDisplayState] = useState<'survey' | 'confirmation' | 'closed'>('survey')
@@ -253,6 +160,61 @@ export function Surveys({ posthog, survey, style }: { posthog: PostHog; survey:
)
}
+const questionTypeMap = (
+ question: SurveyQuestion,
+ questionIndex: number,
+ appearance: SurveyAppearance,
+ onSubmit: (res: string | string[] | number | null) => void,
+ closeSurveyPopup: () => void
+): JSX.Element => {
+ const mapping = {
+ [SurveyQuestionType.Open]: (
+
+ ),
+ [SurveyQuestionType.Link]: (
+
+ ),
+ [SurveyQuestionType.Rating]: (
+
+ ),
+ [SurveyQuestionType.SingleChoice]: (
+
+ ),
+ [SurveyQuestionType.MultipleChoice]: (
+
+ ),
+ }
+ return mapping[question.type]
+}
+
export function Questions({
survey,
posthog,
@@ -329,347 +291,6 @@ const closeSurveyPopup = (posthog: PostHog, survey: Survey) => {
window.dispatchEvent(new Event('PHSurveyClosed'))
}
-export function OpenTextQuestion({
- question,
- appearance,
- onSubmit,
- closeSurveyPopup,
-}: {
- question: BasicSurveyQuestion
- appearance: SurveyAppearance
- onSubmit: (text: string) => void
- closeSurveyPopup: () => void
-}) {
- const textRef = useRef(null)
- const [text, setText] = useState('')
-
- return (
-
- closeSurveyPopup()} />
-
-
- )
-}
-
-export function LinkQuestion({
- question,
- appearance,
- onSubmit,
- closeSurveyPopup,
-}: {
- question: LinkSurveyQuestion
- appearance: SurveyAppearance
- onSubmit: (clicked: string) => void
- closeSurveyPopup: () => void
-}) {
- return (
-
- closeSurveyPopup()} />
-
- onSubmit('link clicked')}
- />
-
- )
-}
-
-export function RatingQuestion({
- question,
- questionIndex,
- appearance,
- onSubmit,
- closeSurveyPopup,
-}: {
- question: RatingSurveyQuestion
- questionIndex: number
- appearance: SurveyAppearance
- onSubmit: (rating: number | null) => void
- closeSurveyPopup: () => void
-}) {
- const scale = question.scale
- const starting = question.scale === 10 ? 0 : 1
- const [rating, setRating] = useState(null)
-
- return (
-
-
closeSurveyPopup()} />
-
-
-
- {question.display === 'emoji' && (
-
- {(question.scale === 3 ? threeScaleEmojis : fiveScaleEmojis).map((emoji, idx) => {
- const active = idx + 1 === rating
- return (
-
- )
- })}
-
- )}
- {question.display === 'number' && (
-
- {(question.scale === 5 ? fiveScaleNumbers : tenScaleNumbers).map((number, idx) => {
- const active = rating === number
- return (
- {
- setRating(num)
- }}
- />
- )
- })}
-
- )}
-
-
-
{question.lowerBoundLabel}
-
{question.upperBoundLabel}
-
-
- onSubmit(rating)}
- />
-
- )
-}
-
-export function RatingButton({
- num,
- active,
- questionIndex,
- appearance,
- setActiveNumber,
-}: {
- num: number
- active: boolean
- questionIndex: number
- appearance: any
- setActiveNumber: (num: number) => void
-}) {
- const { textColor, ref } = useContrastingTextColor({ appearance, defaultTextColor: 'black' })
-
- return (
-
- )
-}
-
-export function ConfirmationMessage({
- confirmationHeader,
- confirmationDescription,
- appearance,
- onClose,
- styleOverrides,
-}: {
- confirmationHeader: string
- confirmationDescription: string
- appearance: SurveyAppearance
- onClose: () => void
- styleOverrides?: React.CSSProperties
-}) {
- return (
- <>
-
-
-
onClose()} />
- {confirmationHeader}
- {confirmationDescription && (
-
- )}
- onClose()}
- />
-
-
- >
- )
-}
-
-export function MultipleChoiceQuestion({
- question,
- questionIndex,
- appearance,
- onSubmit,
- closeSurveyPopup,
-}: {
- question: MultipleSurveyQuestion
- questionIndex: number
- appearance: SurveyAppearance
- onSubmit: (choices: string | string[] | null) => void
- closeSurveyPopup: () => void
-}) {
- const textRef = useRef(null)
- const [selectedChoices, setSelectedChoices] = useState(
- question.type === SurveyQuestionType.MultipleChoice ? [] : null
- )
- const [openChoiceSelected, setOpenChoiceSelected] = useState(false)
- const [openEndedInput, setOpenEndedInput] = useState('')
-
- const inputType = question.type === SurveyQuestionType.SingleChoice ? 'radio' : 'checkbox'
- return (
-
-
closeSurveyPopup()} />
-
-
- {
- if (openChoiceSelected && question.type === SurveyQuestionType.MultipleChoice) {
- if (_isArray(selectedChoices)) {
- onSubmit([...selectedChoices, openEndedInput])
- }
- } else {
- onSubmit(selectedChoices)
- }
- }}
- />
-
- )
-}
-
export function FeedbackWidget({ posthog, survey }: { posthog: PostHog; survey: Survey }): JSX.Element {
const [showSurvey, setShowSurvey] = useState(false)
const [styleOverrides, setStyle] = useState({})
@@ -710,176 +331,3 @@ export function FeedbackWidget({ posthog, survey }: { posthog: PostHog; survey:
>
)
}
-
-const questionTypeMap = (
- question: SurveyQuestion,
- questionIndex: number,
- appearance: SurveyAppearance,
- onSubmit: (res: string | string[] | number | null) => void,
- closeSurveyPopup: () => void
-): JSX.Element => {
- const mapping = {
- [SurveyQuestionType.Open]: (
-
- ),
- [SurveyQuestionType.Link]: (
-
- ),
- [SurveyQuestionType.Rating]: (
-
- ),
- [SurveyQuestionType.SingleChoice]: (
-
- ),
- [SurveyQuestionType.MultipleChoice]: (
-
- ),
- }
- return mapping[question.type]
-}
-
-export function useContrastingTextColor(options: { appearance: SurveyAppearance; defaultTextColor?: string }): {
- ref: Preact.RefObject
- textColor: string
-} {
- const ref = useRef(null)
- const [textColor, setTextColor] = useState(options.defaultTextColor ?? 'white')
-
- // TODO: useContext to get the background colors instead of querying the DOM
- useEffect(() => {
- if (ref.current) {
- const color = getTextColor(ref.current)
- setTextColor(color)
- }
- }, [options.appearance])
-
- return {
- ref,
- textColor,
- }
-}
-
-export const satisfiedEmoji = (
-
-)
-export const neutralEmoji = (
-
-)
-export const dissatisfiedEmoji = (
-
-)
-export const veryDissatisfiedEmoji = (
-
-)
-export const verySatisfiedEmoji = (
-
-)
-export const cancelSVG = (
-
-)
-export const posthogLogo = (
-
-)
-export const checkSVG = (
-
-)
-
-const threeScaleEmojis = [dissatisfiedEmoji, neutralEmoji, dissatisfiedEmoji]
-const fiveScaleEmojis = [veryDissatisfiedEmoji, dissatisfiedEmoji, neutralEmoji, satisfiedEmoji, verySatisfiedEmoji]
-const fiveScaleNumbers = [1, 2, 3, 4, 5]
-const tenScaleNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
diff --git a/src/extensions/surveys/components/BottomSection.tsx b/src/extensions/surveys/components/BottomSection.tsx
new file mode 100644
index 000000000..c701687fb
--- /dev/null
+++ b/src/extensions/surveys/components/BottomSection.tsx
@@ -0,0 +1,46 @@
+import { RefObject } from 'preact'
+import { window } from '../../../utils/globals'
+
+import { SurveyAppearance } from '../../../posthog-surveys-types'
+
+import { useContrastingTextColor } from '../hooks/useContrastingTextColor'
+import { PostHogLogo } from './PostHogLogo'
+
+export function BottomSection({
+ text,
+ submitDisabled,
+ appearance,
+ onSubmit,
+ link,
+}: {
+ text: string
+ submitDisabled: boolean
+ appearance: SurveyAppearance
+ onSubmit: () => void
+ link?: string | null
+}) {
+ const { textColor, ref } = useContrastingTextColor({ appearance })
+
+ return (
+
+
+
+
+ {!appearance.whiteLabel &&
}
+
+ )
+}
diff --git a/src/extensions/surveys/components/ConfirmationMessage.tsx b/src/extensions/surveys/components/ConfirmationMessage.tsx
new file mode 100644
index 000000000..8b9db151b
--- /dev/null
+++ b/src/extensions/surveys/components/ConfirmationMessage.tsx
@@ -0,0 +1,50 @@
+import { BottomSection } from './BottomSection'
+import { Cancel } from './QuestionHeader'
+import { SurveyAppearance } from '../../../posthog-surveys-types'
+import { useContrastingTextColor } from '../hooks/useContrastingTextColor'
+import { RefObject } from 'preact'
+
+export function ConfirmationMessage({
+ confirmationHeader,
+ confirmationDescription,
+ appearance,
+ onClose,
+ styleOverrides,
+}: {
+ confirmationHeader: string
+ confirmationDescription: string
+ appearance: SurveyAppearance
+ onClose: () => void
+ styleOverrides?: React.CSSProperties
+}) {
+ const { textColor, ref } = useContrastingTextColor({ appearance })
+ return (
+ <>
+
+
+
onClose()} />
+ }
+ style={{ color: textColor }}
+ >
+ {confirmationHeader}
+
+ {confirmationDescription && (
+
+ )}
+ onClose()}
+ />
+
+
+ >
+ )
+}
diff --git a/src/extensions/surveys/components/PostHogLogo.tsx b/src/extensions/surveys/components/PostHogLogo.tsx
new file mode 100644
index 000000000..ce73124ce
--- /dev/null
+++ b/src/extensions/surveys/components/PostHogLogo.tsx
@@ -0,0 +1,20 @@
+import { useContrastingTextColor } from '../hooks/useContrastingTextColor'
+import * as Preact from 'preact'
+import { IconPosthogLogo } from '../icons'
+
+export function PostHogLogo({ backgroundColor }: { backgroundColor?: string }) {
+ const { textColor, ref } = useContrastingTextColor({ appearance: { backgroundColor } })
+
+ return (
+ }
+ style={{ backgroundColor: backgroundColor, color: textColor }}
+ className="footer-branding"
+ >
+ Survey by {IconPosthogLogo}
+
+ )
+}
diff --git a/src/extensions/surveys/components/QuestionHeader.tsx b/src/extensions/surveys/components/QuestionHeader.tsx
new file mode 100644
index 000000000..819d4f3f9
--- /dev/null
+++ b/src/extensions/surveys/components/QuestionHeader.tsx
@@ -0,0 +1,29 @@
+import { defaultSurveyAppearance } from '../surveys-utils'
+import { cancelSVG } from '../icons'
+
+export function QuestionHeader({
+ question,
+ description,
+ backgroundColor,
+}: {
+ question: string
+ description?: string | null
+ backgroundColor?: string
+}) {
+ return (
+
+
{question}
+ {description &&
}
+
+ )
+}
+
+export function Cancel({ onClick }: { onClick: () => void }) {
+ return (
+
+
+
+ )
+}
diff --git a/src/extensions/surveys/components/QuestionTypes.tsx b/src/extensions/surveys/components/QuestionTypes.tsx
new file mode 100644
index 000000000..80764303f
--- /dev/null
+++ b/src/extensions/surveys/components/QuestionTypes.tsx
@@ -0,0 +1,333 @@
+import {
+ BasicSurveyQuestion,
+ SurveyAppearance,
+ LinkSurveyQuestion,
+ RatingSurveyQuestion,
+ MultipleSurveyQuestion,
+ SurveyQuestionType,
+} from '../../../posthog-surveys-types'
+import { RefObject } from 'preact'
+import { useRef, useState } from 'preact/hooks'
+import { _isNull, _isArray } from '../../../utils/type-utils'
+import { useContrastingTextColor } from '../hooks/useContrastingTextColor'
+import {
+ checkSVG,
+ dissatisfiedEmoji,
+ neutralEmoji,
+ satisfiedEmoji,
+ veryDissatisfiedEmoji,
+ verySatisfiedEmoji,
+} from '../icons'
+import { defaultSurveyAppearance } from '../surveys-utils'
+import { BottomSection } from './BottomSection'
+import { Cancel, QuestionHeader } from './QuestionHeader'
+
+export function OpenTextQuestion({
+ question,
+ appearance,
+ onSubmit,
+ closeSurveyPopup,
+}: {
+ question: BasicSurveyQuestion
+ appearance: SurveyAppearance
+ onSubmit: (text: string) => void
+ closeSurveyPopup: () => void
+}) {
+ const textRef = useRef(null)
+ const [text, setText] = useState('')
+
+ return (
+
+ closeSurveyPopup()} />
+
+
+ )
+}
+
+export function LinkQuestion({
+ question,
+ appearance,
+ onSubmit,
+ closeSurveyPopup,
+}: {
+ question: LinkSurveyQuestion
+ appearance: SurveyAppearance
+ onSubmit: (clicked: string) => void
+ closeSurveyPopup: () => void
+}) {
+ return (
+
+ closeSurveyPopup()} />
+
+ onSubmit('link clicked')}
+ />
+
+ )
+}
+
+export function RatingQuestion({
+ question,
+ questionIndex,
+ appearance,
+ onSubmit,
+ closeSurveyPopup,
+}: {
+ question: RatingSurveyQuestion
+ questionIndex: number
+ appearance: SurveyAppearance
+ onSubmit: (rating: number | null) => void
+ closeSurveyPopup: () => void
+}) {
+ const scale = question.scale
+ const starting = question.scale === 10 ? 0 : 1
+ const [rating, setRating] = useState(null)
+
+ return (
+
+
closeSurveyPopup()} />
+
+
+
+ {question.display === 'emoji' && (
+
+ {(question.scale === 3 ? threeScaleEmojis : fiveScaleEmojis).map((emoji, idx) => {
+ const active = idx + 1 === rating
+ return (
+
+ )
+ })}
+
+ )}
+ {question.display === 'number' && (
+
+ {(question.scale === 5 ? fiveScaleNumbers : tenScaleNumbers).map((number, idx) => {
+ const active = rating === number
+ return (
+ {
+ setRating(num)
+ }}
+ />
+ )
+ })}
+
+ )}
+
+
+
{question.lowerBoundLabel}
+
{question.upperBoundLabel}
+
+
+ onSubmit(rating)}
+ />
+
+ )
+}
+
+export function RatingButton({
+ num,
+ active,
+ questionIndex,
+ appearance,
+ setActiveNumber,
+}: {
+ num: number
+ active: boolean
+ questionIndex: number
+ appearance: any
+ setActiveNumber: (num: number) => void
+}) {
+ const { textColor, ref } = useContrastingTextColor({ appearance, defaultTextColor: 'white', forceUpdate: active })
+ return (
+
+ )
+}
+
+export function MultipleChoiceQuestion({
+ question,
+ questionIndex,
+ appearance,
+ onSubmit,
+ closeSurveyPopup,
+}: {
+ question: MultipleSurveyQuestion
+ questionIndex: number
+ appearance: SurveyAppearance
+ onSubmit: (choices: string | string[] | null) => void
+ closeSurveyPopup: () => void
+}) {
+ const textRef = useRef(null)
+ const [selectedChoices, setSelectedChoices] = useState(
+ question.type === SurveyQuestionType.MultipleChoice ? [] : null
+ )
+ const [openChoiceSelected, setOpenChoiceSelected] = useState(false)
+ const [openEndedInput, setOpenEndedInput] = useState('')
+
+ const inputType = question.type === SurveyQuestionType.SingleChoice ? 'radio' : 'checkbox'
+ return (
+
+
closeSurveyPopup()} />
+
+
+ {
+ if (openChoiceSelected && question.type === SurveyQuestionType.MultipleChoice) {
+ if (_isArray(selectedChoices)) {
+ onSubmit([...selectedChoices, openEndedInput])
+ }
+ } else {
+ onSubmit(selectedChoices)
+ }
+ }}
+ />
+
+ )
+}
+
+const threeScaleEmojis = [dissatisfiedEmoji, neutralEmoji, dissatisfiedEmoji]
+const fiveScaleEmojis = [veryDissatisfiedEmoji, dissatisfiedEmoji, neutralEmoji, satisfiedEmoji, verySatisfiedEmoji]
+const fiveScaleNumbers = [1, 2, 3, 4, 5]
+const tenScaleNumbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
diff --git a/src/extensions/surveys/hooks/useContrastingTextColor.ts b/src/extensions/surveys/hooks/useContrastingTextColor.ts
new file mode 100644
index 000000000..931437841
--- /dev/null
+++ b/src/extensions/surveys/hooks/useContrastingTextColor.ts
@@ -0,0 +1,29 @@
+import { useEffect, useRef, useState } from 'preact/hooks'
+import { SurveyAppearance } from '../../../posthog-surveys-types'
+import * as Preact from 'preact'
+import { getTextColor } from '../surveys-utils'
+
+export function useContrastingTextColor(options: {
+ appearance: SurveyAppearance
+ defaultTextColor?: string
+ forceUpdate?: boolean
+}): {
+ ref: Preact.RefObject
+ textColor: string
+} {
+ const ref = useRef(null)
+ const [textColor, setTextColor] = useState(options.defaultTextColor ?? 'black')
+
+ // TODO: useContext to get the background colors instead of querying the DOM
+ useEffect(() => {
+ if (ref.current) {
+ const color = getTextColor(ref.current)
+ setTextColor(color)
+ }
+ }, [options.appearance, options.forceUpdate])
+
+ return {
+ ref,
+ textColor,
+ }
+}
diff --git a/src/extensions/surveys/icons.tsx b/src/extensions/surveys/icons.tsx
new file mode 100644
index 000000000..b294e6246
--- /dev/null
+++ b/src/extensions/surveys/icons.tsx
@@ -0,0 +1,91 @@
+export const satisfiedEmoji = (
+
+)
+export const neutralEmoji = (
+
+)
+export const dissatisfiedEmoji = (
+
+)
+export const veryDissatisfiedEmoji = (
+
+)
+export const verySatisfiedEmoji = (
+
+)
+export const cancelSVG = (
+
+)
+export const IconPosthogLogo = (
+
+)
+export const checkSVG = (
+
+)
diff --git a/src/extensions/surveys/surveys-utils.ts b/src/extensions/surveys/surveys-utils.ts
index 0c50940ad..3889ee687 100644
--- a/src/extensions/surveys/surveys-utils.ts
+++ b/src/extensions/surveys/surveys-utils.ts
@@ -1,9 +1,10 @@
import { PostHog } from '../../posthog-core'
import { Survey, SurveyAppearance } from '../../posthog-surveys-types'
-import { window as _window } from '../../utils/globals'
+import { window as _window, document as _document } from '../../utils/globals'
// We cast the types here which is dangerous but protected by the top level generateSurveys call
const window = _window as Window & typeof globalThis
+const document = _document as Document
export const style = (appearance: SurveyAppearance | null) => {
const positions = {
@@ -121,6 +122,7 @@ export const style = (appearance: SurveyAppearance | null) => {
padding: 20px 25px 10px;
display: flex;
flex-direction: column;
+ border-radius: 10px;
}
.survey-question {
font-weight: 500;
@@ -331,6 +333,20 @@ export const defaultSurveyAppearance: SurveyAppearance = {
position: 'right',
}
+export const createShadow = (styleSheet: string, surveyId: string) => {
+ const div = document.createElement('div')
+ div.className = `PostHogSurvey${surveyId}`
+ const shadow = div.attachShadow({ mode: 'open' })
+ if (styleSheet) {
+ const styleElement = Object.assign(document.createElement('style'), {
+ innerText: styleSheet,
+ })
+ shadow.appendChild(styleElement)
+ }
+ document.body.appendChild(div)
+ return shadow
+}
+
export const sendSurveyEvent = (
responses: Record = {},
survey: Survey,
diff --git a/tsconfig.json b/tsconfig.json
index 8c211704e..243e5ee0d 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -24,5 +24,6 @@
"jsxFactory": "h",
"jsxFragmentFactory": "Fragment"
},
- "include": ["src/*.ts*"]
+ "include": ["src/*.ts*"],
+ "exclude": ["src/__tests__/**/*.ts*"]
}