-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement subscription expiring message
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
((api) => { | ||
api.urlOpener.openLink(api.urlOpener.LinkHelpSupport); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(function(api, condition) { | ||
// Show message only if within 1 week of expiring. | ||
let weekBeforeExpireMSecs = api.subscriptionData.expiresOn - 1000 * 60 * 60 * 24; | ||
|
||
if (Date.now() < api.subscriptionData.expiresOn && | ||
Date.now() >= weekBeforeExpireMSecs) { | ||
api.addon.date = weekBeforeExpireMSecs; | ||
condition.enable(); | ||
} else { | ||
condition.disable(); | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
((api) => { | ||
api.urlOpener.openLink(api.urlOpener.LinkAccount); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"api_version": "0.1", | ||
"id": "message_subscription_expiring", | ||
"name": "Subscription expiring message", | ||
"type": "message", | ||
"conditions": { | ||
"javascript": "isExpiring.js" | ||
}, | ||
"message": { | ||
"id": "message_subscription_expiring", | ||
"title": "Your subscription is ending soon", | ||
"subtitle": "Your Mozilla VPN subscription will end in one week. After that, you’ll no longer be able to use Mozilla VPN.", | ||
"badge": "warning", | ||
"blocks": [ | ||
{ | ||
"id": "c_1", | ||
"type": "text", | ||
"content": "Don’t lose your subscription — please go to your account page to renew your access to Mozilla VPN. If you’re having any issues, please contact support to get help." | ||
}, | ||
{ | ||
"id": "c_2", | ||
"type": "button", | ||
"style": "primary", | ||
"content": "Manage account", | ||
"javascript": "manageAccountLink.js" | ||
}, | ||
{ | ||
"id": "c_3", | ||
"type": "button", | ||
"style": "link", | ||
"content": "Contact support", | ||
"javascript": "contactSupportLink.js" | ||
} | ||
] | ||
} | ||
} |