@osovitny/anatoly 3.19.33 → 3.19.34

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.
@@ -5080,11 +5080,7 @@ class SubscriptionsApiService extends ApiServiceBase {
5080
5080
  getSubscriptions(data) {
5081
5081
  return this.get('getSubscriptions', data);
5082
5082
  }
5083
- addSubscription(
5084
- //Subscription
5085
- subscriptionProvider, newSubscriptionId,
5086
- //Plan & Price
5087
- planId, addons, subtotal, promoCode, total, currency, success, error) {
5083
+ addSubscription(subscriptionProvider, newSubscriptionId, planId, addons, subtotal, promoCode, total, currency, success, error) {
5088
5084
  this.post('addSubscription', {
5089
5085
  subscriptionProvider, newSubscriptionId,
5090
5086
  planId, addons, subtotal, promoCode, total, currency
@@ -5099,6 +5095,20 @@ class SubscriptionsApiService extends ApiServiceBase {
5099
5095
  }
5100
5096
  });
5101
5097
  }
5098
+ addFreeSubscription(planId, addons, subtotal, promoCode, total, currency, success, error) {
5099
+ this.post('addFreeSubscription', {
5100
+ planId, addons, subtotal, promoCode, total, currency
5101
+ }).subscribe({
5102
+ next: (data) => {
5103
+ if (success)
5104
+ success(data);
5105
+ },
5106
+ error: (e) => {
5107
+ if (error)
5108
+ error(e);
5109
+ }
5110
+ });
5111
+ }
5102
5112
  cancelSubscription(subscriptionProvider, subscriptionId, success, error) {
5103
5113
  this.post('cancelSubscription', { subscriptionProvider, subscriptionId }).subscribe({
5104
5114
  next: (data) => {
@@ -5166,8 +5176,6 @@ class BillingService {
5166
5176
  createBraintreeToken() {
5167
5177
  return this.apiPayments.createBraintreeToken();
5168
5178
  }
5169
- /*
5170
- */
5171
5179
  addPayment(paymentMethod, paidFor, subtotal, promoCode, total, currency, pmId, pmStatus, pmDetails) {
5172
5180
  this.zone.run(() => {
5173
5181
  let paidForAsString = JSON.stringify(paidFor);
@@ -5202,9 +5210,6 @@ class BillingService {
5202
5210
  this.ns.error("Payment Failed");
5203
5211
  }
5204
5212
  }
5205
- /*
5206
- Adding Subscription after it is paid
5207
- */
5208
5213
  addSubscription(sp, newSubscriptionId, planId, addons, subtotal, promoCode, total, currency) {
5209
5214
  this.zone.run(() => {
5210
5215
  this.apiSubscriptions.addSubscription(sp, newSubscriptionId, planId, addons, subtotal, promoCode, total, currency, () => {
@@ -5215,6 +5220,16 @@ class BillingService {
5215
5220
  });
5216
5221
  });
5217
5222
  }
5223
+ addFreeSubscription(planId, addons, subtotal, promoCode, total, currency) {
5224
+ this.zone.run(() => {
5225
+ this.apiSubscriptions.addFreeSubscription(planId, addons, subtotal, promoCode, total, currency, () => {
5226
+ this.fireSubscriptionAdded(false, false);
5227
+ this.appContext.updateCurrent();
5228
+ }, () => {
5229
+ this.fireSubscriptionAdded(false, true);
5230
+ });
5231
+ });
5232
+ }
5218
5233
  static { this.ɵfac = function BillingService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BillingService)(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(AppContextService), i0.ɵɵinject(PaymentsApiService), i0.ɵɵinject(SubscriptionsApiService), i0.ɵɵinject(NotificationService)); }; }
5219
5234
  static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: BillingService, factory: BillingService.ɵfac }); }
5220
5235
  }