Skip to content

Commit

Permalink
feat: show promo after unlock
Browse files Browse the repository at this point in the history
  • Loading branch information
duchunter committed Nov 7, 2023
1 parent 45c225d commit eaf0729
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 4 deletions.
Binary file added src/renderer/assets/images/cyber-month-2023.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions src/renderer/components/notice/CyberMonthPopup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<div>
<el-dialog
:visible="dialogVisible"
width="60%"
class="premium-dialog header-no-padding body-no-padding"
@close="closeDialog"
>
<div slot="title">
<img
width="100%"
src="~/assets/images/cyber-month-2023.png"
@click="upgradePlan"
>
</div>
</el-dialog>
</div>
</template>

<script>
export default {
computed: {
dialogVisible () {
return this.$store.state.notice.showCyberMonthPopup
}
},
methods: {
closeDialog () {
this.$store.commit('UPDATE_NOTICE', { showCyberMonthPopup: false })
},
upgradePlan () {
this.closeDialog()
this.$router.push('/promo/cyber-month-2023')
}
}
}
</script>

<style lang="scss" scoped></style>
6 changes: 5 additions & 1 deletion src/renderer/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
<PremiumDialog />

<WelcomeToBusiness />

<CyberMonthPopup />
</client-only>
</div>
</div>
Expand All @@ -60,6 +62,7 @@ import PaymentFailedWarning from '../components/notice/PaymentFailedWarning'
import TrialAboutToExpireWarning from '../components/notice/TrialAboutToExpireWarning'
import PremiumDialog from '../components/upgrade/PremiumDialog.vue'
import BottomBanner from '../components/landing/BottomBanner.vue'
import CyberMonthPopup from '../components/notice/CyberMonthPopup.vue'
if (process.env.CS_ENV !== 'web') {
// eslint-disable-next-line no-var, @typescript-eslint/no-unused-vars
Expand All @@ -81,7 +84,8 @@ export default {
PremiumDialog,
Header,
SideBarMenu,
BottomBanner
BottomBanner,
CyberMonthPopup
},
middleware: [
Expand Down
11 changes: 9 additions & 2 deletions src/renderer/plugins/mixins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ Vue.mixin({
)
},
isLifeTimeUser () {
return ['pm_lifetime_premium', 'pm_lifetime_family'].includes(
this.$store.state.currentPlan?.alias
const ALIASES = ['pm_lifetime_premium', 'pm_lifetime_family']
return (
ALIASES.includes(this.$store.state.currentPlan?.alias) ||
ALIASES.includes(this.$store.state.userPw?.pwd_plan)
)
},
isFamilyOwner () {
Expand Down Expand Up @@ -337,6 +339,11 @@ Vue.mixin({
path
})
)

// Show promo popup
if (!this.isLifeTimeUser) {
this.$store.commit('UPDATE_NOTICE', { showCyberMonthPopup: true })
}
} catch (e) {
console.log(e)
// Wrong master pw
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export const state = () => ({
showWelcome: false,
allowShowWelcomeBusiness: false,
allowShowTutorial: false,
showPleaseUpgrade: false
showPleaseUpgrade: false,
showCyberMonthPopup: false
},
ui: {
closeAllModal: false
Expand Down

0 comments on commit eaf0729

Please sign in to comment.