@osovitny/anatoly 2.1.10 → 2.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/osovitny-anatoly.umd.js +10 -10
- package/bundles/osovitny-anatoly.umd.js.map +1 -1
- package/esm2015/lib/core/services/appcontext.service.js +7 -7
- package/esm2015/lib/ui/components/billing/buyaccess-button.component.js +5 -5
- package/fesm2015/osovitny-anatoly.js +10 -10
- package/fesm2015/osovitny-anatoly.js.map +1 -1
- package/lib/core/services/appcontext.service.d.ts +3 -3
- package/lib/ui/components/billing/buyaccess-button.component.d.ts +2 -2
- package/osovitny-anatoly.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -1650,7 +1650,7 @@
|
|
|
1650
1650
|
_this.baseUrl = '/api/appContext';
|
|
1651
1651
|
return _this;
|
|
1652
1652
|
}
|
|
1653
|
-
AppContextService.prototype.
|
|
1653
|
+
AppContextService.prototype.updateCurrentIfExpired = function () {
|
|
1654
1654
|
var context = this.sessionStorage.getObject(this.storageKeyName);
|
|
1655
1655
|
if (!context) {
|
|
1656
1656
|
return;
|
|
@@ -1661,7 +1661,7 @@
|
|
|
1661
1661
|
var lastRequested = new Date(context.lastRequested);
|
|
1662
1662
|
var in2Mins = new Date(lastRequested.getFullYear(), lastRequested.getMonth(), lastRequested.getDate(), lastRequested.getHours(), lastRequested.getMinutes() + 2, 0, 0);
|
|
1663
1663
|
if (in2Mins.getTime() < now.getTime()) {
|
|
1664
|
-
this.
|
|
1664
|
+
this.updateCurrent();
|
|
1665
1665
|
}
|
|
1666
1666
|
}
|
|
1667
1667
|
};
|
|
@@ -1676,7 +1676,6 @@
|
|
|
1676
1676
|
this.successes = [];
|
|
1677
1677
|
this.subscription.unsubscribe();
|
|
1678
1678
|
this.subscription = null;
|
|
1679
|
-
this.current = null;
|
|
1680
1679
|
};
|
|
1681
1680
|
AppContextService.prototype.getCurrent = function (success, getCachedIfExist) {
|
|
1682
1681
|
var _this = this;
|
|
@@ -1702,11 +1701,11 @@
|
|
|
1702
1701
|
}, function (e) {
|
|
1703
1702
|
});
|
|
1704
1703
|
};
|
|
1705
|
-
AppContextService.prototype.
|
|
1704
|
+
AppContextService.prototype.updateCurrent = function (success) {
|
|
1706
1705
|
if (success === void 0) { success = null; }
|
|
1707
1706
|
this.getCurrent(success, false);
|
|
1708
1707
|
};
|
|
1709
|
-
AppContextService.prototype.
|
|
1708
|
+
AppContextService.prototype.clearCurrent = function () {
|
|
1710
1709
|
this.sessionStorage.remove(this.storageKeyName);
|
|
1711
1710
|
};
|
|
1712
1711
|
AppContextService.prototype.isUserSignedIn = function () {
|
|
@@ -1716,9 +1715,10 @@
|
|
|
1716
1715
|
return ContextInitState.isUserAdmin;
|
|
1717
1716
|
};
|
|
1718
1717
|
Object.defineProperty(AppContextService.prototype, "current", {
|
|
1718
|
+
//Properties
|
|
1719
1719
|
//current
|
|
1720
1720
|
get: function () {
|
|
1721
|
-
this.
|
|
1721
|
+
this.updateCurrentIfExpired();
|
|
1722
1722
|
return this.sessionStorage.getObject(this.storageKeyName);
|
|
1723
1723
|
},
|
|
1724
1724
|
set: function (value) {
|
|
@@ -2542,8 +2542,8 @@
|
|
|
2542
2542
|
</file>
|
|
2543
2543
|
*/
|
|
2544
2544
|
var BuyAccessButtonComponent = /** @class */ (function () {
|
|
2545
|
-
function BuyAccessButtonComponent(
|
|
2546
|
-
this.
|
|
2545
|
+
function BuyAccessButtonComponent(appContext, api) {
|
|
2546
|
+
this.appContext = appContext;
|
|
2547
2547
|
this.api = api;
|
|
2548
2548
|
this.contextUpdated = false;
|
|
2549
2549
|
this.isUserSignedIn = false;
|
|
@@ -2552,11 +2552,11 @@
|
|
|
2552
2552
|
}
|
|
2553
2553
|
BuyAccessButtonComponent.prototype.ngOnInit = function () {
|
|
2554
2554
|
var _this = this;
|
|
2555
|
-
if (!this.
|
|
2555
|
+
if (!this.appContext.isUserSignedIn()) {
|
|
2556
2556
|
this.contextUpdated = true;
|
|
2557
2557
|
return;
|
|
2558
2558
|
}
|
|
2559
|
-
this.
|
|
2559
|
+
this.appContext.getCurrent(function (current) {
|
|
2560
2560
|
_this.isUserSignedIn = current.isUserSignedIn;
|
|
2561
2561
|
if (_this.isUserSignedIn) {
|
|
2562
2562
|
_this.currentPlan = current.account.billingPlan;
|