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