@techstuff-dev/foundation-api-utils 1.27.0 → 1.28.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/README.md +2 -0
- package/dist/@types/lib/api/index.d.ts +1 -0
- package/dist/@types/lib/hooks/index.d.ts +12 -0
- package/dist/@types/lib/services/auth/index.d.ts +0 -3
- package/dist/@types/lib/services/content/content.interfaces.d.ts +3 -2
- package/dist/@types/lib/services/index.d.ts +1 -0
- package/dist/@types/lib/services/orders/index.d.ts +269 -0
- package/dist/@types/lib/store/index.d.ts +30 -0
- package/dist/@types/lib/utils/helpers/index.d.ts +1 -0
- package/dist/index.esm.js +149 -109
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +149 -108
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -171,6 +171,32 @@ var setCredentials = (_a$2 = authSlice.actions, _a$2.setCredentials), resetCreat
|
|
|
171
171
|
var isAuthenticated = (_b$2 = authSlice.selectors, _b$2.isAuthenticated), selectAccessToken = _b$2.selectAccessToken, selectRefreshToken = _b$2.selectRefreshToken, selectCurrentUser = _b$2.selectCurrentUser, isVerifying = _b$2.isVerifying, getUserSession = _b$2.getUserSession, selectCurrentUserSub = _b$2.selectCurrentUserSub, selectCurrentUserRefreshToken = _b$2.selectCurrentUserRefreshToken, selectUserTokens = _b$2.selectUserTokens, selectUserSubscriptionStatus = _b$2.selectUserSubscriptionStatus, selectSubscription = _b$2.selectSubscription, selectSubscriptionPrice = _b$2.selectSubscriptionPrice;
|
|
172
172
|
authSlice.reducer;
|
|
173
173
|
|
|
174
|
+
function applyCoupon(coupon, netTotal) {
|
|
175
|
+
var discountedAmount = netTotal * (Number(coupon.discount) / 100);
|
|
176
|
+
var discountedTotal = netTotal - discountedAmount;
|
|
177
|
+
var data = __assign(__assign({}, coupon), { discountedTotal: discountedTotal, discountedAmount: discountedAmount });
|
|
178
|
+
return data;
|
|
179
|
+
}
|
|
180
|
+
function applyTax(taxRate, netTotal) {
|
|
181
|
+
var taxAmount = netTotal * (taxRate.percentage / 100);
|
|
182
|
+
return taxAmount;
|
|
183
|
+
}
|
|
184
|
+
function toCamelCaseObject(obj) {
|
|
185
|
+
var toCamelCase = function (str) {
|
|
186
|
+
return str.replace(/([-_][a-z])/gi, function (match) {
|
|
187
|
+
return match.toUpperCase().replace(/[-_]/, '');
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
var camelCaseObject = {};
|
|
191
|
+
for (var key in obj) {
|
|
192
|
+
if (obj.hasOwnProperty(key)) {
|
|
193
|
+
var camelKey = toCamelCase(key);
|
|
194
|
+
camelCaseObject[camelKey] = obj[key];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return camelCaseObject;
|
|
198
|
+
}
|
|
199
|
+
|
|
174
200
|
// TODO: typing.
|
|
175
201
|
var formatUserPayload = function (payload) {
|
|
176
202
|
var userEmail = payload.email, firstName = payload.given_name, lastName = payload.family_name, dateOfBirth = payload.birthdate, picture = payload.picture, uuid = payload["cognito:username"], termsAccepted = payload["custom:termsAccepted"], subscriptionId = payload["custom:subscriptionId"], contactPreference = payload["custom:contactPreferences"], customerId = payload["custom:customerId"];
|
|
@@ -591,7 +617,7 @@ function formatAuthSession(session) {
|
|
|
591
617
|
};
|
|
592
618
|
}
|
|
593
619
|
function formatFedaratedSession(session) {
|
|
594
|
-
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;
|
|
620
|
+
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;
|
|
595
621
|
return {
|
|
596
622
|
accessToken: (_a = session === null || session === void 0 ? void 0 : session.accessToken) === null || _a === void 0 ? void 0 : _a.jwtToken,
|
|
597
623
|
idToken: (_b = session === null || session === void 0 ? void 0 : session.idToken) === null || _b === void 0 ? void 0 : _b.jwtToken,
|
|
@@ -610,6 +636,7 @@ function formatFedaratedSession(session) {
|
|
|
610
636
|
'custom:contactPreferences': (_0 = (_z = session === null || session === void 0 ? void 0 : session.idToken) === null || _z === void 0 ? void 0 : _z.payload) === null || _0 === void 0 ? void 0 : _0['custom:contactPreferences'],
|
|
611
637
|
'custom:customerId': (_2 = (_1 = session === null || session === void 0 ? void 0 : session.idToken) === null || _1 === void 0 ? void 0 : _1.payload) === null || _2 === void 0 ? void 0 : _2['custom:customerId'],
|
|
612
638
|
picture: (_4 = (_3 = session === null || session === void 0 ? void 0 : session.idToken) === null || _3 === void 0 ? void 0 : _3.payload) === null || _4 === void 0 ? void 0 : _4.picture,
|
|
639
|
+
id: toCamelCaseObject((_5 = session === null || session === void 0 ? void 0 : session.idToken) === null || _5 === void 0 ? void 0 : _5.payload),
|
|
613
640
|
},
|
|
614
641
|
};
|
|
615
642
|
}
|
|
@@ -795,7 +822,7 @@ var formatMediaItem = function (data) {
|
|
|
795
822
|
});
|
|
796
823
|
};
|
|
797
824
|
|
|
798
|
-
var _a$1, _b$1, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
825
|
+
var _a$1, _b$1, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
799
826
|
// Render the store based on the environment.
|
|
800
827
|
var isWeb = process.env.NEXT_PUBLIC_WEB_APP;
|
|
801
828
|
var ENV = isWeb ? process.env : require('react-native-config').default;
|
|
@@ -805,35 +832,40 @@ var ENV = isWeb ? process.env : require('react-native-config').default;
|
|
|
805
832
|
var API_AUTH_PREFIX = ((_b$1 = process.env) === null || _b$1 === void 0 ? void 0 : _b$1.NEXT_PUBLIC_API_AUTH_PREFIX) || ENV.API_AUTH_PREFIX;
|
|
806
833
|
// Payments specific API
|
|
807
834
|
var API_PAYMENTS_PREFIX = ((_c = process.env) === null || _c === void 0 ? void 0 : _c.NEXT_PUBLIC_API_PAYMENTS_PREFIX) || ENV.API_PAYMENTS_PREFIX;
|
|
808
|
-
|
|
809
|
-
var
|
|
810
|
-
|
|
811
|
-
((
|
|
835
|
+
// Orders specific API
|
|
836
|
+
var API_ORDERS_PREFIX = ((_d = process.env) === null || _d === void 0 ? void 0 : _d.NEXT_PUBLIC_API_ORDERS_PREFIX) || ENV.API_ORDERS_PREFIX;
|
|
837
|
+
((_e = process.env) === null || _e === void 0 ? void 0 : _e.NEXT_PUBLIC_APP_BASE_URL) || ENV.APP_BASE_URL;
|
|
838
|
+
var APP_ES_INSTANCE = ((_f = process.env) === null || _f === void 0 ? void 0 : _f.NEXT_PUBLIC_APP_ES_INSTANCE) || ENV.APP_ES_INSTANCE;
|
|
839
|
+
var APP_ES_AUTH = ((_g = process.env) === null || _g === void 0 ? void 0 : _g.NEXT_PUBLIC_APP_ES_AUTH) || ENV.APP_ES_AUTH;
|
|
840
|
+
((_h = process.env) === null || _h === void 0 ? void 0 : _h.NEXT_PUBLIC_APP_ES_PROMO_PANEL_INDEX) ||
|
|
812
841
|
ENV.APP_ES_PROMO_PANEL_INDEX;
|
|
813
|
-
((
|
|
814
|
-
((
|
|
815
|
-
((
|
|
816
|
-
((
|
|
817
|
-
((
|
|
818
|
-
((
|
|
819
|
-
((
|
|
820
|
-
((
|
|
821
|
-
((
|
|
822
|
-
((
|
|
842
|
+
((_j = process.env) === null || _j === void 0 ? void 0 : _j.NEXT_PUBLIC_APP_ES_FAQ_INDEX) || ENV.APP_ES_FAQ_INDEX;
|
|
843
|
+
((_k = process.env) === null || _k === void 0 ? void 0 : _k.NEXT_PUBLIC_APP_ES_PAGES_INDEX) || ENV.APP_ES_PAGES_INDEX;
|
|
844
|
+
((_l = process.env) === null || _l === void 0 ? void 0 : _l.NEXT_PUBLIC_APP_ES_SETTINGS_INDEX) || ENV.APP_ES_SETTINGS_INDEX;
|
|
845
|
+
((_m = process.env) === null || _m === void 0 ? void 0 : _m.NEXT_PUBLIC_APP_ES_PRESS_INDEX) || ENV.APP_ES_PRESS_INDEX;
|
|
846
|
+
((_o = process.env) === null || _o === void 0 ? void 0 : _o.NEXT_PUBLIC_APP_ES_GUESTS_INDEX) || ENV.APP_ES_GUESTS_INDEX;
|
|
847
|
+
((_p = process.env) === null || _p === void 0 ? void 0 : _p.NEXT_PUBLIC_APP_ES_VIDEOS_INDEX) || ENV.APP_ES_VIDEOS_INDEX;
|
|
848
|
+
((_q = process.env) === null || _q === void 0 ? void 0 : _q.NEXT_PUBLIC_APP_ES_SECTIONS_INDEX) || ENV.APP_ES_SECTIONS_INDEX;
|
|
849
|
+
((_r = process.env) === null || _r === void 0 ? void 0 : _r.NEXT_PUBLIC_APP_ES_WORKOUTS_INDEX) || ENV.APP_ES_WORKOUTS_INDEX;
|
|
850
|
+
((_s = process.env) === null || _s === void 0 ? void 0 : _s.NEXT_PUBLIC_APP_ES_SCHEDULE_INDEX) || ENV.APP_ES_SCHEDULE_INDEX;
|
|
851
|
+
((_t = process.env) === null || _t === void 0 ? void 0 : _t.NEXT_PUBLIC_APP_ES_CHALLENGES_INDEX) ||
|
|
823
852
|
ENV.APP_ES_CHALLENGES_INDEX;
|
|
824
|
-
((
|
|
853
|
+
((_u = process.env) === null || _u === void 0 ? void 0 : _u.NEXT_PUBLIC_APP_ES_CHALLENGE_DAYS_INDEX) ||
|
|
825
854
|
ENV.APP_ES_CHALLENGE_DAYS_INDEX;
|
|
826
855
|
|
|
827
856
|
var authDataBaseQuery = fetchBaseQuery({
|
|
828
857
|
baseUrl: API_AUTH_PREFIX,
|
|
829
858
|
prepareHeaders: function (headers_1, _a) { return __awaiter(void 0, [headers_1, _a], void 0, function (headers, _b) {
|
|
830
|
-
var session, idToken, accessToken;
|
|
859
|
+
var session, idToken, accessToken, error_1;
|
|
831
860
|
return __generator(this, function (_c) {
|
|
832
861
|
switch (_c.label) {
|
|
833
862
|
case 0:
|
|
834
863
|
headers.set('Content-Type', 'application/json');
|
|
835
|
-
|
|
864
|
+
_c.label = 1;
|
|
836
865
|
case 1:
|
|
866
|
+
_c.trys.push([1, 3, , 4]);
|
|
867
|
+
return [4 /*yield*/, Auth.currentSession()];
|
|
868
|
+
case 2:
|
|
837
869
|
session = _c.sent();
|
|
838
870
|
idToken = session.getIdToken().getJwtToken();
|
|
839
871
|
accessToken = session.getAccessToken().getJwtToken();
|
|
@@ -843,6 +875,11 @@ var authDataBaseQuery = fetchBaseQuery({
|
|
|
843
875
|
// headers.set('refreshtoken', tokens.refreshToken);
|
|
844
876
|
}
|
|
845
877
|
return [2 /*return*/, headers];
|
|
878
|
+
case 3:
|
|
879
|
+
error_1 = _c.sent();
|
|
880
|
+
console.error('authDataBaseQuery: ', error_1);
|
|
881
|
+
return [2 /*return*/, headers];
|
|
882
|
+
case 4: return [2 /*return*/];
|
|
846
883
|
}
|
|
847
884
|
});
|
|
848
885
|
}); },
|
|
@@ -859,6 +896,7 @@ var authDataBaseQueryWithReauth = function (args, api, extraOptions) { return __
|
|
|
859
896
|
case 0: return [4 /*yield*/, authDataBaseQuery(args, api, extraOptions)];
|
|
860
897
|
case 1:
|
|
861
898
|
result = _b.sent();
|
|
899
|
+
console.log('authDataBaseQueryWithReauth: ', result);
|
|
862
900
|
if (!(((_a = result === null || result === void 0 ? void 0 : result.error) === null || _a === void 0 ? void 0 : _a.status) === 401)) return [3 /*break*/, 6];
|
|
863
901
|
return [4 /*yield*/, Auth.currentAuthenticatedUser({
|
|
864
902
|
bypassCache: true, // Ensures that the user is refreshed from the server
|
|
@@ -892,82 +930,6 @@ var authApi = createApi({
|
|
|
892
930
|
tagTypes: ['UserToken', 'UserData'],
|
|
893
931
|
// keepUnusedDataFor: 300,
|
|
894
932
|
endpoints: function (builder) { return ({
|
|
895
|
-
/**
|
|
896
|
-
* USER API.
|
|
897
|
-
*/
|
|
898
|
-
// login: builder.query<LoginResponse, LoginRequest>({
|
|
899
|
-
// query: (data) => ({
|
|
900
|
-
// url: '/user/login',
|
|
901
|
-
// method: 'POST',
|
|
902
|
-
// body: {
|
|
903
|
-
// email: data.email,
|
|
904
|
-
// password: data.password,
|
|
905
|
-
// },
|
|
906
|
-
// }),
|
|
907
|
-
// async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
|
908
|
-
// try {
|
|
909
|
-
// const response = await queryFulfilled;
|
|
910
|
-
// const decoded = jwtDecode(response?.data?.idToken);
|
|
911
|
-
// const profile = formatUserPayload(decoded as UserPayload);
|
|
912
|
-
// const creds = {
|
|
913
|
-
// accessToken: response?.data?.accessToken,
|
|
914
|
-
// idToken: response?.data?.idToken,
|
|
915
|
-
// refreshToken: response?.data?.refreshToken,
|
|
916
|
-
// accessTokenExpiry: response?.data?.accessTokenExpiry,
|
|
917
|
-
// details: { ...profile },
|
|
918
|
-
// };
|
|
919
|
-
// dispatch(setCredentials(creds));
|
|
920
|
-
// } catch (err) {
|
|
921
|
-
// // `onError` log out user.
|
|
922
|
-
// dispatch(logout());
|
|
923
|
-
// }
|
|
924
|
-
// },
|
|
925
|
-
// providesTags: ['UserToken'],
|
|
926
|
-
// }),
|
|
927
|
-
// refreshToken: builder.query<RefreshResponse, RefreshRequest>({
|
|
928
|
-
// query: (data) => ({
|
|
929
|
-
// url: '/user/refreshtoken',
|
|
930
|
-
// method: 'POST',
|
|
931
|
-
// body: {
|
|
932
|
-
// sub: data.sub,
|
|
933
|
-
// refreshtoken: data.refreshToken,
|
|
934
|
-
// },
|
|
935
|
-
// }),
|
|
936
|
-
// async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
|
937
|
-
// try {
|
|
938
|
-
// const response = await queryFulfilled;
|
|
939
|
-
// const decoded = jwtDecode(response?.data?.idToken);
|
|
940
|
-
// const profile = formatUserPayload(decoded as UserPayload);
|
|
941
|
-
// const creds = {
|
|
942
|
-
// accessToken: response?.data?.accessToken,
|
|
943
|
-
// idToken: response?.data?.idToken,
|
|
944
|
-
// refreshToken: response?.data?.refreshToken,
|
|
945
|
-
// accessTokenExpiry: response?.data?.accessTokenExpiry,
|
|
946
|
-
// details: { ...profile },
|
|
947
|
-
// };
|
|
948
|
-
// dispatch(setCredentials(creds));
|
|
949
|
-
// } catch (err) {
|
|
950
|
-
// // `onError` log out user.
|
|
951
|
-
// dispatch(logout());
|
|
952
|
-
// }
|
|
953
|
-
// },
|
|
954
|
-
// providesTags: ['UserToken'],
|
|
955
|
-
// }),
|
|
956
|
-
// logout: builder.query<LogoutResponse, void>({
|
|
957
|
-
// query: () => ({
|
|
958
|
-
// url: '/user/logout',
|
|
959
|
-
// method: 'POST',
|
|
960
|
-
// }),
|
|
961
|
-
// async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
|
962
|
-
// try {
|
|
963
|
-
// await queryFulfilled;
|
|
964
|
-
// dispatch(logout());
|
|
965
|
-
// } catch (err) {
|
|
966
|
-
// // `onError` log out user.
|
|
967
|
-
// dispatch(logout());
|
|
968
|
-
// }
|
|
969
|
-
// },
|
|
970
|
-
// }),
|
|
971
933
|
resetPassword: builder.mutation({
|
|
972
934
|
query: function (data) { return ({
|
|
973
935
|
url: '/user/password/reset',
|
|
@@ -1250,16 +1212,92 @@ var paymentApi = createApi({
|
|
|
1250
1212
|
// Export hooks for usage in functional components.
|
|
1251
1213
|
paymentApi.useCheckUserSubscriptionQuery; paymentApi.useLazyCheckUserSubscriptionQuery; paymentApi.useGetPaymentPlansQuery; paymentApi.useLazyGetPaymentPlansQuery; paymentApi.useGetTaxRatesQuery; paymentApi.useLazyGetTaxRatesQuery; paymentApi.useCheckPromoCodeQuery; paymentApi.useLazyCheckPromoCodeQuery;
|
|
1252
1214
|
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1215
|
+
var dataBaseQuery = fetchBaseQuery({
|
|
1216
|
+
baseUrl: API_ORDERS_PREFIX,
|
|
1217
|
+
prepareHeaders: function (headers_1, _a) { return __awaiter(void 0, [headers_1, _a], void 0, function (headers, _b) {
|
|
1218
|
+
var session, idToken, accessToken;
|
|
1219
|
+
return __generator(this, function (_c) {
|
|
1220
|
+
switch (_c.label) {
|
|
1221
|
+
case 0:
|
|
1222
|
+
headers.set('Content-Type', 'application/json');
|
|
1223
|
+
return [4 /*yield*/, Auth.currentSession()];
|
|
1224
|
+
case 1:
|
|
1225
|
+
session = _c.sent();
|
|
1226
|
+
console.log('session', session);
|
|
1227
|
+
idToken = session.getIdToken().getJwtToken();
|
|
1228
|
+
accessToken = session.getAccessToken().getJwtToken();
|
|
1229
|
+
if (accessToken && idToken) {
|
|
1230
|
+
headers.set('accesstoken', accessToken);
|
|
1231
|
+
headers.set('idtoken', idToken);
|
|
1232
|
+
// headers.set('refreshtoken', tokens.refreshToken);
|
|
1233
|
+
}
|
|
1234
|
+
return [2 /*return*/, headers];
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
}); },
|
|
1238
|
+
credentials: 'include',
|
|
1239
|
+
});
|
|
1240
|
+
/**
|
|
1241
|
+
* This function is used to retry a request if we get a 401 error.
|
|
1242
|
+
*/
|
|
1243
|
+
var dataBaseQueryWithReauth = function (args, api, extraOptions) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1244
|
+
var result, authSession, user;
|
|
1245
|
+
var _a;
|
|
1246
|
+
return __generator(this, function (_b) {
|
|
1247
|
+
switch (_b.label) {
|
|
1248
|
+
case 0: return [4 /*yield*/, dataBaseQuery(args, api, extraOptions)];
|
|
1249
|
+
case 1:
|
|
1250
|
+
result = _b.sent();
|
|
1251
|
+
console.log('result', result);
|
|
1252
|
+
if (!(((_a = result === null || result === void 0 ? void 0 : result.error) === null || _a === void 0 ? void 0 : _a.status) === 401)) return [3 /*break*/, 6];
|
|
1253
|
+
return [4 /*yield*/, Auth.currentAuthenticatedUser({
|
|
1254
|
+
bypassCache: true, // Ensures that the user is refreshed from the server
|
|
1255
|
+
})];
|
|
1256
|
+
case 2:
|
|
1257
|
+
authSession = _b.sent();
|
|
1258
|
+
user = formatAuthSession(authSession);
|
|
1259
|
+
api.dispatch(setCredentials(user));
|
|
1260
|
+
if (!(authSession === null || authSession === void 0 ? void 0 : authSession.tokens)) return [3 /*break*/, 4];
|
|
1261
|
+
return [4 /*yield*/, dataBaseQuery(args, api, extraOptions)];
|
|
1262
|
+
case 3:
|
|
1263
|
+
// If we get a new access token, retry the original request.
|
|
1264
|
+
result = _b.sent();
|
|
1265
|
+
return [3 /*break*/, 6];
|
|
1266
|
+
case 4:
|
|
1267
|
+
// TODO; require full data reset?
|
|
1268
|
+
return [4 /*yield*/, Auth.signOut()];
|
|
1269
|
+
case 5:
|
|
1270
|
+
// TODO; require full data reset?
|
|
1271
|
+
_b.sent();
|
|
1272
|
+
api.dispatch(logout());
|
|
1273
|
+
// If no access token throw error.
|
|
1274
|
+
throw new Error('No access token found');
|
|
1275
|
+
case 6: return [2 /*return*/, result];
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1278
|
+
}); };
|
|
1279
|
+
var ordersApi = createApi({
|
|
1280
|
+
reducerPath: 'ordersApi',
|
|
1281
|
+
baseQuery: dataBaseQueryWithReauth,
|
|
1282
|
+
tagTypes: ['Orders'],
|
|
1283
|
+
// keepUnusedDataFor: 300,
|
|
1284
|
+
endpoints: function (builder) { return ({
|
|
1285
|
+
/**
|
|
1286
|
+
* USER API.
|
|
1287
|
+
*/
|
|
1288
|
+
fetchOrders: builder.query({
|
|
1289
|
+
query: function (ids) { return ({
|
|
1290
|
+
url: '/order/search',
|
|
1291
|
+
method: 'POST',
|
|
1292
|
+
body: {
|
|
1293
|
+
ids: ids,
|
|
1294
|
+
},
|
|
1295
|
+
}); },
|
|
1296
|
+
}),
|
|
1297
|
+
}); },
|
|
1298
|
+
});
|
|
1299
|
+
// Export hooks for usage in functional components.
|
|
1300
|
+
ordersApi.useFetchOrdersQuery; ordersApi.useLazyFetchOrdersQuery;
|
|
1263
1301
|
|
|
1264
1302
|
var _a, _b;
|
|
1265
1303
|
var initialState = {
|
|
@@ -1411,7 +1449,7 @@ function createPersistStorage() {
|
|
|
1411
1449
|
}
|
|
1412
1450
|
|
|
1413
1451
|
// Infer the `RootState` type from the root reducer
|
|
1414
|
-
var rootReducer = combineSlices(cartSlice, authSlice, authApi, contentApi, paymentApi);
|
|
1452
|
+
var rootReducer = combineSlices(cartSlice, authSlice, authApi, contentApi, paymentApi, ordersApi);
|
|
1415
1453
|
// eg. ['auth', 'creating'], or an empty array if you don't want to whitelist any.
|
|
1416
1454
|
// const storageWhiteList: string[] = [];
|
|
1417
1455
|
var storageBlackList = [];
|
|
@@ -1421,7 +1459,7 @@ var storageBlackList = [];
|
|
|
1421
1459
|
// are needed for each request to prevent cross-request state pollution.
|
|
1422
1460
|
var makeNativeStore = function () {
|
|
1423
1461
|
var storage = require('@react-native-async-storage/async-storage').default;
|
|
1424
|
-
storageBlackList.push(paymentApi.reducerPath, authApi.reducerPath, contentApi.reducerPath);
|
|
1462
|
+
storageBlackList.push(paymentApi.reducerPath, authApi.reducerPath, contentApi.reducerPath, ordersApi.reducerPath);
|
|
1425
1463
|
var persistConfig = {
|
|
1426
1464
|
key: 'root',
|
|
1427
1465
|
storage: storage,
|
|
@@ -1432,6 +1470,7 @@ var makeNativeStore = function () {
|
|
|
1432
1470
|
authApi.middleware,
|
|
1433
1471
|
contentApi.middleware,
|
|
1434
1472
|
paymentApi.middleware,
|
|
1473
|
+
ordersApi.middleware,
|
|
1435
1474
|
];
|
|
1436
1475
|
// `combineSlices` automatically combines the reducers using
|
|
1437
1476
|
// their `reducerPath`s, therefore we no longer need to call `combineReducers`.
|
|
@@ -1469,7 +1508,7 @@ var makeNativeStore = function () {
|
|
|
1469
1508
|
};
|
|
1470
1509
|
var makeWebStore = function () {
|
|
1471
1510
|
var storage = createPersistStorage();
|
|
1472
|
-
storageBlackList.push(paymentApi.reducerPath, authApi.reducerPath, contentApi.reducerPath);
|
|
1511
|
+
storageBlackList.push(paymentApi.reducerPath, authApi.reducerPath, contentApi.reducerPath, ordersApi.reducerPath);
|
|
1473
1512
|
var persistConfig = {
|
|
1474
1513
|
key: 'root',
|
|
1475
1514
|
storage: storage,
|
|
@@ -1480,6 +1519,7 @@ var makeWebStore = function () {
|
|
|
1480
1519
|
authApi.middleware,
|
|
1481
1520
|
contentApi.middleware,
|
|
1482
1521
|
paymentApi.middleware,
|
|
1522
|
+
ordersApi.middleware,
|
|
1483
1523
|
];
|
|
1484
1524
|
// `combineSlices` automatically combines the reducers using
|
|
1485
1525
|
// their `reducerPath`s, therefore we no longer need to call `combineReducers`.
|
|
@@ -1506,5 +1546,5 @@ var makeWebStore = function () {
|
|
|
1506
1546
|
var nativeStore = !isWeb && makeNativeStore();
|
|
1507
1547
|
var webStore = isWeb && makeWebStore();
|
|
1508
1548
|
|
|
1509
|
-
export { addToCart, authApi, authSlice, cartSlice, contentApi, emptyCart, formatAuthSession, formatChallengeDays, formatChallenges, formatConfig, formatFaqs, formatFedaratedSession, formatGuests, formatLongform, formatMediaItem, formatPages, formatPress, formatPromos, formatSchedule, formatSeasons, formatSecondsToISO8601Duration, formatSectionItems, formatSectionPanels, formatSections, formatSeries, formatSettings, formatShortform, formatSocialAuthSession, formatTaxonomies, formatUserPayload, formatVideos, formatWorkout, getUserSession, isAuthenticated, isVerifying, logout, nativeStore, paymentApi, removeFromCart, removePromoCode, resetCreating, resetTaxRate, selectAccessToken, selectCartCount, selectCartItems, selectCartItemsIds, selectCartNetTotal, selectCartStatus, selectCartTaxAmount, selectCartTaxRate, selectCartTotal, selectCurrentUser, selectCurrentUserRefreshToken, selectCurrentUserSub, selectMediaInCart, selectPromoCode, selectRefreshToken, selectSubscription, selectSubscriptionPrice, selectUserSubscriptionStatus, selectUserTokens, setCredentials, setPromoCode, setTaxRate, toggleCart, updateCart, updateSubscription, useAppDispatch, useAppSelector, useAppStore, useForgottenPasswordMutation, useGetUserInfoQuery, useLazyGetUserInfoQuery, useLazyVerifyUserAttributesQuery, useLazyVerifyUserQuery, useLazyVerifyUserResendQuery, useLoggedIn, useRegisterMutation, useResetPasswordAuthMutation, useResetPasswordMutation, useUpdateUserInfoMutation, useUpdateUserMutation, useVerifyUserAttributesQuery, useVerifyUserQuery, useVerifyUserResendQuery, webStore };
|
|
1549
|
+
export { addToCart, authApi, authSlice, cartSlice, contentApi, emptyCart, formatAuthSession, formatChallengeDays, formatChallenges, formatConfig, formatFaqs, formatFedaratedSession, formatGuests, formatLongform, formatMediaItem, formatPages, formatPress, formatPromos, formatSchedule, formatSeasons, formatSecondsToISO8601Duration, formatSectionItems, formatSectionPanels, formatSections, formatSeries, formatSettings, formatShortform, formatSocialAuthSession, formatTaxonomies, formatUserPayload, formatVideos, formatWorkout, getUserSession, isAuthenticated, isVerifying, logout, nativeStore, ordersApi, paymentApi, removeFromCart, removePromoCode, resetCreating, resetTaxRate, selectAccessToken, selectCartCount, selectCartItems, selectCartItemsIds, selectCartNetTotal, selectCartStatus, selectCartTaxAmount, selectCartTaxRate, selectCartTotal, selectCurrentUser, selectCurrentUserRefreshToken, selectCurrentUserSub, selectMediaInCart, selectPromoCode, selectRefreshToken, selectSubscription, selectSubscriptionPrice, selectUserSubscriptionStatus, selectUserTokens, setCredentials, setPromoCode, setTaxRate, toggleCart, updateCart, updateSubscription, useAppDispatch, useAppSelector, useAppStore, useForgottenPasswordMutation, useGetUserInfoQuery, useLazyGetUserInfoQuery, useLazyVerifyUserAttributesQuery, useLazyVerifyUserQuery, useLazyVerifyUserResendQuery, useLoggedIn, useRegisterMutation, useResetPasswordAuthMutation, useResetPasswordMutation, useUpdateUserInfoMutation, useUpdateUserMutation, useVerifyUserAttributesQuery, useVerifyUserQuery, useVerifyUserResendQuery, webStore };
|
|
1510
1550
|
//# sourceMappingURL=index.esm.js.map
|