(key)
| 843 | } |
| 844 | |
| 845 | shouldSeePromotion (key) { |
| 846 | const manualPromotionKeys = ['end-of-trial-promotion-modal'] |
| 847 | if (!key) { |
| 848 | return true |
| 849 | } |
| 850 | |
| 851 | if (manualPromotionKeys.includes(key)) { |
| 852 | return this.shouldSeeManualPromotion(key) |
| 853 | } |
| 854 | |
| 855 | const seenPromotion = this.getSeenPromotion(key) |
| 856 | if (seenPromotion) { |
| 857 | return false |
| 858 | } |
| 859 | const latestDate = Object.values(this.get('seenPromotions') || {}) |
| 860 | .reduce((a, b) => new Date(a) > new Date(b) ? new Date(a) : new Date(b), new Date(0)) |
| 861 | |
| 862 | const aWeekAgo = new Date() |
| 863 | aWeekAgo.setDate(aWeekAgo.getDate() - 7) |
| 864 | return latestDate < aWeekAgo |
| 865 | } |
| 866 | |
| 867 | setSeenPromotion (key) { |
| 868 | const seenPromotions = this.get('seenPromotions') || {} |
no test coverage detected