@frontegg/angular 4.13.0-alpha.2403521885 → 4.13.0-alpha.2420089953
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/frontegg-angular.umd.js +66 -77
- package/bundles/frontegg-angular.umd.js.map +1 -1
- package/bundles/frontegg-angular.umd.min.js +1 -1
- package/bundles/frontegg-angular.umd.min.js.map +1 -1
- package/esm2015/lib/frontegg-app.module.js +3 -3
- package/esm2015/lib/frontegg-subscription.services.js +46 -3
- package/esm2015/public-api.js +1 -2
- package/fesm2015/frontegg-angular.js +59 -67
- package/fesm2015/frontegg-angular.js.map +1 -1
- package/frontegg-angular.metadata.json +1 -1
- package/lib/frontegg-subscription.services.d.ts +13 -3
- package/lib/frontegg-subscription.services.d.ts.map +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +0 -1
- package/public-api.d.ts.map +1 -1
- package/esm2015/lib/frontegg-checkout.services.js +0 -56
- package/lib/frontegg-checkout.services.d.ts +0 -16
- package/lib/frontegg-checkout.services.d.ts.map +0 -1
|
@@ -1064,60 +1064,90 @@
|
|
|
1064
1064
|
authorizedContent: [{ type: i0.Input }]
|
|
1065
1065
|
};
|
|
1066
1066
|
|
|
1067
|
-
var
|
|
1068
|
-
function
|
|
1067
|
+
var FronteggSubscriptionService = /** @class */ (function () {
|
|
1068
|
+
function FronteggSubscriptionService(fronteggAppService) {
|
|
1069
|
+
var _this = this;
|
|
1069
1070
|
this.fronteggAppService = fronteggAppService;
|
|
1071
|
+
this.subscriptionStateSubject = new rxjs.BehaviorSubject({});
|
|
1070
1072
|
this.checkoutStateSubject = new rxjs.BehaviorSubject({
|
|
1073
|
+
loading: false,
|
|
1071
1074
|
open: false,
|
|
1072
1075
|
confirmed: false,
|
|
1073
1076
|
error: null,
|
|
1074
1077
|
});
|
|
1078
|
+
this.loadSubscription = function () { return _this.dispatchAction('billing/subscription/loadSubscription'); };
|
|
1079
|
+
this.openCheckout = function (plan) {
|
|
1080
|
+
_this.checkoutStateSubject.next({
|
|
1081
|
+
loading: false,
|
|
1082
|
+
open: true,
|
|
1083
|
+
confirmed: false,
|
|
1084
|
+
error: null,
|
|
1085
|
+
});
|
|
1086
|
+
_this.fronteggAppService.showCheckoutDialog({
|
|
1087
|
+
plan: plan,
|
|
1088
|
+
onSuccess: function () {
|
|
1089
|
+
_this.checkoutStateSubject.next({
|
|
1090
|
+
loading: false,
|
|
1091
|
+
open: false,
|
|
1092
|
+
confirmed: true,
|
|
1093
|
+
error: null,
|
|
1094
|
+
});
|
|
1095
|
+
},
|
|
1096
|
+
onError: function (error) {
|
|
1097
|
+
var checkoutState = _this.checkoutStateSubject.value;
|
|
1098
|
+
_this.checkoutStateSubject.next(Object.assign(Object.assign({}, checkoutState), { error: error }));
|
|
1099
|
+
},
|
|
1100
|
+
onClose: function () {
|
|
1101
|
+
var checkoutState = _this.checkoutStateSubject.value;
|
|
1102
|
+
_this.checkoutStateSubject.next(Object.assign(Object.assign({}, checkoutState), { open: false }));
|
|
1103
|
+
},
|
|
1104
|
+
});
|
|
1105
|
+
};
|
|
1106
|
+
this.hideCheckout = function () {
|
|
1107
|
+
_this.fronteggAppService.hideCheckoutDialog();
|
|
1108
|
+
};
|
|
1109
|
+
// Memoized Subscription State
|
|
1110
|
+
this.fronteggAppService.subscriptionsState$.subscribe(function (subscriptionState) {
|
|
1111
|
+
if (subscriptionState != null) {
|
|
1112
|
+
var subscription = subscriptionState.billing.subscription, checkoutState = subscriptionState.checkout;
|
|
1113
|
+
if (!FastDeepEqual__default['default'](_this.subscriptionStateSubject.getValue(), subscription)) {
|
|
1114
|
+
_this.subscriptionStateSubject.next(subscription);
|
|
1115
|
+
}
|
|
1116
|
+
var checkoutSubjectState = _this.checkoutStateSubject.getValue();
|
|
1117
|
+
if (checkoutSubjectState.loading !== checkoutState.loading) {
|
|
1118
|
+
_this.checkoutStateSubject.next(Object.assign(Object.assign({}, checkoutSubjectState), { loading: checkoutState.loading }));
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
});
|
|
1075
1122
|
}
|
|
1076
|
-
Object.defineProperty(
|
|
1123
|
+
Object.defineProperty(FronteggSubscriptionService.prototype, "subscriptionState$", {
|
|
1124
|
+
get: function () {
|
|
1125
|
+
return this.subscriptionStateSubject.asObservable();
|
|
1126
|
+
},
|
|
1127
|
+
enumerable: false,
|
|
1128
|
+
configurable: true
|
|
1129
|
+
});
|
|
1130
|
+
Object.defineProperty(FronteggSubscriptionService.prototype, "checkoutState$", {
|
|
1077
1131
|
get: function () {
|
|
1078
1132
|
return this.checkoutStateSubject.asObservable();
|
|
1079
1133
|
},
|
|
1080
1134
|
enumerable: false,
|
|
1081
1135
|
configurable: true
|
|
1082
1136
|
});
|
|
1083
|
-
|
|
1084
|
-
var
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
confirmed: false,
|
|
1088
|
-
error: null,
|
|
1089
|
-
});
|
|
1090
|
-
this.fronteggAppService.showCheckoutDialog({
|
|
1091
|
-
plan: plan,
|
|
1092
|
-
onSuccess: function () {
|
|
1093
|
-
_this.checkoutStateSubject.next({
|
|
1094
|
-
open: false,
|
|
1095
|
-
confirmed: true,
|
|
1096
|
-
error: null,
|
|
1097
|
-
});
|
|
1098
|
-
},
|
|
1099
|
-
onError: function (error) {
|
|
1100
|
-
var checkoutState = _this.checkoutStateSubject.value;
|
|
1101
|
-
_this.checkoutStateSubject.next(Object.assign(Object.assign({}, checkoutState), { error: error }));
|
|
1102
|
-
},
|
|
1103
|
-
onClose: function () {
|
|
1104
|
-
var checkoutState = _this.checkoutStateSubject.value;
|
|
1105
|
-
_this.checkoutStateSubject.next(Object.assign(Object.assign({}, checkoutState), { open: false }));
|
|
1106
|
-
},
|
|
1107
|
-
});
|
|
1108
|
-
};
|
|
1109
|
-
FronteggCheckoutService.prototype.hideCheckout = function () {
|
|
1110
|
-
this.fronteggAppService.hideCheckoutDialog();
|
|
1137
|
+
FronteggSubscriptionService.prototype.dispatchAction = function (type, payload) {
|
|
1138
|
+
var store = this.fronteggAppService.fronteggApp.store;
|
|
1139
|
+
// @ts-ignore
|
|
1140
|
+
store.dispatch({ type: reduxStore.subscriptionsStoreName + "/" + type, payload: payload });
|
|
1111
1141
|
};
|
|
1112
|
-
return
|
|
1142
|
+
return FronteggSubscriptionService;
|
|
1113
1143
|
}());
|
|
1114
|
-
|
|
1115
|
-
|
|
1144
|
+
FronteggSubscriptionService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function FronteggSubscriptionService_Factory() { return new FronteggSubscriptionService(i0__namespace.ɵɵinject(FronteggAppService)); }, token: FronteggSubscriptionService, providedIn: "root" });
|
|
1145
|
+
FronteggSubscriptionService.decorators = [
|
|
1116
1146
|
{ type: i0.Injectable, args: [{
|
|
1117
1147
|
providedIn: 'root',
|
|
1118
1148
|
},] }
|
|
1119
1149
|
];
|
|
1120
|
-
|
|
1150
|
+
FronteggSubscriptionService.ctorParameters = function () { return [
|
|
1121
1151
|
{ type: FronteggAppService }
|
|
1122
1152
|
]; };
|
|
1123
1153
|
|
|
@@ -1132,7 +1162,7 @@
|
|
|
1132
1162
|
FronteggAuthGuard,
|
|
1133
1163
|
FronteggLoadGuard,
|
|
1134
1164
|
FronteggAuthService,
|
|
1135
|
-
|
|
1165
|
+
FronteggSubscriptionService,
|
|
1136
1166
|
{
|
|
1137
1167
|
provide: FronteggAppOptionsClass,
|
|
1138
1168
|
useValue: config,
|
|
@@ -1150,46 +1180,6 @@
|
|
|
1150
1180
|
},] }
|
|
1151
1181
|
];
|
|
1152
1182
|
|
|
1153
|
-
var FronteggSubscriptionService = /** @class */ (function () {
|
|
1154
|
-
function FronteggSubscriptionService(fronteggAppService) {
|
|
1155
|
-
var _this = this;
|
|
1156
|
-
this.fronteggAppService = fronteggAppService;
|
|
1157
|
-
this.subscriptionStateSubject = new rxjs.BehaviorSubject({});
|
|
1158
|
-
this.loadSubscription = function () { return _this.dispatchAction('billing/subscription/loadSubscription'); };
|
|
1159
|
-
// Memoized Subscription State
|
|
1160
|
-
this.fronteggAppService.subscriptionsState$.subscribe(function (subscriptionState) {
|
|
1161
|
-
if (subscriptionState != null) {
|
|
1162
|
-
var subscription = subscriptionState.billing.subscription;
|
|
1163
|
-
if (!FastDeepEqual__default['default'](_this.subscriptionStateSubject.getValue(), subscription)) {
|
|
1164
|
-
_this.subscriptionStateSubject.next(subscription);
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
});
|
|
1168
|
-
}
|
|
1169
|
-
Object.defineProperty(FronteggSubscriptionService.prototype, "subscriptionState$", {
|
|
1170
|
-
get: function () {
|
|
1171
|
-
return this.subscriptionStateSubject.asObservable();
|
|
1172
|
-
},
|
|
1173
|
-
enumerable: false,
|
|
1174
|
-
configurable: true
|
|
1175
|
-
});
|
|
1176
|
-
FronteggSubscriptionService.prototype.dispatchAction = function (type, payload) {
|
|
1177
|
-
var store = this.fronteggAppService.fronteggApp.store;
|
|
1178
|
-
// @ts-ignore
|
|
1179
|
-
store.dispatch({ type: reduxStore.subscriptionsStoreName + "/" + type, payload: payload });
|
|
1180
|
-
};
|
|
1181
|
-
return FronteggSubscriptionService;
|
|
1182
|
-
}());
|
|
1183
|
-
FronteggSubscriptionService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function FronteggSubscriptionService_Factory() { return new FronteggSubscriptionService(i0__namespace.ɵɵinject(FronteggAppService)); }, token: FronteggSubscriptionService, providedIn: "root" });
|
|
1184
|
-
FronteggSubscriptionService.decorators = [
|
|
1185
|
-
{ type: i0.Injectable, args: [{
|
|
1186
|
-
providedIn: 'root',
|
|
1187
|
-
},] }
|
|
1188
|
-
];
|
|
1189
|
-
FronteggSubscriptionService.ctorParameters = function () { return [
|
|
1190
|
-
{ type: FronteggAppService }
|
|
1191
|
-
]; };
|
|
1192
|
-
|
|
1193
1183
|
/*
|
|
1194
1184
|
* Public API Surface of frontegg-app
|
|
1195
1185
|
*/
|
|
@@ -1203,7 +1193,6 @@
|
|
|
1203
1193
|
exports.FronteggAppService = FronteggAppService;
|
|
1204
1194
|
exports.FronteggAuthGuard = FronteggAuthGuard;
|
|
1205
1195
|
exports.FronteggAuthService = FronteggAuthService;
|
|
1206
|
-
exports.FronteggCheckoutService = FronteggCheckoutService;
|
|
1207
1196
|
exports.FronteggComponent = FronteggComponent;
|
|
1208
1197
|
exports.FronteggLoadGuard = FronteggLoadGuard;
|
|
1209
1198
|
exports.FronteggSubscriptionService = FronteggSubscriptionService;
|