Skip to content
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
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "name-request",
"version": "5.8.4",
"version": "5.8.5",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand Down
3 changes: 2 additions & 1 deletion app/src/components/common/applicant-info-2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
</div>
</template>
<span v-if="enablePriorityCheckbox">
Priority name requests are typically reviewed within 1-2 business days.
Priority name requests are typically reviewed within {{ getPriorityWaitTime }} business days.
</span>
<span v-else>
Due to the on-going labour dispute between the government and its employees,
Expand Down Expand Up @@ -295,6 +295,7 @@ export default class ApplicantInfo2 extends Vue {
@Getter(useStore) getNrData!: any
@Getter(useStore) getNrState!: NrState
@Getter(useStore) getPriorityRequest!: boolean
@Getter(useStore) getPriorityWaitTime!: string | number
@Getter(useStore) getShowPriorityRequest!: boolean
@Getter(useStore) isMobile!: boolean

Expand Down
3 changes: 2 additions & 1 deletion app/src/components/common/applicant-info-3.vue
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
</div>
</template>
<span v-if="enablePriorityCheckbox">
Priority name requests are typically reviewed within 1-2 business days.
Priority name requests are typically reviewed within {{ getPriorityWaitTime }} business days.
</span>
<span v-else>
Due to the on-going labour dispute between the government and its employees,
Expand Down Expand Up @@ -369,6 +369,7 @@ export default class ApplicantInfo3 extends Vue {
@Getter(useStore) getNrData!: any
@Getter(useStore) getNrState!: NrState
@Getter(useStore) getPriorityRequest!: boolean
@Getter(useStore) getPriorityWaitTime!: string | number
@Getter(useStore) getShowPriorityRequest!: boolean
@Getter(useStore) isRoleStaff!: boolean
@Getter(useStore) isMobile!: boolean
Expand Down
4 changes: 3 additions & 1 deletion app/src/components/dialogs/upgrade.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
class="mb-8"
>
If you need your name reviewed as quickly as possible, upgrade to a Priority
request. Priority name requests are usually reviewed within 1 to 2 business days.
request. Priority name requests are usually reviewed within {{ getPriorityWaitTime }} business days.
</p>

<FeeSummary
Expand Down Expand Up @@ -127,6 +127,8 @@ export default class UpgradeDialog extends Mixins(
PaymentSessionMixin,
DisplayedComponentMixin
) {
@Getter(useStore) getPriorityWaitTime!: string | number

// the tab indices
// NB: these are reversed to reverse the built-in slide transition
readonly TAB_STAFF_PAYMENT = 0
Expand Down
57 changes: 9 additions & 48 deletions app/src/components/new-request/stats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
>
<div class="stats-content-inner-1 pa-1 text-center">
<div class="stats-value h3-lt">
{{ priorityWaitTime }}
{{ getPriorityWaitTime }}
</div>
<div class="stats-unit">
Days
Expand All @@ -45,7 +45,9 @@
</div>
</template>
<span>
{{ priorityToolTipText }}
If you need your name reviewed as quickly as possible,
Priority requests are available for a fee ($100.00).
Priority name requests are usually reviewed within {{ getPriorityWaitTime }} business days.
</span>
</v-tooltip>
</v-col>
Expand All @@ -69,7 +71,7 @@
>
<div class="stats-content-inner-1 pa-1 text-center">
<div class="stats-value h3-lt">
{{ regularWaitTime }}
{{ getRegularWaitTime }}
</div>
<div class="stats-unit">
Days
Expand Down Expand Up @@ -104,6 +106,8 @@ import NamexServices from '@/services/namex-services'
export default class Stats extends Vue {
@Getter(useStore) getStats!: StatsI
@Getter(useStore) isMobile!: boolean
@Getter(useStore) getRegularWaitTime!: string | number
@Getter(useStore) getPriorityWaitTime!: string | number

@Action(useStore) setStats!: ActionBindingIF

Expand Down Expand Up @@ -132,58 +136,15 @@ export default class Stats extends Vue {
return (this.getStats?.auto_approved_count ?? '-')
}

/** The regular wait time, in days. */
get regularWaitTime (): string | number {
const flagVal = GetFeatureFlag('hardcoded_regular_wait_time')

if (flagVal > 0) return flagVal
if (flagVal < 0) return '-'

const statVal = this.getStats?.regular_wait_time
if (statVal > 0) {
return statVal
}

return '-'
}

/** The priority wait time, in days. */
get priorityWaitTime (): string | number {
const flagVal = GetFeatureFlag('hardcoded_priority_wait_time')

if (flagVal > 0) return flagVal
if (flagVal < 0) return '-'

const statVal = this.getStats?.priority_wait_time
if (statVal > 0) {
return statVal
}

return '-'
}

get showRegularTooltip (): boolean {
const val = Number(this.regularWaitTime)
const val = Number(this.getRegularWaitTime)
return Number.isFinite(val) && val > 0
}

get showPriorityTooltip (): boolean {
const val = Number(this.priorityWaitTime)
const val = Number(this.getPriorityWaitTime)
return Number.isFinite(val) && val > 0
}

get priorityToolTipText (): string {
const priorityToolTipText = GetFeatureFlag('priority-wait-time-tooltip-text')
if (priorityToolTipText) {
return priorityToolTipText
}
// Return default text when no priority tooltip text is available from the feature flag
return `
If you need your name reviewed as quickly as possible,
Priority requests are available for a fee ($100.00).
Priority name requests are usually reviewed within 1 to 2 business days.
`.trim()
}
}
</script>

Expand Down
21 changes: 21 additions & 0 deletions app/src/store/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import {
RequestActions,
XproMapping
} from '@/list-data'
import { GetFeatureFlag } from '@/plugins/launchDarkly'

export const isMobile = (state: StateIF): boolean => {
// fall back to base window width if no window size changes have occurred
Expand Down Expand Up @@ -1318,3 +1319,23 @@ export const getSearchRequest = (state: StateIF): RequestActionsI => {
export const getBusinessAccountId = (state: StateIF): string => {
return state.newRequestModel.businessAccountId
}

export const getPriorityWaitTime = (state: StateIF): string | number => {
const flagVal = GetFeatureFlag('hardcoded_priority_wait_time')
if (flagVal > 0) return flagVal
Copy link
Collaborator

Choose a reason for hiding this comment

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

will the flagval always be number ? same for stat value.

If comparing some text with 0 will yield false;
for example: "some text value" > 0 will compute as false

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, flagval is always number as we defined in Launchdarkly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We define hardcoded_priority_wait_time to return a number in LaunchDarkly. It returns 0 if the FF is disabled.

if (flagVal < 0) return '-'

const statVal = getStats(state)?.priority_wait_time
if (statVal > 0) return statVal
return '-'
}

export const getRegularWaitTime = (state: StateIF): string | number => {
const flagVal = GetFeatureFlag('hardcoded_regular_wait_time')
if (flagVal > 0) return flagVal
if (flagVal < 0) return '-'

const statVal = getStats(state)?.regular_wait_time
if (statVal > 0) return statVal
return '-'
}
Loading