| 220 | } |
| 221 | |
| 222 | decideUpsell () { |
| 223 | // There are also non classroom prepaids. We only use the course or starter_license prepaids to determine |
| 224 | // if we should skip upsell (we ignore the others). |
| 225 | let needle, needle1, needle2 |
| 226 | const coursePrepaids = this.prepaids.filter(p => p.get('type') === 'course') |
| 227 | |
| 228 | const skipUpsellDueToExistingLicenses = coursePrepaids.length > 0 |
| 229 | const shouldUpsell = (me.useStripe() && |
| 230 | !skipUpsellDueToExistingLicenses && |
| 231 | (this.state.get('leadPriority') === 'low') && |
| 232 | ((needle = me.get('preferredLanguage'), !['nl-BE', 'nl-NL'].includes(needle))) && |
| 233 | ((needle1 = me.get('country'), !['australia', 'taiwan', 'hong-kong', 'netherlands', 'indonesia', 'singapore', 'malaysia'].includes(needle1))) && |
| 234 | !__guard__(me.get('administratedTeachers'), x => x.length) |
| 235 | ) |
| 236 | |
| 237 | const shouldUpsellParent = ( |
| 238 | (me.get('role') === 'parent') && |
| 239 | (needle2 = me.get('country'), !['australia', 'taiwan', 'hong-kong', 'netherlands', 'indonesia', 'singapore', 'malaysia'].includes(needle2)) && |
| 240 | !skipUpsellDueToExistingLicenses |
| 241 | ) |
| 242 | |
| 243 | this.state.set({ shouldUpsell, shouldUpsellParent }) |
| 244 | |
| 245 | if ((shouldUpsell || shouldUpsellParent) && !this.upsellTracked) { |
| 246 | this.upsellTracked = true |
| 247 | return (application.tracker != null ? application.tracker.trackEvent('Starter License Upsell: Banner Viewed', { price: this.state.get('centsPerStudent'), seats: this.state.get('quantityToBuy') }) : undefined) |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | updatePrepaidGroups () { |
| 252 | return this.state.set('prepaidGroups', this.prepaids.groupBy(p => p.status())) |