|
52 | 52 | <p v-if="isContactRequired">To learn more about our {{ input.teamType?.name }} plan, click below to contact our sales team.</p> |
53 | 53 | <p v-if="trialMode && !trialHasEnded">Setting up billing will bring your free trial to an end</p> |
54 | 54 | <p v-if="!isContactRequired && team.suspended">Setting up billing will unsuspend your team</p> |
| 55 | + <p v-if="isUpgradingFromMonthlyToYearly">Any additional Hosted or Remote Instances will also switch to yearly billing.</p> |
55 | 56 | <p v-if="!isContactRequired"> Your billing subscription will be updated to reflect the new costs</p> |
56 | 57 | </div> |
57 | 58 | </template> |
|
66 | 67 | :disabled="!formValid" data-action="change-team-type" |
67 | 68 | @click="updateTeam()" |
68 | 69 | > |
69 | | - Change team type |
| 70 | + <span v-if="isUpgradingFromMonthlyToYearly">Switch to Yearly Billing</span> |
| 71 | + <span v-else>Change team type</span> |
70 | 72 | </ff-button> |
71 | 73 | <ff-button |
72 | 74 | v-else :disabled="!formValid" |
@@ -138,12 +140,22 @@ export default { |
138 | 140 | computed: { |
139 | 141 | ...mapState('account', ['user', 'team', 'features']), |
140 | 142 | formValid () { |
| 143 | + const isChangingTeamType = this.input.teamTypeId !== this.team.type.id |
| 144 | +
|
141 | 145 | return !this.isUnmanaged && |
142 | 146 | this.input.teamTypeId && |
143 | 147 | this.isSelectionAvailable && |
144 | | - (this.billingMissing || this.input.teamTypeId !== this.team.type.id) && |
| 148 | + (this.billingMissing || isChangingTeamType || this.isUpgradingFromMonthlyToYearly) && |
145 | 149 | this.upgradeErrors.length === 0 |
146 | 150 | }, |
| 151 | + isUpgradingFromMonthlyToYearly () { |
| 152 | + const inputTeamHasAnnual = Object.prototype.hasOwnProperty.call(this.input, 'teamType') && |
| 153 | + Object.prototype.hasOwnProperty.call(this.input.teamType, 'properties') && |
| 154 | + Object.prototype.hasOwnProperty.call(this.input.teamType.properties, 'billing') && |
| 155 | + Object.prototype.hasOwnProperty.call(this.input.teamType.properties.billing, 'yrPriceId') |
| 156 | +
|
| 157 | + return inputTeamHasAnnual && this.team.billing?.interval === 'month' && this.isAnnualBilling |
| 158 | + }, |
147 | 159 | billingEnabled () { |
148 | 160 | return this.features.billing |
149 | 161 | }, |
@@ -298,6 +310,12 @@ export default { |
298 | 310 | instanceTypes.forEach(instanceType => { |
299 | 311 | this.instanceTypes[instanceType.id] = instanceType |
300 | 312 | }) |
| 313 | +
|
| 314 | + if (this.team.billing?.interval === 'month') { |
| 315 | + this.isAnnualBilling = false |
| 316 | + } else if (this.team.billing?.interval === 'year') { |
| 317 | + this.isAnnualBilling = true |
| 318 | + } |
301 | 319 | }, |
302 | 320 | async mounted () { |
303 | 321 | this.mounted = true |
|
0 commit comments