resolve-account
Advanced tools
Comparing version 1.0.14 to 1.0.15
@@ -20,3 +20,3 @@ (function (root, factory) { | ||
var SOURCE = 'library'; | ||
var VERSION = '1.0.14'; | ||
var VERSION = '1.0.15'; | ||
@@ -51,2 +51,9 @@ function ResolveAccount(options) { | ||
// TODO: ADD THESE THINGS: USAGE RESOVLER ETC | ||
console.log('++++++account', JSON.stringify(account, null, 2)); | ||
console.log('++++++options', JSON.stringify(options, null, 2)); | ||
// @@@DEVELOPER | ||
// account.plan = {}; | ||
// Resolve auth | ||
@@ -74,2 +81,13 @@ account.auth = account.auth || {}; | ||
// @@@DEVELOPER | ||
// account.plan.id = 'basic'; | ||
// account.plan.trial = { | ||
// activated: false, | ||
// expires: { | ||
// timestamp: new Date('2024-04-23T00:07:29.183Z').toISOString(), | ||
// timestampUNIX: Math.round(new Date('2024-04-23T00:07:29.183Z').getTime() / 1000), | ||
// } | ||
// } | ||
// account.plan.status = 'suspended'; | ||
account.plan.limits = account.plan.limits || {}; | ||
@@ -137,2 +155,4 @@ // account.plan.devices = account.plan.devices || 1; | ||
var isBasicPlan = account.plan.id === defaultPlanId; | ||
// Resolve oAuth2 | ||
@@ -145,3 +165,2 @@ account.oauth2 = account.oauth2 || {}; | ||
account.roles = account.roles || {}; | ||
// account.roles.betaTester = account.plan.id === defaultPlanId ? false : account.roles.betaTester === true || account.roles.betaTester === 'true'; | ||
account.roles.betaTester = account.roles.betaTester === true || account.roles.betaTester === 'true'; | ||
@@ -212,5 +231,5 @@ account.roles.developer = account.roles.developer === true || account.roles.developer === 'true'; | ||
account.personal.location = account.personal.location || {}; | ||
account.personal.location.city = account.personal.location.city || ''; | ||
account.personal.location.country = account.personal.location.country || ''; | ||
account.personal.location.region = account.personal.location.region || ''; | ||
account.personal.location.city = account.personal.location.city || ''; | ||
@@ -234,2 +253,4 @@ account.personal.name = account.personal.name || {}; | ||
var billingFrequencyEl = self.dom.select('.auth-billing-frequency-element'); | ||
var billingStatusEl = self.dom.select('.auth-billing-status-element'); | ||
var billingStatusColorEl = self.dom.select('.auth-billing-status-color-element'); | ||
var billingStartDateEl = self.dom.select('.auth-billing-start-date-element'); | ||
@@ -305,7 +326,28 @@ var billingExpirationDateEl = self.dom.select('.auth-billing-expiration-date-element'); | ||
// Change the status to 'failed' if the plan is suspended because room temperature IQ people think 'suspended' means 'cancelled' | ||
var visibleStatus = uppercase(account.plan.status === 'suspended' ? 'failed payment' : account.plan.status); | ||
// If user is on trial, start date is trial exp date | ||
var visibleStartDate = account.plan.trial.activated ? account.plan.trial.expires.timestamp : account.plan.payment.startDate.timestamp; | ||
if (isBasicPlan) { | ||
// Set as start of this month | ||
visibleStartDate = new Date(now.getFullYear(), now.getMonth(), 1).toISOString(); | ||
} | ||
var visibleFrequency = account.plan.payment.frequency === 'unknown' ? 'monthly' : account.plan.payment.frequency; | ||
// Update billing UI | ||
billingPlanId.setInnerHTML(splitDashesAndUppercase(account.plan.id)); | ||
billingFrequencyEl.setInnerHTML(account.plan.id !== defaultPlanId ? ' (billed ' + uppercase(account.plan.payment.frequency) + ')' : ''); | ||
billingStartDateEl.setInnerHTML(account.plan.id !== defaultPlanId ? ' - Purchased ' + getMonth(startDate) + ' ' + startDate.getDate() + ', ' + startDate.getFullYear() : ''); | ||
billingExpirationDateEl.setInnerHTML(account.plan.id !== defaultPlanId && daysTillExpire < 366 | ||
billingFrequencyEl.setInnerHTML(visibleFrequency); | ||
billingStatusEl.setInnerHTML(visibleStatus); | ||
billingStatusColorEl | ||
.removeClass('bg-soft-success').removeClass('bg-soft-danger').removeClass('bg-soft-warning') | ||
.removeClass('text-success').removeClass('text-danger').removeClass('text-warning') | ||
if (account.plan.status === 'active') { | ||
billingStatusColorEl.addClass('bg-soft-success').addClass('text-success'); | ||
} else { | ||
billingStatusColorEl.addClass('bg-soft-danger').addClass('text-danger'); | ||
} | ||
billingStartDateEl.setInnerHTML(new Date(visibleStartDate).toLocaleString(undefined, { | ||
weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', | ||
})); | ||
billingExpirationDateEl.setInnerHTML(isBasicPlan && daysTillExpire < 366 | ||
? '<i class="fas fa-exclamation-triangle mr-1"></i> Expires in ' + daysTillExpire + ' days ' | ||
@@ -312,0 +354,0 @@ : ''); |
{ | ||
"name": "resolve-account", | ||
"version": "1.0.14", | ||
"version": "1.0.15", | ||
"description": "Standardize account JSON structure for projects built under ITW Creative Works", | ||
@@ -32,4 +32,4 @@ "main": "./dist/index.js", | ||
"mocha": "^8.4.0", | ||
"prepare-package": "^1.0.0" | ||
"prepare-package": "^1.0.3" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25590
339