@techstuff-dev/foundation-api-utils 1.23.1 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { fetchBaseQuery, createApi } from '@reduxjs/toolkit/query/react';
2
2
  import { Auth } from 'aws-amplify';
3
- import { createSlice, combineSlices, configureStore } from '@reduxjs/toolkit';
3
+ import { createSlice, createSelector, combineSlices, configureStore } from '@reduxjs/toolkit';
4
4
  import { jwtDecode } from 'jwt-decode';
5
5
  import { useSelector, useDispatch, useStore } from 'react-redux';
6
6
  import { useMemo } from 'react';
@@ -73,13 +73,23 @@ function __generator(thisArg, body) {
73
73
  }
74
74
  }
75
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
+
76
86
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
77
87
  var e = new Error(message);
78
88
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
79
89
  };
80
90
 
81
- var _a$1, _b$1;
82
- var initialState = {
91
+ var _a$2, _b$2;
92
+ var initialState$1 = {
83
93
  authenticated: false,
84
94
  verifying: false,
85
95
  user: {
@@ -103,29 +113,13 @@ var initialState = {
103
113
  email: '',
104
114
  sub: '',
105
115
  },
106
- // creating: {
107
- // details: '',
108
- // payment: '',
109
- // },
110
116
  loading: false,
111
117
  error: false,
112
118
  session: undefined,
113
119
  };
114
- // interface AuthReducers {
115
- // setCredentials: (
116
- // state: AuthState,
117
- // data: {
118
- // payload: any;
119
- // type: string;
120
- // },
121
- // ) => AuthState;
122
- // resetCreating: (state: AuthState) => void;
123
- // updateSubscription: (state: AuthState, data: any) => void;
124
- // logout: () => void;
125
- // }
126
120
  var authSlice = createSlice({
127
121
  name: 'auth',
128
- initialState: initialState,
122
+ initialState: initialState$1,
129
123
  reducers: {
130
124
  setCredentials: function (state, data) {
131
125
  return __assign(__assign({}, state), { session: data.payload.accessToken, authenticated: true, verifying: true, user: __assign(__assign({}, state.user), data.payload) });
@@ -139,15 +133,13 @@ var authSlice = createSlice({
139
133
  updateSubscription: function (state, data) {
140
134
  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 }) }) });
141
135
  },
142
- logout: function () { return initialState; },
136
+ logout: function () { return initialState$1; },
143
137
  },
144
138
  selectors: {
145
139
  isAuthenticated: function (auth) { return auth.authenticated; },
146
140
  selectAccessToken: function (auth) { return auth.user.accessToken; },
147
141
  selectRefreshToken: function (auth) { return auth.user.refreshToken; },
148
142
  selectCurrentUser: function (auth) { return auth.user.details; },
149
- // selectUserCreating: (auth) => auth.creating,
150
- // selectUserCreatingDetails: (auth) => auth.creating.details,
151
143
  isVerifying: function (auth) { return auth.verifying; },
152
144
  getUserSession: function (auth) { return (auth.authenticated ? auth.session : false); },
153
145
  selectCurrentUserSub: function (auth) { return auth.user.sub; },
@@ -174,12 +166,9 @@ var authSlice = createSlice({
174
166
  },
175
167
  });
176
168
  // Action creators are generated for each case reducer function.
177
- var setCredentials = (_a$1 = authSlice.actions, _a$1.setCredentials), resetCreating = _a$1.resetCreating, logout = _a$1.logout, updateSubscription = _a$1.updateSubscription;
169
+ var setCredentials = (_a$2 = authSlice.actions, _a$2.setCredentials), resetCreating = _a$2.resetCreating, logout = _a$2.logout, updateSubscription = _a$2.updateSubscription;
178
170
  // Selectors returned by `slice.selectors` take the root state as their first argument.
179
- var isAuthenticated = (_b$1 = authSlice.selectors, _b$1.isAuthenticated), selectAccessToken = _b$1.selectAccessToken, selectRefreshToken = _b$1.selectRefreshToken, selectCurrentUser = _b$1.selectCurrentUser,
180
- // selectUserCreating,
181
- // selectUserCreatingDetails,
182
- isVerifying = _b$1.isVerifying, getUserSession = _b$1.getUserSession, selectCurrentUserSub = _b$1.selectCurrentUserSub, selectCurrentUserRefreshToken = _b$1.selectCurrentUserRefreshToken, selectUserTokens = _b$1.selectUserTokens, selectUserSubscriptionStatus = _b$1.selectUserSubscriptionStatus, selectSubscription = _b$1.selectSubscription, selectSubscriptionPrice = _b$1.selectSubscriptionPrice;
171
+ 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;
183
172
  authSlice.reducer;
184
173
 
185
174
  // TODO: typing.
@@ -206,28 +195,28 @@ var formatUserPayload = function (payload) {
206
195
  };
207
196
  function formatPromos(data) {
208
197
  return data.map(function (item) {
209
- var _source = item._source;
198
+ 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;
210
199
  return {
211
- uuid: _source.uuid && _source.uuid[0],
212
- id: _source.uuid && _source.uuid[0],
213
- title: _source.title && _source.title[0],
214
- video: _source.video && _source.video[0],
215
- align: _source.align && _source.align[0],
216
- section: _source.section && _source.section[0],
217
- image: _source.image && _source.image[0],
218
- imageFormatted: _source.image_formatted && _source.image_formatted[0],
219
- backgroundImage: _source.background_image && _source.background_image[0],
220
- backgroundVideo: _source.background_video && _source.background_video[0],
221
- backgroundImageFormatted: _source.background_image_formatted &&
222
- _source.background_image_formatted[0],
223
- description: _source.description && _source.description[0],
224
- created: _source.created && _source.created[0],
225
- updated: _source.updated && _source.updated[0],
226
- langcode: _source.langcode && _source.langcode[0],
227
- weight: _source.weight && _source.weight[0],
228
- authPanel: _source.auth_panel && _source.auth_panel[0],
229
- buttonText: _source.button_text && _source.button_text[0],
230
- link: _source.link && _source.link[0],
200
+ 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],
201
+ 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],
202
+ 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],
203
+ video: (_h = (_g = item === null || item === void 0 ? void 0 : item._source) === null || _g === void 0 ? void 0 : _g.video) === null || _h === void 0 ? void 0 : _h[0],
204
+ align: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.align) === null || _k === void 0 ? void 0 : _k[0],
205
+ section: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.section) === null || _m === void 0 ? void 0 : _m[0],
206
+ 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],
207
+ imageFormatted: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.image_formatted) === null || _r === void 0 ? void 0 : _r[0],
208
+ backgroundImage: (_t = (_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.background_image) === null || _t === void 0 ? void 0 : _t[0],
209
+ backgroundVideo: (_v = (_u = item === null || item === void 0 ? void 0 : item._source) === null || _u === void 0 ? void 0 : _u.background_video) === null || _v === void 0 ? void 0 : _v[0],
210
+ backgroundImageFormatted: (_x = (_w = item === null || item === void 0 ? void 0 : item._source) === null || _w === void 0 ? void 0 : _w.background_image_formatted) === null || _x === void 0 ? void 0 : _x[0],
211
+ description: (_z = (_y = item === null || item === void 0 ? void 0 : item._source) === null || _y === void 0 ? void 0 : _y.description) === null || _z === void 0 ? void 0 : _z[0],
212
+ created: (_1 = (_0 = item === null || item === void 0 ? void 0 : item._source) === null || _0 === void 0 ? void 0 : _0.created) === null || _1 === void 0 ? void 0 : _1[0],
213
+ updated: (_3 = (_2 = item === null || item === void 0 ? void 0 : item._source) === null || _2 === void 0 ? void 0 : _2.updated) === null || _3 === void 0 ? void 0 : _3[0],
214
+ langcode: (_5 = (_4 = item === null || item === void 0 ? void 0 : item._source) === null || _4 === void 0 ? void 0 : _4.langcode) === null || _5 === void 0 ? void 0 : _5[0],
215
+ weight: (_7 = (_6 = item === null || item === void 0 ? void 0 : item._source) === null || _6 === void 0 ? void 0 : _6.weight) === null || _7 === void 0 ? void 0 : _7[0],
216
+ authPanel: (_9 = (_8 = item === null || item === void 0 ? void 0 : item._source) === null || _8 === void 0 ? void 0 : _8.auth_panel) === null || _9 === void 0 ? void 0 : _9[0],
217
+ buttonText: (_11 = (_10 = item === null || item === void 0 ? void 0 : item._source) === null || _10 === void 0 ? void 0 : _10.button_text) === null || _11 === void 0 ? void 0 : _11[0],
218
+ link: (_13 = (_12 = item === null || item === void 0 ? void 0 : item._source) === null || _12 === void 0 ? void 0 : _12.link) === null || _13 === void 0 ? void 0 : _13[0],
219
+ term: (_15 = (_14 = item === null || item === void 0 ? void 0 : item._source) === null || _14 === void 0 ? void 0 : _14.term) === null || _15 === void 0 ? void 0 : _15[0],
231
220
  };
232
221
  });
233
222
  }
@@ -256,24 +245,24 @@ function formatWorkout(data) {
256
245
  };
257
246
  });
258
247
  }
259
- function formatSeries(data, channel) {
260
- var formattedSeriesSelection = data.map(function (series) {
261
- return {
262
- uuid: series.uuid,
263
- id: series.uuid,
264
- title: series.title,
265
- subtitle: series.subtitle,
266
- thumb: series.imageThumbnailURL,
267
- mainImage: series.imageURL,
268
- description: series.summary.value,
269
- body: series.body.value,
270
- nid: series.nid,
271
- seasonList: series.season,
272
- channel: channel,
273
- };
274
- });
275
- return formattedSeriesSelection;
276
- }
248
+ // export function formatSeries(data: Series[], channel: string) {
249
+ // const formattedSeriesSelection = data.map((series) => {
250
+ // return {
251
+ // uuid: series.uuid,
252
+ // id: series.uuid,
253
+ // title: series.title,
254
+ // subtitle: series.subtitle,
255
+ // thumb: series.imageThumbnailURL,
256
+ // mainImage: series.imageURL,
257
+ // description: series.summary.value,
258
+ // body: series.body.value,
259
+ // nid: series.nid,
260
+ // seasonList: series.season,
261
+ // channel,
262
+ // };
263
+ // });
264
+ // return formattedSeriesSelection;
265
+ // }
277
266
  function formatShortform(data) {
278
267
  return data.map(function (item) {
279
268
  var _source = item._source;
@@ -295,34 +284,35 @@ function formatShortform(data) {
295
284
  };
296
285
  });
297
286
  }
298
- function formatLongform(data) {
299
- return data.map(function (item) {
300
- var _source = item._source;
301
- return {
302
- uuid: _source.uuid && _source.uuid[0],
303
- id: _source.uuid && _source.uuid[0],
304
- nid: _source.nid && _source.nid[0],
305
- title: _source.title && _source.title[0],
306
- image: _source.image && _source.image[0],
307
- image_promo: _source.image_promo && _source.image_promo[0],
308
- image_promo_large: _source.image_promo_large && _source.image_promo_large[0],
309
- image_poster: _source.image_poster && _source.image_poster[0],
310
- summary: _source.summary && _source.summary[0],
311
- created: _source.created && _source.created[0],
312
- updated: _source.revision_timestamp && _source.revision_timestamp[0],
313
- video: _source.video_manifest && _source.video_manifest[0],
314
- rating: _source.rating && _source.rating[0],
315
- released: _source.released_date && _source.released_date[0],
316
- source_id: _source.source_id && _source.source_id[0],
317
- director: _source.director && _source.director[0],
318
- duration: _source.duration && _source.duration[0],
319
- path: _source.path && _source.path[0],
320
- genres: _source.genres,
321
- actors: _source.actors,
322
- writers: _source.writers,
323
- };
324
- });
325
- }
287
+ // export function formatLongform(data: ESLongForm[]) {
288
+ // return data.map((item) => {
289
+ // const { _source } = item;
290
+ // return {
291
+ // uuid: _source.uuid && _source.uuid[0],
292
+ // id: _source.uuid && _source.uuid[0],
293
+ // nid: _source.nid && _source.nid[0],
294
+ // title: _source.title && _source.title[0],
295
+ // image: _source.image && _source.image[0],
296
+ // image_promo: _source.image_promo && _source.image_promo[0],
297
+ // image_promo_large:
298
+ // _source.image_promo_large && _source.image_promo_large[0],
299
+ // image_poster: _source.image_poster && _source.image_poster[0],
300
+ // summary: _source.summary && _source.summary[0],
301
+ // created: _source.created && _source.created[0],
302
+ // updated: _source.revision_timestamp && _source.revision_timestamp[0],
303
+ // video: _source.video_manifest && _source.video_manifest[0],
304
+ // rating: _source.rating && _source.rating[0],
305
+ // released: _source.released_date && _source.released_date[0],
306
+ // source_id: _source.source_id && _source.source_id[0],
307
+ // director: _source.director && _source.director[0],
308
+ // duration: _source.duration && _source.duration[0],
309
+ // path: _source.path && _source.path[0],
310
+ // genres: _source.genres,
311
+ // actors: _source.actors,
312
+ // writers: _source.writers,
313
+ // };
314
+ // });
315
+ // }
326
316
  function formatFaqs(data) {
327
317
  return data.map(function (item) {
328
318
  var _source = item._source;
@@ -338,16 +328,16 @@ function formatFaqs(data) {
338
328
  }
339
329
  function formatPages(data) {
340
330
  return data.map(function (item) {
341
- var _source = item._source;
331
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
342
332
  return {
343
- uuid: _source.uuid && _source.uuid[0],
344
- id: _source.uuid && _source.uuid[0],
345
- title: _source.title && _source.title[0],
346
- body: _source.body && _source.body[0],
347
- created: _source.created && _source.created[0],
348
- updated: _source.updated && _source.updated[0],
349
- langcode: _source.langcode && _source.langcode[0],
350
- url: _source.url && _source.url[0],
333
+ 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],
334
+ 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],
335
+ 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],
336
+ 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],
337
+ 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],
338
+ 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],
339
+ 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],
340
+ 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],
351
341
  };
352
342
  });
353
343
  }
@@ -647,15 +637,172 @@ function formatSocialAuthSession(tokens) {
647
637
  },
648
638
  };
649
639
  }
640
+ function formatConfig(data) {
641
+ return data.map(function (item) {
642
+ 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;
643
+ return {
644
+ 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],
645
+ 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],
646
+ 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],
647
+ 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],
648
+ 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],
649
+ 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],
650
+ 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],
651
+ 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],
652
+ 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],
653
+ 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],
654
+ 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],
655
+ 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],
656
+ };
657
+ });
658
+ }
659
+ function formatSectionPanels(data) {
660
+ return data.map(function (item) {
661
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
662
+ return {
663
+ 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],
664
+ 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],
665
+ 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],
666
+ 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],
667
+ 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],
668
+ 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],
669
+ items: (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.item_uuid,
670
+ 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],
671
+ };
672
+ });
673
+ }
674
+ function formatSectionItems(data) {
675
+ return data.map(function (item) {
676
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
677
+ return {
678
+ 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],
679
+ 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],
680
+ 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],
681
+ 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],
682
+ 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],
683
+ 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],
684
+ 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],
685
+ 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],
686
+ 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],
687
+ };
688
+ });
689
+ }
690
+ var formatTaxonomies = function (data) {
691
+ return data.map(function (item) {
692
+ 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;
693
+ return {
694
+ 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],
695
+ 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],
696
+ 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],
697
+ 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],
698
+ 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],
699
+ 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],
700
+ 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],
701
+ 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],
702
+ 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],
703
+ 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],
704
+ 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],
705
+ 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],
706
+ 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],
707
+ };
708
+ });
709
+ };
710
+ var formatSeries = function (data) {
711
+ return data.map(function (item) {
712
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
713
+ return {
714
+ 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],
715
+ 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],
716
+ 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],
717
+ 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],
718
+ 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],
719
+ 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],
720
+ 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],
721
+ 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],
722
+ 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],
723
+ 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],
724
+ seasons: ((_w = item === null || item === void 0 ? void 0 : item._source) === null || _w === void 0 ? void 0 : _w.seasons) || [],
725
+ };
726
+ });
727
+ };
728
+ var formatSeasons = function (data) {
729
+ return data.map(function (item) {
730
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
731
+ return {
732
+ 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],
733
+ 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],
734
+ 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],
735
+ 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],
736
+ 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],
737
+ 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],
738
+ 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],
739
+ 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],
740
+ episodes: ((_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.episodes) || [],
741
+ 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],
742
+ 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],
743
+ };
744
+ });
745
+ };
746
+ var formatLongform = function (data) {
747
+ return data.map(function (item) {
748
+ 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;
749
+ return {
750
+ 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],
751
+ 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],
752
+ 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],
753
+ 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],
754
+ 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],
755
+ 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],
756
+ image_poster: (_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],
757
+ image_thumb: (_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],
758
+ 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],
759
+ 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],
760
+ 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],
761
+ image_url: (_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],
762
+ episode_number: (_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],
763
+ };
764
+ });
765
+ };
766
+ var formatMediaItem = function (data) {
767
+ return data.map(function (item) {
768
+ 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;
769
+ return {
770
+ 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],
771
+ 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],
772
+ 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],
773
+ 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],
774
+ 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],
775
+ 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],
776
+ 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],
777
+ 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],
778
+ 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],
779
+ 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],
780
+ 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],
781
+ 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],
782
+ entities: (_0 = item === null || item === void 0 ? void 0 : item._source) === null || _0 === void 0 ? void 0 : _0.entities,
783
+ phrases: (_1 = item === null || item === void 0 ? void 0 : item._source) === null || _1 === void 0 ? void 0 : _1.phrases,
784
+ 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],
785
+ 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],
786
+ 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],
787
+ 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],
788
+ related_items: (_10 = item === null || item === void 0 ? void 0 : item._source) === null || _10 === void 0 ? void 0 : _10.related_uuids,
789
+ franchises: (_11 = item === null || item === void 0 ? void 0 : item._source) === null || _11 === void 0 ? void 0 : _11.franchise_name,
790
+ franchisesIds: (_12 = item === null || item === void 0 ? void 0 : item._source) === null || _12 === void 0 ? void 0 : _12.franchise_tid,
791
+ 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],
792
+ 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],
793
+ 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],
794
+ };
795
+ });
796
+ };
650
797
 
651
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
798
+ var _a$1, _b$1, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
652
799
  // Render the store based on the environment.
653
800
  var isWeb = process.env.NEXT_PUBLIC_WEB_APP;
654
801
  var ENV = isWeb ? process.env : require('react-native-config').default;
655
802
  // export const ENV = process.env;
656
- ((_a = process.env) === null || _a === void 0 ? void 0 : _a.NEXT_PUBLIC_API_PREFIX) || ENV.API_PREFIX;
803
+ ((_a$1 = process.env) === null || _a$1 === void 0 ? void 0 : _a$1.NEXT_PUBLIC_API_PREFIX) || ENV.API_PREFIX;
657
804
  // Auth specific API
658
- var API_AUTH_PREFIX = ((_b = process.env) === null || _b === void 0 ? void 0 : _b.NEXT_PUBLIC_API_AUTH_PREFIX) || ENV.API_AUTH_PREFIX;
805
+ 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;
659
806
  // Payments specific API
660
807
  var API_PAYMENTS_PREFIX = ((_c = process.env) === null || _c === void 0 ? void 0 : _c.NEXT_PUBLIC_API_PAYMENTS_PREFIX) || ENV.API_PAYMENTS_PREFIX;
661
808
  ((_d = process.env) === null || _d === void 0 ? void 0 : _d.NEXT_PUBLIC_APP_BASE_URL) || ENV.APP_BASE_URL;
@@ -1089,6 +1236,136 @@ var paymentApi = createApi({
1089
1236
  // Export hooks for usage in functional components.
1090
1237
  paymentApi.useCheckUserSubscriptionQuery; paymentApi.useLazyCheckUserSubscriptionQuery; paymentApi.useGetPaymentPlansQuery; paymentApi.useLazyGetPaymentPlansQuery;
1091
1238
 
1239
+ function applyCoupon(coupon, netTotal) {
1240
+ var discountedAmount = netTotal * (Number(coupon.discount) / 100);
1241
+ var discountedTotal = netTotal - discountedAmount;
1242
+ var data = __assign(__assign({}, coupon), { discountedTotal: discountedTotal, discountedAmount: discountedAmount });
1243
+ return data;
1244
+ }
1245
+ function applyTax(taxRate, netTotal) {
1246
+ var taxAmount = netTotal * (taxRate.percentage / 100);
1247
+ return taxAmount;
1248
+ }
1249
+
1250
+ var _a, _b;
1251
+ var initialState = {
1252
+ addedItems: [],
1253
+ netTotal: 0,
1254
+ taxRate: {
1255
+ country: 'none',
1256
+ percentage: 0,
1257
+ },
1258
+ taxAmount: 0,
1259
+ promoCode: {
1260
+ code: '',
1261
+ name: '',
1262
+ discount: '',
1263
+ discountedAmount: 0,
1264
+ },
1265
+ grossTotal: 0,
1266
+ loading: false,
1267
+ error: false,
1268
+ open: false,
1269
+ };
1270
+ var cartSlice = createSlice({
1271
+ name: 'cart',
1272
+ initialState: initialState,
1273
+ reducers: {
1274
+ setTaxRate: function (state, action) {
1275
+ var netTotal = state.netTotal, promoCode = state.promoCode;
1276
+ var currentTotal = netTotal;
1277
+ if (promoCode === null || promoCode === void 0 ? void 0 : promoCode.code) {
1278
+ var data = applyCoupon(promoCode, currentTotal);
1279
+ currentTotal = data.discountedTotal;
1280
+ }
1281
+ var taxAmount = applyTax(action.payload, currentTotal);
1282
+ var grossTotal = currentTotal + taxAmount;
1283
+ return __assign(__assign({}, state), { taxRate: action.payload, taxAmount: taxAmount, grossTotal: grossTotal });
1284
+ },
1285
+ resetTaxRate: function (state, action) {
1286
+ console.log('resetTaxRate', action);
1287
+ return __assign(__assign({}, state), { taxRate: {
1288
+ country: 'none',
1289
+ percentage: 0,
1290
+ }, taxAmount: 0 });
1291
+ },
1292
+ setPromoCode: function (state, action) {
1293
+ var netTotal = state.netTotal, taxRate = state.taxRate;
1294
+ var data = applyCoupon(action.payload, netTotal);
1295
+ var taxAmount = applyTax(taxRate, data.discountedTotal);
1296
+ var grossTotal = data.discountedTotal + taxAmount;
1297
+ return __assign(__assign({}, state), { promoCode: {
1298
+ code: data.code,
1299
+ name: data.code,
1300
+ discount: data.discount,
1301
+ discountedAmount: data.discountedAmount,
1302
+ }, taxAmount: taxAmount, grossTotal: grossTotal });
1303
+ },
1304
+ removePromoCode: function (state, action) {
1305
+ console.log('removePromoCode', action);
1306
+ var netTotal = state.netTotal, taxRate = state.taxRate;
1307
+ var taxAmount = applyTax(taxRate, netTotal);
1308
+ var grossTotal = netTotal + taxAmount;
1309
+ return __assign(__assign({}, state), { promoCode: initialState.promoCode, taxAmount: taxAmount, grossTotal: grossTotal });
1310
+ },
1311
+ addToCart: function (state, action) {
1312
+ var _a = action.payload, options = _a.options, item = _a.item;
1313
+ var newTotal = state.netTotal + options.selectedPrice;
1314
+ var taxAmount = newTotal * (state.taxRate.percentage / 100);
1315
+ var grossTotal = newTotal + taxAmount;
1316
+ var addItem = item ? __assign(__assign({}, item), { options: options }) : null;
1317
+ if (!addItem) {
1318
+ return state;
1319
+ }
1320
+ var addedItems = __spreadArray(__spreadArray([], state.addedItems, true), [addItem], false);
1321
+ return __assign(__assign({}, state), { addedItems: addedItems, netTotal: newTotal, grossTotal: grossTotal });
1322
+ },
1323
+ updateCart: function (state, action) {
1324
+ var options = action.payload.options;
1325
+ return __assign(__assign({}, state), { addedItems: state.addedItems.map(function (item) {
1326
+ return item && __assign(__assign({}, item), { options: options });
1327
+ }) });
1328
+ },
1329
+ removeFromCart: function (state, action) {
1330
+ var _a = action.payload, id = _a.id, price = _a.price;
1331
+ var newTotal = state.netTotal - price;
1332
+ var taxAmount = newTotal * (state.taxRate.percentage / 100);
1333
+ var grossTotal = newTotal + taxAmount;
1334
+ return __assign(__assign({}, state), { addedItems: state.addedItems.filter(function (item) { return item && item.uuid !== id; }), netTotal: newTotal, grossTotal: grossTotal });
1335
+ },
1336
+ toggleCart: function (state, action) {
1337
+ return __assign(__assign({}, state), { open: action.payload });
1338
+ },
1339
+ emptyCart: function () { return initialState; },
1340
+ },
1341
+ selectors: {
1342
+ selectMediaInCart: function (cart) { return cart.addedItems; },
1343
+ selectCartTotal: function (cart) { return cart.grossTotal; },
1344
+ selectCartNetTotal: function (cart) { return cart.netTotal; },
1345
+ selectCartTaxRate: function (cart) { return cart.taxRate; },
1346
+ selectCartTaxAmount: function (cart) { return cart.taxAmount; },
1347
+ selectCartCount: function (cart) { return cart.addedItems.length; },
1348
+ selectCartStatus: function (cart) { return cart.open; },
1349
+ selectPromoCode: function (cart) { return cart.promoCode; },
1350
+ },
1351
+ });
1352
+ 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;
1353
+ 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;
1354
+ var selectCartItems = createSelector([selectMediaInCart], function (items) {
1355
+ return items.map(function (item) {
1356
+ return {
1357
+ title: item.title || item.generatedTitle,
1358
+ file: "".concat(item.sku, ".mp4"),
1359
+ options: item.options,
1360
+ script: item.script,
1361
+ };
1362
+ });
1363
+ });
1364
+ var selectCartItemsIds = createSelector([selectMediaInCart], function (items) {
1365
+ return items.map(function (item) { return item.uuid; });
1366
+ });
1367
+ cartSlice.reducer;
1368
+
1092
1369
  var useLoggedIn = function () {
1093
1370
  var isLoggedIn = useSelector(isAuthenticated);
1094
1371
  return useMemo(function () { return isLoggedIn; }, [isLoggedIn]);
@@ -1120,13 +1397,7 @@ function createPersistStorage() {
1120
1397
  }
1121
1398
 
1122
1399
  // Infer the `RootState` type from the root reducer
1123
- var rootReducer = combineSlices(authSlice, authApi, contentApi, paymentApi);
1124
- // export interface RootState {
1125
- // [authSlice.name]: ReturnType<typeof authSlice.reducer>;
1126
- // [authApi.reducerPath]: ReturnType<typeof authApi.reducer>;
1127
- // [contentApi.reducerPath]: ReturnType<typeof contentApi.reducer>;
1128
- // [paymentApi.reducerPath]: ReturnType<typeof paymentApi.reducer>;
1129
- // }
1400
+ var rootReducer = combineSlices(cartSlice, authSlice, authApi, contentApi, paymentApi);
1130
1401
  // eg. ['auth', 'creating'], or an empty array if you don't want to whitelist any.
1131
1402
  // const storageWhiteList: string[] = [];
1132
1403
  var storageBlackList = [];
@@ -1184,9 +1455,6 @@ var makeNativeStore = function () {
1184
1455
  };
1185
1456
  var makeWebStore = function () {
1186
1457
  var storage = createPersistStorage();
1187
- // if (process.env.NEXT_PUBLIC_STORE_BLACKLIST) {
1188
- // storageBlackList.push(process.env.NEXT_PUBLIC_STORE_BLACKLIST);
1189
- // }
1190
1458
  storageBlackList.push(paymentApi.reducerPath, authApi.reducerPath, contentApi.reducerPath);
1191
1459
  var persistConfig = {
1192
1460
  key: 'root',
@@ -1224,5 +1492,5 @@ var makeWebStore = function () {
1224
1492
  var nativeStore = !isWeb && makeNativeStore();
1225
1493
  var webStore = isWeb && makeWebStore();
1226
1494
 
1227
- export { authApi, authSlice, contentApi, formatAuthSession, formatChallengeDays, formatChallenges, formatFaqs, formatFedaratedSession, formatGuests, formatLongform, formatPages, formatPress, formatPromos, formatSchedule, formatSecondsToISO8601Duration, formatSections, formatSeries, formatSettings, formatShortform, formatSocialAuthSession, formatUserPayload, formatVideos, formatWorkout, getUserSession, isAuthenticated, isVerifying, logout, nativeStore, paymentApi, resetCreating, selectAccessToken, selectCurrentUser, selectCurrentUserRefreshToken, selectCurrentUserSub, selectRefreshToken, selectSubscription, selectSubscriptionPrice, selectUserSubscriptionStatus, selectUserTokens, setCredentials, updateSubscription, useAppDispatch, useAppSelector, useAppStore, useForgottenPasswordMutation, useGetUserInfoQuery, useLazyGetUserInfoQuery, useLazyVerifyUserAttributesQuery, useLazyVerifyUserQuery, useLazyVerifyUserResendQuery, useLoggedIn, useRegisterMutation, useResetPasswordAuthMutation, useResetPasswordMutation, useUpdateUserInfoMutation, useUpdateUserMutation, useVerifyUserAttributesQuery, useVerifyUserQuery, useVerifyUserResendQuery, webStore };
1495
+ export { addToCart, authApi, authSlice, cartSlice, contentApi, emptyCart, formatAuthSession, formatChallengeDays, formatChallenges, formatConfig, formatFaqs, formatFedaratedSession, formatGuests, formatLongform, formatMediaItem, formatPages, formatPress, formatPromos, formatSchedule, formatSeasons, formatSecondsToISO8601Duration, formatSectionItems, formatSectionPanels, formatSections, formatSeries, formatSettings, formatShortform, formatSocialAuthSession, formatTaxonomies, formatUserPayload, formatVideos, formatWorkout, getUserSession, isAuthenticated, isVerifying, logout, nativeStore, paymentApi, removeFromCart, removePromoCode, resetCreating, resetTaxRate, selectAccessToken, selectCartCount, selectCartItems, selectCartItemsIds, selectCartNetTotal, selectCartStatus, selectCartTaxAmount, selectCartTaxRate, selectCartTotal, selectCurrentUser, selectCurrentUserRefreshToken, selectCurrentUserSub, selectMediaInCart, selectPromoCode, selectRefreshToken, selectSubscription, selectSubscriptionPrice, selectUserSubscriptionStatus, selectUserTokens, setCredentials, setPromoCode, setTaxRate, toggleCart, updateCart, updateSubscription, useAppDispatch, useAppSelector, useAppStore, useForgottenPasswordMutation, useGetUserInfoQuery, useLazyGetUserInfoQuery, useLazyVerifyUserAttributesQuery, useLazyVerifyUserQuery, useLazyVerifyUserResendQuery, useLoggedIn, useRegisterMutation, useResetPasswordAuthMutation, useResetPasswordMutation, useUpdateUserInfoMutation, useUpdateUserMutation, useVerifyUserAttributesQuery, useVerifyUserQuery, useVerifyUserResendQuery, webStore };
1228
1496
  //# sourceMappingURL=index.esm.js.map