resolve-account
Advanced tools
Comparing version
@@ -20,3 +20,3 @@ (function (root, factory) { | ||
var SOURCE = 'library'; | ||
var VERSION = '0.0.6'; | ||
var VERSION = '0.0.7'; | ||
@@ -32,2 +32,4 @@ function ResolveAccount(options) { | ||
self.properties = {}; | ||
return self; | ||
@@ -38,3 +40,3 @@ }; | ||
var self = this; | ||
firebaseUser = firebaseUser || {}; | ||
@@ -44,6 +46,2 @@ account = account || {}; | ||
var Manager = self.Manager; | ||
var utilities = self.utilities; | ||
var dom = self.dom; | ||
var defaultPlanId = options.defaultPlanId || 'basic'; | ||
@@ -98,8 +96,8 @@ | ||
currentURL = new URL(window.location.href); | ||
isDevelopment = utilities.get(Manager, 'properties.meta.environment', '') === 'development'; | ||
isDevelopment = self.utilities.get(self.Manager, 'properties.meta.environment', '') === 'development'; | ||
if (utilities.get(isDevelopment)) { | ||
if (self.utilities.get(isDevelopment)) { | ||
currentURL.searchParams | ||
.forEach(function(value, key) { | ||
var accountValue = utilities.get(account, key, undefined) | ||
var accountValue = self.utilities.get(account, key, undefined) | ||
if (typeof accountValue !== undefined) { | ||
@@ -109,3 +107,3 @@ if (value === 'true') { value = true } | ||
utilities.set(account, key, value) | ||
self.utilities.set(account, key, value) | ||
} | ||
@@ -195,16 +193,16 @@ }); | ||
var billingSubscribeBtn = dom.select('.auth-billing-subscribe-btn'); | ||
var billingUpdateBtn = dom.select('.auth-billing-update-btn'); | ||
var billingPlanId = dom.select('.auth-billing-plan-id-element'); | ||
var billingFrequencyEl = dom.select('.auth-billing-frequency-element'); | ||
var billingStartDateEl = dom.select('.auth-billing-start-date-element'); | ||
var billingExpirationDateEl = dom.select('.auth-billing-expiration-date-element'); | ||
var billingSubscribeBtn = self.dom.select('.auth-billing-subscribe-btn'); | ||
var billingUpdateBtn = self.dom.select('.auth-billing-update-btn'); | ||
var billingPlanId = self.dom.select('.auth-billing-plan-id-element'); | ||
var billingFrequencyEl = self.dom.select('.auth-billing-frequency-element'); | ||
var billingStartDateEl = self.dom.select('.auth-billing-start-date-element'); | ||
var billingExpirationDateEl = self.dom.select('.auth-billing-expiration-date-element'); | ||
var $referralCount = dom.select('.auth-referral-count-element'); | ||
var $referralCode = dom.select('.auth-referral-code-element'); | ||
var $referralLink = dom.select('.auth-referral-link-element'); | ||
var $referralSocialLink = dom.select('a.auth-referral-social-link[data-provider]'); | ||
var $referralCount = self.dom.select('.auth-referral-count-element'); | ||
var $referralCode = self.dom.select('.auth-referral-code-element'); | ||
var $referralLink = self.dom.select('.auth-referral-link-element'); | ||
var $referralSocialLink = self.dom.select('a.auth-referral-social-link[data-provider]'); | ||
var authCreatedEl = dom.select('.auth-created-element'); | ||
var authPhoneInput = dom.select('.auth-phone-input'); | ||
var authCreatedEl = self.dom.select('.auth-created-element'); | ||
var authPhoneInput = self.dom.select('.auth-phone-input'); | ||
@@ -214,2 +212,12 @@ var updateURL = new URL(cancelURL); | ||
function _setAuthItem(selector, value) { | ||
self.dom.select(selector).each(function(e, i) { | ||
if (e.tagName === 'INPUT') { | ||
self.dom.select(e).setValue(value); | ||
} else { | ||
self.dom.select(e).setInnerHTML(value); | ||
} | ||
}); | ||
} | ||
referralURL.pathname = '/'; | ||
@@ -220,3 +228,3 @@ referralURL.searchParams.set('aff', account.affiliate.code) | ||
new Date( | ||
parseInt(utilities.get(firebaseUser, 'metadata.a', '0')) | ||
parseInt(self.utilities.get(firebaseUser, 'metadata.a', '0')) | ||
) | ||
@@ -248,3 +256,3 @@ .toLocaleString(undefined, { | ||
_setAuthItem('.auth-apikey-element', utilities.get(account, 'api.privateKey', 'n/a')); | ||
_setAuthItem('.auth-apikey-element', self.utilities.get(account, 'api.privateKey', 'n/a')); | ||
@@ -257,3 +265,3 @@ | ||
var affiliateLinkURI = encodeURIComponent(referralURL.toString()); | ||
var affiliateLinkTextURI = encodeURIComponent('Sign up for ' + utilities.get(Manager, 'properties.global.brand.name', 'this') + ', a useful service:'); | ||
var affiliateLinkTextURI = encodeURIComponent('Sign up for ' + self.utilities.get(self.Manager, 'properties.global.brand.name', 'this') + ', a useful service:'); | ||
@@ -290,3 +298,5 @@ $referralSocialLink | ||
return account; | ||
self.properties = account; | ||
return self.properties; | ||
} | ||
@@ -293,0 +303,0 @@ |
{ | ||
"name": "resolve-account", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Standardize account JSON structure for projects built under ITW Creative Works", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
20403
1.84%246
3.36%