@frontegg/redux-store 5.22.0 → 5.25.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/index.js +1 -1
- package/node/index.js +0 -6
- package/node/subscriptions/index.js +25 -38
- package/package.json +2 -2
- package/subscriptions/ManagedSubscriptions/interfaces.d.ts +2 -20
- package/subscriptions/index.js +26 -39
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,
|
|
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 () {
|
|
@@ -55,11 +55,11 @@ const configInitialState = {
|
|
|
55
55
|
fetching: true,
|
|
56
56
|
config: null,
|
|
57
57
|
};
|
|
58
|
-
const reducers$
|
|
58
|
+
const reducers$6 = Object.assign({}, createModuleCaseReducers());
|
|
59
59
|
const { actions: configActions, reducer: reducer$7, name: name$6, } = toolkit.createSlice({
|
|
60
60
|
name: `${constants.subscriptionsStoreName}/config`,
|
|
61
61
|
initialState: configInitialState,
|
|
62
|
-
reducers: reducers$
|
|
62
|
+
reducers: reducers$6,
|
|
63
63
|
});
|
|
64
64
|
const actions$7 = Object.assign({ loadPaymentConfiguration: toolkit.createAction(`${name$6}/loadPaymentConfiguration`) }, configActions);
|
|
65
65
|
|
|
@@ -78,14 +78,14 @@ const initialBillingInformationState = {
|
|
|
78
78
|
error: null,
|
|
79
79
|
},
|
|
80
80
|
};
|
|
81
|
-
const reducers$
|
|
81
|
+
const reducers$5 = Object.assign(Object.assign({}, createModuleCaseReducers()), { setBillingInformation: {
|
|
82
82
|
prepare: (payload) => ({ payload }),
|
|
83
83
|
reducer: (state, action) => (Object.assign(Object.assign({}, state), action.payload)),
|
|
84
84
|
}, setCancellationLoading: createKeyCaseLoadingReducer('cancellation'), setCancellationError: createKeyCaseErrorReducer('cancellation'), setRenewalLoading: createKeyCaseLoadingReducer('renewal'), setRenewalError: createKeyCaseErrorReducer('renewal') });
|
|
85
85
|
const { reducer: reducer$6, actions: overviewActions, name: name$5, } = toolkit.createSlice({
|
|
86
86
|
name: `${constants.subscriptionsStoreName}/billing/information`,
|
|
87
87
|
initialState: initialBillingInformationState,
|
|
88
|
-
reducers: reducers$
|
|
88
|
+
reducers: reducers$5,
|
|
89
89
|
});
|
|
90
90
|
const actions$6 = Object.assign({ loadBillingInformation: toolkit.createAction(`${name$5}/loadBillingInformation`), cancelSubscription: toolkit.createAction(`${name$5}/cancelSubscription`), renewSubscription: toolkit.createAction(`${name$5}/renewSubscription`) }, overviewActions);
|
|
91
91
|
|
|
@@ -94,14 +94,14 @@ const initialPaymentMethodState = {
|
|
|
94
94
|
error: null,
|
|
95
95
|
fetching: true,
|
|
96
96
|
};
|
|
97
|
-
const reducers$
|
|
97
|
+
const reducers$4 = Object.assign(Object.assign({}, createModuleCaseReducers()), { setState: {
|
|
98
98
|
prepare: (payload) => ({ payload }),
|
|
99
99
|
reducer: (state, action) => (Object.assign(Object.assign({}, state), action.payload)),
|
|
100
100
|
} });
|
|
101
101
|
const { reducer: reducer$5, actions: paymentActions, name: name$4, } = toolkit.createSlice({
|
|
102
102
|
name: `${constants.subscriptionsStoreName}/billing/payment`,
|
|
103
103
|
initialState: initialPaymentMethodState,
|
|
104
|
-
reducers: reducers$
|
|
104
|
+
reducers: reducers$4,
|
|
105
105
|
});
|
|
106
106
|
const actions$5 = Object.assign({ loadPaymentMethod: toolkit.createAction(`${name$4}/loadPaymentMethod`), submitPaymentMethod: toolkit.createAction(`${name$4}/submitPaymentMethod`), submitPaymentMethodError: toolkit.createAction(`${name$4}/submitPaymentMethodError`), submitPaymentMethodSuccess: toolkit.createAction(`${name$4}/submitPaymentMethodSuccess`), updatePaymentMethodBillingDetails: toolkit.createAction(`${name$4}/updateBillingDetails`, (payload) => ({ payload })) }, paymentActions);
|
|
107
107
|
|
|
@@ -115,14 +115,14 @@ const initialInvoicesState = {
|
|
|
115
115
|
error: null
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
|
-
const reducers$
|
|
118
|
+
const reducers$3 = Object.assign(Object.assign({}, createModuleCaseReducers()), { setInvoiceDownloadState: {
|
|
119
119
|
prepare: (payload) => ({ payload }),
|
|
120
120
|
reducer: (state, action) => (Object.assign(Object.assign({}, state), { invoiceDownload: Object.assign(Object.assign({}, state.invoiceDownload), action.payload) })),
|
|
121
121
|
} });
|
|
122
122
|
const { reducer: reducer$4, actions: sliceActions$1, name: name$3, } = toolkit.createSlice({
|
|
123
123
|
name: `${constants.subscriptionsStoreName}/billing/invoices`,
|
|
124
124
|
initialState: initialInvoicesState,
|
|
125
|
-
reducers: reducers$
|
|
125
|
+
reducers: reducers$3,
|
|
126
126
|
});
|
|
127
127
|
const actions$4 = Object.assign({ loadInvoices: toolkit.createAction(`${name$3}/loadInvoices`), downloadInvoice: toolkit.createAction(`${name$3}/downloadInvoice`, (payload) => ({ payload })) }, sliceActions$1);
|
|
128
128
|
|
|
@@ -165,7 +165,7 @@ const checkoutInitialState = {
|
|
|
165
165
|
status: exports.CheckoutStatus.SELECTION,
|
|
166
166
|
checkoutPlanId: null,
|
|
167
167
|
};
|
|
168
|
-
const reducers$
|
|
168
|
+
const reducers$2 = Object.assign(Object.assign({}, createModuleCaseReducers()), { setStatus: {
|
|
169
169
|
prepare: (payload) => ({ payload }),
|
|
170
170
|
reducer: (state, action) => (Object.assign(Object.assign({}, state), { status: action.payload })),
|
|
171
171
|
}, selectPlan: {
|
|
@@ -175,7 +175,7 @@ const reducers$1 = Object.assign(Object.assign({}, createModuleCaseReducers()),
|
|
|
175
175
|
const { actions: checkoutActions, reducer: reducer$3, name: name$2 } = toolkit.createSlice({
|
|
176
176
|
name: `${constants.subscriptionsStoreName}/checkout`,
|
|
177
177
|
initialState: checkoutInitialState,
|
|
178
|
-
reducers: reducers$
|
|
178
|
+
reducers: reducers$2,
|
|
179
179
|
});
|
|
180
180
|
const actions$3 = Object.assign({ checkoutPlan: toolkit.createAction(`${name$2}/checkoutPlan`, (payload) => ({ payload })), resetCheckout: toolkit.createAction(`${name$2}/resetCheckout`), confirmCheckout: toolkit.createAction(`${name$2}/confirmCheckout`, (payload) => ({ payload, })), cancelCheckout: toolkit.createAction(`${name$2}/cancelCheckout`), submitCheckout: toolkit.createAction(`${name$2}/submitCheckout`), errorCheckout: toolkit.createAction(`${name$2}/errorCheckout`, (payload) => ({ payload, })), checkoutEvent: toolkit.createAction(`${name$2}/checkoutEvent`, (payload) => ({ payload, })) }, checkoutActions);
|
|
181
181
|
|
|
@@ -184,14 +184,14 @@ const initialSubscriptionStripeState = {
|
|
|
184
184
|
error: null,
|
|
185
185
|
cardSetupIntentSecret: null,
|
|
186
186
|
};
|
|
187
|
-
const reducers = Object.assign(Object.assign({}, createModuleCaseReducers()), { setStripeState: {
|
|
187
|
+
const reducers$1 = Object.assign(Object.assign({}, createModuleCaseReducers()), { setStripeState: {
|
|
188
188
|
prepare: (payload) => ({ payload }),
|
|
189
189
|
reducer: (state, action) => (Object.assign(Object.assign({}, state), action.payload)),
|
|
190
190
|
} });
|
|
191
191
|
const { reducer: reducer$2, actions: reducerActions, name: name$1, } = toolkit.createSlice({
|
|
192
192
|
name: `${constants.subscriptionsStoreName}/stripe`,
|
|
193
193
|
initialState: initialSubscriptionStripeState,
|
|
194
|
-
reducers,
|
|
194
|
+
reducers: reducers$1,
|
|
195
195
|
});
|
|
196
196
|
const actions$2 = Object.assign({ loadCustomer: toolkit.createAction(`${name$1}/loadCustomer`), createCardSetupIntentSecret: toolkit.createAction(`${name$1}/createCardSetupIntentSecret`) }, reducerActions);
|
|
197
197
|
|
|
@@ -201,11 +201,11 @@ const managedSubscriptionsInitialState = {
|
|
|
201
201
|
fetching: true,
|
|
202
202
|
managedSubscriptions: [],
|
|
203
203
|
};
|
|
204
|
-
Object.assign({}, createModuleCaseReducers());
|
|
204
|
+
const reducers = Object.assign({}, createModuleCaseReducers());
|
|
205
205
|
const { reducer: reducer$1, actions: sliceActions, name } = toolkit.createSlice({
|
|
206
206
|
name: `${constants.subscriptionsStoreName}/managedSubscriptions`,
|
|
207
207
|
initialState: managedSubscriptionsInitialState,
|
|
208
|
-
reducers
|
|
208
|
+
reducers,
|
|
209
209
|
});
|
|
210
210
|
const actions$1 = Object.assign({ loadManagedSubscriptions: toolkit.createAction(`${name}/loadManagedSubscriptions`) }, sliceActions);
|
|
211
211
|
|
|
@@ -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,
|
|
@@ -816,15 +808,6 @@ exports.PaymentMethodType = void 0;
|
|
|
816
808
|
PaymentMethodType["CARD"] = "card";
|
|
817
809
|
})(exports.PaymentMethodType || (exports.PaymentMethodType = {}));
|
|
818
810
|
|
|
819
|
-
exports.ManagedSubscriptionStatus = void 0;
|
|
820
|
-
(function (ManagedSubscriptionStatus) {
|
|
821
|
-
ManagedSubscriptionStatus["ACTIVE"] = "ACTIVE";
|
|
822
|
-
ManagedSubscriptionStatus["CANCELED"] = "CANCELED";
|
|
823
|
-
ManagedSubscriptionStatus["INCOMPLETE"] = "INCOMPLETE";
|
|
824
|
-
ManagedSubscriptionStatus["EXPIRED"] = "EXPIRED";
|
|
825
|
-
ManagedSubscriptionStatus["TRIALING"] = "TRIALING";
|
|
826
|
-
})(exports.ManagedSubscriptionStatus || (exports.ManagedSubscriptionStatus = {}));
|
|
827
|
-
|
|
828
811
|
function* configSagas() {
|
|
829
812
|
yield effects.takeEvery(actions$7.loadPaymentConfiguration, loadPaymentConfiguration);
|
|
830
813
|
}
|
|
@@ -906,8 +889,12 @@ function* createCardSetupIntentSecret({ payload }) {
|
|
|
906
889
|
function* loadManagedSubscriptions() {
|
|
907
890
|
yield effects.put(actions$1.setLoading(true));
|
|
908
891
|
try {
|
|
909
|
-
const
|
|
910
|
-
yield effects.put(actions$1.setState(
|
|
892
|
+
const managedSubscriptions = yield effects.call(restApi.api.subscriptions.getManagedSubscriptions);
|
|
893
|
+
yield effects.put(actions$1.setState({
|
|
894
|
+
fetching: false,
|
|
895
|
+
loading: false,
|
|
896
|
+
managedSubscriptions,
|
|
897
|
+
}));
|
|
911
898
|
}
|
|
912
899
|
catch (e) {
|
|
913
900
|
yield effects.put(actions$1.setError(e.message));
|
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.25.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",
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
import {
|
|
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:
|
|
6
|
+
managedSubscriptions: ISubscriptionResponse[];
|
|
25
7
|
}
|
|
26
8
|
export interface ManagedSubscriptionsActions {
|
|
27
9
|
loadManagedSubscriptions: () => void;
|
package/subscriptions/index.js
CHANGED
|
@@ -52,11 +52,11 @@ const configInitialState = {
|
|
|
52
52
|
fetching: true,
|
|
53
53
|
config: null,
|
|
54
54
|
};
|
|
55
|
-
const reducers$
|
|
55
|
+
const reducers$6 = Object.assign({}, createModuleCaseReducers());
|
|
56
56
|
const { actions: configActions, reducer: reducer$7, name: name$6, } = createSlice({
|
|
57
57
|
name: `${subscriptionsStoreName}/config`,
|
|
58
58
|
initialState: configInitialState,
|
|
59
|
-
reducers: reducers$
|
|
59
|
+
reducers: reducers$6,
|
|
60
60
|
});
|
|
61
61
|
const actions$7 = Object.assign({ loadPaymentConfiguration: createAction(`${name$6}/loadPaymentConfiguration`) }, configActions);
|
|
62
62
|
|
|
@@ -75,14 +75,14 @@ const initialBillingInformationState = {
|
|
|
75
75
|
error: null,
|
|
76
76
|
},
|
|
77
77
|
};
|
|
78
|
-
const reducers$
|
|
78
|
+
const reducers$5 = Object.assign(Object.assign({}, createModuleCaseReducers()), { setBillingInformation: {
|
|
79
79
|
prepare: (payload) => ({ payload }),
|
|
80
80
|
reducer: (state, action) => (Object.assign(Object.assign({}, state), action.payload)),
|
|
81
81
|
}, setCancellationLoading: createKeyCaseLoadingReducer('cancellation'), setCancellationError: createKeyCaseErrorReducer('cancellation'), setRenewalLoading: createKeyCaseLoadingReducer('renewal'), setRenewalError: createKeyCaseErrorReducer('renewal') });
|
|
82
82
|
const { reducer: reducer$6, actions: overviewActions, name: name$5, } = createSlice({
|
|
83
83
|
name: `${subscriptionsStoreName}/billing/information`,
|
|
84
84
|
initialState: initialBillingInformationState,
|
|
85
|
-
reducers: reducers$
|
|
85
|
+
reducers: reducers$5,
|
|
86
86
|
});
|
|
87
87
|
const actions$6 = Object.assign({ loadBillingInformation: createAction(`${name$5}/loadBillingInformation`), cancelSubscription: createAction(`${name$5}/cancelSubscription`), renewSubscription: createAction(`${name$5}/renewSubscription`) }, overviewActions);
|
|
88
88
|
|
|
@@ -91,14 +91,14 @@ const initialPaymentMethodState = {
|
|
|
91
91
|
error: null,
|
|
92
92
|
fetching: true,
|
|
93
93
|
};
|
|
94
|
-
const reducers$
|
|
94
|
+
const reducers$4 = Object.assign(Object.assign({}, createModuleCaseReducers()), { setState: {
|
|
95
95
|
prepare: (payload) => ({ payload }),
|
|
96
96
|
reducer: (state, action) => (Object.assign(Object.assign({}, state), action.payload)),
|
|
97
97
|
} });
|
|
98
98
|
const { reducer: reducer$5, actions: paymentActions, name: name$4, } = createSlice({
|
|
99
99
|
name: `${subscriptionsStoreName}/billing/payment`,
|
|
100
100
|
initialState: initialPaymentMethodState,
|
|
101
|
-
reducers: reducers$
|
|
101
|
+
reducers: reducers$4,
|
|
102
102
|
});
|
|
103
103
|
const actions$5 = Object.assign({ loadPaymentMethod: createAction(`${name$4}/loadPaymentMethod`), submitPaymentMethod: createAction(`${name$4}/submitPaymentMethod`), submitPaymentMethodError: createAction(`${name$4}/submitPaymentMethodError`), submitPaymentMethodSuccess: createAction(`${name$4}/submitPaymentMethodSuccess`), updatePaymentMethodBillingDetails: createAction(`${name$4}/updateBillingDetails`, (payload) => ({ payload })) }, paymentActions);
|
|
104
104
|
|
|
@@ -112,14 +112,14 @@ const initialInvoicesState = {
|
|
|
112
112
|
error: null
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
-
const reducers$
|
|
115
|
+
const reducers$3 = Object.assign(Object.assign({}, createModuleCaseReducers()), { setInvoiceDownloadState: {
|
|
116
116
|
prepare: (payload) => ({ payload }),
|
|
117
117
|
reducer: (state, action) => (Object.assign(Object.assign({}, state), { invoiceDownload: Object.assign(Object.assign({}, state.invoiceDownload), action.payload) })),
|
|
118
118
|
} });
|
|
119
119
|
const { reducer: reducer$4, actions: sliceActions$1, name: name$3, } = createSlice({
|
|
120
120
|
name: `${subscriptionsStoreName}/billing/invoices`,
|
|
121
121
|
initialState: initialInvoicesState,
|
|
122
|
-
reducers: reducers$
|
|
122
|
+
reducers: reducers$3,
|
|
123
123
|
});
|
|
124
124
|
const actions$4 = Object.assign({ loadInvoices: createAction(`${name$3}/loadInvoices`), downloadInvoice: createAction(`${name$3}/downloadInvoice`, (payload) => ({ payload })) }, sliceActions$1);
|
|
125
125
|
|
|
@@ -162,7 +162,7 @@ const checkoutInitialState = {
|
|
|
162
162
|
status: CheckoutStatus.SELECTION,
|
|
163
163
|
checkoutPlanId: null,
|
|
164
164
|
};
|
|
165
|
-
const reducers$
|
|
165
|
+
const reducers$2 = Object.assign(Object.assign({}, createModuleCaseReducers()), { setStatus: {
|
|
166
166
|
prepare: (payload) => ({ payload }),
|
|
167
167
|
reducer: (state, action) => (Object.assign(Object.assign({}, state), { status: action.payload })),
|
|
168
168
|
}, selectPlan: {
|
|
@@ -172,7 +172,7 @@ const reducers$1 = Object.assign(Object.assign({}, createModuleCaseReducers()),
|
|
|
172
172
|
const { actions: checkoutActions, reducer: reducer$3, name: name$2 } = createSlice({
|
|
173
173
|
name: `${subscriptionsStoreName}/checkout`,
|
|
174
174
|
initialState: checkoutInitialState,
|
|
175
|
-
reducers: reducers$
|
|
175
|
+
reducers: reducers$2,
|
|
176
176
|
});
|
|
177
177
|
const actions$3 = Object.assign({ checkoutPlan: createAction(`${name$2}/checkoutPlan`, (payload) => ({ payload })), resetCheckout: createAction(`${name$2}/resetCheckout`), confirmCheckout: createAction(`${name$2}/confirmCheckout`, (payload) => ({ payload, })), cancelCheckout: createAction(`${name$2}/cancelCheckout`), submitCheckout: createAction(`${name$2}/submitCheckout`), errorCheckout: createAction(`${name$2}/errorCheckout`, (payload) => ({ payload, })), checkoutEvent: createAction(`${name$2}/checkoutEvent`, (payload) => ({ payload, })) }, checkoutActions);
|
|
178
178
|
|
|
@@ -181,14 +181,14 @@ const initialSubscriptionStripeState = {
|
|
|
181
181
|
error: null,
|
|
182
182
|
cardSetupIntentSecret: null,
|
|
183
183
|
};
|
|
184
|
-
const reducers = Object.assign(Object.assign({}, createModuleCaseReducers()), { setStripeState: {
|
|
184
|
+
const reducers$1 = Object.assign(Object.assign({}, createModuleCaseReducers()), { setStripeState: {
|
|
185
185
|
prepare: (payload) => ({ payload }),
|
|
186
186
|
reducer: (state, action) => (Object.assign(Object.assign({}, state), action.payload)),
|
|
187
187
|
} });
|
|
188
188
|
const { reducer: reducer$2, actions: reducerActions, name: name$1, } = createSlice({
|
|
189
189
|
name: `${subscriptionsStoreName}/stripe`,
|
|
190
190
|
initialState: initialSubscriptionStripeState,
|
|
191
|
-
reducers,
|
|
191
|
+
reducers: reducers$1,
|
|
192
192
|
});
|
|
193
193
|
const actions$2 = Object.assign({ loadCustomer: createAction(`${name$1}/loadCustomer`), createCardSetupIntentSecret: createAction(`${name$1}/createCardSetupIntentSecret`) }, reducerActions);
|
|
194
194
|
|
|
@@ -198,11 +198,11 @@ const managedSubscriptionsInitialState = {
|
|
|
198
198
|
fetching: true,
|
|
199
199
|
managedSubscriptions: [],
|
|
200
200
|
};
|
|
201
|
-
Object.assign({}, createModuleCaseReducers());
|
|
201
|
+
const reducers = Object.assign({}, createModuleCaseReducers());
|
|
202
202
|
const { reducer: reducer$1, actions: sliceActions, name } = createSlice({
|
|
203
203
|
name: `${subscriptionsStoreName}/managedSubscriptions`,
|
|
204
204
|
initialState: managedSubscriptionsInitialState,
|
|
205
|
-
reducers
|
|
205
|
+
reducers,
|
|
206
206
|
});
|
|
207
207
|
const actions$1 = Object.assign({ loadManagedSubscriptions: createAction(`${name}/loadManagedSubscriptions`) }, sliceActions);
|
|
208
208
|
|
|
@@ -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,
|
|
@@ -813,15 +805,6 @@ var PaymentMethodType;
|
|
|
813
805
|
PaymentMethodType["CARD"] = "card";
|
|
814
806
|
})(PaymentMethodType || (PaymentMethodType = {}));
|
|
815
807
|
|
|
816
|
-
var ManagedSubscriptionStatus;
|
|
817
|
-
(function (ManagedSubscriptionStatus) {
|
|
818
|
-
ManagedSubscriptionStatus["ACTIVE"] = "ACTIVE";
|
|
819
|
-
ManagedSubscriptionStatus["CANCELED"] = "CANCELED";
|
|
820
|
-
ManagedSubscriptionStatus["INCOMPLETE"] = "INCOMPLETE";
|
|
821
|
-
ManagedSubscriptionStatus["EXPIRED"] = "EXPIRED";
|
|
822
|
-
ManagedSubscriptionStatus["TRIALING"] = "TRIALING";
|
|
823
|
-
})(ManagedSubscriptionStatus || (ManagedSubscriptionStatus = {}));
|
|
824
|
-
|
|
825
808
|
function* configSagas() {
|
|
826
809
|
yield takeEvery(actions$7.loadPaymentConfiguration, loadPaymentConfiguration);
|
|
827
810
|
}
|
|
@@ -903,8 +886,12 @@ function* createCardSetupIntentSecret({ payload }) {
|
|
|
903
886
|
function* loadManagedSubscriptions() {
|
|
904
887
|
yield put(actions$1.setLoading(true));
|
|
905
888
|
try {
|
|
906
|
-
const
|
|
907
|
-
yield put(actions$1.setState(
|
|
889
|
+
const managedSubscriptions = yield call(api.subscriptions.getManagedSubscriptions);
|
|
890
|
+
yield put(actions$1.setState({
|
|
891
|
+
fetching: false,
|
|
892
|
+
loading: false,
|
|
893
|
+
managedSubscriptions,
|
|
894
|
+
}));
|
|
908
895
|
}
|
|
909
896
|
catch (e) {
|
|
910
897
|
yield put(actions$1.setError(e.message));
|
|
@@ -932,4 +919,4 @@ var subscriptionsStore = {
|
|
|
932
919
|
storeName: subscriptionsStoreName,
|
|
933
920
|
};
|
|
934
921
|
|
|
935
|
-
export { CheckoutEvent, CheckoutStatus,
|
|
922
|
+
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 };
|