@techstuff-dev/foundation-api-utils 1.46.1 → 1.48.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.
Files changed (48) hide show
  1. package/dist/cjs/chunks/index-CfrYa4U_.js +9 -0
  2. package/dist/cjs/chunks/index-CfrYa4U_.js.map +1 -0
  3. package/dist/cjs/chunks/shared-DeNXjWb4.js +18 -0
  4. package/dist/cjs/chunks/shared-DeNXjWb4.js.map +1 -0
  5. package/dist/{index.js → cjs/chunks/slice-CAWa47E3.js} +662 -1377
  6. package/dist/cjs/chunks/slice-CAWa47E3.js.map +1 -0
  7. package/dist/cjs/index.js +97 -0
  8. package/dist/cjs/index.js.map +1 -0
  9. package/dist/cjs/store/index.native.js +413 -0
  10. package/dist/cjs/store/index.native.js.map +1 -0
  11. package/dist/cjs/store/index.web.js +186 -0
  12. package/dist/cjs/store/index.web.js.map +1 -0
  13. package/dist/esm/chunks/index-KjhWa1AL.js +6 -0
  14. package/dist/esm/chunks/index-KjhWa1AL.js.map +1 -0
  15. package/dist/esm/chunks/shared-CmoKpoEq.js +15 -0
  16. package/dist/esm/chunks/shared-CmoKpoEq.js.map +1 -0
  17. package/dist/{index.esm.js → esm/chunks/slice-CRuD2Hce.js} +664 -1373
  18. package/dist/esm/chunks/slice-CRuD2Hce.js.map +1 -0
  19. package/dist/esm/index.js +15 -0
  20. package/dist/esm/index.js.map +1 -0
  21. package/dist/esm/store/index.native.js +411 -0
  22. package/dist/esm/store/index.native.js.map +1 -0
  23. package/dist/esm/store/index.web.js +184 -0
  24. package/dist/esm/store/index.web.js.map +1 -0
  25. package/dist/types/index-DQ61f1lz.d.ts +1295 -0
  26. package/dist/{index.d.ts → types/index.d.ts} +64 -1404
  27. package/dist/types/store/index.d.ts +3 -0
  28. package/package.json +23 -9
  29. package/dist/index.esm.js.map +0 -1
  30. package/dist/index.js.map +0 -1
  31. package/dist/lib/api/index.d.ts +0 -21
  32. package/dist/lib/hooks/index.d.ts +0 -33
  33. package/dist/lib/hooks/useAuth.d.ts +0 -1
  34. package/dist/lib/index.d.ts +0 -6
  35. package/dist/lib/services/auth/index.d.ts +0 -2027
  36. package/dist/lib/services/auth/slice.d.ts +0 -91
  37. package/dist/lib/services/cart/slice.d.ts +0 -155
  38. package/dist/lib/services/content/content.interfaces.d.ts +0 -801
  39. package/dist/lib/services/content/index.d.ts +0 -532
  40. package/dist/lib/services/index.d.ts +0 -7
  41. package/dist/lib/services/orders/index.d.ts +0 -271
  42. package/dist/lib/services/payment/index.d.ts +0 -1063
  43. package/dist/lib/store/index.d.ts +0 -76
  44. package/dist/lib/store/storage.d.ts +0 -2
  45. package/dist/lib/types/index.interfaces.d.ts +0 -428
  46. package/dist/lib/utils/dataFormat/index.d.ts +0 -86
  47. package/dist/lib/utils/helpers/index.d.ts +0 -14
  48. package/dist/node_modules/@reduxjs/toolkit/dist/uncheckedindexed.d.ts +0 -5
@@ -1,90 +1,8 @@
1
- import { isPlainObject as isPlainObject$1, nanoid, formatProdErrorMessage, createAction, createSelector as createSelector$1, createNextState, createAsyncThunk, createSlice, prepareAutoBatched, isAnyOf, isFulfilled, isRejectedWithValue, combineReducers, SHOULD_AUTOBATCH, isAllOf, isRejected, isPending, isAction, isAsyncThunkAction, combineSlices, configureStore } from '@reduxjs/toolkit';
1
+ import { Auth } from 'aws-amplify';
2
+ import { isPlainObject as isPlainObject$1, nanoid, formatProdErrorMessage, createAction, createSelector as createSelector$1, createNextState, createAsyncThunk, createSlice, prepareAutoBatched, isAnyOf, isFulfilled, isRejectedWithValue, combineReducers, SHOULD_AUTOBATCH, isAllOf, isRejected, isPending, isAction, isAsyncThunkAction } from '@reduxjs/toolkit';
2
3
  import { useStore, useSelector, useDispatch, batch, shallowEqual } from 'react-redux';
3
4
  import { useCallback, useDebugValue, useMemo, useState, useEffect, useRef, useLayoutEffect } from 'react';
4
- import { Auth } from 'aws-amplify';
5
5
  import { jwtDecode } from 'jwt-decode';
6
- import { NativeModules } from 'react-native';
7
-
8
- /******************************************************************************
9
- Copyright (c) Microsoft Corporation.
10
-
11
- Permission to use, copy, modify, and/or distribute this software for any
12
- purpose with or without fee is hereby granted.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
- PERFORMANCE OF THIS SOFTWARE.
21
- ***************************************************************************** */
22
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
23
-
24
-
25
- var __assign = function() {
26
- __assign = Object.assign || function __assign(t) {
27
- for (var s, i = 1, n = arguments.length; i < n; i++) {
28
- s = arguments[i];
29
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
30
- }
31
- return t;
32
- };
33
- return __assign.apply(this, arguments);
34
- };
35
-
36
- function __awaiter(thisArg, _arguments, P, generator) {
37
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
- return new (P || (P = Promise))(function (resolve, reject) {
39
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
- step((generator = generator.apply(thisArg, _arguments || [])).next());
43
- });
44
- }
45
-
46
- function __generator(thisArg, body) {
47
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
48
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
49
- function verb(n) { return function (v) { return step([n, v]); }; }
50
- function step(op) {
51
- if (f) throw new TypeError("Generator is already executing.");
52
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
53
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
54
- if (y = 0, t) op = [op[0] & 2, t.value];
55
- switch (op[0]) {
56
- case 0: case 1: t = op; break;
57
- case 4: _.label++; return { value: op[1], done: false };
58
- case 5: _.label++; y = op[1]; op = [0]; continue;
59
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
60
- default:
61
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
62
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
63
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
64
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
65
- if (t[2]) _.ops.pop();
66
- _.trys.pop(); continue;
67
- }
68
- op = body.call(thisArg, _);
69
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
70
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
71
- }
72
- }
73
-
74
- function __spreadArray(to, from, pack) {
75
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
76
- if (ar || !(i in from)) {
77
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
78
- ar[i] = from[i];
79
- }
80
- }
81
- return to.concat(ar || Array.prototype.slice.call(from));
82
- }
83
-
84
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
85
- var e = new Error(message);
86
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
87
- };
88
6
 
89
7
  // src/utils/env.ts
90
8
  var NOTHING = Symbol.for("immer-nothing");
@@ -4763,8 +4681,7 @@ Hook ${hookName} was either not provided or not a function.`);
4763
4681
  // src/query/react/index.ts
4764
4682
  var createApi = /* @__PURE__ */ buildCreateApi(coreModule(), reactHooksModule());
4765
4683
 
4766
- var _a$2, _b$2;
4767
- var initialState$1 = {
4684
+ const initialState$1 = {
4768
4685
  authenticated: false,
4769
4686
  verifying: false,
4770
4687
  user: {
@@ -4792,81 +4709,105 @@ var initialState$1 = {
4792
4709
  error: false,
4793
4710
  session: undefined,
4794
4711
  };
4795
- var authSlice = createSlice({
4712
+ const authSlice = createSlice({
4796
4713
  name: 'auth',
4797
4714
  initialState: initialState$1,
4798
4715
  reducers: {
4799
- setCredentials: function (state, data) {
4800
- return __assign(__assign({}, state), { session: data.payload.accessToken, authenticated: true, verifying: true, user: __assign(__assign({}, state.user), data.payload) });
4716
+ setCredentials: (state, data) => {
4717
+ return {
4718
+ ...state,
4719
+ session: data.payload.accessToken,
4720
+ authenticated: true,
4721
+ verifying: true,
4722
+ user: {
4723
+ ...state.user,
4724
+ ...data.payload,
4725
+ },
4726
+ };
4801
4727
  },
4802
- resetCreating: function (state) {
4803
- return __assign(__assign({}, state), { creating: {
4728
+ resetCreating: (state) => {
4729
+ return {
4730
+ ...state,
4731
+ creating: {
4804
4732
  details: '',
4805
4733
  payment: '',
4806
- } });
4734
+ },
4735
+ };
4807
4736
  },
4808
- updateSubscription: function (state, data) {
4809
- 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 }) }) });
4737
+ updateSubscription: (state, data) => {
4738
+ return {
4739
+ ...state,
4740
+ user: {
4741
+ ...state.user,
4742
+ details: {
4743
+ ...state.user.details,
4744
+ customerId: data.payload.customerId,
4745
+ subscription: data.payload.subscription,
4746
+ subscriptionDetails: data.payload.subscriptionDetails,
4747
+ },
4748
+ },
4749
+ };
4810
4750
  },
4811
- logout: function () { return initialState$1; },
4751
+ logout: () => initialState$1,
4812
4752
  },
4813
4753
  selectors: {
4814
- isAuthenticated: function (auth) { return auth.authenticated; },
4815
- selectAccessToken: function (auth) { return auth.user.accessToken; },
4816
- selectRefreshToken: function (auth) { return auth.user.refreshToken; },
4817
- selectCurrentUser: function (auth) { return auth.user.details; },
4818
- isVerifying: function (auth) { return auth.verifying; },
4819
- getUserSession: function (auth) { return (auth.authenticated ? auth.session : false); },
4754
+ isAuthenticated: (auth) => auth.authenticated,
4755
+ selectAccessToken: (auth) => auth.user.accessToken,
4756
+ selectRefreshToken: (auth) => auth.user.refreshToken,
4757
+ selectCurrentUser: (auth) => auth.user.details,
4758
+ isVerifying: (auth) => auth.verifying,
4759
+ getUserSession: (auth) => (auth.authenticated ? auth.session : false),
4820
4760
  // TODO: override this selector directly in the CNBCMEDIA app.
4821
- selectCurrentUserSub: function (auth) { var _a, _b, _c; return ((_c = (_b = (_a = auth === null || auth === void 0 ? void 0 : auth.user) === null || _a === void 0 ? void 0 : _a.details) === null || _b === void 0 ? void 0 : _b.id) === null || _c === void 0 ? void 0 : _c["custom:legacySub"]) || auth.user.sub; },
4822
- selectCurrentUserRefreshToken: function (auth) { return auth.user.refreshToken; },
4823
- selectUserTokens: function (auth) {
4761
+ selectCurrentUserSub: (auth) => auth?.user?.details?.id?.["custom:legacySub"] || auth.user.sub,
4762
+ selectCurrentUserRefreshToken: (auth) => auth.user.refreshToken,
4763
+ selectUserTokens: (auth) => {
4824
4764
  return {
4825
4765
  accessToken: auth.user.accessToken,
4826
4766
  refreshToken: auth.user.refreshToken,
4827
4767
  idToken: auth.user.idToken,
4828
4768
  };
4829
4769
  },
4830
- selectUserSubscriptionStatus: function (auth) {
4831
- var _a, _b, _c;
4832
- return (_c = (_b = (_a = auth === null || auth === void 0 ? void 0 : auth.user) === null || _a === void 0 ? void 0 : _a.details) === null || _b === void 0 ? void 0 : _b.subscriptionDetails) === null || _c === void 0 ? void 0 : _c.status;
4770
+ selectUserSubscriptionStatus: (auth) => {
4771
+ return auth?.user?.details?.subscriptionDetails?.status;
4833
4772
  },
4834
- selectSubscription: function (auth) {
4835
- var _a, _b;
4836
- return (_b = (_a = auth === null || auth === void 0 ? void 0 : auth.user) === null || _a === void 0 ? void 0 : _a.details) === null || _b === void 0 ? void 0 : _b.subscriptionDetails;
4773
+ selectSubscription: (auth) => {
4774
+ return auth?.user?.details?.subscriptionDetails;
4837
4775
  },
4838
- selectSubscriptionPrice: function (auth) {
4839
- var _a, _b, _c;
4840
- return (_c = (_b = (_a = auth === null || auth === void 0 ? void 0 : auth.user) === null || _a === void 0 ? void 0 : _a.details) === null || _b === void 0 ? void 0 : _b.subscriptionDetails) === null || _c === void 0 ? void 0 : _c.amount;
4776
+ selectSubscriptionPrice: (auth) => {
4777
+ return auth?.user?.details?.subscriptionDetails?.amount;
4841
4778
  },
4842
4779
  },
4843
4780
  });
4844
4781
  // Action creators are generated for each case reducer function.
4845
- var setCredentials = (_a$2 = authSlice.actions, _a$2.setCredentials), resetCreating = _a$2.resetCreating, logout = _a$2.logout, updateSubscription = _a$2.updateSubscription;
4782
+ const { setCredentials, resetCreating, logout, updateSubscription } = authSlice.actions;
4846
4783
  // Selectors returned by `slice.selectors` take the root state as their first argument.
4847
- 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;
4784
+ const { isAuthenticated, selectAccessToken, selectRefreshToken, selectCurrentUser, isVerifying, getUserSession, selectCurrentUserSub, selectCurrentUserRefreshToken, selectUserTokens, selectUserSubscriptionStatus, selectSubscription, selectSubscriptionPrice, } = authSlice.selectors;
4848
4785
  authSlice.reducer;
4849
4786
 
4850
4787
  function applyCoupon(coupon, netTotal) {
4851
- var discountedAmount = netTotal * (Number(coupon.discount) / 100);
4852
- var discountedTotal = netTotal - discountedAmount;
4853
- var data = __assign(__assign({}, coupon), { discountedTotal: discountedTotal, discountedAmount: discountedAmount });
4788
+ const discountedAmount = netTotal * (Number(coupon.discount) / 100);
4789
+ const discountedTotal = netTotal - discountedAmount;
4790
+ const data = {
4791
+ ...coupon,
4792
+ discountedTotal,
4793
+ discountedAmount,
4794
+ };
4854
4795
  return data;
4855
4796
  }
4856
4797
  function applyTax(taxRate, netTotal) {
4857
- var taxAmount = netTotal * (taxRate.percentage / 100);
4798
+ const taxAmount = netTotal * (taxRate.percentage / 100);
4858
4799
  return taxAmount;
4859
4800
  }
4860
4801
  function toCamelCaseObject(obj) {
4861
- var toCamelCase = function (str) {
4862
- return str.replace(/([-_][a-z])/gi, function (match) {
4802
+ const toCamelCase = (str) => {
4803
+ return str.replace(/([-_][a-z])/gi, (match) => {
4863
4804
  return match.toUpperCase().replace(/[-_]/, '');
4864
4805
  });
4865
4806
  };
4866
- var camelCaseObject = {};
4867
- for (var key in obj) {
4807
+ const camelCaseObject = {};
4808
+ for (const key in obj) {
4868
4809
  if (obj.hasOwnProperty(key)) {
4869
- var camelKey = toCamelCase(key);
4810
+ const camelKey = toCamelCase(key);
4870
4811
  camelCaseObject[camelKey] = obj[key];
4871
4812
  }
4872
4813
  }
@@ -4874,44 +4815,43 @@ function toCamelCaseObject(obj) {
4874
4815
  }
4875
4816
 
4876
4817
  // TODO: typing.
4877
- var formatUserPayload = function (payload) {
4878
- 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"];
4879
- var parsedTermsAccepted = termsAccepted ? JSON.parse(termsAccepted) : null;
4880
- var parsedContactPreference = contactPreference
4818
+ const formatUserPayload = (payload) => {
4819
+ const { email: userEmail, given_name: firstName, family_name: lastName, birthdate: dateOfBirth, picture: picture, 'cognito:username': uuid, 'custom:termsAccepted': termsAccepted, 'custom:subscriptionId': subscriptionId, 'custom:contactPreferences': contactPreference, 'custom:customerId': customerId, } = payload;
4820
+ const parsedTermsAccepted = termsAccepted ? JSON.parse(termsAccepted) : null;
4821
+ const parsedContactPreference = contactPreference
4881
4822
  ? JSON.parse(contactPreference)
4882
4823
  : null;
4883
- var data = {
4884
- userEmail: userEmail,
4885
- lastName: lastName,
4886
- firstName: firstName,
4887
- dateOfBirth: dateOfBirth,
4824
+ const data = {
4825
+ userEmail,
4826
+ lastName,
4827
+ firstName,
4828
+ dateOfBirth,
4888
4829
  /** Handles the auth micro service/Cognito serving boolean options as a string. */
4889
4830
  termsAccepted: parsedTermsAccepted,
4890
4831
  contactPreference: parsedContactPreference,
4891
- uuid: uuid,
4832
+ uuid,
4892
4833
  subscription: subscriptionId || null,
4893
- customerId: customerId,
4894
- picture: picture,
4834
+ customerId,
4835
+ picture,
4895
4836
  };
4896
4837
  return data;
4897
4838
  };
4898
4839
  function formatPromos(data) {
4899
- return data.map(function (item) {
4900
- 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;
4840
+ return data.map((item) => {
4901
4841
  return {
4902
- 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],
4903
- id: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.uuid) === null || _d === void 0 ? void 0 : _d[0],
4904
- title: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.title) === null || _f === void 0 ? void 0 : _f[0],
4905
- 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],
4906
- imageFormatted: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.image_formatted) === null || _k === void 0 ? void 0 : _k[0],
4907
- description: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.description) === null || _m === void 0 ? void 0 : _m[0],
4908
- created: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.created) === null || _p === void 0 ? void 0 : _p[0],
4909
- updated: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.updated) === null || _r === void 0 ? void 0 : _r[0],
4910
- weight: (_t = (_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.weight) === null || _t === void 0 ? void 0 : _t[0],
4911
- buttonText: (_v = (_u = item === null || item === void 0 ? void 0 : item._source) === null || _u === void 0 ? void 0 : _u.button_text) === null || _v === void 0 ? void 0 : _v[0],
4912
- link: (_x = (_w = item === null || item === void 0 ? void 0 : item._source) === null || _w === void 0 ? void 0 : _w.link) === null || _x === void 0 ? void 0 : _x[0],
4913
- linkMobile: (_z = (_y = item === null || item === void 0 ? void 0 : item._source) === null || _y === void 0 ? void 0 : _y.link_mobile) === null || _z === void 0 ? void 0 : _z[0],
4914
- term: (_1 = (_0 = item === null || item === void 0 ? void 0 : item._source) === null || _0 === void 0 ? void 0 : _0.term) === null || _1 === void 0 ? void 0 : _1[0],
4842
+ uuid: item?._source?.uuid?.[0],
4843
+ id: item?._source?.uuid?.[0],
4844
+ title: item?._source?.title?.[0],
4845
+ image: item?._source?.image?.[0],
4846
+ imageFormatted: item?._source?.image_formatted?.[0],
4847
+ description: item?._source?.description?.[0],
4848
+ created: item?._source?.created?.[0],
4849
+ updated: item?._source?.updated?.[0],
4850
+ weight: item?._source?.weight?.[0],
4851
+ buttonText: item?._source?.button_text?.[0],
4852
+ link: item?._source?.link?.[0],
4853
+ linkMobile: item?._source?.link_mobile?.[0],
4854
+ term: item?._source?.term?.[0],
4915
4855
  // video: item?._source?.video?.[0],
4916
4856
  // align: item?._source?.align?.[0],
4917
4857
  // section: item?._source?.section?.[0],
@@ -4924,28 +4864,27 @@ function formatPromos(data) {
4924
4864
  });
4925
4865
  }
4926
4866
  function formatWorkout(data) {
4927
- return data.map(function (item) {
4928
- 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;
4867
+ return data.map((item) => {
4929
4868
  return {
4930
- 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],
4931
- 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],
4932
- 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],
4933
- 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],
4934
- 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],
4869
+ changed: item?._source?.changed?.[0],
4870
+ created: item?._source?.created?.[0],
4871
+ uuid: item?._source?.uuid?.[0],
4872
+ description: item?._source?.description?.[0],
4873
+ duration: item?._source?.duration_filter?.[0],
4935
4874
  // duration_filter: item?._source?.duration_filter?.[0],
4936
- 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],
4937
- 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],
4938
- 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],
4939
- 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],
4940
- imageStyled: (_v = (_u = item === null || item === void 0 ? void 0 : item._source) === null || _u === void 0 ? void 0 : _u.image_16_9) === null || _v === void 0 ? void 0 : _v[0],
4941
- image: (_x = (_w = item === null || item === void 0 ? void 0 : item._source) === null || _w === void 0 ? void 0 : _w.image) === null || _x === void 0 ? void 0 : _x[0],
4942
- title: (_z = (_y = item === null || item === void 0 ? void 0 : item._source) === null || _y === void 0 ? void 0 : _y.title) === null || _z === void 0 ? void 0 : _z[0],
4943
- video: (_1 = (_0 = item === null || item === void 0 ? void 0 : item._source) === null || _0 === void 0 ? void 0 : _0.video_url) === null || _1 === void 0 ? void 0 : _1[0],
4944
- videoDownload: (_3 = (_2 = item === null || item === void 0 ? void 0 : item._source) === null || _2 === void 0 ? void 0 : _2.video_download) === null || _3 === void 0 ? void 0 : _3[0],
4945
- videoPoster: (_5 = (_4 = item === null || item === void 0 ? void 0 : item._source) === null || _4 === void 0 ? void 0 : _4.video_poster) === null || _5 === void 0 ? void 0 : _5[0],
4946
- workoutCategory: (_7 = (_6 = item === null || item === void 0 ? void 0 : item._source) === null || _6 === void 0 ? void 0 : _6.workout_category) === null || _7 === void 0 ? void 0 : _7[0],
4947
- workoutType: (_9 = (_8 = item === null || item === void 0 ? void 0 : item._source) === null || _8 === void 0 ? void 0 : _8.workout_type) === null || _9 === void 0 ? void 0 : _9[0],
4948
- livestreamSection: (_11 = (_10 = item === null || item === void 0 ? void 0 : item._source) === null || _10 === void 0 ? void 0 : _10.livestream_section) === null || _11 === void 0 ? void 0 : _11[0],
4875
+ level: item?._source?.level?.[0],
4876
+ published: item?._source?.published?.[0],
4877
+ targeted_section: item?._source?.targeted_section?.[0],
4878
+ uid: item?._source?.uid?.[0],
4879
+ imageStyled: item?._source?.image_16_9?.[0],
4880
+ image: item?._source?.image?.[0],
4881
+ title: item?._source?.title?.[0],
4882
+ video: item?._source?.video_url?.[0],
4883
+ videoDownload: item?._source?.video_download?.[0],
4884
+ videoPoster: item?._source?.video_poster?.[0],
4885
+ workoutCategory: item?._source?.workout_category?.[0],
4886
+ workoutType: item?._source?.workout_type?.[0],
4887
+ livestreamSection: item?._source?.livestream_section?.[0],
4949
4888
  };
4950
4889
  });
4951
4890
  }
@@ -4968,8 +4907,8 @@ function formatWorkout(data) {
4968
4907
  // return formattedSeriesSelection;
4969
4908
  // }
4970
4909
  function formatShortform(data) {
4971
- return data.map(function (item) {
4972
- var _source = item._source;
4910
+ return data.map((item) => {
4911
+ const { _source } = item;
4973
4912
  return {
4974
4913
  uuid: _source.uuid && _source.uuid[0],
4975
4914
  id: _source.uuid && _source.uuid[0],
@@ -5018,8 +4957,8 @@ function formatShortform(data) {
5018
4957
  // });
5019
4958
  // }
5020
4959
  function formatFaqs(data) {
5021
- return data.map(function (item) {
5022
- var _source = item._source;
4960
+ return data.map((item) => {
4961
+ const { _source } = item;
5023
4962
  return {
5024
4963
  uuid: _source.uuid && _source.uuid[0],
5025
4964
  id: _source.uuid && _source.uuid[0],
@@ -5031,24 +4970,23 @@ function formatFaqs(data) {
5031
4970
  });
5032
4971
  }
5033
4972
  function formatPages(data) {
5034
- return data.map(function (item) {
5035
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
4973
+ return data.map((item) => {
5036
4974
  return {
5037
- 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],
5038
- id: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.uuid) === null || _d === void 0 ? void 0 : _d[0],
5039
- title: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.title) === null || _f === void 0 ? void 0 : _f[0],
5040
- body: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.body) === null || _h === void 0 ? void 0 : _h[0],
5041
- 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],
5042
- 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],
5043
- langcode: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.langcode) === null || _p === void 0 ? void 0 : _p[0],
5044
- url: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.url) === null || _r === void 0 ? void 0 : _r[0],
4975
+ uuid: item?._source?.uuid?.[0],
4976
+ id: item?._source?.uuid?.[0],
4977
+ title: item?._source?.title?.[0],
4978
+ body: item?._source?.body?.[0],
4979
+ created: item?._source?.created?.[0],
4980
+ updated: item?._source?.updated?.[0],
4981
+ langcode: item?._source?.langcode?.[0],
4982
+ url: item?._source?.url?.[0],
5045
4983
  };
5046
4984
  });
5047
4985
  }
5048
4986
  function formatSettings(data) {
5049
- return data.map(function (item) {
5050
- var _source = item._source;
5051
- var fieldset = _source.fieldset && _source.fieldset[0].toLowerCase();
4987
+ return data.map((item) => {
4988
+ const { _source } = item;
4989
+ const fieldset = _source.fieldset && _source.fieldset[0].toLowerCase();
5052
4990
  return {
5053
4991
  uuid: _source.uuid && _source.uuid[0],
5054
4992
  created: _source.created && _source.created[0],
@@ -5058,13 +4996,13 @@ function formatSettings(data) {
5058
4996
  video: _source.video && _source.video[0],
5059
4997
  number: _source.number && _source.number[0],
5060
4998
  pass: _source.pass && _source.pass[0],
5061
- fieldset: fieldset,
4999
+ fieldset,
5062
5000
  };
5063
5001
  });
5064
5002
  }
5065
5003
  function formatPress(data) {
5066
- return data.map(function (item) {
5067
- var _source = item._source;
5004
+ return data.map((item) => {
5005
+ const { _source } = item;
5068
5006
  return {
5069
5007
  uuid: _source.uuid && _source.uuid[0],
5070
5008
  created: _source.created && _source.created[0],
@@ -5075,8 +5013,8 @@ function formatPress(data) {
5075
5013
  });
5076
5014
  }
5077
5015
  function formatGuests(data) {
5078
- return data.map(function (item) {
5079
- var _source = item._source;
5016
+ return data.map((item) => {
5017
+ const { _source } = item;
5080
5018
  return {
5081
5019
  uuid: _source.uuid && _source.uuid[0],
5082
5020
  id: _source.id && _source.id[0],
@@ -5089,27 +5027,26 @@ function formatGuests(data) {
5089
5027
  });
5090
5028
  }
5091
5029
  function formatVideos(data) {
5092
- return data.map(function (item) {
5093
- 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;
5030
+ return data.map((item) => {
5094
5031
  return {
5095
- 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],
5096
- 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],
5097
- created: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.created) === null || _f === void 0 ? void 0 : _f[0],
5098
- updated: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.updated) === null || _h === void 0 ? void 0 : _h[0],
5099
- description: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.description) === null || _k === void 0 ? void 0 : _k[0],
5100
- image: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.image) === null || _m === void 0 ? void 0 : _m[0],
5101
- 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],
5102
- 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],
5103
- 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],
5104
- 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],
5105
- 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],
5106
- 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],
5032
+ uuid: item?._source?.uuid?.[0],
5033
+ title: item?._source?.title?.[0],
5034
+ created: item?._source?.created?.[0],
5035
+ updated: item?._source?.updated?.[0],
5036
+ description: item?._source?.description?.[0],
5037
+ image: item?._source?.image?.[0],
5038
+ duration: item?._source?.duration?.[0],
5039
+ section: item?._source?.section?.[0],
5040
+ videoPoster: item?._source?.video_poster?.[0],
5041
+ video: item?._source?.video_url?.[0],
5042
+ videoDownload: item?._source?.video_download?.[0],
5043
+ sectionId: item?._source?.section_id?.[0],
5107
5044
  };
5108
5045
  });
5109
5046
  }
5110
5047
  function formatSections(data) {
5111
- return data.map(function (item) {
5112
- var _source = item._source;
5048
+ return data.map((item) => {
5049
+ const { _source } = item;
5113
5050
  return {
5114
5051
  uuid: _source.uuid && _source.uuid[0],
5115
5052
  title: _source.title && _source.title[0],
@@ -5122,95 +5059,87 @@ function formatSections(data) {
5122
5059
  });
5123
5060
  }
5124
5061
  function formatSchedule(data) {
5125
- return data.map(function (item) {
5126
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
5062
+ return data.map((item) => {
5127
5063
  return {
5128
- 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],
5129
- 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],
5130
- langcode: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.langcode) === null || _f === void 0 ? void 0 : _f[0],
5131
- updated: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.updated) === null || _h === void 0 ? void 0 : _h[0],
5064
+ uuid: item?._source?.uuid?.[0],
5065
+ created: item?._source?.created?.[0],
5066
+ langcode: item?._source?.langcode?.[0],
5067
+ updated: item?._source?.updated?.[0],
5132
5068
  days: [
5133
5069
  {
5134
- monday: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.monday_title) === null || _k === void 0 ? void 0 : _k.map(function (title, index) {
5135
- var _a, _b, _c, _d, _e, _f, _g, _h;
5070
+ monday: item?._source?.monday_title?.map((title, index) => {
5136
5071
  return {
5137
- end: (_b = (_a = item === null || item === void 0 ? void 0 : item._source) === null || _a === void 0 ? void 0 : _a.monday_end) === null || _b === void 0 ? void 0 : _b[index],
5138
- start: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.monday_start) === null || _d === void 0 ? void 0 : _d[index],
5072
+ end: item?._source?.monday_end?.[index],
5073
+ start: item?._source?.monday_start?.[index],
5139
5074
  title: title,
5140
- video: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.monday_video) === null || _f === void 0 ? void 0 : _f[index],
5141
- live: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.monday_live) === null || _h === void 0 ? void 0 : _h[index],
5075
+ video: item?._source?.monday_video?.[index],
5076
+ live: item?._source?.monday_live?.[index],
5142
5077
  };
5143
5078
  }),
5144
5079
  },
5145
5080
  {
5146
- tuesday: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.tuesday_title) === null || _m === void 0 ? void 0 : _m.map(function (title, index) {
5147
- var _a, _b, _c, _d, _e, _f, _g, _h;
5081
+ tuesday: item?._source?.tuesday_title?.map((title, index) => {
5148
5082
  return {
5149
- end: (_b = (_a = item === null || item === void 0 ? void 0 : item._source) === null || _a === void 0 ? void 0 : _a.tuesday_end) === null || _b === void 0 ? void 0 : _b[index],
5150
- start: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.tuesday_start) === null || _d === void 0 ? void 0 : _d[index],
5083
+ end: item?._source?.tuesday_end?.[index],
5084
+ start: item?._source?.tuesday_start?.[index],
5151
5085
  title: title,
5152
- video: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.tuesday_video) === null || _f === void 0 ? void 0 : _f[index],
5153
- live: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.tuesday_live) === null || _h === void 0 ? void 0 : _h[index],
5086
+ video: item?._source?.tuesday_video?.[index],
5087
+ live: item?._source?.tuesday_live?.[index],
5154
5088
  };
5155
5089
  }),
5156
5090
  },
5157
5091
  {
5158
- wednesday: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.wednesday_title) === null || _p === void 0 ? void 0 : _p.map(function (title, index) {
5159
- var _a, _b, _c, _d, _e, _f, _g, _h;
5092
+ wednesday: item?._source?.wednesday_title?.map((title, index) => {
5160
5093
  return {
5161
- end: (_b = (_a = item === null || item === void 0 ? void 0 : item._source) === null || _a === void 0 ? void 0 : _a.wednesday_end) === null || _b === void 0 ? void 0 : _b[index],
5162
- start: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.wednesday_start) === null || _d === void 0 ? void 0 : _d[index],
5094
+ end: item?._source?.wednesday_end?.[index],
5095
+ start: item?._source?.wednesday_start?.[index],
5163
5096
  title: title,
5164
- video: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.wednesday_video) === null || _f === void 0 ? void 0 : _f[index],
5165
- live: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.wednesday_live) === null || _h === void 0 ? void 0 : _h[index],
5097
+ video: item?._source?.wednesday_video?.[index],
5098
+ live: item?._source?.wednesday_live?.[index],
5166
5099
  };
5167
5100
  }),
5168
5101
  },
5169
5102
  {
5170
- thursday: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.thursday_title) === null || _r === void 0 ? void 0 : _r.map(function (title, index) {
5171
- var _a, _b, _c, _d, _e, _f, _g, _h;
5103
+ thursday: item?._source?.thursday_title?.map((title, index) => {
5172
5104
  return {
5173
- end: (_b = (_a = item === null || item === void 0 ? void 0 : item._source) === null || _a === void 0 ? void 0 : _a.thursday_end) === null || _b === void 0 ? void 0 : _b[index],
5174
- start: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.thursday_start) === null || _d === void 0 ? void 0 : _d[index],
5105
+ end: item?._source?.thursday_end?.[index],
5106
+ start: item?._source?.thursday_start?.[index],
5175
5107
  title: title,
5176
- video: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.thursday_video) === null || _f === void 0 ? void 0 : _f[index],
5177
- live: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.thursday_live) === null || _h === void 0 ? void 0 : _h[index],
5108
+ video: item?._source?.thursday_video?.[index],
5109
+ live: item?._source?.thursday_live?.[index],
5178
5110
  };
5179
5111
  }),
5180
5112
  },
5181
5113
  {
5182
- friday: (_t = (_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.friday_title) === null || _t === void 0 ? void 0 : _t.map(function (title, index) {
5183
- var _a, _b, _c, _d, _e, _f, _g, _h;
5114
+ friday: item?._source?.friday_title?.map((title, index) => {
5184
5115
  return {
5185
- end: (_b = (_a = item === null || item === void 0 ? void 0 : item._source) === null || _a === void 0 ? void 0 : _a.friday_end) === null || _b === void 0 ? void 0 : _b[index],
5186
- start: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.friday_start) === null || _d === void 0 ? void 0 : _d[index],
5116
+ end: item?._source?.friday_end?.[index],
5117
+ start: item?._source?.friday_start?.[index],
5187
5118
  title: title,
5188
- video: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.friday_video) === null || _f === void 0 ? void 0 : _f[index],
5189
- live: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.friday_live) === null || _h === void 0 ? void 0 : _h[index],
5119
+ video: item?._source?.friday_video?.[index],
5120
+ live: item?._source?.friday_live?.[index],
5190
5121
  };
5191
5122
  }),
5192
5123
  },
5193
5124
  {
5194
- saturday: (_v = (_u = item === null || item === void 0 ? void 0 : item._source) === null || _u === void 0 ? void 0 : _u.saturday_title) === null || _v === void 0 ? void 0 : _v.map(function (title, index) {
5195
- var _a, _b, _c, _d, _e, _f, _g, _h;
5125
+ saturday: item?._source?.saturday_title?.map((title, index) => {
5196
5126
  return {
5197
- end: (_b = (_a = item === null || item === void 0 ? void 0 : item._source) === null || _a === void 0 ? void 0 : _a.saturday_end) === null || _b === void 0 ? void 0 : _b[index],
5198
- start: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.saturday_start) === null || _d === void 0 ? void 0 : _d[index],
5127
+ end: item?._source?.saturday_end?.[index],
5128
+ start: item?._source?.saturday_start?.[index],
5199
5129
  title: title,
5200
- video: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.saturday_video) === null || _f === void 0 ? void 0 : _f[index],
5201
- live: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.saturday_live) === null || _h === void 0 ? void 0 : _h[index],
5130
+ video: item?._source?.saturday_video?.[index],
5131
+ live: item?._source?.saturday_live?.[index],
5202
5132
  };
5203
5133
  }),
5204
5134
  },
5205
5135
  {
5206
- sunday: (_x = (_w = item === null || item === void 0 ? void 0 : item._source) === null || _w === void 0 ? void 0 : _w.sunday_title) === null || _x === void 0 ? void 0 : _x.map(function (title, index) {
5207
- var _a, _b, _c, _d, _e, _f, _g, _h;
5136
+ sunday: item?._source?.sunday_title?.map((title, index) => {
5208
5137
  return {
5209
- end: (_b = (_a = item === null || item === void 0 ? void 0 : item._source) === null || _a === void 0 ? void 0 : _a.sunday_end) === null || _b === void 0 ? void 0 : _b[index],
5210
- start: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.sunday_start) === null || _d === void 0 ? void 0 : _d[index],
5138
+ end: item?._source?.sunday_end?.[index],
5139
+ start: item?._source?.sunday_start?.[index],
5211
5140
  title: title,
5212
- video: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.sunday_video) === null || _f === void 0 ? void 0 : _f[index],
5213
- live: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.sunday_live) === null || _h === void 0 ? void 0 : _h[index],
5141
+ video: item?._source?.sunday_video?.[index],
5142
+ live: item?._source?.sunday_live?.[index],
5214
5143
  };
5215
5144
  }),
5216
5145
  },
@@ -5219,11 +5148,10 @@ function formatSchedule(data) {
5219
5148
  });
5220
5149
  }
5221
5150
  function formatChallenges(data) {
5222
- return data.map(function (item) {
5223
- var _a;
5224
- var _source = item._source;
5151
+ return data.map((item) => {
5152
+ const { _source } = item;
5225
5153
  return {
5226
- uuid: (_a = _source === null || _source === void 0 ? void 0 : _source.uuid) === null || _a === void 0 ? void 0 : _a[0],
5154
+ uuid: _source?.uuid?.[0],
5227
5155
  title: _source.title && _source.title[0],
5228
5156
  body: _source.body && _source.body[0],
5229
5157
  image: _source.image && _source.image[0],
@@ -5237,17 +5165,16 @@ function formatChallenges(data) {
5237
5165
  });
5238
5166
  }
5239
5167
  function formatChallengeDays(data) {
5240
- return data.map(function (item) {
5241
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
5168
+ return data.map((item) => {
5242
5169
  return {
5243
- 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],
5244
- 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],
5245
- 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],
5246
- 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],
5247
- 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],
5248
- 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],
5249
- 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],
5250
- 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],
5170
+ uuid: item?._source?.uuid?.[0],
5171
+ title: item?._source?.title?.[0],
5172
+ body: item?._source?.body?.[0],
5173
+ image: item?._source?.image?.[0],
5174
+ created: item?._source?.created?.[0],
5175
+ updated: item?._source?.updated?.[0],
5176
+ video: item?._source?.video?.[0],
5177
+ workout: item?._source?.workout?.[0],
5251
5178
  };
5252
5179
  });
5253
5180
  }
@@ -5255,360 +5182,328 @@ function formatSecondsToISO8601Duration(seconds) {
5255
5182
  if (!seconds)
5256
5183
  return '';
5257
5184
  // Calculate hours, minutes, and remaining seconds
5258
- var hours = Math.floor(seconds / 3600);
5259
- var minutes = Math.floor((seconds % 3600) / 60);
5260
- var remainingSeconds = seconds % 60;
5185
+ const hours = Math.floor(seconds / 3600);
5186
+ const minutes = Math.floor((seconds % 3600) / 60);
5187
+ const remainingSeconds = seconds % 60;
5261
5188
  // Build the ISO 8601 duration string
5262
- var duration = 'PT';
5189
+ let duration = 'PT';
5263
5190
  if (hours > 0) {
5264
- duration += "".concat(hours, "H");
5191
+ duration += `${hours}H`;
5265
5192
  }
5266
5193
  if (minutes > 0) {
5267
- duration += "".concat(minutes, "M");
5194
+ duration += `${minutes}M`;
5268
5195
  }
5269
5196
  if (remainingSeconds > 0 || duration === 'PT') {
5270
- duration += "".concat(remainingSeconds, "S");
5197
+ duration += `${remainingSeconds}S`;
5271
5198
  }
5272
5199
  return duration;
5273
5200
  }
5274
5201
  function formatAuthSession(session) {
5275
- 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;
5276
5202
  return {
5277
- accessToken: (_a = session === null || session === void 0 ? void 0 : session.tokens) === null || _a === void 0 ? void 0 : _a.accessToken.toString(),
5278
- idToken: (_c = (_b = session === null || session === void 0 ? void 0 : session.tokens) === null || _b === void 0 ? void 0 : _b.idToken) === null || _c === void 0 ? void 0 : _c.toString(),
5203
+ accessToken: session?.tokens?.accessToken.toString(),
5204
+ idToken: session?.tokens?.idToken?.toString(),
5279
5205
  refreshToken: undefined,
5280
- accessTokenExpiry: (_f = (_e = (_d = session === null || session === void 0 ? void 0 : session.tokens) === null || _d === void 0 ? void 0 : _d.idToken) === null || _e === void 0 ? void 0 : _e.payload) === null || _f === void 0 ? void 0 : _f.exp,
5281
- expires: (_j = (_h = (_g = session === null || session === void 0 ? void 0 : session.tokens) === null || _g === void 0 ? void 0 : _g.idToken) === null || _h === void 0 ? void 0 : _h.payload) === null || _j === void 0 ? void 0 : _j.exp,
5282
- sub: (_o = (_m = (_l = (_k = session === null || session === void 0 ? void 0 : session.tokens) === null || _k === void 0 ? void 0 : _k.idToken) === null || _l === void 0 ? void 0 : _l.payload) === null || _m === void 0 ? void 0 : _m['cognito:username']) === null || _o === void 0 ? void 0 : _o.toString(),
5206
+ accessTokenExpiry: session?.tokens?.idToken?.payload?.exp,
5207
+ expires: session?.tokens?.idToken?.payload?.exp,
5208
+ sub: session?.tokens?.idToken?.payload?.['cognito:username']?.toString(),
5283
5209
  details: {
5284
- userEmail: (_s = (_r = (_q = (_p = session === null || session === void 0 ? void 0 : session.tokens) === null || _p === void 0 ? void 0 : _p.idToken) === null || _q === void 0 ? void 0 : _q.payload) === null || _r === void 0 ? void 0 : _r.email) === null || _s === void 0 ? void 0 : _s.toString(),
5285
- firstName: (_w = (_v = (_u = (_t = session === null || session === void 0 ? void 0 : session.tokens) === null || _t === void 0 ? void 0 : _t.idToken) === null || _u === void 0 ? void 0 : _u.payload) === null || _v === void 0 ? void 0 : _v.given_name) === null || _w === void 0 ? void 0 : _w.toString(),
5286
- lastName: (_0 = (_z = (_y = (_x = session === null || session === void 0 ? void 0 : session.tokens) === null || _x === void 0 ? void 0 : _x.idToken) === null || _y === void 0 ? void 0 : _y.payload) === null || _z === void 0 ? void 0 : _z.family_name) === null || _0 === void 0 ? void 0 : _0.toString(),
5287
- dateOfBirth: (_4 = (_3 = (_2 = (_1 = session === null || session === void 0 ? void 0 : session.tokens) === null || _1 === void 0 ? void 0 : _1.idToken) === null || _2 === void 0 ? void 0 : _2.payload) === null || _3 === void 0 ? void 0 : _3.birthdate) === null || _4 === void 0 ? void 0 : _4.toString(),
5288
- 'cognito:username': (_8 = (_7 = (_6 = (_5 = session === null || session === void 0 ? void 0 : session.tokens) === null || _5 === void 0 ? void 0 : _5.idToken) === null || _6 === void 0 ? void 0 : _6.payload) === null || _7 === void 0 ? void 0 : _7['cognito:username']) === null || _8 === void 0 ? void 0 : _8.toString(),
5289
- 'custom:termsAccepted': (_12 = (_11 = (_10 = (_9 = session === null || session === void 0 ? void 0 : session.tokens) === null || _9 === void 0 ? void 0 : _9.idToken) === null || _10 === void 0 ? void 0 : _10.payload) === null || _11 === void 0 ? void 0 : _11['custom:termsAccepted']) === null || _12 === void 0 ? void 0 : _12.toString(),
5290
- 'custom:subscriptionId': (_16 = (_15 = (_14 = (_13 = session === null || session === void 0 ? void 0 : session.tokens) === null || _13 === void 0 ? void 0 : _13.idToken) === null || _14 === void 0 ? void 0 : _14.payload) === null || _15 === void 0 ? void 0 : _15['custom:subscriptionId']) === null || _16 === void 0 ? void 0 : _16.toString(),
5291
- 'custom:contactPreferences': (_20 = (_19 = (_18 = (_17 = session === null || session === void 0 ? void 0 : session.tokens) === null || _17 === void 0 ? void 0 : _17.idToken) === null || _18 === void 0 ? void 0 : _18.payload) === null || _19 === void 0 ? void 0 : _19['custom:contactPreferences']) === null || _20 === void 0 ? void 0 : _20.toString(),
5292
- 'custom:customerId': (_24 = (_23 = (_22 = (_21 = session === null || session === void 0 ? void 0 : session.tokens) === null || _21 === void 0 ? void 0 : _21.idToken) === null || _22 === void 0 ? void 0 : _22.payload) === null || _23 === void 0 ? void 0 : _23['custom:customerId']) === null || _24 === void 0 ? void 0 : _24.toString(),
5293
- picture: (_28 = (_27 = (_26 = (_25 = session === null || session === void 0 ? void 0 : session.tokens) === null || _25 === void 0 ? void 0 : _25.idToken) === null || _26 === void 0 ? void 0 : _26.payload) === null || _27 === void 0 ? void 0 : _27.picture) === null || _28 === void 0 ? void 0 : _28.toString(),
5210
+ userEmail: session?.tokens?.idToken?.payload?.email?.toString(),
5211
+ firstName: session?.tokens?.idToken?.payload?.given_name?.toString(),
5212
+ lastName: session?.tokens?.idToken?.payload?.family_name?.toString(),
5213
+ dateOfBirth: session?.tokens?.idToken?.payload?.birthdate?.toString(),
5214
+ 'cognito:username': session?.tokens?.idToken?.payload?.['cognito:username']?.toString(),
5215
+ 'custom:termsAccepted': session?.tokens?.idToken?.payload?.['custom:termsAccepted']?.toString(),
5216
+ 'custom:subscriptionId': session?.tokens?.idToken?.payload?.['custom:subscriptionId']?.toString(),
5217
+ 'custom:contactPreferences': session?.tokens?.idToken?.payload?.['custom:contactPreferences']?.toString(),
5218
+ 'custom:customerId': session?.tokens?.idToken?.payload?.['custom:customerId']?.toString(),
5219
+ picture: session?.tokens?.idToken?.payload?.picture?.toString(),
5294
5220
  },
5295
5221
  };
5296
5222
  }
5297
5223
  function formatFedaratedSession(session) {
5298
- 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;
5299
5224
  return {
5300
- accessToken: (_a = session === null || session === void 0 ? void 0 : session.accessToken) === null || _a === void 0 ? void 0 : _a.jwtToken,
5301
- idToken: (_b = session === null || session === void 0 ? void 0 : session.idToken) === null || _b === void 0 ? void 0 : _b.jwtToken,
5302
- refreshToken: (_c = session === null || session === void 0 ? void 0 : session.refreshToken) === null || _c === void 0 ? void 0 : _c.token,
5303
- accessTokenExpiry: (_e = (_d = session === null || session === void 0 ? void 0 : session.accessToken) === null || _d === void 0 ? void 0 : _d.payload) === null || _e === void 0 ? void 0 : _e.exp,
5304
- expires: (_g = (_f = session === null || session === void 0 ? void 0 : session.accessToken) === null || _f === void 0 ? void 0 : _f.payload) === null || _g === void 0 ? void 0 : _g.exp,
5305
- sub: (_j = (_h = session === null || session === void 0 ? void 0 : session.idToken) === null || _h === void 0 ? void 0 : _h.payload) === null || _j === void 0 ? void 0 : _j.sub,
5225
+ accessToken: session?.accessToken?.jwtToken,
5226
+ idToken: session?.idToken?.jwtToken,
5227
+ refreshToken: session?.refreshToken?.token,
5228
+ accessTokenExpiry: session?.accessToken?.payload?.exp,
5229
+ expires: session?.accessToken?.payload?.exp,
5230
+ sub: session?.idToken?.payload?.sub,
5306
5231
  details: {
5307
- userEmail: (_l = (_k = session === null || session === void 0 ? void 0 : session.idToken) === null || _k === void 0 ? void 0 : _k.payload) === null || _l === void 0 ? void 0 : _l.email,
5308
- firstName: (_o = (_m = session === null || session === void 0 ? void 0 : session.idToken) === null || _m === void 0 ? void 0 : _m.payload) === null || _o === void 0 ? void 0 : _o.given_name,
5309
- lastName: (_q = (_p = session === null || session === void 0 ? void 0 : session.idToken) === null || _p === void 0 ? void 0 : _p.payload) === null || _q === void 0 ? void 0 : _q.family_name,
5310
- dateOfBirth: (_s = (_r = session === null || session === void 0 ? void 0 : session.idToken) === null || _r === void 0 ? void 0 : _r.payload) === null || _s === void 0 ? void 0 : _s.birthdate,
5311
- 'cognito:username': (_u = (_t = session === null || session === void 0 ? void 0 : session.idToken) === null || _t === void 0 ? void 0 : _t.payload) === null || _u === void 0 ? void 0 : _u.sub,
5312
- 'custom:termsAccepted': (_w = (_v = session === null || session === void 0 ? void 0 : session.idToken) === null || _v === void 0 ? void 0 : _v.payload) === null || _w === void 0 ? void 0 : _w['custom:termsAccepted'],
5313
- 'custom:subscriptionId': (_y = (_x = session === null || session === void 0 ? void 0 : session.idToken) === null || _x === void 0 ? void 0 : _x.payload) === null || _y === void 0 ? void 0 : _y['custom:subscriptionId'],
5314
- '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'],
5315
- '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'],
5316
- 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,
5317
- id: toCamelCaseObject((_5 = session === null || session === void 0 ? void 0 : session.idToken) === null || _5 === void 0 ? void 0 : _5.payload),
5232
+ userEmail: session?.idToken?.payload?.email,
5233
+ firstName: session?.idToken?.payload?.given_name,
5234
+ lastName: session?.idToken?.payload?.family_name,
5235
+ dateOfBirth: session?.idToken?.payload?.birthdate,
5236
+ 'cognito:username': session?.idToken?.payload?.sub,
5237
+ 'custom:termsAccepted': session?.idToken?.payload?.['custom:termsAccepted'],
5238
+ 'custom:subscriptionId': session?.idToken?.payload?.['custom:subscriptionId'],
5239
+ 'custom:contactPreferences': session?.idToken?.payload?.['custom:contactPreferences'],
5240
+ 'custom:customerId': session?.idToken?.payload?.['custom:customerId'],
5241
+ picture: session?.idToken?.payload?.picture,
5242
+ id: toCamelCaseObject(session?.idToken?.payload),
5318
5243
  },
5319
5244
  };
5320
5245
  }
5321
5246
  function formatSocialAuthSession(tokens) {
5322
- var idToken = jwtDecode(tokens.idToken);
5247
+ const idToken = jwtDecode(tokens.idToken);
5323
5248
  return {
5324
5249
  socialSignin: true,
5325
5250
  accessToken: tokens.accessToken,
5326
5251
  idToken: tokens.idToken,
5327
5252
  refreshToken: tokens.refreshToken,
5328
- accessTokenExpiry: idToken === null || idToken === void 0 ? void 0 : idToken.exp,
5329
- expires: idToken === null || idToken === void 0 ? void 0 : idToken.exp,
5253
+ accessTokenExpiry: idToken?.exp,
5254
+ expires: idToken?.exp,
5330
5255
  sub: idToken.sub,
5331
5256
  details: {
5332
5257
  userEmail: idToken.email,
5333
5258
  firstName: idToken.given_name,
5334
5259
  lastName: idToken.family_name,
5335
- dateOfBirth: idToken === null || idToken === void 0 ? void 0 : idToken.birthdate,
5336
- 'cognito:username': idToken === null || idToken === void 0 ? void 0 : idToken['cognito:username'],
5337
- 'custom:termsAccepted': idToken === null || idToken === void 0 ? void 0 : idToken['custom:termsAccepted'],
5338
- 'custom:subscriptionId': idToken === null || idToken === void 0 ? void 0 : idToken['custom:subscriptionId'],
5339
- 'custom:contactPreferences': idToken === null || idToken === void 0 ? void 0 : idToken['custom:contactPreferences'],
5340
- 'custom:customerId': idToken === null || idToken === void 0 ? void 0 : idToken['custom:customerId'],
5341
- picture: idToken === null || idToken === void 0 ? void 0 : idToken.picture,
5260
+ dateOfBirth: idToken?.birthdate,
5261
+ 'cognito:username': idToken?.['cognito:username'],
5262
+ 'custom:termsAccepted': idToken?.['custom:termsAccepted'],
5263
+ 'custom:subscriptionId': idToken?.['custom:subscriptionId'],
5264
+ 'custom:contactPreferences': idToken?.['custom:contactPreferences'],
5265
+ 'custom:customerId': idToken?.['custom:customerId'],
5266
+ picture: idToken?.picture,
5342
5267
  },
5343
5268
  };
5344
5269
  }
5345
5270
  function formatConfig(data) {
5346
- return data.map(function (item) {
5347
- 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;
5271
+ return data.map((item) => {
5348
5272
  return {
5349
- 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],
5350
- id: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.uuid) === null || _d === void 0 ? void 0 : _d[0],
5351
- created: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.created) === null || _f === void 0 ? void 0 : _f[0],
5352
- updated: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.updated) === null || _h === void 0 ? void 0 : _h[0],
5353
- type: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.type) === null || _k === void 0 ? void 0 : _k[0],
5354
- cla: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.cla) === null || _m === void 0 ? void 0 : _m[0],
5355
- enabled: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.enabled) === null || _p === void 0 ? void 0 : _p[0],
5356
- name: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.name) === null || _r === void 0 ? void 0 : _r[0],
5357
- price: (_t = (_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.price) === null || _t === void 0 ? void 0 : _t[0],
5358
- video: (_v = (_u = item === null || item === void 0 ? void 0 : item._source) === null || _u === void 0 ? void 0 : _u.video) === null || _v === void 0 ? void 0 : _v[0],
5359
- imageHomepage: (_x = (_w = item === null || item === void 0 ? void 0 : item._source) === null || _w === void 0 ? void 0 : _w.image_homepage) === null || _x === void 0 ? void 0 : _x[0],
5360
- imageSectionBanner: (_z = (_y = item === null || item === void 0 ? void 0 : item._source) === null || _y === void 0 ? void 0 : _y.image_section_banner) === null || _z === void 0 ? void 0 : _z[0],
5273
+ uuid: item?._source?.uuid?.[0],
5274
+ id: item?._source?.uuid?.[0],
5275
+ created: item?._source?.created?.[0],
5276
+ updated: item?._source?.updated?.[0],
5277
+ type: item?._source?.type?.[0],
5278
+ cla: item?._source?.cla?.[0],
5279
+ enabled: item?._source?.enabled?.[0],
5280
+ name: item?._source?.name?.[0],
5281
+ price: item?._source?.price?.[0],
5282
+ video: item?._source?.video?.[0],
5283
+ imageHomepage: item?._source?.image_homepage?.[0],
5284
+ imageSectionBanner: item?._source?.image_section_banner?.[0],
5361
5285
  };
5362
5286
  });
5363
5287
  }
5364
5288
  function formatSectionPanels(data) {
5365
- return data.map(function (item) {
5366
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
5289
+ return data.map((item) => {
5367
5290
  return {
5368
- 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],
5369
- id: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.uuid) === null || _d === void 0 ? void 0 : _d[0],
5370
- title: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.title) === null || _f === void 0 ? void 0 : _f[0],
5371
- created: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.created) === null || _h === void 0 ? void 0 : _h[0],
5372
- updated: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.updated) === null || _k === void 0 ? void 0 : _k[0],
5373
- weight: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.weight) === null || _m === void 0 ? void 0 : _m[0],
5374
- items: (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.item_uuid,
5375
- type: (_q = (_p = item === null || item === void 0 ? void 0 : item._source) === null || _p === void 0 ? void 0 : _p.type) === null || _q === void 0 ? void 0 : _q[0],
5291
+ uuid: item?._source?.uuid?.[0],
5292
+ id: item?._source?.uuid?.[0],
5293
+ title: item?._source?.title?.[0],
5294
+ created: item?._source?.created?.[0],
5295
+ updated: item?._source?.updated?.[0],
5296
+ weight: item?._source?.weight?.[0],
5297
+ items: item?._source?.item_uuid,
5298
+ type: item?._source?.type?.[0],
5376
5299
  };
5377
5300
  });
5378
5301
  }
5379
5302
  function formatSectionItems(data) {
5380
- return data.map(function (item) {
5381
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
5303
+ return data.map((item) => {
5382
5304
  return {
5383
- 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],
5384
- id: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.uuid) === null || _d === void 0 ? void 0 : _d[0],
5385
- title: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.title) === null || _f === void 0 ? void 0 : _f[0],
5386
- created: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.created) === null || _h === void 0 ? void 0 : _h[0],
5387
- updated: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.updated) === null || _k === void 0 ? void 0 : _k[0],
5388
- type: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.type) === null || _m === void 0 ? void 0 : _m[0],
5389
- term: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.term) === null || _p === void 0 ? void 0 : _p[0],
5390
- image: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.custom_image_formatted) === null || _r === void 0 ? void 0 : _r[0],
5391
- bannerImage: (_t = (_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.banner_image_formatted) === null || _t === void 0 ? void 0 : _t[0],
5305
+ uuid: item?._source?.uuid?.[0],
5306
+ id: item?._source?.uuid?.[0],
5307
+ title: item?._source?.title?.[0],
5308
+ created: item?._source?.created?.[0],
5309
+ updated: item?._source?.updated?.[0],
5310
+ type: item?._source?.type?.[0],
5311
+ term: item?._source?.term?.[0],
5312
+ image: item?._source?.custom_image_formatted?.[0],
5313
+ bannerImage: item?._source?.banner_image_formatted?.[0],
5392
5314
  };
5393
5315
  });
5394
5316
  }
5395
- var formatTaxonomies = function (data) {
5396
- return data.map(function (item) {
5397
- 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;
5317
+ const formatTaxonomies = (data) => {
5318
+ return data.map((item) => {
5398
5319
  return {
5399
- 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],
5400
- id: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.uuid) === null || _d === void 0 ? void 0 : _d[0],
5401
- updated: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.updated) === null || _f === void 0 ? void 0 : _f[0],
5402
- vocabulary: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.vocabulary) === null || _h === void 0 ? void 0 : _h[0],
5403
- name: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.name) === null || _k === void 0 ? void 0 : _k[0],
5404
- description: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.description) === null || _m === void 0 ? void 0 : _m[0],
5405
- image: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.image) === null || _p === void 0 ? void 0 : _p[0],
5406
- imageBanner: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.image_banner) === null || _r === void 0 ? void 0 : _r[0],
5407
- imageBannerTaxonomy: (_t = (_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.image_banner_taxonomy) === null || _t === void 0 ? void 0 : _t[0],
5408
- imageLarge: (_v = (_u = item === null || item === void 0 ? void 0 : item._source) === null || _u === void 0 ? void 0 : _u.image_large_16_9) === null || _v === void 0 ? void 0 : _v[0],
5409
- weight: (_x = (_w = item === null || item === void 0 ? void 0 : item._source) === null || _w === void 0 ? void 0 : _w.weight) === null || _x === void 0 ? void 0 : _x[0],
5410
- parentName: (_z = (_y = item === null || item === void 0 ? void 0 : item._source) === null || _y === void 0 ? void 0 : _y.parent_name) === null || _z === void 0 ? void 0 : _z[0],
5411
- color: (_1 = (_0 = item === null || item === void 0 ? void 0 : item._source) === null || _0 === void 0 ? void 0 : _0.color) === null || _1 === void 0 ? void 0 : _1[0],
5320
+ uuid: item?._source?.uuid?.[0],
5321
+ id: item?._source?.uuid?.[0],
5322
+ updated: item?._source?.updated?.[0],
5323
+ vocabulary: item?._source?.vocabulary?.[0],
5324
+ name: item?._source?.name?.[0],
5325
+ description: item?._source?.description?.[0],
5326
+ image: item?._source?.image?.[0],
5327
+ imageBanner: item?._source?.image_banner?.[0],
5328
+ imageBannerTaxonomy: item?._source?.image_banner_taxonomy?.[0],
5329
+ imageLarge: item?._source?.image_large_16_9?.[0],
5330
+ weight: item?._source?.weight?.[0],
5331
+ parentName: item?._source?.parent_name?.[0],
5332
+ color: item?._source?.color?.[0],
5412
5333
  };
5413
5334
  });
5414
5335
  };
5415
- var formatSeries = function (data) {
5416
- return data.map(function (item) {
5417
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
5336
+ const formatSeries = (data) => {
5337
+ return data.map((item) => {
5418
5338
  return {
5419
- 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],
5420
- id: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.uuid) === null || _d === void 0 ? void 0 : _d[0],
5421
- created: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.created) === null || _f === void 0 ? void 0 : _f[0],
5422
- updated: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.updated) === null || _h === void 0 ? void 0 : _h[0],
5423
- title: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.display_title) === null || _k === void 0 ? void 0 : _k[0],
5424
- synopsis: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.synopsis) === null || _m === void 0 ? void 0 : _m[0],
5425
- imagePoster: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.image_style_poster) === null || _p === void 0 ? void 0 : _p[0],
5426
- imageThumb: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.image_style_thumb) === null || _r === void 0 ? void 0 : _r[0],
5427
- category: (_t = (_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.category) === null || _t === void 0 ? void 0 : _t[0],
5428
- categoryId: (_v = (_u = item === null || item === void 0 ? void 0 : item._source) === null || _u === void 0 ? void 0 : _u.category_id) === null || _v === void 0 ? void 0 : _v[0],
5429
- seasons: ((_w = item === null || item === void 0 ? void 0 : item._source) === null || _w === void 0 ? void 0 : _w.seasons) || [],
5339
+ uuid: item?._source?.uuid?.[0],
5340
+ id: item?._source?.uuid?.[0],
5341
+ created: item?._source?.created?.[0],
5342
+ updated: item?._source?.updated?.[0],
5343
+ title: item?._source?.display_title?.[0],
5344
+ synopsis: item?._source?.synopsis?.[0],
5345
+ imagePoster: item?._source?.image_style_poster?.[0],
5346
+ imageThumb: item?._source?.image_style_thumb?.[0],
5347
+ category: item?._source?.category?.[0],
5348
+ categoryId: item?._source?.category_id?.[0],
5349
+ seasons: item?._source?.seasons || [],
5430
5350
  };
5431
5351
  });
5432
5352
  };
5433
- var formatSeasons = function (data) {
5434
- return data.map(function (item) {
5435
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
5353
+ const formatSeasons = (data) => {
5354
+ return data.map((item) => {
5436
5355
  return {
5437
- 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],
5438
- id: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.uuid) === null || _d === void 0 ? void 0 : _d[0],
5439
- created: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.created) === null || _f === void 0 ? void 0 : _f[0],
5440
- updated: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.updated) === null || _h === void 0 ? void 0 : _h[0],
5441
- title: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.display_title) === null || _k === void 0 ? void 0 : _k[0],
5442
- synopsis: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.synopsis) === null || _m === void 0 ? void 0 : _m[0],
5443
- imagePoster: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.image_style_poster) === null || _p === void 0 ? void 0 : _p[0],
5444
- imageThumb: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.image_style_thumb) === null || _r === void 0 ? void 0 : _r[0],
5445
- episodes: ((_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.episodes) || [],
5446
- seasonNumber: (_u = (_t = item === null || item === void 0 ? void 0 : item._source) === null || _t === void 0 ? void 0 : _t.season_number) === null || _u === void 0 ? void 0 : _u[0],
5447
- showId: (_w = (_v = item === null || item === void 0 ? void 0 : item._source) === null || _v === void 0 ? void 0 : _v.show) === null || _w === void 0 ? void 0 : _w[0],
5356
+ uuid: item?._source?.uuid?.[0],
5357
+ id: item?._source?.uuid?.[0],
5358
+ created: item?._source?.created?.[0],
5359
+ updated: item?._source?.updated?.[0],
5360
+ title: item?._source?.display_title?.[0],
5361
+ synopsis: item?._source?.synopsis?.[0],
5362
+ imagePoster: item?._source?.image_style_poster?.[0],
5363
+ imageThumb: item?._source?.image_style_thumb?.[0],
5364
+ episodes: item?._source?.episodes || [],
5365
+ seasonNumber: item?._source?.season_number?.[0],
5366
+ showId: item?._source?.show?.[0],
5448
5367
  };
5449
5368
  });
5450
5369
  };
5451
- var formatLongform = function (data) {
5452
- return data.map(function (item) {
5453
- 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;
5370
+ const formatLongform = (data) => {
5371
+ return data.map((item) => {
5454
5372
  return {
5455
- 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],
5456
- id: (_d = (_c = item === null || item === void 0 ? void 0 : item._source) === null || _c === void 0 ? void 0 : _c.uuid) === null || _d === void 0 ? void 0 : _d[0],
5457
- created: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.created) === null || _f === void 0 ? void 0 : _f[0],
5458
- updated: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.updated) === null || _h === void 0 ? void 0 : _h[0],
5459
- title: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.display_title) === null || _k === void 0 ? void 0 : _k[0],
5460
- synopsis: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.synopsis) === null || _m === void 0 ? void 0 : _m[0],
5461
- imagePoster: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.image_style_poster) === null || _p === void 0 ? void 0 : _p[0],
5462
- imageThumb: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.image_style_thumb) === null || _r === void 0 ? void 0 : _r[0],
5463
- duration: (_t = (_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.duration) === null || _t === void 0 ? void 0 : _t[0],
5464
- releaseDate: (_v = (_u = item === null || item === void 0 ? void 0 : item._source) === null || _u === void 0 ? void 0 : _u.release_date) === null || _v === void 0 ? void 0 : _v[0],
5465
- video: (_x = (_w = item === null || item === void 0 ? void 0 : item._source) === null || _w === void 0 ? void 0 : _w.video) === null || _x === void 0 ? void 0 : _x[0],
5466
- imageUrl: (_z = (_y = item === null || item === void 0 ? void 0 : item._source) === null || _y === void 0 ? void 0 : _y.image_url) === null || _z === void 0 ? void 0 : _z[0],
5467
- episodeNumber: (_1 = (_0 = item === null || item === void 0 ? void 0 : item._source) === null || _0 === void 0 ? void 0 : _0.episode_number) === null || _1 === void 0 ? void 0 : _1[0],
5373
+ uuid: item?._source?.uuid?.[0],
5374
+ id: item?._source?.uuid?.[0],
5375
+ created: item?._source?.created?.[0],
5376
+ updated: item?._source?.updated?.[0],
5377
+ title: item?._source?.display_title?.[0],
5378
+ synopsis: item?._source?.synopsis?.[0],
5379
+ imagePoster: item?._source?.image_style_poster?.[0],
5380
+ imageThumb: item?._source?.image_style_thumb?.[0],
5381
+ duration: item?._source?.duration?.[0],
5382
+ releaseDate: item?._source?.release_date?.[0],
5383
+ video: item?._source?.video?.[0],
5384
+ imageUrl: item?._source?.image_url?.[0],
5385
+ episodeNumber: item?._source?.episode_number?.[0],
5468
5386
  };
5469
5387
  });
5470
5388
  };
5471
- var formatMediaItem = function (data) {
5472
- return data.map(function (item) {
5473
- 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;
5389
+ const formatMediaItem = (data) => {
5390
+ return data.map((item) => {
5474
5391
  return {
5475
- 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],
5476
- 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],
5477
- image: (_f = (_e = item === null || item === void 0 ? void 0 : item._source) === null || _e === void 0 ? void 0 : _e.image) === null || _f === void 0 ? void 0 : _f[0],
5478
- customThumbnail: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.custom_thumbnail) === null || _h === void 0 ? void 0 : _h[0],
5479
- price: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.price) === null || _k === void 0 ? void 0 : _k[0],
5480
- priceTwoYear: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.price_2_year) === null || _m === void 0 ? void 0 : _m[0],
5481
- revisionTimestamp: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.revision_timestamp) === null || _p === void 0 ? void 0 : _p[0],
5482
- sku: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.sku) === null || _r === void 0 ? void 0 : _r[0],
5483
- status: (_t = (_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.status) === null || _t === void 0 ? void 0 : _t[0],
5484
- uuid: (_v = (_u = item === null || item === void 0 ? void 0 : item._source) === null || _u === void 0 ? void 0 : _u.uuid) === null || _v === void 0 ? void 0 : _v[0],
5485
- description: (_x = (_w = item === null || item === void 0 ? void 0 : item._source) === null || _w === void 0 ? void 0 : _w.description) === null || _x === void 0 ? void 0 : _x[0],
5486
- transcript: (_z = (_y = item === null || item === void 0 ? void 0 : item._source) === null || _y === void 0 ? void 0 : _y.transcript) === null || _z === void 0 ? void 0 : _z[0],
5487
- entities: (_0 = item === null || item === void 0 ? void 0 : item._source) === null || _0 === void 0 ? void 0 : _0.entities,
5488
- phrases: (_1 = item === null || item === void 0 ? void 0 : item._source) === null || _1 === void 0 ? void 0 : _1.phrases,
5489
- video: (_3 = (_2 = item === null || item === void 0 ? void 0 : item._source) === null || _2 === void 0 ? void 0 : _2.video) === null || _3 === void 0 ? void 0 : _3[0],
5490
- title: (_5 = (_4 = item === null || item === void 0 ? void 0 : item._source) === null || _4 === void 0 ? void 0 : _4.title) === null || _5 === void 0 ? void 0 : _5[0],
5491
- generatedTitle: (_7 = (_6 = item === null || item === void 0 ? void 0 : item._source) === null || _6 === void 0 ? void 0 : _6.generated_title) === null || _7 === void 0 ? void 0 : _7[0],
5492
- projectPricing: (_9 = (_8 = item === null || item === void 0 ? void 0 : item._source) === null || _8 === void 0 ? void 0 : _8.project_pricing) === null || _9 === void 0 ? void 0 : _9[0],
5493
- related_items: (_10 = item === null || item === void 0 ? void 0 : item._source) === null || _10 === void 0 ? void 0 : _10.related_uuids,
5494
- franchises: (_11 = item === null || item === void 0 ? void 0 : item._source) === null || _11 === void 0 ? void 0 : _11.franchise_name,
5495
- franchisesIds: (_12 = item === null || item === void 0 ? void 0 : item._source) === null || _12 === void 0 ? void 0 : _12.franchise_tid,
5496
- original: (_14 = (_13 = item === null || item === void 0 ? void 0 : item._source) === null || _13 === void 0 ? void 0 : _13.original) === null || _14 === void 0 ? void 0 : _14[0],
5497
- script: (_16 = (_15 = item === null || item === void 0 ? void 0 : item._source) === null || _15 === void 0 ? void 0 : _15.script) === null || _16 === void 0 ? void 0 : _16[0],
5498
- hideThumbnailTitle: (_18 = (_17 = item === null || item === void 0 ? void 0 : item._source) === null || _17 === void 0 ? void 0 : _17.hide_thumbnail_title) === null || _18 === void 0 ? void 0 : _18[0],
5392
+ changed: item?._source?.changed?.[0],
5393
+ created: item?._source?.created?.[0],
5394
+ image: item?._source?.image?.[0],
5395
+ customThumbnail: item?._source?.custom_thumbnail?.[0],
5396
+ price: item?._source?.price?.[0],
5397
+ priceTwoYear: item?._source?.price_2_year?.[0],
5398
+ revisionTimestamp: item?._source?.revision_timestamp?.[0],
5399
+ sku: item?._source?.sku?.[0],
5400
+ status: item?._source?.status?.[0],
5401
+ uuid: item?._source?.uuid?.[0],
5402
+ description: item?._source?.description?.[0],
5403
+ transcript: item?._source?.transcript?.[0],
5404
+ entities: item?._source?.entities,
5405
+ phrases: item?._source?.phrases,
5406
+ video: item?._source?.video?.[0],
5407
+ title: item?._source?.title?.[0],
5408
+ generatedTitle: item?._source?.generated_title?.[0],
5409
+ projectPricing: item?._source?.project_pricing?.[0],
5410
+ related_items: item?._source?.related_uuids,
5411
+ franchises: item?._source?.franchise_name,
5412
+ franchisesIds: item?._source?.franchise_tid,
5413
+ original: item?._source?.original?.[0],
5414
+ script: item?._source?.script?.[0],
5415
+ hideThumbnailTitle: item?._source?.hide_thumbnail_title?.[0],
5499
5416
  };
5500
5417
  });
5501
5418
  };
5502
5419
 
5503
- var _a$1, _b$1, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
5504
5420
  // Render the store based on the environment.
5505
- var isWeb = process.env.NEXT_PUBLIC_WEB_APP;
5506
- var ENV = isWeb ? process.env : Promise.resolve().then(function () { return index$1; }).then(function (mod) { return mod.default; }).catch(function () { return ({}); });
5421
+ const isWeb = process.env.NEXT_PUBLIC_WEB_APP;
5422
+ const ENV = isWeb ? process.env : import('./index-KjhWa1AL.js').then((mod) => mod.default).catch(() => ({}));
5507
5423
  // export const ENV = process.env;
5508
- ((_a$1 = process.env) === null || _a$1 === void 0 ? void 0 : _a$1.NEXT_PUBLIC_API_PREFIX) || ENV.API_PREFIX;
5424
+ process.env?.NEXT_PUBLIC_API_PREFIX || ENV.API_PREFIX;
5509
5425
  // Auth specific API
5510
- 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;
5426
+ const API_AUTH_PREFIX = process.env?.NEXT_PUBLIC_API_AUTH_PREFIX || ENV.API_AUTH_PREFIX;
5511
5427
  // Payments specific API
5512
- var API_PAYMENTS_PREFIX = ((_c = process.env) === null || _c === void 0 ? void 0 : _c.NEXT_PUBLIC_API_PAYMENTS_PREFIX) || ENV.API_PAYMENTS_PREFIX;
5428
+ const API_PAYMENTS_PREFIX = process.env?.NEXT_PUBLIC_API_PAYMENTS_PREFIX || ENV.API_PAYMENTS_PREFIX;
5513
5429
  // Orders specific API
5514
- var API_ORDERS_PREFIX = ((_d = process.env) === null || _d === void 0 ? void 0 : _d.NEXT_PUBLIC_API_ORDERS_PREFIX) || ENV.API_ORDERS_PREFIX;
5515
- ((_e = process.env) === null || _e === void 0 ? void 0 : _e.NEXT_PUBLIC_APP_BASE_URL) || ENV.APP_BASE_URL;
5516
- var APP_ES_INSTANCE = ((_f = process.env) === null || _f === void 0 ? void 0 : _f.NEXT_PUBLIC_APP_ES_INSTANCE) || ENV.APP_ES_INSTANCE;
5517
- var APP_ES_AUTH = ((_g = process.env) === null || _g === void 0 ? void 0 : _g.NEXT_PUBLIC_APP_ES_AUTH) || ENV.APP_ES_AUTH;
5518
- ((_h = process.env) === null || _h === void 0 ? void 0 : _h.NEXT_PUBLIC_APP_ES_PROMO_PANEL_INDEX) ||
5430
+ const API_ORDERS_PREFIX = process.env?.NEXT_PUBLIC_API_ORDERS_PREFIX || ENV.API_ORDERS_PREFIX;
5431
+ process.env?.NEXT_PUBLIC_APP_BASE_URL || ENV.APP_BASE_URL;
5432
+ const APP_ES_INSTANCE = process.env?.NEXT_PUBLIC_APP_ES_INSTANCE || ENV.APP_ES_INSTANCE;
5433
+ const APP_ES_AUTH = process.env?.NEXT_PUBLIC_APP_ES_AUTH || ENV.APP_ES_AUTH;
5434
+ process.env?.NEXT_PUBLIC_APP_ES_PROMO_PANEL_INDEX ||
5519
5435
  ENV.APP_ES_PROMO_PANEL_INDEX;
5520
- ((_j = process.env) === null || _j === void 0 ? void 0 : _j.NEXT_PUBLIC_APP_ES_FAQ_INDEX) || ENV.APP_ES_FAQ_INDEX;
5521
- ((_k = process.env) === null || _k === void 0 ? void 0 : _k.NEXT_PUBLIC_APP_ES_PAGES_INDEX) || ENV.APP_ES_PAGES_INDEX;
5522
- ((_l = process.env) === null || _l === void 0 ? void 0 : _l.NEXT_PUBLIC_APP_ES_SETTINGS_INDEX) || ENV.APP_ES_SETTINGS_INDEX;
5523
- ((_m = process.env) === null || _m === void 0 ? void 0 : _m.NEXT_PUBLIC_APP_ES_PRESS_INDEX) || ENV.APP_ES_PRESS_INDEX;
5524
- ((_o = process.env) === null || _o === void 0 ? void 0 : _o.NEXT_PUBLIC_APP_ES_GUESTS_INDEX) || ENV.APP_ES_GUESTS_INDEX;
5525
- ((_p = process.env) === null || _p === void 0 ? void 0 : _p.NEXT_PUBLIC_APP_ES_VIDEOS_INDEX) || ENV.APP_ES_VIDEOS_INDEX;
5526
- ((_q = process.env) === null || _q === void 0 ? void 0 : _q.NEXT_PUBLIC_APP_ES_SECTIONS_INDEX) || ENV.APP_ES_SECTIONS_INDEX;
5527
- ((_r = process.env) === null || _r === void 0 ? void 0 : _r.NEXT_PUBLIC_APP_ES_WORKOUTS_INDEX) || ENV.APP_ES_WORKOUTS_INDEX;
5528
- ((_s = process.env) === null || _s === void 0 ? void 0 : _s.NEXT_PUBLIC_APP_ES_SCHEDULE_INDEX) || ENV.APP_ES_SCHEDULE_INDEX;
5529
- ((_t = process.env) === null || _t === void 0 ? void 0 : _t.NEXT_PUBLIC_APP_ES_CHALLENGES_INDEX) ||
5436
+ process.env?.NEXT_PUBLIC_APP_ES_FAQ_INDEX || ENV.APP_ES_FAQ_INDEX;
5437
+ process.env?.NEXT_PUBLIC_APP_ES_PAGES_INDEX || ENV.APP_ES_PAGES_INDEX;
5438
+ process.env?.NEXT_PUBLIC_APP_ES_SETTINGS_INDEX || ENV.APP_ES_SETTINGS_INDEX;
5439
+ process.env?.NEXT_PUBLIC_APP_ES_PRESS_INDEX || ENV.APP_ES_PRESS_INDEX;
5440
+ process.env?.NEXT_PUBLIC_APP_ES_GUESTS_INDEX || ENV.APP_ES_GUESTS_INDEX;
5441
+ process.env?.NEXT_PUBLIC_APP_ES_VIDEOS_INDEX || ENV.APP_ES_VIDEOS_INDEX;
5442
+ process.env?.NEXT_PUBLIC_APP_ES_SECTIONS_INDEX || ENV.APP_ES_SECTIONS_INDEX;
5443
+ process.env?.NEXT_PUBLIC_APP_ES_WORKOUTS_INDEX || ENV.APP_ES_WORKOUTS_INDEX;
5444
+ process.env?.NEXT_PUBLIC_APP_ES_SCHEDULE_INDEX || ENV.APP_ES_SCHEDULE_INDEX;
5445
+ process.env?.NEXT_PUBLIC_APP_ES_CHALLENGES_INDEX ||
5530
5446
  ENV.APP_ES_CHALLENGES_INDEX;
5531
- ((_u = process.env) === null || _u === void 0 ? void 0 : _u.NEXT_PUBLIC_APP_ES_CHALLENGE_DAYS_INDEX) ||
5447
+ process.env?.NEXT_PUBLIC_APP_ES_CHALLENGE_DAYS_INDEX ||
5532
5448
  ENV.APP_ES_CHALLENGE_DAYS_INDEX;
5533
5449
 
5534
- var authDataBaseQuery = fetchBaseQuery({
5450
+ const authDataBaseQuery = fetchBaseQuery({
5535
5451
  baseUrl: API_AUTH_PREFIX,
5536
- prepareHeaders: function (headers_1, _a) { return __awaiter(void 0, [headers_1, _a], void 0, function (headers, _b) {
5537
- var session, idToken, accessToken, error_1;
5538
- return __generator(this, function (_c) {
5539
- switch (_c.label) {
5540
- case 0:
5541
- headers.set('Content-Type', 'application/json');
5542
- _c.label = 1;
5543
- case 1:
5544
- _c.trys.push([1, 3, , 4]);
5545
- return [4 /*yield*/, Auth.currentSession()];
5546
- case 2:
5547
- session = _c.sent();
5548
- idToken = session.getIdToken().getJwtToken();
5549
- accessToken = session.getAccessToken().getJwtToken();
5550
- if (accessToken && idToken) {
5551
- headers.set('accesstoken', accessToken);
5552
- headers.set('idtoken', idToken);
5553
- // headers.set('refreshtoken', tokens.refreshToken);
5554
- }
5555
- return [2 /*return*/, headers];
5556
- case 3:
5557
- error_1 = _c.sent();
5558
- console.error('authDataBaseQuery: ', error_1);
5559
- return [2 /*return*/, headers];
5560
- case 4: return [2 /*return*/];
5452
+ prepareHeaders: async (headers, {}) => {
5453
+ headers.set('Content-Type', 'application/json');
5454
+ try {
5455
+ // add accessToken to headers from slice using selectAccessToken selector
5456
+ const session = await Auth.currentSession();
5457
+ const idToken = session.getIdToken().getJwtToken(); // ID token
5458
+ const accessToken = session.getAccessToken().getJwtToken(); // Access token
5459
+ if (accessToken && idToken) {
5460
+ headers.set('accesstoken', accessToken);
5461
+ headers.set('idtoken', idToken);
5462
+ // headers.set('refreshtoken', tokens.refreshToken);
5561
5463
  }
5562
- });
5563
- }); },
5464
+ return headers;
5465
+ }
5466
+ catch (error) {
5467
+ console.error('authDataBaseQuery: ', error);
5468
+ return headers;
5469
+ }
5470
+ },
5564
5471
  credentials: 'include',
5565
5472
  });
5566
5473
  /**
5567
5474
  * This function is used to retry a request if we get a 401 error.
5568
5475
  */
5569
- var authDataBaseQueryWithReauth = function (args, api, extraOptions) { return __awaiter(void 0, void 0, void 0, function () {
5570
- var result, authSession, user;
5571
- var _a;
5572
- return __generator(this, function (_b) {
5573
- switch (_b.label) {
5574
- case 0: return [4 /*yield*/, authDataBaseQuery(args, api, extraOptions)];
5575
- case 1:
5576
- result = _b.sent();
5577
- if (!(((_a = result === null || result === void 0 ? void 0 : result.error) === null || _a === void 0 ? void 0 : _a.status) === 401)) return [3 /*break*/, 6];
5578
- return [4 /*yield*/, Auth.currentAuthenticatedUser({
5579
- bypassCache: true, // Ensures that the user is refreshed from the server
5580
- })];
5581
- case 2:
5582
- authSession = _b.sent();
5583
- user = formatAuthSession(authSession);
5584
- api.dispatch(setCredentials(user));
5585
- if (!(authSession === null || authSession === void 0 ? void 0 : authSession.tokens)) return [3 /*break*/, 4];
5586
- return [4 /*yield*/, authDataBaseQuery(args, api, extraOptions)];
5587
- case 3:
5588
- // If we get a new access token, retry the original request.
5589
- result = _b.sent();
5590
- return [3 /*break*/, 6];
5591
- case 4:
5476
+ const authDataBaseQueryWithReauth = async (args, api, extraOptions) => {
5477
+ let result = await authDataBaseQuery(args, api, extraOptions);
5478
+ // If we get a 401 error
5479
+ if (result?.error?.status === 401) {
5480
+ const authSession = await Auth.currentAuthenticatedUser({
5481
+ bypassCache: true, // Ensures that the user is refreshed from the server
5482
+ });
5483
+ const user = formatAuthSession(authSession);
5484
+ api.dispatch(setCredentials(user));
5485
+ if (authSession?.tokens) {
5486
+ // If we get a new access token, retry the original request.
5487
+ result = await authDataBaseQuery(args, api, extraOptions);
5488
+ }
5489
+ else {
5592
5490
  // TODO; require full data reset?
5593
- return [4 /*yield*/, Auth.signOut()];
5594
- case 5:
5595
- // TODO; require full data reset?
5596
- _b.sent();
5597
- api.dispatch(logout());
5598
- // If no access token throw error.
5599
- throw new Error('No access token found');
5600
- case 6: return [2 /*return*/, result];
5491
+ await Auth.signOut();
5492
+ api.dispatch(logout());
5493
+ // If no access token throw error.
5494
+ throw new Error('No access token found');
5601
5495
  }
5602
- });
5603
- }); };
5604
- var authApi = createApi({
5496
+ }
5497
+ return result;
5498
+ };
5499
+ const authApi = createApi({
5605
5500
  reducerPath: 'authApi',
5606
5501
  baseQuery: authDataBaseQueryWithReauth,
5607
5502
  tagTypes: ['UserToken', 'UserData'],
5608
5503
  // keepUnusedDataFor: 300,
5609
- endpoints: function (builder) { return ({
5504
+ endpoints: (builder) => ({
5610
5505
  resetPassword: builder.mutation({
5611
- query: function (data) { return ({
5506
+ query: (data) => ({
5612
5507
  url: '/user/password/reset',
5613
5508
  method: 'POST',
5614
5509
  body: {
@@ -5617,10 +5512,10 @@ var authApi = createApi({
5617
5512
  currentPassword: data.currentPassword,
5618
5513
  newPassword: data.newPassword,
5619
5514
  },
5620
- }); },
5515
+ }),
5621
5516
  }),
5622
5517
  resetPasswordAuth: builder.mutation({
5623
- query: function (data) { return ({
5518
+ query: (data) => ({
5624
5519
  url: '/user/password/reset-auth',
5625
5520
  method: 'POST',
5626
5521
  body: {
@@ -5628,54 +5523,41 @@ var authApi = createApi({
5628
5523
  currentPassword: data.currentPassword,
5629
5524
  newPassword: data.newPassword,
5630
5525
  },
5631
- }); },
5526
+ }),
5632
5527
  }),
5633
5528
  forgottenPassword: builder.mutation({
5634
- query: function (data) { return ({
5529
+ query: (data) => ({
5635
5530
  url: '/user/password/forgot',
5636
5531
  method: 'POST',
5637
5532
  body: {
5638
5533
  email: data.email,
5639
5534
  },
5640
- }); },
5535
+ }),
5641
5536
  }),
5642
5537
  register: builder.mutation({
5643
- query: function (data) { return ({
5538
+ query: (data) => ({
5644
5539
  url: '/user/register',
5645
5540
  method: 'POST',
5646
5541
  body: data,
5647
- }); },
5648
- onQueryStarted: function (arg_1, _a) {
5649
- return __awaiter(this, arguments, void 0, function (arg, _b) {
5650
- var err_1;
5651
- var dispatch = _b.dispatch, queryFulfilled = _b.queryFulfilled;
5652
- return __generator(this, function (_c) {
5653
- switch (_c.label) {
5654
- case 0:
5655
- _c.trys.push([0, 2, , 3]);
5656
- return [4 /*yield*/, queryFulfilled];
5657
- case 1:
5658
- _c.sent();
5659
- dispatch(resetCreating());
5660
- return [3 /*break*/, 3];
5661
- case 2:
5662
- err_1 = _c.sent();
5663
- console.error('REGISTER: ', err_1);
5664
- return [3 /*break*/, 3];
5665
- case 3: return [2 /*return*/];
5666
- }
5667
- });
5668
- });
5542
+ }),
5543
+ async onQueryStarted(arg, { dispatch, queryFulfilled }) {
5544
+ try {
5545
+ await queryFulfilled;
5546
+ dispatch(resetCreating());
5547
+ }
5548
+ catch (err) {
5549
+ console.error('REGISTER: ', err);
5550
+ }
5669
5551
  },
5670
5552
  }),
5671
5553
  verifyUser: builder.query({
5672
- query: function (data) { return ({
5554
+ query: (data) => ({
5673
5555
  url: '/user/verify',
5674
5556
  method: 'POST',
5675
5557
  body: data,
5676
- }); },
5677
- transformErrorResponse: function (rawResult) {
5678
- var status = rawResult.status, data = rawResult.data, message = rawResult.message;
5558
+ }),
5559
+ transformErrorResponse: (rawResult) => {
5560
+ const { status, data, message } = rawResult;
5679
5561
  switch (status) {
5680
5562
  case 429:
5681
5563
  // Toast.info(TOO_MANY_REQUESTS_MESSAGE);
@@ -5687,7 +5569,7 @@ var authApi = createApi({
5687
5569
  */
5688
5570
  return {
5689
5571
  route: 'resend',
5690
- message: (data === null || data === void 0 ? void 0 : data.message) || message,
5572
+ message: data?.message || message,
5691
5573
  };
5692
5574
  case 404:
5693
5575
  /**
@@ -5695,7 +5577,7 @@ var authApi = createApi({
5695
5577
  */
5696
5578
  return {
5697
5579
  route: 'failed',
5698
- message: (data === null || data === void 0 ? void 0 : data.message) || message,
5580
+ message: data?.message || message,
5699
5581
  };
5700
5582
  case 401:
5701
5583
  /**
@@ -5703,159 +5585,146 @@ var authApi = createApi({
5703
5585
  */
5704
5586
  return {
5705
5587
  route: 'error',
5706
- message: (data === null || data === void 0 ? void 0 : data.message) || message,
5588
+ message: data?.message || message,
5707
5589
  };
5708
5590
  default:
5709
5591
  return {
5710
5592
  route: 'error',
5711
- message: (data === null || data === void 0 ? void 0 : data.message) || message,
5593
+ message: data?.message || message,
5712
5594
  };
5713
5595
  }
5714
5596
  },
5715
- transformResponse: function (rawResult) {
5716
- var data = rawResult.data;
5717
- return { route: 'success', message: data === null || data === void 0 ? void 0 : data.message };
5597
+ transformResponse: (rawResult) => {
5598
+ const { data } = rawResult;
5599
+ return { route: 'success', message: data?.message };
5718
5600
  },
5719
5601
  }),
5720
5602
  verifyUserAttributes: builder.query({
5721
- query: function (data) { return ({
5603
+ query: (data) => ({
5722
5604
  url: '/user/verify/email',
5723
5605
  method: 'POST',
5724
5606
  body: data,
5725
- }); },
5607
+ }),
5726
5608
  }),
5727
5609
  verifyUserResend: builder.query({
5728
- query: function (data) { return ({
5610
+ query: (data) => ({
5729
5611
  url: '/user/verify/resend',
5730
5612
  method: 'POST',
5731
5613
  body: data,
5732
- }); },
5614
+ }),
5733
5615
  }),
5734
5616
  getUserInfo: builder.query({
5735
- query: function (uuid) { return ({
5736
- url: "/data/user/".concat(uuid),
5617
+ query: (uuid) => ({
5618
+ url: `/data/user/${uuid}`,
5737
5619
  method: 'GET',
5738
- }); },
5620
+ }),
5739
5621
  providesTags: ['UserData'],
5740
5622
  }),
5741
5623
  updateUserInfo: builder.mutation({
5742
- query: function (expressions) { return ({
5624
+ query: (expressions) => ({
5743
5625
  url: '/data/user',
5744
5626
  method: 'PATCH',
5745
5627
  body: expressions,
5746
- }); },
5628
+ }),
5747
5629
  invalidatesTags: ['UserData'],
5748
5630
  }),
5749
5631
  updateUser: builder.mutation({
5750
- query: function (data) { return ({
5632
+ query: (data) => ({
5751
5633
  url: '/user',
5752
5634
  method: 'PATCH',
5753
5635
  body: data,
5754
- }); },
5636
+ }),
5755
5637
  invalidatesTags: ['UserData'],
5756
5638
  }),
5757
- }); },
5639
+ }),
5758
5640
  });
5759
5641
  // Export hooks for usage in functional components.
5760
- var // useLoginQuery,
5642
+ const {
5643
+ // useLoginQuery,
5761
5644
  // useLazyLoginQuery,
5762
5645
  // useRefreshTokenQuery,
5763
5646
  // useLazyRefreshTokenQuery,
5764
5647
  // useLogoutQuery,
5765
5648
  // useLazyLogoutQuery,
5766
- useResetPasswordMutation = authApi.useResetPasswordMutation, // Use this for mobile app.
5767
- 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;
5649
+ useResetPasswordMutation, // Use this for mobile app.
5650
+ useResetPasswordAuthMutation, useRegisterMutation, useVerifyUserQuery, useLazyVerifyUserQuery, useGetUserInfoQuery, useLazyGetUserInfoQuery, useUpdateUserInfoMutation, useForgottenPasswordMutation, useVerifyUserAttributesQuery, useLazyVerifyUserAttributesQuery, useVerifyUserResendQuery, useLazyVerifyUserResendQuery, useUpdateUserMutation, } = authApi;
5768
5651
 
5769
- var contentApi = createApi({
5652
+ const contentApi = createApi({
5770
5653
  reducerPath: 'contentApi',
5771
5654
  baseQuery: fetchBaseQuery({
5772
5655
  baseUrl: APP_ES_INSTANCE,
5773
- prepareHeaders: function (headers) {
5656
+ prepareHeaders: (headers) => {
5774
5657
  headers.set('Authorization', APP_ES_AUTH);
5775
5658
  return headers;
5776
5659
  },
5777
5660
  }),
5778
5661
  tagTypes: ['Data', 'Workout'],
5779
5662
  // keepUnusedDataFor: 300,
5780
- endpoints: function (builder) { return ({
5663
+ endpoints: (builder) => ({
5781
5664
  getData: builder.query({
5782
- query: function (_a) {
5783
- var index = _a.index, _b = _a.options, options = _b === void 0 ? {} : _b;
5784
- return ({
5785
- url: "".concat(index, "/_search"),
5786
- method: 'POST',
5787
- body: {
5788
- from: 0,
5789
- size: options.size || 1000,
5790
- sort: options.sort || [{ created: { order: 'desc' } }],
5791
- query: options.query || {
5792
- match_all: {},
5793
- },
5665
+ query: ({ index, options = {} }) => ({
5666
+ url: `${index}/_search`,
5667
+ method: 'POST',
5668
+ body: {
5669
+ from: 0,
5670
+ size: options.size || 1000,
5671
+ sort: options.sort || [{ created: { order: 'desc' } }],
5672
+ query: options.query || {
5673
+ match_all: {},
5794
5674
  },
5795
- });
5796
- },
5797
- transformResponse: function (response) { var _a; return (_a = response === null || response === void 0 ? void 0 : response.hits) === null || _a === void 0 ? void 0 : _a.hits; },
5675
+ },
5676
+ }),
5677
+ transformResponse: (response) => response?.hits?.hits,
5798
5678
  providesTags: ['Data'],
5799
5679
  }),
5800
5680
  getDataById: builder.query({
5801
- query: function (_a) {
5802
- var _b;
5803
- var index = _a.index, ids = _a.ids;
5804
- return ({
5805
- url: "".concat(index, "/_search"),
5806
- method: 'POST',
5807
- body: {
5808
- from: 0,
5809
- size: ids.length,
5810
- query: {
5811
- terms: (_b = {},
5812
- _b['uuid.keyword'] = ids,
5813
- _b),
5681
+ query: ({ index, ids }) => ({
5682
+ url: `${index}/_search`,
5683
+ method: 'POST',
5684
+ body: {
5685
+ from: 0,
5686
+ size: ids.length,
5687
+ query: {
5688
+ terms: {
5689
+ ['uuid.keyword']: ids,
5814
5690
  },
5815
5691
  },
5816
- });
5817
- },
5818
- transformResponse: function (response) { var _a; return (_a = response === null || response === void 0 ? void 0 : response.hits) === null || _a === void 0 ? void 0 : _a.hits; },
5692
+ },
5693
+ }),
5694
+ transformResponse: (response) => response?.hits?.hits,
5819
5695
  providesTags: ['Workout'],
5820
5696
  }),
5821
- }); },
5697
+ }),
5822
5698
  });
5823
- contentApi.useGetDataQuery; contentApi.useLazyGetDataQuery; contentApi.useGetDataByIdQuery; contentApi.useLazyGetDataByIdQuery;
5699
+ const { useGetDataQuery, useLazyGetDataQuery, useGetDataByIdQuery, useLazyGetDataByIdQuery, } = contentApi;
5824
5700
 
5825
- var paymentApi = createApi({
5701
+ const paymentApi = createApi({
5826
5702
  reducerPath: 'paymentApi',
5827
5703
  baseQuery: fetchBaseQuery({
5828
5704
  baseUrl: API_PAYMENTS_PREFIX,
5829
- prepareHeaders: function (headers_1, _a) { return __awaiter(void 0, [headers_1, _a], void 0, function (headers, _b) {
5830
- var session, idToken, accessToken;
5831
- return __generator(this, function (_c) {
5832
- switch (_c.label) {
5833
- case 0:
5834
- headers.set('Content-Type', 'application/json');
5835
- return [4 /*yield*/, Auth.currentSession()];
5836
- case 1:
5837
- session = _c.sent();
5838
- idToken = session.getIdToken().getJwtToken();
5839
- accessToken = session.getAccessToken().getJwtToken();
5840
- if (accessToken && idToken) {
5841
- headers.set('accesstoken', accessToken);
5842
- headers.set('idtoken', idToken);
5843
- // headers.set('refreshtoken', tokens.refreshToken);
5844
- }
5845
- return [2 /*return*/, headers];
5846
- }
5847
- });
5848
- }); },
5705
+ prepareHeaders: async (headers, {}) => {
5706
+ headers.set('Content-Type', 'application/json');
5707
+ // add accessToken to headers from slice using selectAccessToken selector
5708
+ const session = await Auth.currentSession();
5709
+ const idToken = session.getIdToken().getJwtToken(); // ID token
5710
+ const accessToken = session.getAccessToken().getJwtToken(); // Access token
5711
+ if (accessToken && idToken) {
5712
+ headers.set('accesstoken', accessToken);
5713
+ headers.set('idtoken', idToken);
5714
+ // headers.set('refreshtoken', tokens.refreshToken);
5715
+ }
5716
+ return headers;
5717
+ },
5849
5718
  credentials: 'include',
5850
5719
  }),
5851
5720
  tagTypes: ['UserSubscription', 'Plans', 'TaxRates', 'PromoCodes'],
5852
5721
  // keepUnusedDataFor: 300,
5853
- endpoints: function (builder) { return ({
5722
+ endpoints: (builder) => ({
5854
5723
  /**
5855
5724
  * USER API.
5856
5725
  */
5857
5726
  checkUserSubscription: builder.query({
5858
- query: function (data) { return ({
5727
+ query: (data) => ({
5859
5728
  url: '/payment/subscriber',
5860
5729
  method: 'POST',
5861
5730
  body: {
@@ -5863,119 +5732,99 @@ var paymentApi = createApi({
5863
5732
  email: data.email,
5864
5733
  sub: data.sub,
5865
5734
  },
5866
- }); },
5735
+ }),
5867
5736
  providesTags: ['UserSubscription'],
5868
5737
  }),
5869
5738
  getPaymentPlans: builder.query({
5870
- query: function () { return '/payment/plans'; },
5739
+ query: () => '/payment/plans',
5871
5740
  providesTags: ['Plans'],
5872
5741
  }),
5873
5742
  getTaxRates: builder.query({
5874
- query: function () { return ({
5743
+ query: () => ({
5875
5744
  url: '/payment/tax-rates',
5876
5745
  method: 'GET',
5877
- }); },
5746
+ }),
5878
5747
  providesTags: ['TaxRates'],
5879
5748
  }),
5880
5749
  checkPromoCode: builder.query({
5881
- query: function (promoCode) { return ({
5882
- url: "/payment/coupon/".concat(promoCode),
5750
+ query: (promoCode) => ({
5751
+ url: `/payment/coupon/${promoCode}`,
5883
5752
  method: 'GET',
5884
- }); },
5753
+ }),
5885
5754
  providesTags: ['PromoCodes'],
5886
5755
  }),
5887
- }); },
5756
+ }),
5888
5757
  });
5889
5758
  // Export hooks for usage in functional components.
5890
- paymentApi.useCheckUserSubscriptionQuery; paymentApi.useLazyCheckUserSubscriptionQuery; paymentApi.useGetPaymentPlansQuery; paymentApi.useLazyGetPaymentPlansQuery; paymentApi.useGetTaxRatesQuery; paymentApi.useLazyGetTaxRatesQuery; paymentApi.useCheckPromoCodeQuery; paymentApi.useLazyCheckPromoCodeQuery;
5759
+ const { useCheckUserSubscriptionQuery, useLazyCheckUserSubscriptionQuery, useGetPaymentPlansQuery, useLazyGetPaymentPlansQuery, useGetTaxRatesQuery, useLazyGetTaxRatesQuery, useCheckPromoCodeQuery, useLazyCheckPromoCodeQuery, } = paymentApi;
5891
5760
 
5892
- var dataBaseQuery = fetchBaseQuery({
5761
+ const dataBaseQuery = fetchBaseQuery({
5893
5762
  baseUrl: API_ORDERS_PREFIX,
5894
- prepareHeaders: function (headers_1, _a) { return __awaiter(void 0, [headers_1, _a], void 0, function (headers, _b) {
5895
- var session, idToken, accessToken;
5896
- return __generator(this, function (_c) {
5897
- switch (_c.label) {
5898
- case 0:
5899
- headers.set('Content-Type', 'application/json');
5900
- return [4 /*yield*/, Auth.currentSession()];
5901
- case 1:
5902
- session = _c.sent();
5903
- idToken = session.getIdToken().getJwtToken();
5904
- accessToken = session.getAccessToken().getJwtToken();
5905
- if (accessToken && idToken) {
5906
- headers.set('accesstoken', accessToken);
5907
- headers.set('idtoken', idToken);
5908
- // headers.set('refreshtoken', tokens.refreshToken);
5909
- }
5910
- return [2 /*return*/, headers];
5911
- }
5912
- });
5913
- }); },
5763
+ prepareHeaders: async (headers, {}) => {
5764
+ headers.set('Content-Type', 'application/json');
5765
+ // add accessToken to headers from slice using selectAccessToken selector
5766
+ const session = await Auth.currentSession();
5767
+ const idToken = session.getIdToken().getJwtToken(); // ID token
5768
+ const accessToken = session.getAccessToken().getJwtToken(); // Access token
5769
+ if (accessToken && idToken) {
5770
+ headers.set('accesstoken', accessToken);
5771
+ headers.set('idtoken', idToken);
5772
+ // headers.set('refreshtoken', tokens.refreshToken);
5773
+ }
5774
+ return headers;
5775
+ },
5914
5776
  credentials: 'include',
5915
5777
  });
5916
5778
  /**
5917
5779
  * This function is used to retry a request if we get a 401 error.
5918
5780
  */
5919
- var dataBaseQueryWithReauth = function (args, api, extraOptions) { return __awaiter(void 0, void 0, void 0, function () {
5920
- var result, authSession, user;
5921
- var _a;
5922
- return __generator(this, function (_b) {
5923
- switch (_b.label) {
5924
- case 0: return [4 /*yield*/, dataBaseQuery(args, api, extraOptions)];
5925
- case 1:
5926
- result = _b.sent();
5927
- if (!(((_a = result === null || result === void 0 ? void 0 : result.error) === null || _a === void 0 ? void 0 : _a.status) === 401)) return [3 /*break*/, 6];
5928
- return [4 /*yield*/, Auth.currentAuthenticatedUser({
5929
- bypassCache: true, // Ensures that the user is refreshed from the server
5930
- })];
5931
- case 2:
5932
- authSession = _b.sent();
5933
- user = formatAuthSession(authSession);
5934
- api.dispatch(setCredentials(user));
5935
- if (!(authSession === null || authSession === void 0 ? void 0 : authSession.tokens)) return [3 /*break*/, 4];
5936
- return [4 /*yield*/, dataBaseQuery(args, api, extraOptions)];
5937
- case 3:
5938
- // If we get a new access token, retry the original request.
5939
- result = _b.sent();
5940
- return [3 /*break*/, 6];
5941
- case 4:
5781
+ const dataBaseQueryWithReauth = async (args, api, extraOptions) => {
5782
+ let result = await dataBaseQuery(args, api, extraOptions);
5783
+ // If we get a 401 error
5784
+ if (result?.error?.status === 401) {
5785
+ const authSession = await Auth.currentAuthenticatedUser({
5786
+ bypassCache: true, // Ensures that the user is refreshed from the server
5787
+ });
5788
+ const user = formatAuthSession(authSession);
5789
+ api.dispatch(setCredentials(user));
5790
+ if (authSession?.tokens) {
5791
+ // If we get a new access token, retry the original request.
5792
+ result = await dataBaseQuery(args, api, extraOptions);
5793
+ }
5794
+ else {
5942
5795
  // TODO; require full data reset?
5943
- return [4 /*yield*/, Auth.signOut()];
5944
- case 5:
5945
- // TODO; require full data reset?
5946
- _b.sent();
5947
- api.dispatch(logout());
5948
- // If no access token throw error.
5949
- throw new Error('No access token found');
5950
- case 6: return [2 /*return*/, result];
5796
+ await Auth.signOut();
5797
+ api.dispatch(logout());
5798
+ // If no access token throw error.
5799
+ throw new Error('No access token found');
5951
5800
  }
5952
- });
5953
- }); };
5954
- var ordersApi = createApi({
5801
+ }
5802
+ return result;
5803
+ };
5804
+ const ordersApi = createApi({
5955
5805
  reducerPath: 'ordersApi',
5956
5806
  baseQuery: dataBaseQueryWithReauth,
5957
5807
  tagTypes: ['Orders'],
5958
5808
  // keepUnusedDataFor: 300,
5959
- endpoints: function (builder) { return ({
5809
+ endpoints: (builder) => ({
5960
5810
  /**
5961
5811
  * USER API.
5962
5812
  */
5963
5813
  fetchOrders: builder.query({
5964
- query: function (ids) { return ({
5814
+ query: (ids) => ({
5965
5815
  url: '/order/search',
5966
5816
  method: 'POST',
5967
5817
  body: {
5968
- ids: ids,
5818
+ ids,
5969
5819
  },
5970
- }); },
5820
+ }),
5971
5821
  }),
5972
- }); },
5822
+ }),
5973
5823
  });
5974
5824
  // Export hooks for usage in functional components.
5975
- ordersApi.useFetchOrdersQuery; ordersApi.useLazyFetchOrdersQuery;
5825
+ const { useFetchOrdersQuery, useLazyFetchOrdersQuery } = ordersApi;
5976
5826
 
5977
- var _a, _b;
5978
- var initialState = {
5827
+ const initialState = {
5979
5828
  addedItems: [],
5980
5829
  netTotal: 0,
5981
5830
  taxRate: {
@@ -5994,696 +5843,138 @@ var initialState = {
5994
5843
  error: false,
5995
5844
  open: false,
5996
5845
  };
5997
- var cartSlice = createSlice({
5846
+ const cartSlice = createSlice({
5998
5847
  name: 'cart',
5999
- initialState: initialState,
5848
+ initialState,
6000
5849
  reducers: {
6001
- setTaxRate: function (state, action) {
6002
- var netTotal = state.netTotal, promoCode = state.promoCode;
6003
- var currentTotal = netTotal;
6004
- if (promoCode === null || promoCode === void 0 ? void 0 : promoCode.code) {
6005
- var data = applyCoupon(promoCode, currentTotal);
5850
+ setTaxRate: (state, action) => {
5851
+ const { netTotal, promoCode } = state;
5852
+ let currentTotal = netTotal;
5853
+ if (promoCode?.code) {
5854
+ const data = applyCoupon(promoCode, currentTotal);
6006
5855
  currentTotal = data.discountedTotal;
6007
5856
  }
6008
- var taxAmount = applyTax(action.payload, currentTotal);
6009
- var grossTotal = currentTotal + taxAmount;
6010
- return __assign(__assign({}, state), { taxRate: action.payload, taxAmount: taxAmount, grossTotal: grossTotal });
5857
+ const taxAmount = applyTax(action.payload, currentTotal);
5858
+ const grossTotal = currentTotal + taxAmount;
5859
+ return {
5860
+ ...state,
5861
+ taxRate: action.payload,
5862
+ taxAmount,
5863
+ grossTotal,
5864
+ };
6011
5865
  },
6012
- resetTaxRate: function (state, action) {
6013
- return __assign(__assign({}, state), { taxRate: {
5866
+ resetTaxRate: (state, action) => {
5867
+ return {
5868
+ ...state,
5869
+ taxRate: {
6014
5870
  country: 'none',
6015
5871
  percentage: 0,
6016
- }, taxAmount: 0 });
5872
+ },
5873
+ taxAmount: 0,
5874
+ };
6017
5875
  },
6018
- setPromoCode: function (state, action) {
6019
- var netTotal = state.netTotal, taxRate = state.taxRate;
6020
- var data = applyCoupon(action.payload, netTotal);
6021
- var taxAmount = applyTax(taxRate, data.discountedTotal);
6022
- var grossTotal = data.discountedTotal + taxAmount;
6023
- return __assign(__assign({}, state), { promoCode: {
5876
+ setPromoCode: (state, action) => {
5877
+ const { netTotal, taxRate } = state;
5878
+ const data = applyCoupon(action.payload, netTotal);
5879
+ const taxAmount = applyTax(taxRate, data.discountedTotal);
5880
+ const grossTotal = data.discountedTotal + taxAmount;
5881
+ return {
5882
+ ...state,
5883
+ promoCode: {
6024
5884
  code: data.code,
6025
5885
  name: data.code,
6026
5886
  discount: data.discount,
6027
5887
  discountedAmount: data.discountedAmount,
6028
- }, taxAmount: taxAmount, grossTotal: grossTotal });
5888
+ },
5889
+ taxAmount,
5890
+ grossTotal,
5891
+ };
6029
5892
  },
6030
- removePromoCode: function (state, action) {
6031
- var netTotal = state.netTotal, taxRate = state.taxRate;
6032
- var taxAmount = applyTax(taxRate, netTotal);
6033
- var grossTotal = netTotal + taxAmount;
6034
- return __assign(__assign({}, state), { promoCode: initialState.promoCode, taxAmount: taxAmount, grossTotal: grossTotal });
5893
+ removePromoCode: (state, action) => {
5894
+ const { netTotal, taxRate } = state;
5895
+ const taxAmount = applyTax(taxRate, netTotal);
5896
+ const grossTotal = netTotal + taxAmount;
5897
+ return {
5898
+ ...state,
5899
+ promoCode: initialState.promoCode,
5900
+ taxAmount,
5901
+ grossTotal,
5902
+ };
6035
5903
  },
6036
- addToCart: function (state, action) {
6037
- var _a = action.payload, options = _a.options, item = _a.item;
6038
- var newTotal = state.netTotal + options.selectedPrice;
6039
- var taxAmount = newTotal * (state.taxRate.percentage / 100);
6040
- var grossTotal = newTotal + taxAmount;
6041
- var addItem = item ? __assign(__assign({}, item), { options: options }) : null;
5904
+ addToCart: (state, action) => {
5905
+ const { options, item } = action.payload;
5906
+ const newTotal = state.netTotal + options.selectedPrice;
5907
+ const taxAmount = newTotal * (state.taxRate.percentage / 100);
5908
+ const grossTotal = newTotal + taxAmount;
5909
+ const addItem = item ? { ...item, options } : null;
6042
5910
  if (!addItem) {
6043
5911
  return state;
6044
5912
  }
6045
- var addedItems = __spreadArray(__spreadArray([], state.addedItems, true), [addItem], false);
6046
- return __assign(__assign({}, state), { addedItems: addedItems, netTotal: newTotal, grossTotal: grossTotal });
5913
+ const addedItems = [...state.addedItems, addItem];
5914
+ return {
5915
+ ...state,
5916
+ addedItems: addedItems,
5917
+ netTotal: newTotal,
5918
+ grossTotal: grossTotal,
5919
+ };
6047
5920
  },
6048
- updateCart: function (state, action) {
6049
- var options = action.payload.options;
6050
- return __assign(__assign({}, state), { addedItems: state.addedItems.map(function (item) {
6051
- return item && __assign(__assign({}, item), { options: options });
6052
- }) });
5921
+ updateCart: (state, action) => {
5922
+ const { options } = action.payload;
5923
+ return {
5924
+ ...state,
5925
+ addedItems: state.addedItems.map((item) => item && {
5926
+ ...item,
5927
+ options: options,
5928
+ }),
5929
+ };
6053
5930
  },
6054
- removeFromCart: function (state, action) {
6055
- var _a = action.payload, id = _a.id, price = _a.price;
6056
- var newTotal = state.netTotal - price;
6057
- var taxAmount = newTotal * (state.taxRate.percentage / 100);
6058
- var grossTotal = newTotal + taxAmount;
6059
- return __assign(__assign({}, state), { addedItems: state.addedItems.filter(function (item) { return item && item.uuid !== id; }), netTotal: newTotal, grossTotal: grossTotal });
5931
+ removeFromCart: (state, action) => {
5932
+ const { id, price } = action.payload;
5933
+ const newTotal = state.netTotal - price;
5934
+ const taxAmount = newTotal * (state.taxRate.percentage / 100);
5935
+ const grossTotal = newTotal + taxAmount;
5936
+ return {
5937
+ ...state,
5938
+ addedItems: state.addedItems.filter((item) => item && item.uuid !== id),
5939
+ netTotal: newTotal,
5940
+ grossTotal: grossTotal,
5941
+ };
6060
5942
  },
6061
- toggleCart: function (state, action) {
6062
- return __assign(__assign({}, state), { open: action.payload });
5943
+ toggleCart: (state, action) => {
5944
+ return {
5945
+ ...state,
5946
+ open: action.payload,
5947
+ };
6063
5948
  },
6064
- emptyCart: function () { return initialState; },
5949
+ emptyCart: () => initialState,
6065
5950
  },
6066
5951
  selectors: {
6067
- selectMediaInCart: function (cart) { return cart.addedItems; },
6068
- selectCartTotal: function (cart) { return cart.grossTotal; },
6069
- selectCartNetTotal: function (cart) { return cart.netTotal; },
6070
- selectCartTaxRate: function (cart) { return cart.taxRate; },
6071
- selectCartTaxAmount: function (cart) { return cart.taxAmount; },
6072
- selectCartCount: function (cart) { return cart.addedItems.length; },
6073
- selectCartStatus: function (cart) { return cart.open; },
6074
- selectPromoCode: function (cart) { return cart.promoCode; },
5952
+ selectMediaInCart: (cart) => cart.addedItems,
5953
+ selectCartTotal: (cart) => cart.grossTotal,
5954
+ selectCartNetTotal: (cart) => cart.netTotal,
5955
+ selectCartTaxRate: (cart) => cart.taxRate,
5956
+ selectCartTaxAmount: (cart) => cart.taxAmount,
5957
+ selectCartCount: (cart) => cart.addedItems.length,
5958
+ selectCartStatus: (cart) => cart.open,
5959
+ selectPromoCode: (cart) => cart.promoCode,
6075
5960
  },
6076
5961
  });
6077
- var setTaxRate = (_a = cartSlice.actions, _a.setTaxRate), resetTaxRate = _a.resetTaxRate, setPromoCode = _a.setPromoCode, removePromoCode = _a.removePromoCode, addToCart = _a.addToCart, updateCart = _a.updateCart, removeFromCart = _a.removeFromCart, emptyCart = _a.emptyCart, toggleCart = _a.toggleCart;
6078
- var selectMediaInCart = (_b = cartSlice.selectors, _b.selectMediaInCart), selectCartTotal = _b.selectCartTotal, selectCartNetTotal = _b.selectCartNetTotal, selectCartTaxRate = _b.selectCartTaxRate, selectCartTaxAmount = _b.selectCartTaxAmount, selectCartCount = _b.selectCartCount, selectCartStatus = _b.selectCartStatus, selectPromoCode = _b.selectPromoCode;
6079
- var selectCartItems = createSelector$1([selectMediaInCart], function (items) {
6080
- return items.map(function (item) {
5962
+ const { setTaxRate, resetTaxRate, setPromoCode, removePromoCode, addToCart, updateCart, removeFromCart, emptyCart, toggleCart, } = cartSlice.actions;
5963
+ const { selectMediaInCart, selectCartTotal, selectCartNetTotal, selectCartTaxRate, selectCartTaxAmount, selectCartCount, selectCartStatus, selectPromoCode, } = cartSlice.selectors;
5964
+ const selectCartItems = createSelector$1([selectMediaInCart], (items) => {
5965
+ return items.map((item) => {
6081
5966
  return {
6082
5967
  title: item.title || item.generatedTitle,
6083
- file: "".concat(item.sku, ".mp4"),
5968
+ file: `${item.sku}.mp4`,
6084
5969
  options: item.options,
6085
5970
  script: item.script,
6086
5971
  };
6087
5972
  });
6088
5973
  });
6089
- var selectCartItemsIds = createSelector$1([selectMediaInCart], function (items) {
6090
- return items.map(function (item) { return item.uuid; });
5974
+ const selectCartItemsIds = createSelector$1([selectMediaInCart], (items) => {
5975
+ return items.map((item) => item.uuid);
6091
5976
  });
6092
5977
  cartSlice.reducer;
6093
5978
 
6094
- var useLoggedIn = function () {
6095
- var isLoggedIn = useSelector(isAuthenticated);
6096
- return useMemo(function () { return isLoggedIn; }, [isLoggedIn]);
6097
- };
6098
-
6099
- // This file serves as a central hub for re-exporting pre-typed Redux hooks.
6100
- // Use throughout your app instead of plain `useDispatch` and `useSelector`
6101
- var useAppDispatch = isWeb ? useDispatch.withTypes() : useDispatch.withTypes();
6102
- var useAppSelector = isWeb ? useSelector.withTypes() : useSelector.withTypes();
6103
- var useAppStore = isWeb ? useStore.withTypes() : useStore.withTypes();
6104
-
6105
- function getDefaultExportFromCjs (x) {
6106
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
6107
- }
6108
-
6109
- var createWebStorage$1 = {};
6110
-
6111
- var getStorage = {};
6112
-
6113
- var hasRequiredGetStorage;
6114
-
6115
- function requireGetStorage () {
6116
- if (hasRequiredGetStorage) return getStorage;
6117
- hasRequiredGetStorage = 1;
6118
-
6119
- getStorage.__esModule = true;
6120
- getStorage.default = getStorage$1;
6121
-
6122
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
6123
-
6124
- function noop() {}
6125
-
6126
- var noopStorage = {
6127
- getItem: noop,
6128
- setItem: noop,
6129
- removeItem: noop
6130
- };
6131
-
6132
- function hasStorage(storageType) {
6133
- if ((typeof self === "undefined" ? "undefined" : _typeof(self)) !== 'object' || !(storageType in self)) {
6134
- return false;
6135
- }
6136
-
6137
- try {
6138
- var storage = self[storageType];
6139
- var testKey = "redux-persist ".concat(storageType, " test");
6140
- storage.setItem(testKey, 'test');
6141
- storage.getItem(testKey);
6142
- storage.removeItem(testKey);
6143
- } catch (e) {
6144
- if (process.env.NODE_ENV !== 'production') console.warn("redux-persist ".concat(storageType, " test failed, persistence will be disabled."));
6145
- return false;
6146
- }
6147
-
6148
- return true;
6149
- }
6150
-
6151
- function getStorage$1(type) {
6152
- var storageType = "".concat(type, "Storage");
6153
- if (hasStorage(storageType)) return self[storageType];else {
6154
- if (process.env.NODE_ENV !== 'production') {
6155
- console.error("redux-persist failed to create sync storage. falling back to noop storage.");
6156
- }
6157
-
6158
- return noopStorage;
6159
- }
6160
- }
6161
- return getStorage;
6162
- }
6163
-
6164
- var hasRequiredCreateWebStorage;
6165
-
6166
- function requireCreateWebStorage () {
6167
- if (hasRequiredCreateWebStorage) return createWebStorage$1;
6168
- hasRequiredCreateWebStorage = 1;
6169
-
6170
- createWebStorage$1.__esModule = true;
6171
- createWebStorage$1.default = createWebStorage;
6172
-
6173
- var _getStorage = _interopRequireDefault(requireGetStorage());
6174
-
6175
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6176
-
6177
- function createWebStorage(type) {
6178
- var storage = (0, _getStorage.default)(type);
6179
- return {
6180
- getItem: function getItem(key) {
6181
- return new Promise(function (resolve, reject) {
6182
- resolve(storage.getItem(key));
6183
- });
6184
- },
6185
- setItem: function setItem(key, item) {
6186
- return new Promise(function (resolve, reject) {
6187
- resolve(storage.setItem(key, item));
6188
- });
6189
- },
6190
- removeItem: function removeItem(key) {
6191
- return new Promise(function (resolve, reject) {
6192
- resolve(storage.removeItem(key));
6193
- });
6194
- }
6195
- };
6196
- }
6197
- return createWebStorage$1;
6198
- }
6199
-
6200
- var createWebStorageExports = requireCreateWebStorage();
6201
- var createWebStorage = /*@__PURE__*/getDefaultExportFromCjs(createWebStorageExports);
6202
-
6203
- // @ts-expect-error - required for module alias
6204
- function createPersistStorage() {
6205
- var isServer = typeof window === 'undefined';
6206
- // Returns noop (dummy) storage.
6207
- if (isServer) {
6208
- return {
6209
- getItem: function () {
6210
- return Promise.resolve(null);
6211
- },
6212
- setItem: function () {
6213
- return Promise.resolve();
6214
- },
6215
- removeItem: function () {
6216
- return Promise.resolve();
6217
- },
6218
- };
6219
- }
6220
- return createWebStorage('local');
6221
- }
6222
-
6223
- // Infer the `RootState` type from the root reducer
6224
- var rootReducer = combineSlices(cartSlice, authSlice, authApi, contentApi, paymentApi, ordersApi);
6225
- // eg. ['auth', 'creating'], or an empty array if you don't want to whitelist any.
6226
- // const storageWhiteList: string[] = [];
6227
- var storageBlackList = [];
6228
- // `makeStore` encapsulates the store configuration to allow
6229
- // creating unique store instances, which is particularly important for
6230
- // server-side rendering (SSR) scenarios. In SSR, separate store instances
6231
- // are needed for each request to prevent cross-request state pollution.
6232
- var makeNativeStore = function () {
6233
- var customEnhancers = [];
6234
- // const Platform = require('react-native').Platform;
6235
- var Platform = import('react-native').then(function (mod) { return mod.Platform; }).catch(function () { return ({}); });
6236
- console.log('makeNativeStore Platform', Platform);
6237
- var reducer;
6238
- var FLUSH;
6239
- var REHYDRATE;
6240
- var PAUSE;
6241
- var PERSIST;
6242
- var PURGE;
6243
- var REGISTER;
6244
- if (Platform.OS !== 'web' && !Platform.isTV) {
6245
- var reduxPersist = require('redux-persist');
6246
- var persistReducer = require('redux-persist').persistReducer;
6247
- FLUSH = reduxPersist.FLUSH;
6248
- REHYDRATE = reduxPersist.REHYDRATE;
6249
- PAUSE = reduxPersist.PAUSE;
6250
- PERSIST = reduxPersist.PERSIST;
6251
- PURGE = reduxPersist.PURGE;
6252
- REGISTER = reduxPersist.REGISTER;
6253
- storageBlackList.push(paymentApi.reducerPath, authApi.reducerPath, contentApi.reducerPath, ordersApi.reducerPath);
6254
- // const storage =
6255
- // require('@react-native-async-storage/async-storage').default;
6256
- var storage = Promise.resolve().then(function () { return index; }).then(function (mod) { return mod.default; }).catch(function () { return ({}); });
6257
- var persistConfig = {
6258
- key: 'root',
6259
- storage: storage,
6260
- // whitelist: storageWhiteList,
6261
- blacklist: storageBlackList,
6262
- };
6263
- var persistedReducer = persistReducer(persistConfig, rootReducer);
6264
- reducer = persistedReducer;
6265
- }
6266
- else {
6267
- reducer = rootReducer;
6268
- }
6269
- var middlewares = [
6270
- authApi.middleware,
6271
- contentApi.middleware,
6272
- paymentApi.middleware,
6273
- ordersApi.middleware,
6274
- ];
6275
- return configureStore({
6276
- reducer: reducer,
6277
- // Adding the api middleware enables caching, invalidation, polling,
6278
- // and other useful features of `rtk-query`.
6279
- middleware: function (getDefaultMiddleware) {
6280
- return getDefaultMiddleware({
6281
- immutableCheck: { warnAfter: 256 },
6282
- serializableCheck: {
6283
- warnAfter: 256,
6284
- ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
6285
- },
6286
- }).concat(middlewares);
6287
- },
6288
- enhancers: function (getDefaultEnhancers) {
6289
- return getDefaultEnhancers().concat(customEnhancers);
6290
- },
6291
- });
6292
- };
6293
- var makeWebStore = function () {
6294
- var reduxPersist = require('redux-persist');
6295
- var persistReducer = require('redux-persist').persistReducer;
6296
- var FLUSH = reduxPersist.FLUSH;
6297
- var REHYDRATE = reduxPersist.REHYDRATE;
6298
- var PAUSE = reduxPersist.PAUSE;
6299
- var PERSIST = reduxPersist.PERSIST;
6300
- var PURGE = reduxPersist.PURGE;
6301
- var REGISTER = reduxPersist.REGISTER;
6302
- var storage = createPersistStorage();
6303
- storageBlackList.push(paymentApi.reducerPath, authApi.reducerPath, contentApi.reducerPath, ordersApi.reducerPath);
6304
- var persistConfig = {
6305
- key: 'root',
6306
- storage: storage,
6307
- // whitelist: storageWhiteList,
6308
- blacklist: storageBlackList,
6309
- };
6310
- var middlewares = [
6311
- authApi.middleware,
6312
- contentApi.middleware,
6313
- paymentApi.middleware,
6314
- ordersApi.middleware,
6315
- ];
6316
- // `combineSlices` automatically combines the reducers using
6317
- // their `reducerPath`s, therefore we no longer need to call `combineReducers`.
6318
- var persistedReducer = persistReducer(persistConfig, rootReducer);
6319
- var customEnhancers = [];
6320
- return configureStore({
6321
- reducer: persistedReducer,
6322
- // Adding the api middleware enables caching, invalidation, polling,
6323
- // and other useful features of `rtk-query`.
6324
- middleware: function (getDefaultMiddleware) {
6325
- return getDefaultMiddleware({
6326
- immutableCheck: { warnAfter: 256 },
6327
- serializableCheck: {
6328
- warnAfter: 256,
6329
- ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
6330
- },
6331
- }).concat(middlewares);
6332
- },
6333
- enhancers: function (getDefaultEnhancers) {
6334
- return getDefaultEnhancers().concat(customEnhancers);
6335
- },
6336
- });
6337
- };
6338
- var nativeStore = !isWeb ? makeNativeStore() : undefined;
6339
- var webStore = isWeb ? makeWebStore() : undefined;
6340
-
6341
- const Config = NativeModules.RNCConfigModule || {};
6342
-
6343
- var index$1 = /*#__PURE__*/Object.freeze({
6344
- __proto__: null,
6345
- Config: Config,
6346
- default: Config
6347
- });
6348
-
6349
- var isPlainObj;
6350
- var hasRequiredIsPlainObj;
6351
-
6352
- function requireIsPlainObj () {
6353
- if (hasRequiredIsPlainObj) return isPlainObj;
6354
- hasRequiredIsPlainObj = 1;
6355
-
6356
- isPlainObj = value => {
6357
- if (Object.prototype.toString.call(value) !== '[object Object]') {
6358
- return false;
6359
- }
6360
-
6361
- const prototype = Object.getPrototypeOf(value);
6362
- return prototype === null || prototype === Object.prototype;
6363
- };
6364
- return isPlainObj;
6365
- }
6366
-
6367
- var mergeOptions$1;
6368
- var hasRequiredMergeOptions;
6369
-
6370
- function requireMergeOptions () {
6371
- if (hasRequiredMergeOptions) return mergeOptions$1;
6372
- hasRequiredMergeOptions = 1;
6373
- const isOptionObject = requireIsPlainObj();
6374
-
6375
- const {hasOwnProperty} = Object.prototype;
6376
- const {propertyIsEnumerable} = Object;
6377
- const defineProperty = (object, name, value) => Object.defineProperty(object, name, {
6378
- value,
6379
- writable: true,
6380
- enumerable: true,
6381
- configurable: true
6382
- });
6383
-
6384
- const globalThis = mergeOptions$1;
6385
- const defaultMergeOptions = {
6386
- concatArrays: false,
6387
- ignoreUndefined: false
6388
- };
6389
-
6390
- const getEnumerableOwnPropertyKeys = value => {
6391
- const keys = [];
6392
-
6393
- for (const key in value) {
6394
- if (hasOwnProperty.call(value, key)) {
6395
- keys.push(key);
6396
- }
6397
- }
6398
-
6399
- /* istanbul ignore else */
6400
- if (Object.getOwnPropertySymbols) {
6401
- const symbols = Object.getOwnPropertySymbols(value);
6402
-
6403
- for (const symbol of symbols) {
6404
- if (propertyIsEnumerable.call(value, symbol)) {
6405
- keys.push(symbol);
6406
- }
6407
- }
6408
- }
6409
-
6410
- return keys;
6411
- };
6412
-
6413
- function clone(value) {
6414
- if (Array.isArray(value)) {
6415
- return cloneArray(value);
6416
- }
6417
-
6418
- if (isOptionObject(value)) {
6419
- return cloneOptionObject(value);
6420
- }
6421
-
6422
- return value;
6423
- }
6424
-
6425
- function cloneArray(array) {
6426
- const result = array.slice(0, 0);
6427
-
6428
- getEnumerableOwnPropertyKeys(array).forEach(key => {
6429
- defineProperty(result, key, clone(array[key]));
6430
- });
6431
-
6432
- return result;
6433
- }
6434
-
6435
- function cloneOptionObject(object) {
6436
- const result = Object.getPrototypeOf(object) === null ? Object.create(null) : {};
6437
-
6438
- getEnumerableOwnPropertyKeys(object).forEach(key => {
6439
- defineProperty(result, key, clone(object[key]));
6440
- });
6441
-
6442
- return result;
6443
- }
6444
-
6445
- /**
6446
- * @param {*} merged already cloned
6447
- * @param {*} source something to merge
6448
- * @param {string[]} keys keys to merge
6449
- * @param {Object} config Config Object
6450
- * @returns {*} cloned Object
6451
- */
6452
- const mergeKeys = (merged, source, keys, config) => {
6453
- keys.forEach(key => {
6454
- if (typeof source[key] === 'undefined' && config.ignoreUndefined) {
6455
- return;
6456
- }
6457
-
6458
- // Do not recurse into prototype chain of merged
6459
- if (key in merged && merged[key] !== Object.getPrototypeOf(merged)) {
6460
- defineProperty(merged, key, merge(merged[key], source[key], config));
6461
- } else {
6462
- defineProperty(merged, key, clone(source[key]));
6463
- }
6464
- });
6465
-
6466
- return merged;
6467
- };
6468
-
6469
- /**
6470
- * @param {*} merged already cloned
6471
- * @param {*} source something to merge
6472
- * @param {Object} config Config Object
6473
- * @returns {*} cloned Object
6474
- *
6475
- * see [Array.prototype.concat ( ...arguments )](http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.concat)
6476
- */
6477
- const concatArrays = (merged, source, config) => {
6478
- let result = merged.slice(0, 0);
6479
- let resultIndex = 0;
6480
-
6481
- [merged, source].forEach(array => {
6482
- const indices = [];
6483
-
6484
- // `result.concat(array)` with cloning
6485
- for (let k = 0; k < array.length; k++) {
6486
- if (!hasOwnProperty.call(array, k)) {
6487
- continue;
6488
- }
6489
-
6490
- indices.push(String(k));
6491
-
6492
- if (array === merged) {
6493
- // Already cloned
6494
- defineProperty(result, resultIndex++, array[k]);
6495
- } else {
6496
- defineProperty(result, resultIndex++, clone(array[k]));
6497
- }
6498
- }
6499
-
6500
- // Merge non-index keys
6501
- result = mergeKeys(result, array, getEnumerableOwnPropertyKeys(array).filter(key => !indices.includes(key)), config);
6502
- });
6503
-
6504
- return result;
6505
- };
6506
-
6507
- /**
6508
- * @param {*} merged already cloned
6509
- * @param {*} source something to merge
6510
- * @param {Object} config Config Object
6511
- * @returns {*} cloned Object
6512
- */
6513
- function merge(merged, source, config) {
6514
- if (config.concatArrays && Array.isArray(merged) && Array.isArray(source)) {
6515
- return concatArrays(merged, source, config);
6516
- }
6517
-
6518
- if (!isOptionObject(source) || !isOptionObject(merged)) {
6519
- return clone(source);
6520
- }
6521
-
6522
- return mergeKeys(merged, source, getEnumerableOwnPropertyKeys(source), config);
6523
- }
6524
-
6525
- mergeOptions$1 = function (...options) {
6526
- const config = merge(clone(defaultMergeOptions), (this !== globalThis && this) || {}, defaultMergeOptions);
6527
- let merged = {_: {}};
6528
-
6529
- for (const option of options) {
6530
- if (option === undefined) {
6531
- continue;
6532
- }
6533
-
6534
- if (!isOptionObject(option)) {
6535
- throw new TypeError('`' + option + '` is not an Option Object');
6536
- }
6537
-
6538
- merged = merge(merged, {_: option}, config);
6539
- }
6540
-
6541
- return merged._;
6542
- };
6543
- return mergeOptions$1;
6544
- }
6545
-
6546
- var mergeOptionsExports = requireMergeOptions();
6547
- var mergeOptions = /*@__PURE__*/getDefaultExportFromCjs(mergeOptionsExports);
6548
-
6549
- /**
6550
- * Thin ESM wrapper for CJS named exports.
6551
- *
6552
- * Ref: https://redfin.engineering/node-modules-at-war-why-commonjs-and-es-modules-cant-get-along-9617135eeca1
6553
- */
6554
-
6555
- // eslint-disable-next-line @typescript-eslint/ban-types
6556
-
6557
- // eslint-disable-next-line @typescript-eslint/ban-types
6558
-
6559
- const merge = mergeOptions.bind({
6560
- concatArrays: true,
6561
- ignoreUndefined: true
6562
- });
6563
- function mergeLocalStorageItem(key, value) {
6564
- const oldValue = window.localStorage.getItem(key);
6565
- if (oldValue) {
6566
- const oldObject = JSON.parse(oldValue);
6567
- const newObject = JSON.parse(value);
6568
- const nextValue = JSON.stringify(merge(oldObject, newObject));
6569
- window.localStorage.setItem(key, nextValue);
6570
- } else {
6571
- window.localStorage.setItem(key, value);
6572
- }
6573
- }
6574
- function createPromise(getValue, callback) {
6575
- return new Promise((resolve, reject) => {
6576
- try {
6577
- const value = getValue();
6578
- callback?.(null, value);
6579
- resolve(value);
6580
- } catch (err) {
6581
- callback?.(err);
6582
- reject(err);
6583
- }
6584
- });
6585
- }
6586
- function createPromiseAll(promises, callback, processResult) {
6587
- return Promise.all(promises).then(result => {
6588
- const value = processResult?.(result) ?? null;
6589
- callback?.(null, value);
6590
- return Promise.resolve(value);
6591
- }, errors => {
6592
- callback?.(errors);
6593
- return Promise.reject(errors);
6594
- });
6595
- }
6596
- const AsyncStorage = {
6597
- /**
6598
- * Fetches `key` value.
6599
- */
6600
- getItem: (key, callback) => {
6601
- return createPromise(() => window.localStorage.getItem(key), callback);
6602
- },
6603
- /**
6604
- * Sets `value` for `key`.
6605
- */
6606
- setItem: (key, value, callback) => {
6607
- return createPromise(() => window.localStorage.setItem(key, value), callback);
6608
- },
6609
- /**
6610
- * Removes a `key`
6611
- */
6612
- removeItem: (key, callback) => {
6613
- return createPromise(() => window.localStorage.removeItem(key), callback);
6614
- },
6615
- /**
6616
- * Merges existing value with input value, assuming they are stringified JSON.
6617
- */
6618
- mergeItem: (key, value, callback) => {
6619
- return createPromise(() => mergeLocalStorageItem(key, value), callback);
6620
- },
6621
- /**
6622
- * Erases *all* AsyncStorage for the domain.
6623
- */
6624
- clear: callback => {
6625
- return createPromise(() => window.localStorage.clear(), callback);
6626
- },
6627
- /**
6628
- * Gets *all* keys known to the app, for all callers, libraries, etc.
6629
- */
6630
- getAllKeys: callback => {
6631
- return createPromise(() => {
6632
- const numberOfKeys = window.localStorage.length;
6633
- const keys = [];
6634
- for (let i = 0; i < numberOfKeys; i += 1) {
6635
- const key = window.localStorage.key(i) || "";
6636
- keys.push(key);
6637
- }
6638
- return keys;
6639
- }, callback);
6640
- },
6641
- /**
6642
- * (stub) Flushes any pending requests using a single batch call to get the data.
6643
- */
6644
- flushGetRequests: () => undefined,
6645
- /**
6646
- * multiGet resolves to an array of key-value pair arrays that matches the
6647
- * input format of multiSet.
6648
- *
6649
- * multiGet(['k1', 'k2']) -> [['k1', 'val1'], ['k2', 'val2']]
6650
- */
6651
- multiGet: (keys, callback) => {
6652
- const promises = keys.map(key => AsyncStorage.getItem(key));
6653
- const processResult = result => result.map((value, i) => [keys[i], value]);
6654
- return createPromiseAll(promises, callback, processResult);
6655
- },
6656
- /**
6657
- * Takes an array of key-value array pairs.
6658
- * multiSet([['k1', 'val1'], ['k2', 'val2']])
6659
- */
6660
- multiSet: (keyValuePairs, callback) => {
6661
- const promises = keyValuePairs.map(item => AsyncStorage.setItem(item[0], item[1]));
6662
- return createPromiseAll(promises, callback);
6663
- },
6664
- /**
6665
- * Delete all the keys in the `keys` array.
6666
- */
6667
- multiRemove: (keys, callback) => {
6668
- const promises = keys.map(key => AsyncStorage.removeItem(key));
6669
- return createPromiseAll(promises, callback);
6670
- },
6671
- /**
6672
- * Takes an array of key-value array pairs and merges them with existing
6673
- * values, assuming they are stringified JSON.
6674
- *
6675
- * multiMerge([['k1', 'val1'], ['k2', 'val2']])
6676
- */
6677
- multiMerge: (keyValuePairs, callback) => {
6678
- const promises = keyValuePairs.map(item => AsyncStorage.mergeItem(item[0], item[1]));
6679
- return createPromiseAll(promises, callback);
6680
- }
6681
- };
6682
-
6683
- var index = /*#__PURE__*/Object.freeze({
6684
- __proto__: null,
6685
- default: AsyncStorage
6686
- });
6687
-
6688
- 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 };
6689
- //# sourceMappingURL=index.esm.js.map
5979
+ export { selectCartItems as $, selectCurrentUser as A, isVerifying as B, getUserSession as C, selectCurrentUserSub as D, selectCurrentUserRefreshToken as E, selectUserTokens as F, selectUserSubscriptionStatus as G, selectSubscription as H, selectSubscriptionPrice as I, cartSlice as J, setTaxRate as K, resetTaxRate as L, setPromoCode as M, removePromoCode as N, addToCart as O, updateCart as P, removeFromCart as Q, emptyCart as R, toggleCart as S, selectMediaInCart as T, selectCartTotal as U, selectCartNetTotal as V, selectCartTaxRate as W, selectCartTaxAmount as X, selectCartCount as Y, selectCartStatus as Z, selectPromoCode as _, authApi as a, selectCartItemsIds as a0, formatUserPayload as a1, formatPromos as a2, formatWorkout as a3, formatShortform as a4, formatFaqs as a5, formatPages as a6, formatSettings as a7, formatPress as a8, formatGuests as a9, formatVideos as aa, formatSections as ab, formatSchedule as ac, formatChallenges as ad, formatChallengeDays as ae, formatSecondsToISO8601Duration as af, formatAuthSession as ag, formatFedaratedSession as ah, formatSocialAuthSession as ai, formatConfig as aj, formatSectionPanels as ak, formatSectionItems as al, formatTaxonomies as am, formatSeries as an, formatSeasons as ao, formatLongform as ap, formatMediaItem as aq, useResetPasswordAuthMutation as b, contentApi as c, useRegisterMutation as d, useVerifyUserQuery as e, useLazyVerifyUserQuery as f, useGetUserInfoQuery as g, useLazyGetUserInfoQuery as h, isAuthenticated as i, useUpdateUserInfoMutation as j, useForgottenPasswordMutation as k, useVerifyUserAttributesQuery as l, useLazyVerifyUserAttributesQuery as m, useVerifyUserResendQuery as n, ordersApi as o, paymentApi as p, useLazyVerifyUserResendQuery as q, useUpdateUserMutation as r, authSlice as s, setCredentials as t, useResetPasswordMutation as u, resetCreating as v, logout as w, updateSubscription as x, selectAccessToken as y, selectRefreshToken as z };
5980
+ //# sourceMappingURL=slice-CRuD2Hce.js.map