@frontegg/redux-store 5.36.0 → 5.38.1
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.
|
@@ -397,11 +397,7 @@ function* cancelSubscription() {
|
|
|
397
397
|
try {
|
|
398
398
|
yield effects.put(actions$6.setCancellationLoading(true));
|
|
399
399
|
yield effects.call(restApi.api.subscriptions.cancelManagedSubscription, subscriptionId);
|
|
400
|
-
yield
|
|
401
|
-
subscription: Object.assign(Object.assign({}, subscription), { cancellation: {
|
|
402
|
-
policy: restApi.ISubscriptionCancellationPolicy.AT_PERIOD_END,
|
|
403
|
-
} }),
|
|
404
|
-
}));
|
|
400
|
+
yield loadSubscription();
|
|
405
401
|
yield effects.put(actions$6.setCancellationLoading(false));
|
|
406
402
|
}
|
|
407
403
|
catch (e) {
|
|
@@ -425,9 +421,7 @@ function* renewSubscription() {
|
|
|
425
421
|
try {
|
|
426
422
|
yield effects.put(actions$6.setRenewalLoading(true));
|
|
427
423
|
yield effects.call(restApi.api.subscriptions.renewManagedSubscription, subscriptionId);
|
|
428
|
-
yield
|
|
429
|
-
subscription: Object.assign(Object.assign({}, subscription), { cancellation: null }),
|
|
430
|
-
}));
|
|
424
|
+
yield loadSubscription();
|
|
431
425
|
yield effects.put(actions$6.setRenewalLoading(false));
|
|
432
426
|
}
|
|
433
427
|
catch (e) {
|
|
@@ -543,7 +537,6 @@ function* loadSummariesMock() {
|
|
|
543
537
|
currentPlanId: planResponseMock[0].id,
|
|
544
538
|
defaultPlanId: planResponseMock[0].id,
|
|
545
539
|
},
|
|
546
|
-
subscription: Object.assign(Object.assign({}, subscriptionResponseMock), { startDate: subscriptionResponseMock.startDate, currentPeriodStart: subscriptionResponseMock.currentPeriodStart, currentPeriodEnd: subscriptionResponseMock.currentPeriodEnd, status: toSubscriptionStatus(subscriptionResponseMock.status), cancellation: subscriptionResponseMock.cancellation && toSubscriptionCancellation(subscriptionResponseMock.cancellation), trialEnd: null }),
|
|
547
540
|
plan: Object.assign(Object.assign({}, planResponseMock[0]), { price: (_a = planResponseMock[0].price) === null || _a === void 0 ? void 0 : _a.amount, currency: (_b = planResponseMock[0].price) === null || _b === void 0 ? void 0 : _b.currency, recurringInterval: 'month' }),
|
|
548
541
|
}));
|
|
549
542
|
}
|
|
@@ -742,9 +735,7 @@ function* confirmPlan({ payload: paymentMethodId }) {
|
|
|
742
735
|
loading: false,
|
|
743
736
|
status: exports.CheckoutStatus.CONFIRM,
|
|
744
737
|
}));
|
|
745
|
-
yield
|
|
746
|
-
subscription: Object.assign(Object.assign({}, subscription), { status: exports.SubscriptionStatus.ACTIVE }),
|
|
747
|
-
}));
|
|
738
|
+
yield loadSubscription();
|
|
748
739
|
yield effects.put(actions$2.checkoutEvent(exports.CheckoutEvent.CONFIRMED));
|
|
749
740
|
return;
|
|
750
741
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Plan
|
|
1
|
+
import { Plan } from '../../general.interfaces';
|
|
2
2
|
import { ISubscriptionSummariesResponse } from '@frontegg/rest-api';
|
|
3
3
|
export interface BillingInformationState {
|
|
4
4
|
loading: boolean;
|
|
5
5
|
error: string | null;
|
|
6
6
|
fetching: boolean;
|
|
7
7
|
summary?: ISubscriptionSummariesResponse;
|
|
8
|
-
subscription?: Subscription;
|
|
9
8
|
plan?: Plan;
|
|
10
9
|
}
|
|
11
10
|
export interface BillingInformationActions {
|
package/subscriptions/index.js
CHANGED
|
@@ -394,11 +394,7 @@ function* cancelSubscription() {
|
|
|
394
394
|
try {
|
|
395
395
|
yield put(actions$6.setCancellationLoading(true));
|
|
396
396
|
yield call(api.subscriptions.cancelManagedSubscription, subscriptionId);
|
|
397
|
-
yield
|
|
398
|
-
subscription: Object.assign(Object.assign({}, subscription), { cancellation: {
|
|
399
|
-
policy: ISubscriptionCancellationPolicy.AT_PERIOD_END,
|
|
400
|
-
} }),
|
|
401
|
-
}));
|
|
397
|
+
yield loadSubscription();
|
|
402
398
|
yield put(actions$6.setCancellationLoading(false));
|
|
403
399
|
}
|
|
404
400
|
catch (e) {
|
|
@@ -422,9 +418,7 @@ function* renewSubscription() {
|
|
|
422
418
|
try {
|
|
423
419
|
yield put(actions$6.setRenewalLoading(true));
|
|
424
420
|
yield call(api.subscriptions.renewManagedSubscription, subscriptionId);
|
|
425
|
-
yield
|
|
426
|
-
subscription: Object.assign(Object.assign({}, subscription), { cancellation: null }),
|
|
427
|
-
}));
|
|
421
|
+
yield loadSubscription();
|
|
428
422
|
yield put(actions$6.setRenewalLoading(false));
|
|
429
423
|
}
|
|
430
424
|
catch (e) {
|
|
@@ -540,7 +534,6 @@ function* loadSummariesMock() {
|
|
|
540
534
|
currentPlanId: planResponseMock[0].id,
|
|
541
535
|
defaultPlanId: planResponseMock[0].id,
|
|
542
536
|
},
|
|
543
|
-
subscription: Object.assign(Object.assign({}, subscriptionResponseMock), { startDate: subscriptionResponseMock.startDate, currentPeriodStart: subscriptionResponseMock.currentPeriodStart, currentPeriodEnd: subscriptionResponseMock.currentPeriodEnd, status: toSubscriptionStatus(subscriptionResponseMock.status), cancellation: subscriptionResponseMock.cancellation && toSubscriptionCancellation(subscriptionResponseMock.cancellation), trialEnd: null }),
|
|
544
537
|
plan: Object.assign(Object.assign({}, planResponseMock[0]), { price: (_a = planResponseMock[0].price) === null || _a === void 0 ? void 0 : _a.amount, currency: (_b = planResponseMock[0].price) === null || _b === void 0 ? void 0 : _b.currency, recurringInterval: 'month' }),
|
|
545
538
|
}));
|
|
546
539
|
}
|
|
@@ -739,9 +732,7 @@ function* confirmPlan({ payload: paymentMethodId }) {
|
|
|
739
732
|
loading: false,
|
|
740
733
|
status: CheckoutStatus.CONFIRM,
|
|
741
734
|
}));
|
|
742
|
-
yield
|
|
743
|
-
subscription: Object.assign(Object.assign({}, subscription), { status: SubscriptionStatus.ACTIVE }),
|
|
744
|
-
}));
|
|
735
|
+
yield loadSubscription();
|
|
745
736
|
yield put(actions$2.checkoutEvent(CheckoutEvent.CONFIRMED));
|
|
746
737
|
return;
|
|
747
738
|
}
|