Skip to content

Commit

Permalink
fix(surveys): prioritize question button text field and thank you cou…
Browse files Browse the repository at this point in the history
…ntdown is not automatic (#893)

* fix(surveys): prioritize question button text field

* thank you messages do not auto disappear
  • Loading branch information
liyiy authored Nov 15, 2023
1 parent a5dd496 commit c64cc35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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
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

0 comments on commit c64cc35

Please sign in to comment.