Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(surveys): prioritize question button text field and thank you countdown is not automatic #893

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/extensions/surveys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export const createOpenTextOrLinkPopup = (
<div class="bottom-section">
<div class="buttons">
<button class="form-submit auto-text-color" type="submit">${
survey.appearance?.submitButtonText || 'Submit'
question.buttonText || survey.appearance?.submitButtonText || 'Submit'
}</button>
</div>
<a href="https://posthog.com" target="_blank" rel="noopener" class="footer-branding auto-text-color">Survey by ${posthogLogo}</a>
Expand Down Expand Up @@ -526,7 +526,7 @@ export const createRatingsPopup = (
<div class="bottom-section">
<div class="buttons">
<button class="form-submit auto-text-color" type="submit" ${isOptional ? '' : 'disabled'}>${
survey.appearance?.submitButtonText || 'Submit'
question.buttonText || survey.appearance?.submitButtonText || 'Submit'
}</button>
</div>
<a href="https://posthog.com" target="_blank" rel="noopener" class="footer-branding auto-text-color">Survey by ${posthogLogo}</a>
Expand Down Expand Up @@ -618,7 +618,7 @@ export const createMultipleChoicePopup = (
<div class="bottom-section">
<div class="buttons">
<button class="form-submit auto-text-color" type="submit" ${isOptional ? '' : 'disabled'}>${
survey.appearance?.submitButtonText || 'Submit'
question.buttonText || survey.appearance?.submitButtonText || 'Submit'
}</button>
</div>
<a href="https://posthog.com" target="_blank" rel="noopener" class="footer-branding auto-text-color">Survey by ${posthogLogo}</a>
Expand Down Expand Up @@ -741,7 +741,7 @@ export const callSurveys = (posthog: PostHog, forceReload: boolean = false) => {
})
}
const countdownEl = thankYouElement.querySelector('.thank-you-message-countdown')
if (countdownEl) {
if (survey.appearance?.autoDisappear && countdownEl) {
let count = 3
countdownEl.textContent = `(${count})`
const countdown = setInterval(() => {
Expand Down
3 changes: 3 additions & 0 deletions src/posthog-surveys-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ export interface SurveyAppearance {
backgroundColor?: string
submitButtonColor?: string
textColor?: string
// deprecate submit button text eventually
submitButtonText?: string
descriptionTextColor?: string
ratingButtonColor?: string
ratingButtonActiveColor?: string
ratingButtonHoverColor?: string
whiteLabel?: boolean
autoDisappear?: boolean
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

making the countdown for thank you messages optional

displayThankYouMessage?: boolean
thankYouMessageHeader?: string
thankYouMessageDescription?: string
Expand All @@ -37,6 +39,7 @@ interface SurveyQuestionBase {
question: string
description?: string | null
optional?: boolean
buttonText?: string
}

export interface BasicSurveyQuestion extends SurveyQuestionBase {
Expand Down
Loading