@techstuff-dev/foundation-api-utils 1.13.0 → 1.14.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 +60 -60
- package/dist/@types/lib/services/auth/index.d.ts +15 -15
- package/dist/@types/lib/services/auth/slice.d.ts +4 -4
- package/dist/@types/lib/services/content/content.interfaces.d.ts +60 -20
- package/dist/@types/lib/services/content/index.d.ts +2 -2
- package/dist/@types/lib/services/index.d.ts +1 -0
- package/dist/@types/lib/store/index.d.ts +150 -150
- package/dist/@types/lib/types/index.interfaces.d.ts +2 -2
- package/dist/@types/lib/utils/dataFormat/index.d.ts +13 -49
- package/dist/index.esm.js +63 -75
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +83 -74
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ export type User = {
|
|
|
23
23
|
details?: UserDetails;
|
|
24
24
|
email?: string;
|
|
25
25
|
info?: Info;
|
|
26
|
-
sub
|
|
26
|
+
sub: string;
|
|
27
27
|
};
|
|
28
28
|
export type UserDetails = {
|
|
29
29
|
userSub?: string;
|
|
@@ -160,7 +160,7 @@ export interface LogoutResponse {
|
|
|
160
160
|
export interface UpdateUserInfoRequest {
|
|
161
161
|
sub: string;
|
|
162
162
|
expressions: {
|
|
163
|
-
|
|
163
|
+
[key: string]: {
|
|
164
164
|
KEY: string;
|
|
165
165
|
VALUE: any[];
|
|
166
166
|
};
|
|
@@ -51,7 +51,7 @@ export declare function formatLongform(data: ESLongForm[]): {
|
|
|
51
51
|
image_promo_large: string | undefined;
|
|
52
52
|
image_poster: string | undefined;
|
|
53
53
|
summary: string | undefined;
|
|
54
|
-
created:
|
|
54
|
+
created: number | undefined;
|
|
55
55
|
updated: string | undefined;
|
|
56
56
|
video: string | undefined;
|
|
57
57
|
rating: string | undefined;
|
|
@@ -69,23 +69,14 @@ export declare function formatFaqs(data: ESFaq[]): {
|
|
|
69
69
|
id: string | undefined;
|
|
70
70
|
title: string | undefined;
|
|
71
71
|
answer: string | undefined;
|
|
72
|
-
created:
|
|
73
|
-
updated:
|
|
74
|
-
}[];
|
|
75
|
-
export declare function formatPages(data: ESPage[]): {
|
|
76
|
-
uuid: string | undefined;
|
|
77
|
-
id: string | undefined;
|
|
78
|
-
title: string | undefined;
|
|
79
|
-
body: string | undefined;
|
|
80
|
-
created: string | undefined;
|
|
81
|
-
updated: string | undefined;
|
|
82
|
-
langcode: string | undefined;
|
|
83
|
-
url: string | undefined;
|
|
72
|
+
created: number | undefined;
|
|
73
|
+
updated: number | undefined;
|
|
84
74
|
}[];
|
|
75
|
+
export declare function formatPages(data: ESPage[]): Page[];
|
|
85
76
|
export declare function formatSettings(data: ESSetting[]): {
|
|
86
77
|
uuid: string | undefined;
|
|
87
|
-
created:
|
|
88
|
-
updated:
|
|
78
|
+
created: number | undefined;
|
|
79
|
+
updated: number | undefined;
|
|
89
80
|
status: string | undefined;
|
|
90
81
|
type: string | undefined;
|
|
91
82
|
video: string | undefined;
|
|
@@ -95,8 +86,8 @@ export declare function formatSettings(data: ESSetting[]): {
|
|
|
95
86
|
}[];
|
|
96
87
|
export declare function formatPress(data: ESPress[]): {
|
|
97
88
|
uuid: string | undefined;
|
|
98
|
-
created:
|
|
99
|
-
updated:
|
|
89
|
+
created: number | undefined;
|
|
90
|
+
updated: number | undefined;
|
|
100
91
|
image: string | undefined;
|
|
101
92
|
title: string | undefined;
|
|
102
93
|
}[];
|
|
@@ -104,41 +95,14 @@ export declare function formatGuests(data: ESGuest[]): {
|
|
|
104
95
|
uuid: string | undefined;
|
|
105
96
|
id: string | undefined;
|
|
106
97
|
title: string | undefined;
|
|
107
|
-
updated:
|
|
98
|
+
updated: number | undefined;
|
|
108
99
|
description: string | undefined;
|
|
109
100
|
image: string | undefined;
|
|
110
101
|
display: string | undefined;
|
|
111
102
|
}[];
|
|
112
103
|
export declare function formatVideos(data: ESVideo[]): Video[];
|
|
113
|
-
export declare function formatSections(data: ESSection[]):
|
|
114
|
-
uuid: string | undefined;
|
|
115
|
-
title: string | undefined;
|
|
116
|
-
description: string | undefined;
|
|
117
|
-
image: string | undefined;
|
|
118
|
-
challenge: string | undefined;
|
|
119
|
-
display: string | undefined;
|
|
120
|
-
id: string | undefined;
|
|
121
|
-
}[];
|
|
104
|
+
export declare function formatSections(data: ESSection[]): Section[];
|
|
122
105
|
export declare function formatSchedule(data: ESSchedule[]): Schedule[];
|
|
123
|
-
export declare function formatChallenges(data: ESChallenge[]):
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
body: string | undefined;
|
|
127
|
-
image: string | undefined;
|
|
128
|
-
challengeKey: string | undefined;
|
|
129
|
-
created: string | undefined;
|
|
130
|
-
days: string[] | undefined;
|
|
131
|
-
updated: string | undefined;
|
|
132
|
-
purchaseButtonLabel: string | undefined;
|
|
133
|
-
price: string | undefined;
|
|
134
|
-
}[];
|
|
135
|
-
export declare function formatChallengeDays(data: ESChallengeDay[]): {
|
|
136
|
-
uuid: string | undefined;
|
|
137
|
-
title: string | undefined;
|
|
138
|
-
body: string | undefined;
|
|
139
|
-
image: string | undefined;
|
|
140
|
-
created: string | undefined;
|
|
141
|
-
updated: string | undefined;
|
|
142
|
-
video: string | undefined;
|
|
143
|
-
workout: string | undefined;
|
|
144
|
-
}[];
|
|
106
|
+
export declare function formatChallenges(data: ESChallenge[]): Challenge[];
|
|
107
|
+
export declare function formatChallengeDays(data: ESChallengeDay[]): ChallengeDay[];
|
|
108
|
+
export declare function formatSecondsToISO8601Duration(seconds?: number): string;
|
package/dist/index.esm.js
CHANGED
|
@@ -99,6 +99,7 @@ var initialState = {
|
|
|
99
99
|
accessTokenExpiry: null,
|
|
100
100
|
refreshToken: '',
|
|
101
101
|
email: '',
|
|
102
|
+
sub: '',
|
|
102
103
|
},
|
|
103
104
|
creating: {
|
|
104
105
|
details: '',
|
|
@@ -135,7 +136,7 @@ var authSlice = createSlice({
|
|
|
135
136
|
selectUserCreatingDetails: function (auth) { return auth.creating.details; },
|
|
136
137
|
isVerifying: function (auth) { return auth.verifying; },
|
|
137
138
|
getUserSession: function (auth) { return (auth.authenticated ? auth.session : false); },
|
|
138
|
-
selectCurrentUserSub: function (auth) {
|
|
139
|
+
selectCurrentUserSub: function (auth) { return auth.user.sub; },
|
|
139
140
|
selectCurrentUserRefreshToken: function (auth) { return auth.user.refreshToken; },
|
|
140
141
|
selectUserTokens: function (auth) {
|
|
141
142
|
return {
|
|
@@ -215,30 +216,29 @@ function formatPromos(data) {
|
|
|
215
216
|
});
|
|
216
217
|
}
|
|
217
218
|
function formatWorkout(data) {
|
|
218
|
-
|
|
219
|
-
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
|
|
219
|
+
return data.map(function (item) {
|
|
220
|
+
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;
|
|
220
221
|
return {
|
|
221
222
|
changed: (_b = (_a = item === null || item === void 0 ? void 0 : item._source) === null || _a === void 0 ? void 0 : _a.changed) === null || _b === void 0 ? void 0 : _b[0],
|
|
222
223
|
created: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.created) === null || _d === void 0 ? void 0 : _d[0],
|
|
223
224
|
uuid: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.uuid) === null || _f === void 0 ? void 0 : _f[0],
|
|
224
225
|
description: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.description) === null || _h === void 0 ? void 0 : _h[0],
|
|
225
|
-
duration: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.
|
|
226
|
-
duration_filter:
|
|
227
|
-
level: (
|
|
228
|
-
published: (
|
|
229
|
-
targeted_section: (
|
|
230
|
-
uid: (
|
|
231
|
-
image: (
|
|
232
|
-
title: (
|
|
233
|
-
video: (
|
|
234
|
-
videoDownload: (
|
|
235
|
-
videoPoster: (
|
|
236
|
-
workoutCategory: (
|
|
237
|
-
workoutType: (
|
|
238
|
-
|
|
226
|
+
duration: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.duration_filter) === null || _k === void 0 ? void 0 : _k[0],
|
|
227
|
+
// duration_filter: item?._source?.duration_filter?.[0],
|
|
228
|
+
level: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.level) === null || _m === void 0 ? void 0 : _m[0],
|
|
229
|
+
published: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.published) === null || _p === void 0 ? void 0 : _p[0],
|
|
230
|
+
targeted_section: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.targeted_section) === null || _r === void 0 ? void 0 : _r[0],
|
|
231
|
+
uid: (_t = (_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.uid) === null || _t === void 0 ? void 0 : _t[0],
|
|
232
|
+
image: (_v = (_u = item === null || item === void 0 ? void 0 : item._source) === null || _u === void 0 ? void 0 : _u.image) === null || _v === void 0 ? void 0 : _v[0],
|
|
233
|
+
title: (_x = (_w = item === null || item === void 0 ? void 0 : item._source) === null || _w === void 0 ? void 0 : _w.title) === null || _x === void 0 ? void 0 : _x[0],
|
|
234
|
+
video: (_z = (_y = item === null || item === void 0 ? void 0 : item._source) === null || _y === void 0 ? void 0 : _y.video_url) === null || _z === void 0 ? void 0 : _z[0],
|
|
235
|
+
videoDownload: (_1 = (_0 = item === null || item === void 0 ? void 0 : item._source) === null || _0 === void 0 ? void 0 : _0.video_download) === null || _1 === void 0 ? void 0 : _1[0],
|
|
236
|
+
videoPoster: (_3 = (_2 = item === null || item === void 0 ? void 0 : item._source) === null || _2 === void 0 ? void 0 : _2.video_poster) === null || _3 === void 0 ? void 0 : _3[0],
|
|
237
|
+
workoutCategory: (_5 = (_4 = item === null || item === void 0 ? void 0 : item._source) === null || _4 === void 0 ? void 0 : _4.workout_category) === null || _5 === void 0 ? void 0 : _5[0],
|
|
238
|
+
workoutType: (_7 = (_6 = item === null || item === void 0 ? void 0 : item._source) === null || _6 === void 0 ? void 0 : _6.workout_type) === null || _7 === void 0 ? void 0 : _7[0],
|
|
239
|
+
livestreamSection: (_9 = (_8 = item === null || item === void 0 ? void 0 : item._source) === null || _8 === void 0 ? void 0 : _8.livestream_section) === null || _9 === void 0 ? void 0 : _9[0],
|
|
239
240
|
};
|
|
240
241
|
});
|
|
241
|
-
return response;
|
|
242
242
|
}
|
|
243
243
|
function formatSeries(data, channel) {
|
|
244
244
|
var formattedSeriesSelection = data.map(function (series) {
|
|
@@ -379,7 +379,7 @@ function formatGuests(data) {
|
|
|
379
379
|
});
|
|
380
380
|
}
|
|
381
381
|
function formatVideos(data) {
|
|
382
|
-
|
|
382
|
+
return data.map(function (item) {
|
|
383
383
|
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;
|
|
384
384
|
return {
|
|
385
385
|
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],
|
|
@@ -391,12 +391,11 @@ function formatVideos(data) {
|
|
|
391
391
|
duration: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.duration) === null || _p === void 0 ? void 0 : _p[0],
|
|
392
392
|
section: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.section) === null || _r === void 0 ? void 0 : _r[0],
|
|
393
393
|
videoPoster: (_t = (_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.video_poster) === null || _t === void 0 ? void 0 : _t[0],
|
|
394
|
-
|
|
394
|
+
video: (_v = (_u = item === null || item === void 0 ? void 0 : item._source) === null || _u === void 0 ? void 0 : _u.video_url) === null || _v === void 0 ? void 0 : _v[0],
|
|
395
395
|
videoDownload: (_x = (_w = item === null || item === void 0 ? void 0 : item._source) === null || _w === void 0 ? void 0 : _w.video_download) === null || _x === void 0 ? void 0 : _x[0],
|
|
396
396
|
sectionId: (_z = (_y = item === null || item === void 0 ? void 0 : item._source) === null || _y === void 0 ? void 0 : _y.section_id) === null || _z === void 0 ? void 0 : _z[0],
|
|
397
397
|
};
|
|
398
398
|
});
|
|
399
|
-
return response;
|
|
400
399
|
}
|
|
401
400
|
function formatSections(data) {
|
|
402
401
|
return data.map(function (item) {
|
|
@@ -511,9 +510,10 @@ function formatSchedule(data) {
|
|
|
511
510
|
}
|
|
512
511
|
function formatChallenges(data) {
|
|
513
512
|
return data.map(function (item) {
|
|
513
|
+
var _a;
|
|
514
514
|
var _source = item._source;
|
|
515
515
|
return {
|
|
516
|
-
uuid: _source
|
|
516
|
+
uuid: (_a = _source === null || _source === void 0 ? void 0 : _source.uuid) === null || _a === void 0 ? void 0 : _a[0],
|
|
517
517
|
title: _source.title && _source.title[0],
|
|
518
518
|
body: _source.body && _source.body[0],
|
|
519
519
|
image: _source.image && _source.image[0],
|
|
@@ -541,6 +541,26 @@ function formatChallengeDays(data) {
|
|
|
541
541
|
};
|
|
542
542
|
});
|
|
543
543
|
}
|
|
544
|
+
function formatSecondsToISO8601Duration(seconds) {
|
|
545
|
+
if (!seconds)
|
|
546
|
+
return '';
|
|
547
|
+
// Calculate hours, minutes, and remaining seconds
|
|
548
|
+
var hours = Math.floor(seconds / 3600);
|
|
549
|
+
var minutes = Math.floor((seconds % 3600) / 60);
|
|
550
|
+
var remainingSeconds = seconds % 60;
|
|
551
|
+
// Build the ISO 8601 duration string
|
|
552
|
+
var duration = 'PT';
|
|
553
|
+
if (hours > 0) {
|
|
554
|
+
duration += "".concat(hours, "H");
|
|
555
|
+
}
|
|
556
|
+
if (minutes > 0) {
|
|
557
|
+
duration += "".concat(minutes, "M");
|
|
558
|
+
}
|
|
559
|
+
if (remainingSeconds > 0 || duration === 'PT') {
|
|
560
|
+
duration += "".concat(remainingSeconds, "S");
|
|
561
|
+
}
|
|
562
|
+
return duration;
|
|
563
|
+
}
|
|
544
564
|
|
|
545
565
|
// console.log('process.env', process.env);
|
|
546
566
|
// console.log('process.env?.WEB_APP', process.env?.WEB_APP);
|
|
@@ -588,17 +608,17 @@ var authApi = createApi({
|
|
|
588
608
|
// add accessToken to headers from slice using selectAccessToken selector
|
|
589
609
|
var tokens = selectUserTokens(state);
|
|
590
610
|
console.log('tokens: ', tokens);
|
|
591
|
-
if (tokens) {
|
|
611
|
+
if (tokens.accessToken && tokens.idToken) {
|
|
592
612
|
headers.set('accesstoken', tokens.accessToken);
|
|
593
613
|
headers.set('idtoken', tokens.idToken);
|
|
594
|
-
headers.set('refreshtoken', tokens.refreshToken);
|
|
614
|
+
// headers.set('refreshtoken', tokens.refreshToken);
|
|
595
615
|
}
|
|
596
616
|
return headers;
|
|
597
617
|
},
|
|
598
618
|
credentials: 'include',
|
|
599
619
|
}),
|
|
600
|
-
tagTypes: ['UserToken'],
|
|
601
|
-
keepUnusedDataFor: 300,
|
|
620
|
+
tagTypes: ['UserToken', 'UserData'],
|
|
621
|
+
// keepUnusedDataFor: 300,
|
|
602
622
|
endpoints: function (builder) { return ({
|
|
603
623
|
/**
|
|
604
624
|
* USER API.
|
|
@@ -848,6 +868,7 @@ var authApi = createApi({
|
|
|
848
868
|
url: "/data/user/".concat(uuid),
|
|
849
869
|
method: 'GET',
|
|
850
870
|
}); },
|
|
871
|
+
providesTags: ['UserData'],
|
|
851
872
|
}),
|
|
852
873
|
updateUserInfo: builder.mutation({
|
|
853
874
|
query: function (expressions) { return ({
|
|
@@ -855,6 +876,7 @@ var authApi = createApi({
|
|
|
855
876
|
method: 'PATCH',
|
|
856
877
|
body: expressions,
|
|
857
878
|
}); },
|
|
879
|
+
invalidatesTags: ['UserData'],
|
|
858
880
|
}),
|
|
859
881
|
updateUser: builder.mutation({
|
|
860
882
|
query: function (data) { return ({
|
|
@@ -862,14 +884,13 @@ var authApi = createApi({
|
|
|
862
884
|
method: 'PATCH',
|
|
863
885
|
body: data,
|
|
864
886
|
}); },
|
|
887
|
+
invalidatesTags: ['UserData'],
|
|
865
888
|
}),
|
|
866
889
|
}); },
|
|
867
890
|
});
|
|
868
891
|
// Export hooks for usage in functional components.
|
|
869
|
-
authApi.useLoginQuery
|
|
892
|
+
var useLoginQuery = authApi.useLoginQuery, useLazyLoginQuery = authApi.useLazyLoginQuery, useResetPasswordMutation = authApi.useResetPasswordMutation, useResetPasswordAuthMutation = authApi.useResetPasswordAuthMutation, useRefreshTokenQuery = authApi.useRefreshTokenQuery, useLazyRefreshTokenQuery = authApi.useLazyRefreshTokenQuery, useLogoutQuery = authApi.useLogoutQuery, useLazyLogoutQuery = authApi.useLazyLogoutQuery, 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;
|
|
870
893
|
|
|
871
|
-
// console.log('APP_ES_INSTANCE', APP_ES_INSTANCE);
|
|
872
|
-
// console.log('APP_ES_AUTH', APP_ES_AUTH);
|
|
873
894
|
var contentApi = createApi({
|
|
874
895
|
reducerPath: 'contentApi',
|
|
875
896
|
baseQuery: fetchBaseQuery({
|
|
@@ -901,41 +922,7 @@ var contentApi = createApi({
|
|
|
901
922
|
transformResponse: function (response) { var _a; return (_a = response === null || response === void 0 ? void 0 : response.hits) === null || _a === void 0 ? void 0 : _a.hits; },
|
|
902
923
|
providesTags: ['Data'],
|
|
903
924
|
}),
|
|
904
|
-
|
|
905
|
-
// query: (index) => ({
|
|
906
|
-
// url: `${index}/_search`,
|
|
907
|
-
// method: 'POST',
|
|
908
|
-
// body: {
|
|
909
|
-
// from: 0,
|
|
910
|
-
// size: 100,
|
|
911
|
-
// sort: [{ created: { order: 'desc' } }],
|
|
912
|
-
// query: {
|
|
913
|
-
// match_all: {},
|
|
914
|
-
// },
|
|
915
|
-
// },
|
|
916
|
-
// }),
|
|
917
|
-
// transformResponse: (response: ESPromoResponse) =>
|
|
918
|
-
// formatPromos(response?.hits?.hits),
|
|
919
|
-
// providesTags: ['Promos'],
|
|
920
|
-
// }),
|
|
921
|
-
// getWorkouts: builder.query<Workout[], string | undefined>({
|
|
922
|
-
// query: (index) => ({
|
|
923
|
-
// url: `${index}/_search`,
|
|
924
|
-
// method: 'POST',
|
|
925
|
-
// body: {
|
|
926
|
-
// from: 0,
|
|
927
|
-
// size: 100,
|
|
928
|
-
// sort: [{ created: { order: 'desc' } }],
|
|
929
|
-
// query: {
|
|
930
|
-
// match_all: {},
|
|
931
|
-
// },
|
|
932
|
-
// },
|
|
933
|
-
// }),
|
|
934
|
-
// transformResponse: (response: ESWorkoutResponse) =>
|
|
935
|
-
// formatESWorkoutItems(response?.hits?.hits),
|
|
936
|
-
// providesTags: ['Workouts'],
|
|
937
|
-
// }),
|
|
938
|
-
getWorkoutById: builder.query({
|
|
925
|
+
getDataById: builder.query({
|
|
939
926
|
query: function (_a) {
|
|
940
927
|
var index = _a.index, id = _a.id;
|
|
941
928
|
return ({
|
|
@@ -943,25 +930,20 @@ var contentApi = createApi({
|
|
|
943
930
|
method: 'POST',
|
|
944
931
|
body: {
|
|
945
932
|
query: {
|
|
946
|
-
|
|
933
|
+
match: {
|
|
947
934
|
uuid: id,
|
|
948
935
|
},
|
|
949
936
|
},
|
|
950
937
|
},
|
|
951
938
|
});
|
|
952
939
|
},
|
|
940
|
+
transformResponse: function (response) { var _a; return (_a = response === null || response === void 0 ? void 0 : response.hits) === null || _a === void 0 ? void 0 : _a.hits; },
|
|
953
941
|
providesTags: ['Workout'],
|
|
954
942
|
}),
|
|
955
943
|
}); },
|
|
956
944
|
});
|
|
957
|
-
contentApi.useGetDataQuery; contentApi.useLazyGetDataQuery;
|
|
958
|
-
// useGetPromosQuery,
|
|
959
|
-
// useLazyGetPromosQuery,
|
|
960
|
-
// useGetWorkoutsQuery,
|
|
961
|
-
// useLazyGetWorkoutsQuery,
|
|
962
|
-
contentApi.useGetWorkoutByIdQuery; contentApi.useLazyGetWorkoutByIdQuery;
|
|
945
|
+
contentApi.useGetDataQuery; contentApi.useLazyGetDataQuery; contentApi.useGetDataByIdQuery; contentApi.useLazyGetDataByIdQuery;
|
|
963
946
|
|
|
964
|
-
console.log('API_PAYMENTS_PREFIX: ', API_PAYMENTS_PREFIX);
|
|
965
947
|
var paymentApi = createApi({
|
|
966
948
|
reducerPath: 'paymentApi',
|
|
967
949
|
baseQuery: fetchBaseQuery({
|
|
@@ -973,10 +955,10 @@ var paymentApi = createApi({
|
|
|
973
955
|
// add accessToken to headers from slice using selectAccessToken selector
|
|
974
956
|
var tokens = selectUserTokens(state);
|
|
975
957
|
console.log('tokens: ', tokens);
|
|
976
|
-
if (tokens) {
|
|
958
|
+
if (tokens.accessToken && tokens.idToken) {
|
|
977
959
|
headers.set('accesstoken', tokens.accessToken);
|
|
978
960
|
headers.set('idtoken', tokens.idToken);
|
|
979
|
-
headers.set('refreshtoken', tokens.refreshToken);
|
|
961
|
+
// headers.set('refreshtoken', tokens.refreshToken);
|
|
980
962
|
}
|
|
981
963
|
return headers;
|
|
982
964
|
},
|
|
@@ -1055,6 +1037,12 @@ function createPersistStorage() {
|
|
|
1055
1037
|
|
|
1056
1038
|
// Infer the `RootState` type from the root reducer
|
|
1057
1039
|
var rootReducer = combineSlices(authSlice, authApi, contentApi, paymentApi);
|
|
1040
|
+
// export interface RootState {
|
|
1041
|
+
// [authSlice.name]: ReturnType<typeof authSlice.reducer>;
|
|
1042
|
+
// [authApi.reducerPath]: ReturnType<typeof authApi.reducer>;
|
|
1043
|
+
// [contentApi.reducerPath]: ReturnType<typeof contentApi.reducer>;
|
|
1044
|
+
// [paymentApi.reducerPath]: ReturnType<typeof paymentApi.reducer>;
|
|
1045
|
+
// }
|
|
1058
1046
|
// eg. ['auth', 'creating'], or an empty array if you don't want to whitelist any.
|
|
1059
1047
|
// const storageWhiteList: string[] = [];
|
|
1060
1048
|
// `makeStore` encapsulates the store configuration to allow
|
|
@@ -1144,5 +1132,5 @@ var makeWebStore = function () {
|
|
|
1144
1132
|
var nativeStore = !isWeb && makeNativeStore();
|
|
1145
1133
|
var webStore = isWeb && makeWebStore();
|
|
1146
1134
|
|
|
1147
|
-
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 };
|
|
1135
|
+
export { authApi, authSlice, contentApi, formatChallengeDays, formatChallenges, formatFaqs, formatGuests, formatLongform, formatPages, formatPress, formatPromos, formatSchedule, formatSecondsToISO8601Duration, 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, useForgottenPasswordMutation, useGetUserInfoQuery, useLazyGetUserInfoQuery, useLazyLoginQuery, useLazyLogoutQuery, useLazyRefreshTokenQuery, useLazyVerifyUserAttributesQuery, useLazyVerifyUserQuery, useLazyVerifyUserResendQuery, useLoggedIn, useLoginQuery, useLogoutQuery, useRefreshTokenQuery, useRegisterMutation, useResetPasswordAuthMutation, useResetPasswordMutation, useUpdateUserInfoMutation, useUpdateUserMutation, useVerifyUserAttributesQuery, useVerifyUserQuery, useVerifyUserResendQuery, webStore };
|
|
1148
1136
|
//# sourceMappingURL=index.esm.js.map
|