@techstuff-dev/foundation-api-utils 1.10.0 → 1.12.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/dist/@types/lib/hooks/index.d.ts +12 -0
- package/dist/@types/lib/services/auth/slice.d.ts +268 -55
- package/dist/@types/lib/services/index.d.ts +2 -0
- package/dist/@types/lib/services/payment/index.d.ts +8 -0
- package/dist/@types/lib/store/index.d.ts +30 -0
- package/dist/@types/lib/types/index.interfaces.d.ts +195 -22
- package/dist/index.esm.js +119 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +138 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -21,23 +21,89 @@ export type User = {
|
|
|
21
21
|
accessTokenExpiry: number | null;
|
|
22
22
|
details: UserDetails;
|
|
23
23
|
email: string;
|
|
24
|
-
info
|
|
24
|
+
info?: Info;
|
|
25
25
|
};
|
|
26
26
|
export type UserDetails = {
|
|
27
27
|
userSub: string;
|
|
28
28
|
uuid?: string;
|
|
29
|
+
subscription?: string;
|
|
29
30
|
subscriptionDetails?: {
|
|
31
|
+
id: string;
|
|
32
|
+
created: number;
|
|
30
33
|
status: string;
|
|
34
|
+
nextPayment: number;
|
|
35
|
+
amount: number;
|
|
36
|
+
interval: string;
|
|
37
|
+
currency: string;
|
|
38
|
+
cancelAt: string;
|
|
39
|
+
planID: string;
|
|
40
|
+
planDescription: string;
|
|
41
|
+
paymentDetails: {
|
|
42
|
+
response: {
|
|
43
|
+
id: string;
|
|
44
|
+
object: string;
|
|
45
|
+
allow_redisplay: string;
|
|
46
|
+
billing_details: {
|
|
47
|
+
address: {
|
|
48
|
+
city: null;
|
|
49
|
+
country: null;
|
|
50
|
+
line1: null;
|
|
51
|
+
line2: null;
|
|
52
|
+
postal_code: null;
|
|
53
|
+
state: null;
|
|
54
|
+
};
|
|
55
|
+
email: null;
|
|
56
|
+
name: string;
|
|
57
|
+
phone: null;
|
|
58
|
+
};
|
|
59
|
+
card: {
|
|
60
|
+
brand: string;
|
|
61
|
+
checks: {
|
|
62
|
+
address_line1_check: null;
|
|
63
|
+
address_postal_code_check: null;
|
|
64
|
+
cvc_check: string;
|
|
65
|
+
};
|
|
66
|
+
country: string;
|
|
67
|
+
display_brand: string;
|
|
68
|
+
exp_month: number;
|
|
69
|
+
exp_year: number;
|
|
70
|
+
fingerprint: string;
|
|
71
|
+
funding: string;
|
|
72
|
+
generated_from: null;
|
|
73
|
+
last4: string;
|
|
74
|
+
networks: {
|
|
75
|
+
available: string[];
|
|
76
|
+
preferred: null;
|
|
77
|
+
};
|
|
78
|
+
three_d_secure_usage: {
|
|
79
|
+
supported: boolean;
|
|
80
|
+
};
|
|
81
|
+
wallet: null;
|
|
82
|
+
};
|
|
83
|
+
created: number;
|
|
84
|
+
customer: string;
|
|
85
|
+
livemode: boolean;
|
|
86
|
+
metadata: {};
|
|
87
|
+
type: string;
|
|
88
|
+
};
|
|
89
|
+
formatted: {
|
|
90
|
+
id: string;
|
|
91
|
+
maskedNumber: string;
|
|
92
|
+
expirationDate: string;
|
|
93
|
+
cardType: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
31
96
|
};
|
|
32
97
|
firstName?: string;
|
|
33
98
|
lastName?: string;
|
|
34
99
|
userEmail?: string;
|
|
100
|
+
avatar?: string;
|
|
35
101
|
termsAccepted?: string;
|
|
36
102
|
dateOfBirth?: string;
|
|
37
103
|
contactPreference: boolean;
|
|
38
104
|
password?: string;
|
|
39
105
|
passwordConfirm?: string;
|
|
40
|
-
agency
|
|
106
|
+
agency?: boolean;
|
|
41
107
|
};
|
|
42
108
|
export type Info = {
|
|
43
109
|
orders?: string[];
|
|
@@ -91,26 +157,7 @@ export interface VerifyUserResponse {
|
|
|
91
157
|
export interface AuthState {
|
|
92
158
|
authenticated: boolean;
|
|
93
159
|
verifying: boolean;
|
|
94
|
-
user:
|
|
95
|
-
accessToken: string;
|
|
96
|
-
idToken: string;
|
|
97
|
-
refreshToken: string;
|
|
98
|
-
accessTokenExpiry?: number;
|
|
99
|
-
details: {
|
|
100
|
-
subscriptionDetails?: any;
|
|
101
|
-
userSub?: string;
|
|
102
|
-
userEmail?: string;
|
|
103
|
-
lastName?: string;
|
|
104
|
-
firstName?: string;
|
|
105
|
-
dateOfBirth?: string;
|
|
106
|
-
termsAccepted: any;
|
|
107
|
-
contactPreference: any;
|
|
108
|
-
uuid?: string;
|
|
109
|
-
subscription?: any;
|
|
110
|
-
customerId?: string;
|
|
111
|
-
};
|
|
112
|
-
email?: string;
|
|
113
|
-
};
|
|
160
|
+
user: User;
|
|
114
161
|
creating: {
|
|
115
162
|
details: string;
|
|
116
163
|
payment: string;
|
|
@@ -187,8 +234,134 @@ export interface UpdateUserRequest {
|
|
|
187
234
|
lastName: string;
|
|
188
235
|
termsAccepted: string;
|
|
189
236
|
userEmail: string;
|
|
237
|
+
avatar?: string;
|
|
190
238
|
uuid: string;
|
|
191
239
|
}
|
|
192
240
|
export interface UpdateUserResponse {
|
|
193
241
|
results: string;
|
|
194
242
|
}
|
|
243
|
+
export interface UserSubRequest {
|
|
244
|
+
id: string;
|
|
245
|
+
email: string;
|
|
246
|
+
sub: string;
|
|
247
|
+
}
|
|
248
|
+
export interface UserSubResponse {
|
|
249
|
+
response: {
|
|
250
|
+
id: string;
|
|
251
|
+
object: string;
|
|
252
|
+
address: null;
|
|
253
|
+
balance: number;
|
|
254
|
+
created: number;
|
|
255
|
+
currency: string;
|
|
256
|
+
default_currency: string;
|
|
257
|
+
default_source: null;
|
|
258
|
+
delinquent: boolean;
|
|
259
|
+
description: null;
|
|
260
|
+
discount: null;
|
|
261
|
+
email: string;
|
|
262
|
+
invoice_prefix: string;
|
|
263
|
+
invoice_settings: {
|
|
264
|
+
custom_fields: null;
|
|
265
|
+
default_payment_method: string;
|
|
266
|
+
footer: null;
|
|
267
|
+
rendering_options: null;
|
|
268
|
+
};
|
|
269
|
+
livemode: boolean;
|
|
270
|
+
metadata: {};
|
|
271
|
+
name: string;
|
|
272
|
+
phone: null;
|
|
273
|
+
preferred_locales: [];
|
|
274
|
+
shipping: null;
|
|
275
|
+
sources: {
|
|
276
|
+
object: string;
|
|
277
|
+
data: [];
|
|
278
|
+
has_more: boolean;
|
|
279
|
+
total_count: number;
|
|
280
|
+
url: string;
|
|
281
|
+
};
|
|
282
|
+
subscriptions: {
|
|
283
|
+
object: string;
|
|
284
|
+
data: [];
|
|
285
|
+
has_more: boolean;
|
|
286
|
+
total_count: number;
|
|
287
|
+
url: string;
|
|
288
|
+
};
|
|
289
|
+
tax_exempt: string;
|
|
290
|
+
tax_ids: {
|
|
291
|
+
object: string;
|
|
292
|
+
data: [];
|
|
293
|
+
has_more: boolean;
|
|
294
|
+
total_count: number;
|
|
295
|
+
url: string;
|
|
296
|
+
};
|
|
297
|
+
test_clock: null;
|
|
298
|
+
};
|
|
299
|
+
customerId: string;
|
|
300
|
+
subscription: {
|
|
301
|
+
amount: number;
|
|
302
|
+
cancelAt: null;
|
|
303
|
+
created: number;
|
|
304
|
+
currency: string;
|
|
305
|
+
id: string;
|
|
306
|
+
interval: string;
|
|
307
|
+
nextPayment: number;
|
|
308
|
+
planDescription: string;
|
|
309
|
+
planID: string;
|
|
310
|
+
status: string;
|
|
311
|
+
};
|
|
312
|
+
payment: {
|
|
313
|
+
response: {
|
|
314
|
+
id: string;
|
|
315
|
+
object: string;
|
|
316
|
+
allow_redisplay: string;
|
|
317
|
+
billing_details: {
|
|
318
|
+
address: {
|
|
319
|
+
city: null;
|
|
320
|
+
country: null;
|
|
321
|
+
line1: null;
|
|
322
|
+
line2: null;
|
|
323
|
+
postal_code: null;
|
|
324
|
+
state: null;
|
|
325
|
+
};
|
|
326
|
+
email: null;
|
|
327
|
+
name: string;
|
|
328
|
+
phone: null;
|
|
329
|
+
};
|
|
330
|
+
card: {
|
|
331
|
+
brand: string;
|
|
332
|
+
checks: {
|
|
333
|
+
address_line1_check: null;
|
|
334
|
+
address_postal_code_check: null;
|
|
335
|
+
cvc_check: string;
|
|
336
|
+
};
|
|
337
|
+
country: string;
|
|
338
|
+
display_brand: string;
|
|
339
|
+
exp_month: number;
|
|
340
|
+
exp_year: number;
|
|
341
|
+
fingerprint: string;
|
|
342
|
+
funding: string;
|
|
343
|
+
generated_from: null;
|
|
344
|
+
last4: string;
|
|
345
|
+
networks: {
|
|
346
|
+
available: string[];
|
|
347
|
+
preferred: null;
|
|
348
|
+
};
|
|
349
|
+
three_d_secure_usage: {
|
|
350
|
+
supported: boolean;
|
|
351
|
+
};
|
|
352
|
+
wallet: null;
|
|
353
|
+
};
|
|
354
|
+
created: number;
|
|
355
|
+
customer: string;
|
|
356
|
+
livemode: boolean;
|
|
357
|
+
metadata: {};
|
|
358
|
+
type: string;
|
|
359
|
+
};
|
|
360
|
+
formatted: {
|
|
361
|
+
id: string;
|
|
362
|
+
maskedNumber: string;
|
|
363
|
+
expirationDate: string;
|
|
364
|
+
cardType: string;
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
}
|
package/dist/index.esm.js
CHANGED
|
@@ -85,9 +85,8 @@ var initialState = {
|
|
|
85
85
|
details: {
|
|
86
86
|
userSub: '',
|
|
87
87
|
uuid: '',
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
},
|
|
88
|
+
subscription: '',
|
|
89
|
+
subscriptionDetails: undefined,
|
|
91
90
|
firstName: '',
|
|
92
91
|
lastName: '',
|
|
93
92
|
userEmail: '',
|
|
@@ -97,7 +96,7 @@ var initialState = {
|
|
|
97
96
|
},
|
|
98
97
|
accessToken: '',
|
|
99
98
|
idToken: '',
|
|
100
|
-
accessTokenExpiry:
|
|
99
|
+
accessTokenExpiry: null,
|
|
101
100
|
refreshToken: '',
|
|
102
101
|
email: '',
|
|
103
102
|
},
|
|
@@ -114,7 +113,7 @@ var authSlice = createSlice({
|
|
|
114
113
|
initialState: initialState,
|
|
115
114
|
reducers: {
|
|
116
115
|
setCredentials: function (state, data) {
|
|
117
|
-
return __assign(__assign({}, state), { session: data.payload.accessToken, authenticated: true, verifying: true, user: data.payload });
|
|
116
|
+
return __assign(__assign({}, state), { session: data.payload.accessToken, authenticated: true, verifying: true, user: __assign(__assign({}, state.user), data.payload) });
|
|
118
117
|
},
|
|
119
118
|
resetCreating: function (state) {
|
|
120
119
|
return __assign(__assign({}, state), { creating: {
|
|
@@ -122,6 +121,9 @@ var authSlice = createSlice({
|
|
|
122
121
|
payment: '',
|
|
123
122
|
} });
|
|
124
123
|
},
|
|
124
|
+
updateSubscription: function (state, data) {
|
|
125
|
+
return __assign(__assign({}, state), { user: __assign(__assign({}, state.user), { details: __assign(__assign({}, state.user.details), { subscription: data.payload.subscription, subscriptionDetails: data.payload.subscriptionDetails }) }) });
|
|
126
|
+
},
|
|
125
127
|
logout: function () { return initialState; },
|
|
126
128
|
},
|
|
127
129
|
selectors: {
|
|
@@ -135,12 +137,30 @@ var authSlice = createSlice({
|
|
|
135
137
|
getUserSession: function (auth) { return (auth.authenticated ? auth.session : false); },
|
|
136
138
|
selectCurrentUserSub: function (auth) { return auth.user.details.uuid; },
|
|
137
139
|
selectCurrentUserRefreshToken: function (auth) { return auth.user.refreshToken; },
|
|
140
|
+
selectUserTokens: function (auth) {
|
|
141
|
+
return {
|
|
142
|
+
accessToken: auth.user.accessToken,
|
|
143
|
+
refreshToken: auth.user.refreshToken,
|
|
144
|
+
idToken: auth.user.idToken,
|
|
145
|
+
};
|
|
146
|
+
},
|
|
147
|
+
selectUserSubscriptionStatus: function (auth) {
|
|
148
|
+
var _a;
|
|
149
|
+
return (_a = auth.user.details.subscriptionDetails) === null || _a === void 0 ? void 0 : _a.status;
|
|
150
|
+
},
|
|
151
|
+
selectSubscription: function (auth) {
|
|
152
|
+
return auth.user.details.subscriptionDetails;
|
|
153
|
+
},
|
|
154
|
+
selectSubscriptionPrice: function (auth) {
|
|
155
|
+
var _a;
|
|
156
|
+
return (_a = auth.user.details.subscriptionDetails) === null || _a === void 0 ? void 0 : _a.amount;
|
|
157
|
+
},
|
|
138
158
|
},
|
|
139
159
|
});
|
|
140
160
|
// Action creators are generated for each case reducer function.
|
|
141
|
-
var setCredentials = (_a$1 = authSlice.actions, _a$1.setCredentials), resetCreating = _a$1.resetCreating, logout = _a$1.logout;
|
|
161
|
+
var setCredentials = (_a$1 = authSlice.actions, _a$1.setCredentials), resetCreating = _a$1.resetCreating, logout = _a$1.logout, updateSubscription = _a$1.updateSubscription;
|
|
142
162
|
// Selectors returned by `slice.selectors` take the root state as their first argument.
|
|
143
|
-
var isAuthenticated = (_b$1 = authSlice.selectors, _b$1.isAuthenticated)
|
|
163
|
+
var isAuthenticated = (_b$1 = authSlice.selectors, _b$1.isAuthenticated), selectAccessToken = _b$1.selectAccessToken, selectRefreshToken = _b$1.selectRefreshToken, selectCurrentUser = _b$1.selectCurrentUser, selectUserCreating = _b$1.selectUserCreating, selectUserCreatingDetails = _b$1.selectUserCreatingDetails, 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;
|
|
144
164
|
authSlice.reducer;
|
|
145
165
|
|
|
146
166
|
// TODO: typing.
|
|
@@ -530,11 +550,11 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
|
530
550
|
var isWeb = process.env.NEXT_PUBLIC_WEB_APP;
|
|
531
551
|
var ENV = isWeb ? process.env : require('react-native-config').default;
|
|
532
552
|
// export const ENV = process.env;
|
|
533
|
-
|
|
553
|
+
((_a = process.env) === null || _a === void 0 ? void 0 : _a.NEXT_PUBLIC_API_PREFIX) || ENV.API_PREFIX;
|
|
534
554
|
// Auth specific API
|
|
535
555
|
var API_AUTH_PREFIX = ((_b = process.env) === null || _b === void 0 ? void 0 : _b.NEXT_PUBLIC_API_AUTH_PREFIX) || ENV.API_AUTH_PREFIX;
|
|
536
556
|
// Payments specific API
|
|
537
|
-
((_c = process.env) === null || _c === void 0 ? void 0 : _c.NEXT_PUBLIC_API_PAYMENTS_PREFIX) || ENV.API_PAYMENTS_PREFIX;
|
|
557
|
+
var API_PAYMENTS_PREFIX = ((_c = process.env) === null || _c === void 0 ? void 0 : _c.NEXT_PUBLIC_API_PAYMENTS_PREFIX) || ENV.API_PAYMENTS_PREFIX;
|
|
538
558
|
((_d = process.env) === null || _d === void 0 ? void 0 : _d.NEXT_PUBLIC_APP_BASE_URL) || ENV.APP_BASE_URL;
|
|
539
559
|
var APP_ES_INSTANCE = ((_e = process.env) === null || _e === void 0 ? void 0 : _e.NEXT_PUBLIC_APP_ES_INSTANCE) || ENV.APP_ES_INSTANCE;
|
|
540
560
|
var APP_ES_AUTH = ((_f = process.env) === null || _f === void 0 ? void 0 : _f.NEXT_PUBLIC_APP_ES_AUTH) || ENV.APP_ES_AUTH;
|
|
@@ -557,8 +577,19 @@ var APP_ES_AUTH = ((_f = process.env) === null || _f === void 0 ? void 0 : _f.NE
|
|
|
557
577
|
var authApi = createApi({
|
|
558
578
|
reducerPath: 'authApi',
|
|
559
579
|
baseQuery: fetchBaseQuery({
|
|
560
|
-
baseUrl:
|
|
561
|
-
prepareHeaders: function (headers) {
|
|
580
|
+
baseUrl: API_AUTH_PREFIX,
|
|
581
|
+
prepareHeaders: function (headers, _a) {
|
|
582
|
+
var getState = _a.getState;
|
|
583
|
+
var state = getState();
|
|
584
|
+
headers.set('Content-Type', 'application/json');
|
|
585
|
+
// add accessToken to headers from slice using selectAccessToken selector
|
|
586
|
+
var tokens = selectUserTokens(state);
|
|
587
|
+
console.log('tokens: ', tokens);
|
|
588
|
+
if (tokens) {
|
|
589
|
+
headers.set('accesstoken', tokens.accessToken);
|
|
590
|
+
headers.set('idtoken', tokens.idToken);
|
|
591
|
+
headers.set('refreshtoken', tokens.refreshToken);
|
|
592
|
+
}
|
|
562
593
|
return headers;
|
|
563
594
|
},
|
|
564
595
|
credentials: 'include',
|
|
@@ -811,7 +842,7 @@ var authApi = createApi({
|
|
|
811
842
|
}),
|
|
812
843
|
getUserInfo: builder.query({
|
|
813
844
|
query: function (uuid) { return ({
|
|
814
|
-
url: "/user/".concat(uuid),
|
|
845
|
+
url: "/data/user/".concat(uuid),
|
|
815
846
|
method: 'GET',
|
|
816
847
|
}); },
|
|
817
848
|
}),
|
|
@@ -927,6 +958,68 @@ contentApi.useGetDataQuery; contentApi.useLazyGetDataQuery;
|
|
|
927
958
|
// useLazyGetWorkoutsQuery,
|
|
928
959
|
contentApi.useGetWorkoutByIdQuery; contentApi.useLazyGetWorkoutByIdQuery;
|
|
929
960
|
|
|
961
|
+
console.log('API_PAYMENTS_PREFIX: ', API_PAYMENTS_PREFIX);
|
|
962
|
+
var paymentApi = createApi({
|
|
963
|
+
reducerPath: 'paymentApi',
|
|
964
|
+
baseQuery: fetchBaseQuery({
|
|
965
|
+
baseUrl: API_PAYMENTS_PREFIX,
|
|
966
|
+
prepareHeaders: function (headers, _a) {
|
|
967
|
+
var getState = _a.getState;
|
|
968
|
+
var state = getState();
|
|
969
|
+
headers.set('Content-Type', 'application/json');
|
|
970
|
+
// add accessToken to headers from slice using selectAccessToken selector
|
|
971
|
+
var tokens = selectUserTokens(state);
|
|
972
|
+
console.log('tokens: ', tokens);
|
|
973
|
+
if (tokens) {
|
|
974
|
+
headers.set('accesstoken', tokens.accessToken);
|
|
975
|
+
headers.set('idtoken', tokens.idToken);
|
|
976
|
+
headers.set('refreshtoken', tokens.refreshToken);
|
|
977
|
+
}
|
|
978
|
+
return headers;
|
|
979
|
+
},
|
|
980
|
+
credentials: 'include',
|
|
981
|
+
}),
|
|
982
|
+
tagTypes: ['UserSubscription'],
|
|
983
|
+
keepUnusedDataFor: 300,
|
|
984
|
+
endpoints: function (builder) { return ({
|
|
985
|
+
/**
|
|
986
|
+
* USER API.
|
|
987
|
+
*/
|
|
988
|
+
checkUserSubscription: builder.query({
|
|
989
|
+
query: function (data) { return ({
|
|
990
|
+
url: '/payment/subscriber',
|
|
991
|
+
method: 'POST',
|
|
992
|
+
body: {
|
|
993
|
+
id: data.id,
|
|
994
|
+
email: data.email,
|
|
995
|
+
sub: data.sub,
|
|
996
|
+
},
|
|
997
|
+
}); },
|
|
998
|
+
// async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
|
999
|
+
// try {
|
|
1000
|
+
// const response = await queryFulfilled;
|
|
1001
|
+
// const decoded = jwtDecode(response?.data?.idToken);
|
|
1002
|
+
// const profile = formatUserPayload(decoded as UserPayload);
|
|
1003
|
+
// const creds = {
|
|
1004
|
+
// accessToken: response?.data?.accessToken,
|
|
1005
|
+
// idToken: response?.data?.idToken,
|
|
1006
|
+
// refreshToken: response?.data?.refreshToken,
|
|
1007
|
+
// accessTokenExpiry: response?.data?.accessTokenExpiry,
|
|
1008
|
+
// details: { ...profile },
|
|
1009
|
+
// };
|
|
1010
|
+
// dispatch(setCredentials(creds));
|
|
1011
|
+
// } catch (err) {
|
|
1012
|
+
// // `onError` log out user.
|
|
1013
|
+
// dispatch(logout());
|
|
1014
|
+
// }
|
|
1015
|
+
// },
|
|
1016
|
+
providesTags: ['UserSubscription'],
|
|
1017
|
+
}),
|
|
1018
|
+
}); },
|
|
1019
|
+
});
|
|
1020
|
+
// Export hooks for usage in functional components.
|
|
1021
|
+
paymentApi.useCheckUserSubscriptionQuery; paymentApi.useLazyCheckUserSubscriptionQuery;
|
|
1022
|
+
|
|
930
1023
|
var useLoggedIn = function () {
|
|
931
1024
|
var isLoggedIn = useSelector(isAuthenticated);
|
|
932
1025
|
return useMemo(function () { return isLoggedIn; }, [isLoggedIn]);
|
|
@@ -958,7 +1051,7 @@ function createPersistStorage() {
|
|
|
958
1051
|
}
|
|
959
1052
|
|
|
960
1053
|
// Infer the `RootState` type from the root reducer
|
|
961
|
-
var rootReducer = combineSlices(authSlice, authApi, contentApi);
|
|
1054
|
+
var rootReducer = combineSlices(authSlice, authApi, contentApi, paymentApi);
|
|
962
1055
|
// eg. ['auth', 'creating'], or an empty array if you don't want to whitelist any.
|
|
963
1056
|
// const storageWhiteList: string[] = [];
|
|
964
1057
|
// `makeStore` encapsulates the store configuration to allow
|
|
@@ -972,13 +1065,18 @@ var makeNativeStore = function () {
|
|
|
972
1065
|
storage: storage,
|
|
973
1066
|
// whitelist: storageWhiteList,
|
|
974
1067
|
};
|
|
975
|
-
var middlewares = [
|
|
1068
|
+
var middlewares = [
|
|
1069
|
+
authApi.middleware,
|
|
1070
|
+
contentApi.middleware,
|
|
1071
|
+
paymentApi.middleware,
|
|
1072
|
+
];
|
|
976
1073
|
// `combineSlices` automatically combines the reducers using
|
|
977
1074
|
// their `reducerPath`s, therefore we no longer need to call `combineReducers`.
|
|
978
1075
|
var persistedReducer = persistReducer(persistConfig, rootReducer);
|
|
979
1076
|
var customEnhancers = [];
|
|
980
1077
|
// Make sure compilation stops in next.js web app.
|
|
981
|
-
if (!process.env.NEXT_PUBLIC_WEB_APP &&
|
|
1078
|
+
if (!process.env.NEXT_PUBLIC_WEB_APP &&
|
|
1079
|
+
process.env.NODE_ENV === 'development') {
|
|
982
1080
|
var Reactotron = require('reactotron-react-native').default;
|
|
983
1081
|
var reactotronRedux = require('reactotron-redux').reactotronRedux;
|
|
984
1082
|
var reactotron = Reactotron.configure({ name: 'nrgAtHome' })
|
|
@@ -1013,7 +1111,11 @@ var makeWebStore = function () {
|
|
|
1013
1111
|
storage: storage,
|
|
1014
1112
|
// whitelist: storageWhiteList,
|
|
1015
1113
|
};
|
|
1016
|
-
var middlewares = [
|
|
1114
|
+
var middlewares = [
|
|
1115
|
+
authApi.middleware,
|
|
1116
|
+
contentApi.middleware,
|
|
1117
|
+
paymentApi.middleware,
|
|
1118
|
+
];
|
|
1017
1119
|
// `combineSlices` automatically combines the reducers using
|
|
1018
1120
|
// their `reducerPath`s, therefore we no longer need to call `combineReducers`.
|
|
1019
1121
|
var persistedReducer = persistReducer(persistConfig, rootReducer);
|
|
@@ -1039,5 +1141,5 @@ var makeWebStore = function () {
|
|
|
1039
1141
|
var nativeStore = !isWeb && makeNativeStore();
|
|
1040
1142
|
var webStore = isWeb && makeWebStore();
|
|
1041
1143
|
|
|
1042
|
-
export { authApi, contentApi, formatChallengeDays, formatChallenges, formatFaqs, formatGuests, formatLongform, formatPages, formatPress, formatPromos, formatSchedule, formatSections, formatSeries, formatSettings, formatShortform, formatUserPayload, formatVideos, formatWorkout, nativeStore, useAppDispatch, useAppSelector, useAppStore, useLoggedIn, webStore };
|
|
1144
|
+
export { authApi, authSlice, contentApi, formatChallengeDays, formatChallenges, formatFaqs, formatGuests, formatLongform, formatPages, formatPress, formatPromos, formatSchedule, formatSections, formatSeries, formatSettings, formatShortform, formatUserPayload, formatVideos, formatWorkout, getUserSession, isAuthenticated, isVerifying, logout, nativeStore, paymentApi, resetCreating, selectAccessToken, selectCurrentUser, selectCurrentUserRefreshToken, selectCurrentUserSub, selectRefreshToken, selectSubscription, selectSubscriptionPrice, selectUserCreating, selectUserCreatingDetails, selectUserSubscriptionStatus, selectUserTokens, setCredentials, updateSubscription, useAppDispatch, useAppSelector, useAppStore, useLoggedIn, webStore };
|
|
1043
1145
|
//# sourceMappingURL=index.esm.js.map
|