diff --git a/app/components/countdown_alert_component.rb b/app/components/countdown_alert_component.rb index 2b2fcb57652..8e70d508d73 100644 --- a/app/components/countdown_alert_component.rb +++ b/app/components/countdown_alert_component.rb @@ -1,20 +1,18 @@ # frozen_string_literal: true class CountdownAlertComponent < BaseComponent - attr_reader :show_at_remaining, :alert_options, :countdown_options, :redirect_url, :tag_options + attr_reader :show_at_remaining, :alert_options, :countdown_options, :tag_options def initialize( show_at_remaining: nil, alert_options: {}, countdown_options: {}, - redirect_url: nil, **tag_options ) @show_at_remaining = show_at_remaining @alert_options = alert_options @countdown_options = countdown_options @tag_options = tag_options - @redirect_url = redirect_url end def call @@ -24,7 +22,6 @@ def call **tag_options, class: css_class, 'show-at-remaining': show_at_remaining&.in_milliseconds, - 'redirect-url': redirect_url, ) end diff --git a/app/javascript/packages/countdown/countdown-alert-element.spec.ts b/app/javascript/packages/countdown/countdown-alert-element.spec.ts index 0c252153f39..28a3dfd39e2 100644 --- a/app/javascript/packages/countdown/countdown-alert-element.spec.ts +++ b/app/javascript/packages/countdown/countdown-alert-element.spec.ts @@ -5,14 +5,9 @@ import './countdown-element'; describe('CountdownAlertElement', () => { const sandbox = useSandbox({ useFakeTimers: true }); - function createElement({ - showAtRemaining, - redirectURL, - }: { showAtRemaining?: number; redirectURL?: string } = {}) { + function createElement({ showAtRemaining }: { showAtRemaining?: number } = {}) { document.body.innerHTML = ` - +

@@ -46,13 +41,4 @@ describe('CountdownAlertElement', () => { expect(element.show).to.have.been.called(); }); }); - - it('redirects when time has expired', () => { - createElement({ redirectURL: '#teapot' }); - - sandbox.clock.tick(91000); - expect(window.location.hash).to.equal(''); - sandbox.clock.tick(1000); - expect(window.location.hash).to.equal('#teapot'); - }); }); diff --git a/app/javascript/packages/countdown/countdown-alert-element.ts b/app/javascript/packages/countdown/countdown-alert-element.ts index 7e72f151ea9..dcdf6479b96 100644 --- a/app/javascript/packages/countdown/countdown-alert-element.ts +++ b/app/javascript/packages/countdown/countdown-alert-element.ts @@ -1,4 +1,3 @@ -import { trackEvent } from '@18f/identity-analytics'; import type { CountdownElement } from './countdown-element'; export class CountdownAlertElement extends HTMLElement { @@ -6,20 +5,12 @@ export class CountdownAlertElement extends HTMLElement { if (this.showAtRemaining) { this.addEventListener('lg:countdown:tick', this.handleShowAtRemainingTick); } - - if (this.redirectURL) { - this.addEventListener('lg:countdown:tick', this.handleRedirectTick); - } } get showAtRemaining(): number | null { return Number(this.getAttribute('show-at-remaining')) || null; } - get redirectURL(): string | null { - return this.getAttribute('redirect-url') || null; - } - get countdown(): CountdownElement { return this.querySelector('lg-countdown')!; } @@ -31,18 +22,6 @@ export class CountdownAlertElement extends HTMLElement { } }; - handleRedirectTick = () => { - if (this.countdown.timeRemaining <= 0) { - trackEvent('Countdown timeout redirect', { - path: this.redirectURL, - expiration: this.countdown.expiration, - timeRemaining: this.countdown.timeRemaining, - }); - window.location.href = this.redirectURL!; - this.removeEventListener('lg:countdown:tick', this.handleRedirectTick); - } - }; - show() { this.classList.remove('display-none'); }