@techstuff-dev/foundation-api-utils 1.20.3 → 1.21.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.
- package/dist/@types/lib/hooks/index.d.ts +20 -28
- package/dist/@types/lib/index.d.ts +2 -1
- package/dist/@types/lib/services/auth/index.d.ts +2 -788
- package/dist/@types/lib/services/auth/slice.d.ts +0 -10
- package/dist/@types/lib/services/content/content.interfaces.d.ts +31 -31
- package/dist/@types/lib/services/content/index.d.ts +1 -0
- package/dist/@types/lib/services/payment/index.d.ts +283 -21
- package/dist/@types/lib/store/index.d.ts +50 -70
- package/dist/@types/lib/types/index.interfaces.d.ts +21 -11
- package/dist/@types/lib/utils/dataFormat/index.d.ts +1 -0
- package/dist/index.esm.js +135 -175
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +134 -182
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fetchBaseQuery, createApi } from '@reduxjs/toolkit/query/react';
|
|
2
2
|
import { Auth } from 'aws-amplify';
|
|
3
|
-
import { jwtDecode } from 'jwt-decode';
|
|
4
3
|
import { createSlice, combineSlices, configureStore } from '@reduxjs/toolkit';
|
|
4
|
+
import { jwtDecode } from 'jwt-decode';
|
|
5
5
|
import { useSelector, useDispatch, useStore } from 'react-redux';
|
|
6
6
|
import { useMemo } from 'react';
|
|
7
7
|
import { persistReducer, FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER } from 'redux-persist';
|
|
@@ -103,14 +103,26 @@ var initialState = {
|
|
|
103
103
|
email: '',
|
|
104
104
|
sub: '',
|
|
105
105
|
},
|
|
106
|
-
creating: {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
},
|
|
106
|
+
// creating: {
|
|
107
|
+
// details: '',
|
|
108
|
+
// payment: '',
|
|
109
|
+
// },
|
|
110
110
|
loading: false,
|
|
111
111
|
error: false,
|
|
112
112
|
session: undefined,
|
|
113
113
|
};
|
|
114
|
+
// interface AuthReducers {
|
|
115
|
+
// setCredentials: (
|
|
116
|
+
// state: AuthState,
|
|
117
|
+
// data: {
|
|
118
|
+
// payload: any;
|
|
119
|
+
// type: string;
|
|
120
|
+
// },
|
|
121
|
+
// ) => AuthState;
|
|
122
|
+
// resetCreating: (state: AuthState) => void;
|
|
123
|
+
// updateSubscription: (state: AuthState, data: any) => void;
|
|
124
|
+
// logout: () => void;
|
|
125
|
+
// }
|
|
114
126
|
var authSlice = createSlice({
|
|
115
127
|
name: 'auth',
|
|
116
128
|
initialState: initialState,
|
|
@@ -125,7 +137,7 @@ var authSlice = createSlice({
|
|
|
125
137
|
} });
|
|
126
138
|
},
|
|
127
139
|
updateSubscription: function (state, data) {
|
|
128
|
-
return __assign(__assign({}, state), { user: __assign(__assign({}, state.user), { details: __assign(__assign({}, state.user.details), { subscription: data.payload.subscription, subscriptionDetails: data.payload.subscriptionDetails }) }) });
|
|
140
|
+
return __assign(__assign({}, state), { user: __assign(__assign({}, state.user), { details: __assign(__assign({}, state.user.details), { customerId: data.payload.customerId, subscription: data.payload.subscription, subscriptionDetails: data.payload.subscriptionDetails }) }) });
|
|
129
141
|
},
|
|
130
142
|
logout: function () { return initialState; },
|
|
131
143
|
},
|
|
@@ -134,8 +146,8 @@ var authSlice = createSlice({
|
|
|
134
146
|
selectAccessToken: function (auth) { return auth.user.accessToken; },
|
|
135
147
|
selectRefreshToken: function (auth) { return auth.user.refreshToken; },
|
|
136
148
|
selectCurrentUser: function (auth) { return auth.user.details; },
|
|
137
|
-
selectUserCreating:
|
|
138
|
-
selectUserCreatingDetails:
|
|
149
|
+
// selectUserCreating: (auth) => auth.creating,
|
|
150
|
+
// selectUserCreatingDetails: (auth) => auth.creating.details,
|
|
139
151
|
isVerifying: function (auth) { return auth.verifying; },
|
|
140
152
|
getUserSession: function (auth) { return (auth.authenticated ? auth.session : false); },
|
|
141
153
|
selectCurrentUserSub: function (auth) { return auth.user.sub; },
|
|
@@ -164,7 +176,10 @@ var authSlice = createSlice({
|
|
|
164
176
|
// Action creators are generated for each case reducer function.
|
|
165
177
|
var setCredentials = (_a$1 = authSlice.actions, _a$1.setCredentials), resetCreating = _a$1.resetCreating, logout = _a$1.logout, updateSubscription = _a$1.updateSubscription;
|
|
166
178
|
// Selectors returned by `slice.selectors` take the root state as their first argument.
|
|
167
|
-
var isAuthenticated = (_b$1 = authSlice.selectors, _b$1.isAuthenticated), selectAccessToken = _b$1.selectAccessToken, selectRefreshToken = _b$1.selectRefreshToken, selectCurrentUser = _b$1.selectCurrentUser,
|
|
179
|
+
var isAuthenticated = (_b$1 = authSlice.selectors, _b$1.isAuthenticated), selectAccessToken = _b$1.selectAccessToken, selectRefreshToken = _b$1.selectRefreshToken, selectCurrentUser = _b$1.selectCurrentUser,
|
|
180
|
+
// selectUserCreating,
|
|
181
|
+
// selectUserCreatingDetails,
|
|
182
|
+
isVerifying = _b$1.isVerifying, getUserSession = _b$1.getUserSession, selectCurrentUserSub = _b$1.selectCurrentUserSub, selectCurrentUserRefreshToken = _b$1.selectCurrentUserRefreshToken, selectUserTokens = _b$1.selectUserTokens, selectUserSubscriptionStatus = _b$1.selectUserSubscriptionStatus, selectSubscription = _b$1.selectSubscription, selectSubscriptionPrice = _b$1.selectSubscriptionPrice;
|
|
168
183
|
authSlice.reducer;
|
|
169
184
|
|
|
170
185
|
// TODO: typing.
|
|
@@ -529,16 +544,16 @@ function formatChallenges(data) {
|
|
|
529
544
|
}
|
|
530
545
|
function formatChallengeDays(data) {
|
|
531
546
|
return data.map(function (item) {
|
|
532
|
-
var
|
|
547
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
533
548
|
return {
|
|
534
|
-
uuid: _source.uuid
|
|
535
|
-
title: _source.title
|
|
536
|
-
body: _source.body
|
|
537
|
-
image: _source.image
|
|
538
|
-
created: _source.created
|
|
539
|
-
updated: _source.updated
|
|
540
|
-
video: _source.video
|
|
541
|
-
workout: _source.workout
|
|
549
|
+
uuid: (_b = (_a = item === null || item === void 0 ? void 0 : item._source) === null || _a === void 0 ? void 0 : _a.uuid) === null || _b === void 0 ? void 0 : _b[0],
|
|
550
|
+
title: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.title) === null || _d === void 0 ? void 0 : _d[0],
|
|
551
|
+
body: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.body) === null || _f === void 0 ? void 0 : _f[0],
|
|
552
|
+
image: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.image) === null || _h === void 0 ? void 0 : _h[0],
|
|
553
|
+
created: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.created) === null || _k === void 0 ? void 0 : _k[0],
|
|
554
|
+
updated: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.updated) === null || _m === void 0 ? void 0 : _m[0],
|
|
555
|
+
video: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.video) === null || _p === void 0 ? void 0 : _p[0],
|
|
556
|
+
workout: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.workout) === null || _r === void 0 ? void 0 : _r[0],
|
|
542
557
|
};
|
|
543
558
|
});
|
|
544
559
|
}
|
|
@@ -562,38 +577,6 @@ function formatSecondsToISO8601Duration(seconds) {
|
|
|
562
577
|
}
|
|
563
578
|
return duration;
|
|
564
579
|
}
|
|
565
|
-
// export function formatAuthSession(session: any): User {
|
|
566
|
-
// console.log('formatAuthSession session', session);
|
|
567
|
-
// return {
|
|
568
|
-
// accessToken: session?.tokens?.accessToken.toString(),
|
|
569
|
-
// idToken: session?.tokens?.idToken?.toString(),
|
|
570
|
-
// refreshToken: undefined,
|
|
571
|
-
// accessTokenExpiry: session?.tokens?.idToken?.payload?.exp,
|
|
572
|
-
// expires: session?.tokens?.idToken?.payload?.exp,
|
|
573
|
-
// sub: session?.tokens?.idToken?.payload?.['cognito:username']?.toString(),
|
|
574
|
-
// details: {
|
|
575
|
-
// userEmail: session?.tokens?.idToken?.payload?.email?.toString(),
|
|
576
|
-
// firstName: session?.tokens?.idToken?.payload?.given_name?.toString(),
|
|
577
|
-
// lastName: session?.tokens?.idToken?.payload?.family_name?.toString(),
|
|
578
|
-
// dateOfBirth: session?.tokens?.idToken?.payload?.birthdate?.toString(),
|
|
579
|
-
// picture: session?.tokens?.idToken?.payload?.picture?.toString(),
|
|
580
|
-
// 'cognito:username':
|
|
581
|
-
// session?.tokens?.idToken?.payload?.['cognito:username']?.toString(),
|
|
582
|
-
// 'custom:termsAccepted':
|
|
583
|
-
// session?.tokens?.idToken?.payload?.['custom:termsAccepted']?.toString(),
|
|
584
|
-
// 'custom:subscriptionId':
|
|
585
|
-
// session?.tokens?.idToken?.payload?.[
|
|
586
|
-
// 'custom:subscriptionId'
|
|
587
|
-
// ]?.toString(),
|
|
588
|
-
// 'custom:contactPreferences':
|
|
589
|
-
// session?.tokens?.idToken?.payload?.[
|
|
590
|
-
// 'custom:contactPreferences'
|
|
591
|
-
// ]?.toString(),
|
|
592
|
-
// 'custom:customerId':
|
|
593
|
-
// session?.tokens?.idToken?.payload?.['custom:customerId']?.toString(),
|
|
594
|
-
// },
|
|
595
|
-
// };
|
|
596
|
-
// }
|
|
597
580
|
function formatAuthSession(session) {
|
|
598
581
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28;
|
|
599
582
|
return {
|
|
@@ -705,6 +688,7 @@ var authDataBaseQuery = fetchBaseQuery({
|
|
|
705
688
|
return [4 /*yield*/, Auth.currentSession()];
|
|
706
689
|
case 1:
|
|
707
690
|
session = _c.sent();
|
|
691
|
+
console.log('session: ', session);
|
|
708
692
|
idToken = session.getIdToken().getJwtToken();
|
|
709
693
|
accessToken = session.getAccessToken().getJwtToken();
|
|
710
694
|
if (accessToken && idToken) {
|
|
@@ -765,94 +749,79 @@ var authApi = createApi({
|
|
|
765
749
|
/**
|
|
766
750
|
* USER API.
|
|
767
751
|
*/
|
|
768
|
-
login: builder.query({
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
};
|
|
842
|
-
dispatch(setCredentials(creds));
|
|
843
|
-
return [3 /*break*/, 3];
|
|
844
|
-
case 2:
|
|
845
|
-
_h.sent();
|
|
846
|
-
// `onError` log out user.
|
|
847
|
-
dispatch(logout());
|
|
848
|
-
return [3 /*break*/, 3];
|
|
849
|
-
case 3: return [2 /*return*/];
|
|
850
|
-
}
|
|
851
|
-
});
|
|
852
|
-
});
|
|
853
|
-
},
|
|
854
|
-
providesTags: ['UserToken'],
|
|
855
|
-
}),
|
|
752
|
+
// login: builder.query<LoginResponse, LoginRequest>({
|
|
753
|
+
// query: (data) => ({
|
|
754
|
+
// url: '/user/login',
|
|
755
|
+
// method: 'POST',
|
|
756
|
+
// body: {
|
|
757
|
+
// email: data.email,
|
|
758
|
+
// password: data.password,
|
|
759
|
+
// },
|
|
760
|
+
// }),
|
|
761
|
+
// async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
|
762
|
+
// try {
|
|
763
|
+
// const response = await queryFulfilled;
|
|
764
|
+
// const decoded = jwtDecode(response?.data?.idToken);
|
|
765
|
+
// const profile = formatUserPayload(decoded as UserPayload);
|
|
766
|
+
// const creds = {
|
|
767
|
+
// accessToken: response?.data?.accessToken,
|
|
768
|
+
// idToken: response?.data?.idToken,
|
|
769
|
+
// refreshToken: response?.data?.refreshToken,
|
|
770
|
+
// accessTokenExpiry: response?.data?.accessTokenExpiry,
|
|
771
|
+
// details: { ...profile },
|
|
772
|
+
// };
|
|
773
|
+
// dispatch(setCredentials(creds));
|
|
774
|
+
// } catch (err) {
|
|
775
|
+
// // `onError` log out user.
|
|
776
|
+
// dispatch(logout());
|
|
777
|
+
// }
|
|
778
|
+
// },
|
|
779
|
+
// providesTags: ['UserToken'],
|
|
780
|
+
// }),
|
|
781
|
+
// refreshToken: builder.query<RefreshResponse, RefreshRequest>({
|
|
782
|
+
// query: (data) => ({
|
|
783
|
+
// url: '/user/refreshtoken',
|
|
784
|
+
// method: 'POST',
|
|
785
|
+
// body: {
|
|
786
|
+
// sub: data.sub,
|
|
787
|
+
// refreshtoken: data.refreshToken,
|
|
788
|
+
// },
|
|
789
|
+
// }),
|
|
790
|
+
// async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
|
791
|
+
// try {
|
|
792
|
+
// const response = await queryFulfilled;
|
|
793
|
+
// const decoded = jwtDecode(response?.data?.idToken);
|
|
794
|
+
// const profile = formatUserPayload(decoded as UserPayload);
|
|
795
|
+
// const creds = {
|
|
796
|
+
// accessToken: response?.data?.accessToken,
|
|
797
|
+
// idToken: response?.data?.idToken,
|
|
798
|
+
// refreshToken: response?.data?.refreshToken,
|
|
799
|
+
// accessTokenExpiry: response?.data?.accessTokenExpiry,
|
|
800
|
+
// details: { ...profile },
|
|
801
|
+
// };
|
|
802
|
+
// dispatch(setCredentials(creds));
|
|
803
|
+
// } catch (err) {
|
|
804
|
+
// // `onError` log out user.
|
|
805
|
+
// dispatch(logout());
|
|
806
|
+
// }
|
|
807
|
+
// },
|
|
808
|
+
// providesTags: ['UserToken'],
|
|
809
|
+
// }),
|
|
810
|
+
// logout: builder.query<LogoutResponse, void>({
|
|
811
|
+
// query: () => ({
|
|
812
|
+
// url: '/user/logout',
|
|
813
|
+
// method: 'POST',
|
|
814
|
+
// }),
|
|
815
|
+
// async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
|
816
|
+
// try {
|
|
817
|
+
// await queryFulfilled;
|
|
818
|
+
// dispatch(logout());
|
|
819
|
+
// } catch (err) {
|
|
820
|
+
// // `onError` log out user.
|
|
821
|
+
// dispatch(logout());
|
|
822
|
+
// }
|
|
823
|
+
// },
|
|
824
|
+
// }),
|
|
856
825
|
resetPassword: builder.mutation({
|
|
857
826
|
query: function (data) { return ({
|
|
858
827
|
url: '/user/password/reset',
|
|
@@ -867,7 +836,7 @@ var authApi = createApi({
|
|
|
867
836
|
}),
|
|
868
837
|
resetPasswordAuth: builder.mutation({
|
|
869
838
|
query: function (data) { return ({
|
|
870
|
-
url: '/user/password/reset',
|
|
839
|
+
url: '/user/password/reset-auth',
|
|
871
840
|
method: 'POST',
|
|
872
841
|
body: {
|
|
873
842
|
email: data.email,
|
|
@@ -885,34 +854,6 @@ var authApi = createApi({
|
|
|
885
854
|
},
|
|
886
855
|
}); },
|
|
887
856
|
}),
|
|
888
|
-
logout: builder.query({
|
|
889
|
-
query: function () { return ({
|
|
890
|
-
url: '/user/logout',
|
|
891
|
-
method: 'POST',
|
|
892
|
-
}); },
|
|
893
|
-
onQueryStarted: function (arg_1, _a) {
|
|
894
|
-
return __awaiter(this, arguments, void 0, function (arg, _b) {
|
|
895
|
-
var dispatch = _b.dispatch, queryFulfilled = _b.queryFulfilled;
|
|
896
|
-
return __generator(this, function (_c) {
|
|
897
|
-
switch (_c.label) {
|
|
898
|
-
case 0:
|
|
899
|
-
_c.trys.push([0, 2, , 3]);
|
|
900
|
-
return [4 /*yield*/, queryFulfilled];
|
|
901
|
-
case 1:
|
|
902
|
-
_c.sent();
|
|
903
|
-
dispatch(logout());
|
|
904
|
-
return [3 /*break*/, 3];
|
|
905
|
-
case 2:
|
|
906
|
-
_c.sent();
|
|
907
|
-
// `onError` log out user.
|
|
908
|
-
dispatch(logout());
|
|
909
|
-
return [3 /*break*/, 3];
|
|
910
|
-
case 3: return [2 /*return*/];
|
|
911
|
-
}
|
|
912
|
-
});
|
|
913
|
-
});
|
|
914
|
-
},
|
|
915
|
-
}),
|
|
916
857
|
register: builder.mutation({
|
|
917
858
|
query: function (data) { return ({
|
|
918
859
|
url: '/user/register',
|
|
@@ -921,7 +862,7 @@ var authApi = createApi({
|
|
|
921
862
|
}); },
|
|
922
863
|
onQueryStarted: function (arg_1, _a) {
|
|
923
864
|
return __awaiter(this, arguments, void 0, function (arg, _b) {
|
|
924
|
-
var
|
|
865
|
+
var err_1;
|
|
925
866
|
var dispatch = _b.dispatch, queryFulfilled = _b.queryFulfilled;
|
|
926
867
|
return __generator(this, function (_c) {
|
|
927
868
|
switch (_c.label) {
|
|
@@ -933,8 +874,8 @@ var authApi = createApi({
|
|
|
933
874
|
dispatch(resetCreating());
|
|
934
875
|
return [3 /*break*/, 3];
|
|
935
876
|
case 2:
|
|
936
|
-
|
|
937
|
-
console.error('REGISTER: ',
|
|
877
|
+
err_1 = _c.sent();
|
|
878
|
+
console.error('REGISTER: ', err_1);
|
|
938
879
|
return [3 /*break*/, 3];
|
|
939
880
|
case 3: return [2 /*return*/];
|
|
940
881
|
}
|
|
@@ -1031,7 +972,14 @@ var authApi = createApi({
|
|
|
1031
972
|
}); },
|
|
1032
973
|
});
|
|
1033
974
|
// Export hooks for usage in functional components.
|
|
1034
|
-
var
|
|
975
|
+
var // useLoginQuery,
|
|
976
|
+
// useLazyLoginQuery,
|
|
977
|
+
// useRefreshTokenQuery,
|
|
978
|
+
// useLazyRefreshTokenQuery,
|
|
979
|
+
// useLogoutQuery,
|
|
980
|
+
// useLazyLogoutQuery,
|
|
981
|
+
useResetPasswordMutation = authApi.useResetPasswordMutation, // Use this for mobile app.
|
|
982
|
+
useResetPasswordAuthMutation = authApi.useResetPasswordAuthMutation, useRegisterMutation = authApi.useRegisterMutation, useVerifyUserQuery = authApi.useVerifyUserQuery, useLazyVerifyUserQuery = authApi.useLazyVerifyUserQuery, useGetUserInfoQuery = authApi.useGetUserInfoQuery, useLazyGetUserInfoQuery = authApi.useLazyGetUserInfoQuery, useUpdateUserInfoMutation = authApi.useUpdateUserInfoMutation, useForgottenPasswordMutation = authApi.useForgottenPasswordMutation, useVerifyUserAttributesQuery = authApi.useVerifyUserAttributesQuery, useLazyVerifyUserAttributesQuery = authApi.useLazyVerifyUserAttributesQuery, useVerifyUserResendQuery = authApi.useVerifyUserResendQuery, useLazyVerifyUserResendQuery = authApi.useLazyVerifyUserResendQuery, useUpdateUserMutation = authApi.useUpdateUserMutation;
|
|
1035
983
|
|
|
1036
984
|
var contentApi = createApi({
|
|
1037
985
|
reducerPath: 'contentApi',
|
|
@@ -1115,8 +1063,8 @@ var paymentApi = createApi({
|
|
|
1115
1063
|
}); },
|
|
1116
1064
|
credentials: 'include',
|
|
1117
1065
|
}),
|
|
1118
|
-
tagTypes: ['UserSubscription'],
|
|
1119
|
-
keepUnusedDataFor: 300,
|
|
1066
|
+
tagTypes: ['UserSubscription', 'Plans'],
|
|
1067
|
+
// keepUnusedDataFor: 300,
|
|
1120
1068
|
endpoints: function (builder) { return ({
|
|
1121
1069
|
/**
|
|
1122
1070
|
* USER API.
|
|
@@ -1133,10 +1081,14 @@ var paymentApi = createApi({
|
|
|
1133
1081
|
}); },
|
|
1134
1082
|
providesTags: ['UserSubscription'],
|
|
1135
1083
|
}),
|
|
1084
|
+
getPaymentPlans: builder.query({
|
|
1085
|
+
query: function () { return '/payment/plans'; },
|
|
1086
|
+
providesTags: ['Plans'],
|
|
1087
|
+
}),
|
|
1136
1088
|
}); },
|
|
1137
1089
|
});
|
|
1138
1090
|
// Export hooks for usage in functional components.
|
|
1139
|
-
paymentApi.useCheckUserSubscriptionQuery; paymentApi.useLazyCheckUserSubscriptionQuery;
|
|
1091
|
+
paymentApi.useCheckUserSubscriptionQuery; paymentApi.useLazyCheckUserSubscriptionQuery; paymentApi.useGetPaymentPlansQuery; paymentApi.useLazyGetPaymentPlansQuery;
|
|
1140
1092
|
|
|
1141
1093
|
var useLoggedIn = function () {
|
|
1142
1094
|
var isLoggedIn = useSelector(isAuthenticated);
|
|
@@ -1178,16 +1130,19 @@ var rootReducer = combineSlices(authSlice, authApi, contentApi, paymentApi);
|
|
|
1178
1130
|
// }
|
|
1179
1131
|
// eg. ['auth', 'creating'], or an empty array if you don't want to whitelist any.
|
|
1180
1132
|
// const storageWhiteList: string[] = [];
|
|
1133
|
+
var storageBlackList = [];
|
|
1181
1134
|
// `makeStore` encapsulates the store configuration to allow
|
|
1182
1135
|
// creating unique store instances, which is particularly important for
|
|
1183
1136
|
// server-side rendering (SSR) scenarios. In SSR, separate store instances
|
|
1184
1137
|
// are needed for each request to prevent cross-request state pollution.
|
|
1185
1138
|
var makeNativeStore = function () {
|
|
1186
1139
|
var storage = require('@react-native-async-storage/async-storage').default;
|
|
1140
|
+
storageBlackList.push(paymentApi.reducerPath);
|
|
1187
1141
|
var persistConfig = {
|
|
1188
1142
|
key: 'root',
|
|
1189
1143
|
storage: storage,
|
|
1190
1144
|
// whitelist: storageWhiteList,
|
|
1145
|
+
blacklist: storageBlackList,
|
|
1191
1146
|
};
|
|
1192
1147
|
var middlewares = [
|
|
1193
1148
|
authApi.middleware,
|
|
@@ -1230,10 +1185,15 @@ var makeNativeStore = function () {
|
|
|
1230
1185
|
};
|
|
1231
1186
|
var makeWebStore = function () {
|
|
1232
1187
|
var storage = createPersistStorage();
|
|
1188
|
+
// if (process.env.NEXT_PUBLIC_STORE_BLACKLIST) {
|
|
1189
|
+
// storageBlackList.push(process.env.NEXT_PUBLIC_STORE_BLACKLIST);
|
|
1190
|
+
// }
|
|
1191
|
+
storageBlackList.push(paymentApi.reducerPath);
|
|
1233
1192
|
var persistConfig = {
|
|
1234
1193
|
key: 'root',
|
|
1235
1194
|
storage: storage,
|
|
1236
1195
|
// whitelist: storageWhiteList,
|
|
1196
|
+
blacklist: storageBlackList,
|
|
1237
1197
|
};
|
|
1238
1198
|
var middlewares = [
|
|
1239
1199
|
authApi.middleware,
|
|
@@ -1265,5 +1225,5 @@ var makeWebStore = function () {
|
|
|
1265
1225
|
var nativeStore = !isWeb && makeNativeStore();
|
|
1266
1226
|
var webStore = isWeb && makeWebStore();
|
|
1267
1227
|
|
|
1268
|
-
export { authApi, authSlice, contentApi, formatAuthSession, formatChallengeDays, formatChallenges, formatFaqs, formatFedaratedSession, formatGuests, formatLongform, formatPages, formatPress, formatPromos, formatSchedule, formatSecondsToISO8601Duration, formatSections, formatSeries, formatSettings, formatShortform, formatSocialAuthSession, formatUserPayload, formatVideos, formatWorkout, getUserSession, isAuthenticated, isVerifying, logout, nativeStore, paymentApi, resetCreating, selectAccessToken, selectCurrentUser, selectCurrentUserRefreshToken, selectCurrentUserSub, selectRefreshToken, selectSubscription, selectSubscriptionPrice,
|
|
1228
|
+
export { authApi, authSlice, contentApi, formatAuthSession, formatChallengeDays, formatChallenges, formatFaqs, formatFedaratedSession, formatGuests, formatLongform, formatPages, formatPress, formatPromos, formatSchedule, formatSecondsToISO8601Duration, formatSections, formatSeries, formatSettings, formatShortform, formatSocialAuthSession, formatUserPayload, formatVideos, formatWorkout, getUserSession, isAuthenticated, isVerifying, logout, nativeStore, paymentApi, resetCreating, selectAccessToken, selectCurrentUser, selectCurrentUserRefreshToken, selectCurrentUserSub, selectRefreshToken, selectSubscription, selectSubscriptionPrice, selectUserSubscriptionStatus, selectUserTokens, setCredentials, updateSubscription, useAppDispatch, useAppSelector, useAppStore, useForgottenPasswordMutation, useGetUserInfoQuery, useLazyGetUserInfoQuery, useLazyVerifyUserAttributesQuery, useLazyVerifyUserQuery, useLazyVerifyUserResendQuery, useLoggedIn, useRegisterMutation, useResetPasswordAuthMutation, useResetPasswordMutation, useUpdateUserInfoMutation, useUpdateUserMutation, useVerifyUserAttributesQuery, useVerifyUserQuery, useVerifyUserResendQuery, webStore };
|
|
1269
1229
|
//# sourceMappingURL=index.esm.js.map
|