-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display warning when plan is expiring
- Loading branch information
1 parent
a19fe04
commit 8bc645f
Showing
23 changed files
with
752 additions
and
143 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
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
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
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,6 @@ | ||
export const SEEN_ENTERPRISE_EXPIRATION_MODAL_COOKIE_PREFIX = 'seen-enterprise-expiration-modal-'; | ||
|
||
export const PLAN_EXPIRY_VARIANTS = { | ||
expired: 'Expired', | ||
expiring: 'Expiring', | ||
}; |
79 changes: 79 additions & 0 deletions
79
src/components/BudgetExpiryAlertAndModal/data/expiryThresholds.js
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,79 @@ | ||
import sanitizeHTML from 'sanitize-html'; | ||
import parse from 'html-react-parser'; | ||
import { PLAN_EXPIRY_VARIANTS } from './constants'; | ||
|
||
const expiryThresholds = { | ||
120: ({ date }) => ({ | ||
notificationTemplate: { | ||
title: 'Your Learner Credit plan expires soon', | ||
variant: 'info', | ||
message: `Your Learner Credit plan expires ${date}. Contact support today to renew your plan and keep people learning.`, | ||
dismissible: true, | ||
}, | ||
modalTemplate: { | ||
title: 'Your plan expires soon', | ||
message: `Your Learner Credit plan expires ${date}. Contact support today to renew your plan and keep people learning.`, | ||
}, | ||
variant: PLAN_EXPIRY_VARIANTS.expiring, | ||
}), | ||
90: ({ date }) => ({ | ||
notificationTemplate: { | ||
title: 'Reminder: Your Learner Credit plan expires soon', | ||
variant: 'info', | ||
message: `Your Learner Credit plan expires ${date}. Contact support today to renew your plan and keep people learning.`, | ||
dismissible: true, | ||
}, | ||
modalTemplate: { | ||
title: 'Reminder: Your plan expires soon', | ||
message: `Your Learner Credit plan expires ${date}. Contact support today to renew your plan and keep people learning.`, | ||
}, | ||
variant: PLAN_EXPIRY_VARIANTS.expiring, | ||
}), | ||
60: ({ date }) => ({ | ||
notificationTemplate: { | ||
title: `Your Learner Credit plan expires ${date}`, | ||
variant: 'warning', | ||
message: 'When your Learner Credit plan expires, you will no longer have access to administrative functions and the remaining balance of your budget(s) will be unusable. Contact support today to renew your plan.', | ||
dismissible: true, | ||
}, | ||
modalTemplate: { | ||
title: `Your Learner Credit plan expires ${date}`, | ||
message: `Your Learner Credit plan expires ${date}. Contact support today to renew your plan and keep people learning.`, | ||
}, | ||
variant: PLAN_EXPIRY_VARIANTS.expiring, | ||
}), | ||
30: ({ date }) => ({ | ||
notificationTemplate: { | ||
title: 'Your Learner Credit plan expires in less than 30 days', | ||
variant: 'danger', | ||
message: 'When your plan expires you will lose access to administrative functions and the remaining balance of your plan’s budget(s) will be unusable. Contact support today to renew your plan.', | ||
}, | ||
modalTemplate: { | ||
title: 'Your Learner Credit plan expires in less than 30 days', | ||
message: `Your Learner Credit plan expires ${date}. Contact support today to renew your plan and keep people learning.`, | ||
}, | ||
variant: PLAN_EXPIRY_VARIANTS.expiring, | ||
}), | ||
10: ({ date, days, hours }) => ({ | ||
notificationTemplate: { | ||
title: `Reminder: Your Learner Credit plan expires ${date}`, | ||
variant: 'danger', | ||
message: parse(sanitizeHTML(`Your Learner Credit plan expires in <strong>${days} days and ${hours} hours</strong>. Contact support today to renew your plan.`)), | ||
}, | ||
modalTemplate: { | ||
title: `Reminder: Your Learner Credit plan expires ${date}`, | ||
message: `Your Learner Credit plan expires ${date}. Contact support today to renew your plan and keep people learning.`, | ||
}, | ||
variant: PLAN_EXPIRY_VARIANTS.expiring, | ||
}), | ||
0: ({ date }) => ({ | ||
notificationTemplate: null, | ||
modalTemplate: { | ||
title: 'Your Learner Credit plan has expired', | ||
message: `Your Learner Credit plan expired on ${date}. You are no longer able to assign courses to learners. Please contact your representative if you have any questions or concerns.`, | ||
}, | ||
variant: PLAN_EXPIRY_VARIANTS.expired, | ||
}), | ||
}; | ||
|
||
export default expiryThresholds; |
Oops, something went wrong.