@frontegg/redux-store 5.23.0 → 5.24.0
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/node/subscriptions/index.js +5 -13
- package/package.json +2 -2
- package/subscriptions/index.js +5 -13
|
@@ -674,15 +674,12 @@ function* resetCheckout() {
|
|
|
674
674
|
}));
|
|
675
675
|
}
|
|
676
676
|
function* confirmPlan({ payload: paymentMethodId }) {
|
|
677
|
-
|
|
678
|
-
const { subscription, status, checkoutPlanId } = yield effects.select(({ subscriptions: { billing: { information }, checkout, }, }) => ({
|
|
677
|
+
const { subscription, status, planId } = yield effects.select(({ subscriptions: { billing: { information }, checkout, }, }) => ({
|
|
679
678
|
subscription: information.subscription,
|
|
680
679
|
status: checkout.status,
|
|
681
|
-
|
|
680
|
+
planId: checkout.checkoutPlanId,
|
|
682
681
|
}));
|
|
683
|
-
|
|
684
|
-
const subscriptionItemId = (_a = subscription === null || subscription === void 0 ? void 0 : subscription.items[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
685
|
-
if (!checkoutPlanId || !subscriptionId || !subscriptionItemId) {
|
|
682
|
+
if (!planId || !subscription) {
|
|
686
683
|
yield effects.put(actions$3.setState({
|
|
687
684
|
loading: false,
|
|
688
685
|
status: exports.CheckoutStatus.ERROR,
|
|
@@ -695,14 +692,9 @@ function* confirmPlan({ payload: paymentMethodId }) {
|
|
|
695
692
|
error: null,
|
|
696
693
|
}));
|
|
697
694
|
try {
|
|
698
|
-
yield effects.call(restApi.api.subscriptions.updateSubscription,
|
|
695
|
+
yield effects.call(restApi.api.subscriptions.updateSubscription, subscription.id, {
|
|
699
696
|
paymentMethodId,
|
|
700
|
-
|
|
701
|
-
{
|
|
702
|
-
id: subscriptionItemId,
|
|
703
|
-
planId: checkoutPlanId,
|
|
704
|
-
},
|
|
705
|
-
],
|
|
697
|
+
planId,
|
|
706
698
|
});
|
|
707
699
|
yield effects.put(actions$3.setState({
|
|
708
700
|
checkoutPlanId: null,
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
3
|
"libName": "FronteggReduxStore",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.24.0",
|
|
5
5
|
"author": "Frontegg LTD",
|
|
6
6
|
"main": "./node/index.js",
|
|
7
7
|
"module": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@frontegg/rest-api": "2.10.
|
|
10
|
+
"@frontegg/rest-api": "2.10.58",
|
|
11
11
|
"@reduxjs/toolkit": "^1.5.0",
|
|
12
12
|
"redux-saga": "^1.1.0",
|
|
13
13
|
"tslib": "^2.3.1",
|
package/subscriptions/index.js
CHANGED
|
@@ -671,15 +671,12 @@ function* resetCheckout() {
|
|
|
671
671
|
}));
|
|
672
672
|
}
|
|
673
673
|
function* confirmPlan({ payload: paymentMethodId }) {
|
|
674
|
-
|
|
675
|
-
const { subscription, status, checkoutPlanId } = yield select(({ subscriptions: { billing: { information }, checkout, }, }) => ({
|
|
674
|
+
const { subscription, status, planId } = yield select(({ subscriptions: { billing: { information }, checkout, }, }) => ({
|
|
676
675
|
subscription: information.subscription,
|
|
677
676
|
status: checkout.status,
|
|
678
|
-
|
|
677
|
+
planId: checkout.checkoutPlanId,
|
|
679
678
|
}));
|
|
680
|
-
|
|
681
|
-
const subscriptionItemId = (_a = subscription === null || subscription === void 0 ? void 0 : subscription.items[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
682
|
-
if (!checkoutPlanId || !subscriptionId || !subscriptionItemId) {
|
|
679
|
+
if (!planId || !subscription) {
|
|
683
680
|
yield put(actions$3.setState({
|
|
684
681
|
loading: false,
|
|
685
682
|
status: CheckoutStatus.ERROR,
|
|
@@ -692,14 +689,9 @@ function* confirmPlan({ payload: paymentMethodId }) {
|
|
|
692
689
|
error: null,
|
|
693
690
|
}));
|
|
694
691
|
try {
|
|
695
|
-
yield call(api.subscriptions.updateSubscription,
|
|
692
|
+
yield call(api.subscriptions.updateSubscription, subscription.id, {
|
|
696
693
|
paymentMethodId,
|
|
697
|
-
|
|
698
|
-
{
|
|
699
|
-
id: subscriptionItemId,
|
|
700
|
-
planId: checkoutPlanId,
|
|
701
|
-
},
|
|
702
|
-
],
|
|
694
|
+
planId,
|
|
703
695
|
});
|
|
704
696
|
yield put(actions$3.setState({
|
|
705
697
|
checkoutPlanId: null,
|