@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.
@@ -674,15 +674,12 @@ function* resetCheckout() {
674
674
  }));
675
675
  }
676
676
  function* confirmPlan({ payload: paymentMethodId }) {
677
- var _a;
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
- checkoutPlanId: checkout.checkoutPlanId,
680
+ planId: checkout.checkoutPlanId,
682
681
  }));
683
- const subscriptionId = subscription === null || subscription === void 0 ? void 0 : subscription.id;
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, subscriptionId, {
695
+ yield effects.call(restApi.api.subscriptions.updateSubscription, subscription.id, {
699
696
  paymentMethodId,
700
- items: [
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.23.0",
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.57",
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",
@@ -671,15 +671,12 @@ function* resetCheckout() {
671
671
  }));
672
672
  }
673
673
  function* confirmPlan({ payload: paymentMethodId }) {
674
- var _a;
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
- checkoutPlanId: checkout.checkoutPlanId,
677
+ planId: checkout.checkoutPlanId,
679
678
  }));
680
- const subscriptionId = subscription === null || subscription === void 0 ? void 0 : subscription.id;
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, subscriptionId, {
692
+ yield call(api.subscriptions.updateSubscription, subscription.id, {
696
693
  paymentMethodId,
697
- items: [
698
- {
699
- id: subscriptionItemId,
700
- planId: checkoutPlanId,
701
- },
702
- ],
694
+ planId,
703
695
  });
704
696
  yield put(actions$3.setState({
705
697
  checkoutPlanId: null,