@techstuff-dev/foundation-api-utils 1.50.2 → 1.51.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/cjs/chunks/{shared-xQBEY4BX.js → shared-CPf85o9W.js} +2 -7
- package/dist/cjs/chunks/shared-CPf85o9W.js.map +1 -0
- package/dist/cjs/chunks/{slice-Cy4kZKn1.js → slice-CHzSWFmR.js} +88 -53
- package/dist/cjs/chunks/{slice-Cy4kZKn1.js.map → slice-CHzSWFmR.js.map} +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/store/index.native.js +5 -335
- package/dist/cjs/store/index.native.js.map +1 -1
- package/dist/cjs/store/index.web.js +7 -3
- package/dist/cjs/store/index.web.js.map +1 -1
- package/dist/esm/chunks/{shared-ykPFVPQ6.js → shared-9n1t2QnH.js} +3 -7
- package/dist/esm/chunks/shared-9n1t2QnH.js.map +1 -0
- package/dist/esm/chunks/{slice-qwy3bNV7.js → slice-Bersugzi.js} +89 -54
- package/dist/esm/chunks/{slice-qwy3bNV7.js.map → slice-Bersugzi.js.map} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/store/index.native.js +5 -335
- package/dist/esm/store/index.native.js.map +1 -1
- package/dist/esm/store/index.web.js +6 -2
- package/dist/esm/store/index.web.js.map +1 -1
- package/dist/types/hooks/index.d.ts +1 -1
- package/dist/types/{index-CS4llMqY.d.ts → index-B9lcBPLO.d.ts} +8 -8
- package/dist/types/index.d.ts +7 -7
- package/dist/types/store/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/chunks/shared-xQBEY4BX.js.map +0 -1
- package/dist/esm/chunks/shared-ykPFVPQ6.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Auth } from 'aws-amplify';
|
|
2
2
|
import { r as resetCreating, s as setCredentials, l as logout } from './slice-ChJ8ZvmP.js';
|
|
3
|
-
import { isPlainObject as isPlainObject$1,
|
|
3
|
+
import { nanoid, formatProdErrorMessage, isPlainObject as isPlainObject$1, createAction, createSelector as createSelector$1, createNextState, createAsyncThunk, createSlice, prepareAutoBatched, isAnyOf, isFulfilled, isRejectedWithValue, combineReducers, SHOULD_AUTOBATCH, isAllOf, isRejected, isPending, isAction, isAsyncThunkAction } from '@reduxjs/toolkit';
|
|
4
4
|
import { useStore, useSelector, useDispatch, batch, shallowEqual } from 'react-redux';
|
|
5
5
|
import { useCallback, useDebugValue, useMemo, useState, useEffect, useRef, useLayoutEffect } from 'react';
|
|
6
6
|
import { jwtDecode } from 'jwt-decode';
|
|
@@ -5393,7 +5393,8 @@ const runOnPlatform = (config) => {
|
|
|
5393
5393
|
*/
|
|
5394
5394
|
// Helper function to get environment variable with fallback
|
|
5395
5395
|
const getEnvVar$1 = (key, fallback = '') => {
|
|
5396
|
-
|
|
5396
|
+
const value = process.env[key] || fallback;
|
|
5397
|
+
return value;
|
|
5397
5398
|
};
|
|
5398
5399
|
// Core API endpoints
|
|
5399
5400
|
const API_PREFIX$1 = getEnvVar$1('NEXT_PUBLIC_API_PREFIX');
|
|
@@ -5552,30 +5553,38 @@ apiConfig.APP_ES_CHALLENGES_INDEX;
|
|
|
5552
5553
|
apiConfig.APP_ES_CHALLENGE_DAYS_INDEX;
|
|
5553
5554
|
apiConfig.PLATFORM;
|
|
5554
5555
|
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
headers
|
|
5567
|
-
|
|
5556
|
+
// Create a dynamic baseQuery that resolves URL at request time
|
|
5557
|
+
const createAuthBaseQuery = () => {
|
|
5558
|
+
const baseUrl = typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_API_AUTH_PREFIX
|
|
5559
|
+
? process.env.NEXT_PUBLIC_API_AUTH_PREFIX
|
|
5560
|
+
: (API_AUTH_PREFIX || '');
|
|
5561
|
+
console.log('[authApi] Resolved baseUrl:', baseUrl);
|
|
5562
|
+
return fetchBaseQuery({
|
|
5563
|
+
baseUrl,
|
|
5564
|
+
prepareHeaders: async (headers) => {
|
|
5565
|
+
headers.set('Content-Type', 'application/json');
|
|
5566
|
+
try {
|
|
5567
|
+
// add accessToken to headers from slice using selectAccessToken selector
|
|
5568
|
+
const session = await Auth.currentSession();
|
|
5569
|
+
const idToken = session.getIdToken().getJwtToken(); // ID token
|
|
5570
|
+
const accessToken = session.getAccessToken().getJwtToken(); // Access token
|
|
5571
|
+
if (accessToken && idToken) {
|
|
5572
|
+
headers.set('accesstoken', accessToken);
|
|
5573
|
+
headers.set('idtoken', idToken);
|
|
5574
|
+
// headers.set('refreshtoken', tokens.refreshToken);
|
|
5575
|
+
}
|
|
5576
|
+
return headers;
|
|
5568
5577
|
}
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
}
|
|
5577
|
-
|
|
5578
|
-
|
|
5578
|
+
catch (error) {
|
|
5579
|
+
// eslint-disable-next-line no-console
|
|
5580
|
+
console.error('authDataBaseQuery: ', error);
|
|
5581
|
+
return headers;
|
|
5582
|
+
}
|
|
5583
|
+
},
|
|
5584
|
+
credentials: 'include',
|
|
5585
|
+
});
|
|
5586
|
+
};
|
|
5587
|
+
const authDataBaseQuery = createAuthBaseQuery();
|
|
5579
5588
|
/**
|
|
5580
5589
|
* This function is used to retry a request if we get a 401 error.
|
|
5581
5590
|
*/
|
|
@@ -5756,15 +5765,25 @@ const {
|
|
|
5756
5765
|
useResetPasswordMutation, // Use this for mobile app.
|
|
5757
5766
|
useResetPasswordAuthMutation, useRegisterMutation, useVerifyUserQuery, useLazyVerifyUserQuery, useGetUserInfoQuery, useLazyGetUserInfoQuery, useUpdateUserInfoMutation, useForgottenPasswordMutation, useVerifyUserAttributesQuery, useLazyVerifyUserAttributesQuery, useVerifyUserResendQuery, useLazyVerifyUserResendQuery, useUpdateUserMutation, } = authApi;
|
|
5758
5767
|
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5768
|
+
// Create dynamic baseQuery that resolves URL at request time
|
|
5769
|
+
const createContentBaseQuery = () => {
|
|
5770
|
+
const baseUrl = typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_ELASTICSEARCH_HOST
|
|
5771
|
+
? process.env.NEXT_PUBLIC_ELASTICSEARCH_HOST
|
|
5772
|
+
: (APP_ES_INSTANCE || '');
|
|
5773
|
+
const auth = typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_APP_ES_AUTH
|
|
5774
|
+
? process.env.NEXT_PUBLIC_APP_ES_AUTH
|
|
5775
|
+
: (APP_ES_AUTH || '');
|
|
5776
|
+
return fetchBaseQuery({
|
|
5777
|
+
baseUrl,
|
|
5763
5778
|
prepareHeaders: (headers) => {
|
|
5764
|
-
headers.set('Authorization',
|
|
5779
|
+
headers.set('Authorization', auth);
|
|
5765
5780
|
return headers;
|
|
5766
5781
|
},
|
|
5767
|
-
})
|
|
5782
|
+
});
|
|
5783
|
+
};
|
|
5784
|
+
const contentApi = createApi({
|
|
5785
|
+
reducerPath: 'contentApi',
|
|
5786
|
+
baseQuery: createContentBaseQuery(),
|
|
5768
5787
|
tagTypes: ['Data', 'Workout'],
|
|
5769
5788
|
// keepUnusedDataFor: 300,
|
|
5770
5789
|
endpoints: (builder) => ({
|
|
@@ -5805,10 +5824,14 @@ const contentApi = createApi({
|
|
|
5805
5824
|
});
|
|
5806
5825
|
const { useGetDataQuery, useLazyGetDataQuery, useGetDataByIdQuery, useLazyGetDataByIdQuery, } = contentApi;
|
|
5807
5826
|
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5827
|
+
// Dynamic baseQuery that resolves URL at request time
|
|
5828
|
+
const dynamicBaseQuery = async (args, api, extraOptions) => {
|
|
5829
|
+
// Resolve base URL at request time, not module load time
|
|
5830
|
+
const baseUrl = typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_API_PAYMENTS_PREFIX
|
|
5831
|
+
? process.env.NEXT_PUBLIC_API_PAYMENTS_PREFIX
|
|
5832
|
+
: (API_PAYMENTS_PREFIX || '');
|
|
5833
|
+
const baseQuery = fetchBaseQuery({
|
|
5834
|
+
baseUrl,
|
|
5812
5835
|
prepareHeaders: async (headers) => {
|
|
5813
5836
|
headers.set('Content-Type', 'application/json');
|
|
5814
5837
|
// add accessToken to headers from slice using selectAccessToken selector
|
|
@@ -5823,7 +5846,12 @@ const paymentApi = createApi({
|
|
|
5823
5846
|
return headers;
|
|
5824
5847
|
},
|
|
5825
5848
|
credentials: 'include',
|
|
5826
|
-
})
|
|
5849
|
+
});
|
|
5850
|
+
return baseQuery(args, api, extraOptions);
|
|
5851
|
+
};
|
|
5852
|
+
const paymentApi = createApi({
|
|
5853
|
+
reducerPath: 'paymentApi',
|
|
5854
|
+
baseQuery: dynamicBaseQuery,
|
|
5827
5855
|
tagTypes: ['UserSubscription', 'Plans', 'TaxRates', 'PromoCodes'],
|
|
5828
5856
|
// keepUnusedDataFor: 300,
|
|
5829
5857
|
endpoints: (builder) => ({
|
|
@@ -5865,23 +5893,30 @@ const paymentApi = createApi({
|
|
|
5865
5893
|
// Export hooks for usage in functional components.
|
|
5866
5894
|
const { useCheckUserSubscriptionQuery, useLazyCheckUserSubscriptionQuery, useGetPaymentPlansQuery, useLazyGetPaymentPlansQuery, useGetTaxRatesQuery, useLazyGetTaxRatesQuery, useCheckPromoCodeQuery, useLazyCheckPromoCodeQuery, } = paymentApi;
|
|
5867
5895
|
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
headers
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5896
|
+
// Create dynamic baseQuery that resolves URL at request time
|
|
5897
|
+
const createOrdersBaseQuery = () => {
|
|
5898
|
+
const baseUrl = typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_API_ORDERS_PREFIX
|
|
5899
|
+
? process.env.NEXT_PUBLIC_API_ORDERS_PREFIX
|
|
5900
|
+
: (API_ORDERS_PREFIX || '');
|
|
5901
|
+
return fetchBaseQuery({
|
|
5902
|
+
baseUrl,
|
|
5903
|
+
prepareHeaders: async (headers) => {
|
|
5904
|
+
headers.set('Content-Type', 'application/json');
|
|
5905
|
+
// add accessToken to headers from slice using selectAccessToken selector
|
|
5906
|
+
const session = await Auth.currentSession();
|
|
5907
|
+
const idToken = session.getIdToken().getJwtToken(); // ID token
|
|
5908
|
+
const accessToken = session.getAccessToken().getJwtToken(); // Access token
|
|
5909
|
+
if (accessToken && idToken) {
|
|
5910
|
+
headers.set('accesstoken', accessToken);
|
|
5911
|
+
headers.set('idtoken', idToken);
|
|
5912
|
+
// headers.set('refreshtoken', tokens.refreshToken);
|
|
5913
|
+
}
|
|
5914
|
+
return headers;
|
|
5915
|
+
},
|
|
5916
|
+
credentials: 'include',
|
|
5917
|
+
});
|
|
5918
|
+
};
|
|
5919
|
+
const dataBaseQuery = createOrdersBaseQuery();
|
|
5885
5920
|
/**
|
|
5886
5921
|
* This function is used to retry a request if we get a 401 error.
|
|
5887
5922
|
*/
|
|
@@ -6084,4 +6119,4 @@ const selectCartItemsIds = createSelector$1([selectMediaInCart], (items) => {
|
|
|
6084
6119
|
cartSlice.reducer;
|
|
6085
6120
|
|
|
6086
6121
|
export { formatAuthSession as $, emptyCart as A, toggleCart as B, selectMediaInCart as C, selectCartTotal as D, selectCartNetTotal as E, selectCartTaxRate as F, selectCartTaxAmount as G, selectCartCount as H, selectCartStatus as I, selectPromoCode as J, selectCartItems as K, selectCartItemsIds as L, formatUserPayload as M, formatPromos as N, formatWorkout as O, formatShortform as P, formatFaqs as Q, formatPages as R, formatSettings as S, formatPress as T, formatGuests as U, formatVideos as V, formatSections as W, formatSchedule as X, formatChallenges as Y, formatChallengeDays as Z, formatSecondsToISO8601Duration as _, authApi as a, formatFedaratedSession as a0, formatSocialAuthSession as a1, formatConfig as a2, formatSectionPanels as a3, formatSectionItems as a4, formatTaxonomies as a5, formatSeries as a6, formatSeasons as a7, formatLongform as a8, formatMediaItem as a9, isWeb as aa, isReactNative as ab, getPlatform as ac, runOnPlatform as ad, onlyUnique as ae, applyCoupon as af, applyTax as ag, toCamelCaseObject as ah, useResetPasswordAuthMutation as b, contentApi as c, useRegisterMutation as d, useVerifyUserQuery as e, useLazyVerifyUserQuery as f, useGetUserInfoQuery as g, useLazyGetUserInfoQuery as h, useUpdateUserInfoMutation as i, useForgottenPasswordMutation as j, useVerifyUserAttributesQuery as k, useLazyVerifyUserAttributesQuery as l, useVerifyUserResendQuery as m, useLazyVerifyUserResendQuery as n, ordersApi as o, paymentApi as p, useUpdateUserMutation as q, cartSlice as r, setTaxRate as s, resetTaxRate as t, useResetPasswordMutation as u, setPromoCode as v, removePromoCode as w, addToCart as x, updateCart as y, removeFromCart as z };
|
|
6087
|
-
//# sourceMappingURL=slice-
|
|
6122
|
+
//# sourceMappingURL=slice-Bersugzi.js.map
|