@frontegg/redux-store 5.24.0 → 5.27.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.
@@ -22,6 +22,10 @@ declare const reducers: {
22
22
  loginState: import("..").LoginState;
23
23
  activateState: import("..").ActivateAccountState;
24
24
  acceptInvitationState: import("..").AcceptInvitationState;
25
+ /**
26
+ * if you see error in matcher that's mean the DispatchAction does not
27
+ * contains the same functions in reducers and actions
28
+ */
25
29
  forgotPasswordState: import("..").ForgotPasswordState;
26
30
  resetPhoneNumberState: ResetPhoneNumberState;
27
31
  ssoState: import("..").SSOState;
@@ -52,6 +56,10 @@ declare const reducers: {
52
56
  loginState: import("..").LoginState;
53
57
  activateState: import("..").ActivateAccountState;
54
58
  acceptInvitationState: import("..").AcceptInvitationState;
59
+ /**
60
+ * if you see error in matcher that's mean the DispatchAction does not
61
+ * contains the same functions in reducers and actions
62
+ */
55
63
  forgotPasswordState: import("..").ForgotPasswordState;
56
64
  resetPhoneNumberState: ResetPhoneNumberState;
57
65
  ssoState: import("..").SSOState;
@@ -89,8 +97,8 @@ declare type DispatchedActions = {
89
97
  setResetPhoneNumberState: (state: Partial<ResetPhoneNumberState>) => void;
90
98
  resetResetPhoneNumberState: () => void;
91
99
  resetPhoneNumber: (payload: WithCallback<IResetPhoneNumber>) => void;
92
- verifyResetPhoneNumber: (payload?: WithCallback<IVerifyResetPhoneNumber>) => void;
93
- changePhoneNumber: (payload?: ChangePhoneNumberPayload) => void;
100
+ verifyResetPhoneNumber: (payload: WithCallback<IVerifyResetPhoneNumber>) => void;
101
+ changePhoneNumber: (payload: ChangePhoneNumberPayload) => void;
94
102
  };
95
103
  export declare type ResetPhoneNumberActions = DispatchedActions;
96
104
  export { resetPhoneNumberState, reducers as resetPhoneNumberReducers, actions as resetPhoneNumberActions };
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { AcceptInvitationStep, ActivateAccountStep, ApiStateKeys, ForgotPasswordStep, LoginStep, MFAStep, ResetPhoneNumberStep, SSOStateKeys, SamlVendors, SignUpStage, TeamStateKeys, acceptInvitationActions, acceptInvitationReducers, acceptInvitationState, accountSettingsActions, accountSettingsReducers, accountSettingsState, activateAccountActions, activateAccountReducers, activateState, apiTokensActions, apiTokensReducers, apiTokensState, default as auth, authActions, authInitialState, authMockSagas, authReducers, authSagas, forgotPasswordActions, forgotPasswordReducers, forgotPasswordState, loginActions, loginReducers, loginState, mfaActions, mfaReducers, mfaState, profileActions, profileReducers, profileState, resetPhoneNumberActions, resetPhoneNumberReducers, resetPhoneNumberState, rolesActions, rolesReducers, rolesState, securityPolicyActions, securityPolicyReducers, securityPolicyState, signUpActions, signUpReducers, signUpState, socialLoginState, socialLoginsActions, socialLoginsReducer, ssoActions, ssoReducers, ssoState, teamActions, teamReducers, teamState, tenantsActions, tenantsReducers, tenantsState } from './auth/index.js';
2
2
  export { auditLogsActions, auditLogsReducers, auditLogsState, default as audits, auditsActions, auditsInitialState, auditsMetadataActions, auditsMetadataReducers, auditsMetadataState, auditsMockSagas, auditsReducers, auditsSagas } from './audits/index.js';
3
3
  export { default as connectivity, connectivityActions, connectivityInitialState, connectivityReducers, connectivitySagas } from './connectivity/index.js';
4
- export { CheckoutEvent, CheckoutStatus, ManagedSubscriptionStatus, PaymentMethodType, PaymentProvider, SubscriptionCancellationPolicy, SubscriptionStatus, subscriptionActions, subscriptionInitialState, subscriptionReducers, subscriptionSagas, subscriptionSagasMock, default as subscriptions } from './subscriptions/index.js';
4
+ export { CheckoutEvent, CheckoutStatus, PaymentMethodType, PaymentProvider, SubscriptionCancellationPolicy, SubscriptionStatus, subscriptionActions, subscriptionInitialState, subscriptionReducers, subscriptionSagas, subscriptionSagasMock, default as subscriptions } from './subscriptions/index.js';
5
5
  export { default as vendor } from './vendor/index.js';
6
6
  export { createFronteggStore } from './toolkit/index.js';
7
7
  export { AuthStrategyEnum } from '@frontegg/rest-api';
package/node/index.js CHANGED
@@ -173,12 +173,6 @@ Object.defineProperty(exports, 'CheckoutStatus', {
173
173
  return subscriptions_index.CheckoutStatus;
174
174
  }
175
175
  });
176
- Object.defineProperty(exports, 'ManagedSubscriptionStatus', {
177
- enumerable: true,
178
- get: function () {
179
- return subscriptions_index.ManagedSubscriptionStatus;
180
- }
181
- });
182
176
  Object.defineProperty(exports, 'PaymentMethodType', {
183
177
  enumerable: true,
184
178
  get: function () {
@@ -69,6 +69,7 @@ const initialBillingInformationState = {
69
69
  fetching: true,
70
70
  externallyManaged: false,
71
71
  defaultPlanId: null,
72
+ defaultPaymentId: null,
72
73
  cancellation: {
73
74
  loading: false,
74
75
  error: null,
@@ -199,7 +200,7 @@ const managedSubscriptionsInitialState = {
199
200
  loading: false,
200
201
  error: null,
201
202
  fetching: true,
202
- managedSubscriptions: [],
203
+ managedSubscription: null,
203
204
  };
204
205
  const reducers = Object.assign({}, createModuleCaseReducers());
205
206
  const { reducer: reducer$1, actions: sliceActions, name } = toolkit.createSlice({
@@ -281,6 +282,7 @@ const subscriptionResponseMock = {
281
282
  externalId: 'sub_1JbhYVEwsu4qiqnnfMhYAdY6',
282
283
  startDate: '2021-09-20T08:08:51.000Z',
283
284
  status: restApi.ISubscriptionStatus.ACTIVE,
285
+ externallyManaged: false,
284
286
  cancellation: null,
285
287
  currentPeriodStart: '2021-09-20T08:08:51.000Z',
286
288
  currentPeriodEnd: '2021-10-20T08:08:51.000Z',
@@ -359,8 +361,8 @@ const paymentMethodsMock = [
359
361
  billingDetails: {
360
362
  name: 'Dummy',
361
363
  email: 'dummy@email.com',
362
- }
363
- }
364
+ },
365
+ },
364
366
  ];
365
367
 
366
368
  function* subscriptionBillingInformationSagas() {
@@ -388,11 +390,12 @@ function* loadSummaries(tenantId) {
388
390
  var _a, _b;
389
391
  yield effects.put(actions$6.setLoading(true));
390
392
  try {
391
- const { currentPlanId, subscriptionId, externallyManaged, defaultPlanId } = yield effects.call(restApi.api.subscriptions.getSubscriptionSummaries, tenantId);
392
- const subscriptionResponse = yield effects.call(restApi.api.subscriptions.getSubscription, subscriptionId);
393
+ const { currentPlanId, subscriptionId, externallyManaged, defaultPlanId, paymentMethodId: defaultPaymentId, } = yield effects.call(restApi.api.subscriptions.getSubscriptionSummaries, tenantId);
394
+ const subscriptionResponse = yield effects.call(restApi.api.subscriptions.getManagedSubscription, subscriptionId);
393
395
  const planResponse = yield effects.call(restApi.api.subscriptions.getSubscriptionPlan, currentPlanId);
394
396
  yield effects.put(actions$6.setBillingInformation(Object.assign(Object.assign({ loading: false, fetching: false, externallyManaged,
395
- defaultPlanId }, (subscriptionResponse
397
+ defaultPlanId,
398
+ defaultPaymentId }, (subscriptionResponse
396
399
  ? {
397
400
  subscription: {
398
401
  id: subscriptionResponse.id,
@@ -692,9 +695,10 @@ function* confirmPlan({ payload: paymentMethodId }) {
692
695
  error: null,
693
696
  }));
694
697
  try {
695
- yield effects.call(restApi.api.subscriptions.updateSubscription, subscription.id, {
698
+ yield effects.call(restApi.api.subscriptions.updateManagedSubscription, subscription.id, {
696
699
  paymentMethodId,
697
700
  planId,
701
+ items: []
698
702
  });
699
703
  yield effects.put(actions$3.setState({
700
704
  checkoutPlanId: null,
@@ -808,15 +812,6 @@ exports.PaymentMethodType = void 0;
808
812
  PaymentMethodType["CARD"] = "card";
809
813
  })(exports.PaymentMethodType || (exports.PaymentMethodType = {}));
810
814
 
811
- exports.ManagedSubscriptionStatus = void 0;
812
- (function (ManagedSubscriptionStatus) {
813
- ManagedSubscriptionStatus["ACTIVE"] = "ACTIVE";
814
- ManagedSubscriptionStatus["CANCELED"] = "CANCELED";
815
- ManagedSubscriptionStatus["INCOMPLETE"] = "INCOMPLETE";
816
- ManagedSubscriptionStatus["EXPIRED"] = "EXPIRED";
817
- ManagedSubscriptionStatus["TRIALING"] = "TRIALING";
818
- })(exports.ManagedSubscriptionStatus || (exports.ManagedSubscriptionStatus = {}));
819
-
820
815
  function* configSagas() {
821
816
  yield effects.takeEvery(actions$7.loadPaymentConfiguration, loadPaymentConfiguration);
822
817
  }
@@ -902,7 +897,7 @@ function* loadManagedSubscriptions() {
902
897
  yield effects.put(actions$1.setState({
903
898
  fetching: false,
904
899
  loading: false,
905
- managedSubscriptions,
900
+ managedSubscription: managedSubscriptions === null || managedSubscriptions === void 0 ? void 0 : managedSubscriptions[0],
906
901
  }));
907
902
  }
908
903
  catch (e) {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
3
  "libName": "FronteggReduxStore",
4
- "version": "5.24.0",
4
+ "version": "5.27.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.58",
10
+ "@frontegg/rest-api": "2.10.60",
11
11
  "@reduxjs/toolkit": "^1.5.0",
12
12
  "redux-saga": "^1.1.0",
13
13
  "tslib": "^2.3.1",
@@ -5,6 +5,7 @@ export interface BillingInformationState {
5
5
  fetching: boolean;
6
6
  externallyManaged: boolean;
7
7
  defaultPlanId: string | null;
8
+ defaultPaymentId: string | null;
8
9
  subscription?: Subscription;
9
10
  plan?: Plan;
10
11
  cancellation: {
@@ -1,27 +1,9 @@
1
- import { SubscriptionCancellation, SubscriptionItem } from '../general.interfaces';
2
- export declare enum ManagedSubscriptionStatus {
3
- ACTIVE = "ACTIVE",
4
- CANCELED = "CANCELED",
5
- INCOMPLETE = "INCOMPLETE",
6
- EXPIRED = "EXPIRED",
7
- TRIALING = "TRIALING"
8
- }
9
- export interface ManagedSubscription {
10
- id: string;
11
- externalId: string;
12
- startDate: Date;
13
- currentPeriodStart: Date;
14
- currentPeriodEnd: Date;
15
- status: ManagedSubscriptionStatus;
16
- cancellation: SubscriptionCancellation | null;
17
- items: SubscriptionItem[];
18
- trialEnd?: Date;
19
- }
1
+ import { ISubscriptionResponse } from '@frontegg/rest-api';
20
2
  export interface ManagedSubscriptionsState {
21
3
  loading: boolean;
22
4
  error: string | null;
23
5
  fetching: boolean;
24
- managedSubscriptions: ManagedSubscription[];
6
+ managedSubscription: ISubscriptionResponse | null;
25
7
  }
26
8
  export interface ManagedSubscriptionsActions {
27
9
  loadManagedSubscriptions: () => void;
@@ -66,6 +66,7 @@ const initialBillingInformationState = {
66
66
  fetching: true,
67
67
  externallyManaged: false,
68
68
  defaultPlanId: null,
69
+ defaultPaymentId: null,
69
70
  cancellation: {
70
71
  loading: false,
71
72
  error: null,
@@ -196,7 +197,7 @@ const managedSubscriptionsInitialState = {
196
197
  loading: false,
197
198
  error: null,
198
199
  fetching: true,
199
- managedSubscriptions: [],
200
+ managedSubscription: null,
200
201
  };
201
202
  const reducers = Object.assign({}, createModuleCaseReducers());
202
203
  const { reducer: reducer$1, actions: sliceActions, name } = createSlice({
@@ -278,6 +279,7 @@ const subscriptionResponseMock = {
278
279
  externalId: 'sub_1JbhYVEwsu4qiqnnfMhYAdY6',
279
280
  startDate: '2021-09-20T08:08:51.000Z',
280
281
  status: ISubscriptionStatus.ACTIVE,
282
+ externallyManaged: false,
281
283
  cancellation: null,
282
284
  currentPeriodStart: '2021-09-20T08:08:51.000Z',
283
285
  currentPeriodEnd: '2021-10-20T08:08:51.000Z',
@@ -356,8 +358,8 @@ const paymentMethodsMock = [
356
358
  billingDetails: {
357
359
  name: 'Dummy',
358
360
  email: 'dummy@email.com',
359
- }
360
- }
361
+ },
362
+ },
361
363
  ];
362
364
 
363
365
  function* subscriptionBillingInformationSagas() {
@@ -385,11 +387,12 @@ function* loadSummaries(tenantId) {
385
387
  var _a, _b;
386
388
  yield put(actions$6.setLoading(true));
387
389
  try {
388
- const { currentPlanId, subscriptionId, externallyManaged, defaultPlanId } = yield call(api.subscriptions.getSubscriptionSummaries, tenantId);
389
- const subscriptionResponse = yield call(api.subscriptions.getSubscription, subscriptionId);
390
+ const { currentPlanId, subscriptionId, externallyManaged, defaultPlanId, paymentMethodId: defaultPaymentId, } = yield call(api.subscriptions.getSubscriptionSummaries, tenantId);
391
+ const subscriptionResponse = yield call(api.subscriptions.getManagedSubscription, subscriptionId);
390
392
  const planResponse = yield call(api.subscriptions.getSubscriptionPlan, currentPlanId);
391
393
  yield put(actions$6.setBillingInformation(Object.assign(Object.assign({ loading: false, fetching: false, externallyManaged,
392
- defaultPlanId }, (subscriptionResponse
394
+ defaultPlanId,
395
+ defaultPaymentId }, (subscriptionResponse
393
396
  ? {
394
397
  subscription: {
395
398
  id: subscriptionResponse.id,
@@ -689,9 +692,10 @@ function* confirmPlan({ payload: paymentMethodId }) {
689
692
  error: null,
690
693
  }));
691
694
  try {
692
- yield call(api.subscriptions.updateSubscription, subscription.id, {
695
+ yield call(api.subscriptions.updateManagedSubscription, subscription.id, {
693
696
  paymentMethodId,
694
697
  planId,
698
+ items: []
695
699
  });
696
700
  yield put(actions$3.setState({
697
701
  checkoutPlanId: null,
@@ -805,15 +809,6 @@ var PaymentMethodType;
805
809
  PaymentMethodType["CARD"] = "card";
806
810
  })(PaymentMethodType || (PaymentMethodType = {}));
807
811
 
808
- var ManagedSubscriptionStatus;
809
- (function (ManagedSubscriptionStatus) {
810
- ManagedSubscriptionStatus["ACTIVE"] = "ACTIVE";
811
- ManagedSubscriptionStatus["CANCELED"] = "CANCELED";
812
- ManagedSubscriptionStatus["INCOMPLETE"] = "INCOMPLETE";
813
- ManagedSubscriptionStatus["EXPIRED"] = "EXPIRED";
814
- ManagedSubscriptionStatus["TRIALING"] = "TRIALING";
815
- })(ManagedSubscriptionStatus || (ManagedSubscriptionStatus = {}));
816
-
817
812
  function* configSagas() {
818
813
  yield takeEvery(actions$7.loadPaymentConfiguration, loadPaymentConfiguration);
819
814
  }
@@ -899,7 +894,7 @@ function* loadManagedSubscriptions() {
899
894
  yield put(actions$1.setState({
900
895
  fetching: false,
901
896
  loading: false,
902
- managedSubscriptions,
897
+ managedSubscription: managedSubscriptions === null || managedSubscriptions === void 0 ? void 0 : managedSubscriptions[0],
903
898
  }));
904
899
  }
905
900
  catch (e) {
@@ -928,4 +923,4 @@ var subscriptionsStore = {
928
923
  storeName: subscriptionsStoreName,
929
924
  };
930
925
 
931
- export { CheckoutEvent, CheckoutStatus, ManagedSubscriptionStatus, PaymentMethodType, PaymentProvider, SubscriptionCancellationPolicy, SubscriptionStatus, subscriptionsStore as default, actions as subscriptionActions, initialState as subscriptionInitialState, reducer as subscriptionReducers, sagas as subscriptionSagas, mockSagas as subscriptionSagasMock };
926
+ export { CheckoutEvent, CheckoutStatus, PaymentMethodType, PaymentProvider, SubscriptionCancellationPolicy, SubscriptionStatus, subscriptionsStore as default, actions as subscriptionActions, initialState as subscriptionInitialState, reducer as subscriptionReducers, sagas as subscriptionSagas, mockSagas as subscriptionSagasMock };