@techstuff-dev/foundation-api-utils 1.6.0 → 1.7.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
@@ -147,7 +147,9 @@ authSlice.reducer;
147
147
  var formatUserPayload = function (payload) {
148
148
  var userEmail = payload.email, firstName = payload.given_name, lastName = payload.family_name, dateOfBirth = payload.birthdate, uuid = payload["cognito:username"], termsAccepted = payload["custom:termsAccepted"], subscriptionId = payload["custom:subscriptionId"], contactPreference = payload["custom:contactPreferences"], customerId = payload["custom:customerId"];
149
149
  var parsedTermsAccepted = termsAccepted ? JSON.parse(termsAccepted) : null;
150
- var parsedContactPreference = contactPreference ? JSON.parse(contactPreference) : null;
150
+ var parsedContactPreference = contactPreference
151
+ ? JSON.parse(contactPreference)
152
+ : null;
151
153
  var data = {
152
154
  userEmail: userEmail,
153
155
  lastName: lastName,
@@ -189,30 +191,337 @@ function formatPromos(data) {
189
191
  };
190
192
  });
191
193
  }
192
- function formatESWorkoutItems(data) {
194
+ function formatWorkout(data) {
193
195
  var response = data.map(function (item) {
194
- var _a = item._source, changed = _a.changed, uuid = _a.uuid, description = _a.description, duration = _a.duration, duration_filter = _a.duration_filter, image = _a.image, level = _a.level, published = _a.published, targeted_section = _a.targeted_section, title = _a.title, uid = _a.uid, video_url = _a.video_url, video_poster = _a.video_poster, workout_category = _a.workout_category, workout_type = _a.workout_type, livestream_section = _a.livestream_section;
196
+ 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;
195
197
  return {
196
- changed: changed && changed[0],
197
- uuid: uuid && uuid[0],
198
- description: description && description[0],
199
- duration: duration && duration[0],
200
- duration_filter: duration_filter && duration_filter[0],
201
- level: level && level[0],
202
- published: published && published[0],
203
- targeted_section: targeted_section && targeted_section[0],
204
- uid: uid && uid[0],
205
- image: image && image[0],
206
- title: title && title[0],
207
- video: video_url && video_url[0],
208
- video_poster: video_poster && video_poster[0],
209
- workout_category: workout_category && workout_category[0],
210
- workout_type: workout_type && workout_type[0],
211
- livestream_section: livestream_section && livestream_section[0],
198
+ 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],
199
+ 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],
200
+ 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],
201
+ 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],
202
+ duration: (_k = (_j = item === null || item === void 0 ? void 0 : item._source) === null || _j === void 0 ? void 0 : _j.duration) === null || _k === void 0 ? void 0 : _k[0],
203
+ duration_filter: (_m = (_l = item === null || item === void 0 ? void 0 : item._source) === null || _l === void 0 ? void 0 : _l.duration_filter) === null || _m === void 0 ? void 0 : _m[0],
204
+ level: (_p = (_o = item === null || item === void 0 ? void 0 : item._source) === null || _o === void 0 ? void 0 : _o.level) === null || _p === void 0 ? void 0 : _p[0],
205
+ published: (_r = (_q = item === null || item === void 0 ? void 0 : item._source) === null || _q === void 0 ? void 0 : _q.published) === null || _r === void 0 ? void 0 : _r[0],
206
+ targeted_section: (_t = (_s = item === null || item === void 0 ? void 0 : item._source) === null || _s === void 0 ? void 0 : _s.targeted_section) === null || _t === void 0 ? void 0 : _t[0],
207
+ uid: (_v = (_u = item === null || item === void 0 ? void 0 : item._source) === null || _u === void 0 ? void 0 : _u.uid) === null || _v === void 0 ? void 0 : _v[0],
208
+ 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],
209
+ 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],
210
+ 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],
211
+ video_download: (_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],
212
+ video_poster: (_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],
213
+ workout_category: (_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],
214
+ workout_type: (_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],
215
+ livestream_section: (_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],
212
216
  };
213
217
  });
214
218
  return response;
215
219
  }
220
+ function formatSeries(data, channel) {
221
+ var formattedSeriesSelection = data.map(function (series) {
222
+ return {
223
+ uuid: series.uuid,
224
+ id: series.uuid,
225
+ title: series.title,
226
+ subtitle: series.subtitle,
227
+ thumb: series.imageThumbnailURL,
228
+ mainImage: series.imageURL,
229
+ description: series.summary.value,
230
+ body: series.body.value,
231
+ nid: series.nid,
232
+ seasonList: series.season,
233
+ channel: channel,
234
+ };
235
+ });
236
+ return formattedSeriesSelection;
237
+ }
238
+ function formatShortform(data) {
239
+ return data.map(function (item) {
240
+ var _source = item._source;
241
+ return {
242
+ uuid: _source.uuid && _source.uuid[0],
243
+ id: _source.uuid && _source.uuid[0],
244
+ nid: _source.nid && _source.nid[0],
245
+ title: _source.title && _source.title[0],
246
+ thumb: _source.field_image_thumb && _source.field_image_thumb[0],
247
+ mainImage: _source.field_image_poster && _source.field_image_poster[0],
248
+ description: _source.field_short_synopsis && _source.field_short_synopsis[0],
249
+ body: _source.field_body && _source.field_body[0],
250
+ channel: _source.field_channel && _source.field_channel[0],
251
+ updated: _source.revision_timestamp && _source.revision_timestamp[0],
252
+ langcode: _source.langcode && _source.langcode[0],
253
+ video: _source.field_videomanifest && _source.field_videomanifest[0],
254
+ duration: _source.field_duration && _source.field_duration[0],
255
+ category: _source.field_category && _source.field_category[0],
256
+ };
257
+ });
258
+ }
259
+ function formatLongform(data) {
260
+ return data.map(function (item) {
261
+ var _source = item._source;
262
+ return {
263
+ uuid: _source.uuid && _source.uuid[0],
264
+ id: _source.uuid && _source.uuid[0],
265
+ nid: _source.nid && _source.nid[0],
266
+ title: _source.title && _source.title[0],
267
+ image: _source.image && _source.image[0],
268
+ image_promo: _source.image_promo && _source.image_promo[0],
269
+ image_promo_large: _source.image_promo_large && _source.image_promo_large[0],
270
+ image_poster: _source.image_poster && _source.image_poster[0],
271
+ summary: _source.summary && _source.summary[0],
272
+ created: _source.created && _source.created[0],
273
+ updated: _source.revision_timestamp && _source.revision_timestamp[0],
274
+ video: _source.video_manifest && _source.video_manifest[0],
275
+ rating: _source.rating && _source.rating[0],
276
+ released: _source.released_date && _source.released_date[0],
277
+ source_id: _source.source_id && _source.source_id[0],
278
+ director: _source.director && _source.director[0],
279
+ duration: _source.duration && _source.duration[0],
280
+ path: _source.path && _source.path[0],
281
+ genres: _source.genres,
282
+ actors: _source.actors,
283
+ writers: _source.writers,
284
+ };
285
+ });
286
+ }
287
+ function formatFaqs(data) {
288
+ return data.map(function (item) {
289
+ var _source = item._source;
290
+ return {
291
+ uuid: _source.uuid && _source.uuid[0],
292
+ id: _source.uuid && _source.uuid[0],
293
+ title: _source.title && _source.title[0],
294
+ answer: _source.answer && _source.answer[0],
295
+ created: _source.created && _source.created[0],
296
+ updated: _source.updated && _source.updated[0],
297
+ };
298
+ });
299
+ }
300
+ function formatPages(data) {
301
+ return data.map(function (item) {
302
+ var _source = item._source;
303
+ return {
304
+ uuid: _source.uuid && _source.uuid[0],
305
+ id: _source.uuid && _source.uuid[0],
306
+ title: _source.title && _source.title[0],
307
+ body: _source.body && _source.body[0],
308
+ created: _source.created && _source.created[0],
309
+ updated: _source.updated && _source.updated[0],
310
+ langcode: _source.langcode && _source.langcode[0],
311
+ url: _source.url && _source.url[0],
312
+ };
313
+ });
314
+ }
315
+ function formatSettings(data) {
316
+ return data.map(function (item) {
317
+ var _source = item._source;
318
+ var fieldset = _source.fieldset && _source.fieldset[0].toLowerCase();
319
+ return {
320
+ uuid: _source.uuid && _source.uuid[0],
321
+ created: _source.created && _source.created[0],
322
+ updated: _source.updated && _source.updated[0],
323
+ status: _source.status && _source.status[0],
324
+ type: _source.type && _source.type[0],
325
+ video: _source.video && _source.video[0],
326
+ number: _source.number && _source.number[0],
327
+ pass: _source.pass && _source.pass[0],
328
+ fieldset: fieldset,
329
+ };
330
+ });
331
+ }
332
+ function formatPress(data) {
333
+ return data.map(function (item) {
334
+ var _source = item._source;
335
+ return {
336
+ uuid: _source.uuid && _source.uuid[0],
337
+ created: _source.created && _source.created[0],
338
+ updated: _source.updated && _source.updated[0],
339
+ image: _source.image && _source.image[0],
340
+ title: _source.title && _source.title[0],
341
+ };
342
+ });
343
+ }
344
+ function formatGuests(data) {
345
+ return data.map(function (item) {
346
+ var _source = item._source;
347
+ return {
348
+ uuid: _source.uuid && _source.uuid[0],
349
+ id: _source.id && _source.id[0],
350
+ title: _source.title && _source.title[0],
351
+ updated: _source.updated && _source.updated[0],
352
+ description: _source.description && _source.description[0],
353
+ image: _source.image_16_9 && _source.image_16_9[0],
354
+ display: _source.display && _source.display[0],
355
+ };
356
+ });
357
+ }
358
+ function formatVideos(data) {
359
+ return data.map(function (item) {
360
+ var _source = item._source;
361
+ return {
362
+ uuid: _source.uuid && _source.uuid[0],
363
+ title: _source.title && _source.title[0],
364
+ updated: _source.updated && _source.updated[0],
365
+ description: _source.description && _source.description[0],
366
+ image: _source.image && _source.image[0],
367
+ duration: _source.duration && _source.duration[0],
368
+ section: _source.section && _source.section[0],
369
+ video_poster: _source.video_poster && _source.video_poster[0],
370
+ video_url: _source.video_url && _source.video_url[0],
371
+ section_id: _source.section_id && _source.section_id[0],
372
+ };
373
+ });
374
+ }
375
+ function formatSections(data) {
376
+ return data.map(function (item) {
377
+ var _source = item._source;
378
+ return {
379
+ uuid: _source.uuid && _source.uuid[0],
380
+ title: _source.title && _source.title[0],
381
+ description: _source.description && _source.description[0],
382
+ image: _source.image && _source.image[0],
383
+ challenge: _source.challenge && _source.challenge[0],
384
+ display: _source.display && _source.display[0],
385
+ id: _source.id && _source.id[0],
386
+ };
387
+ });
388
+ }
389
+ function formatSchedule(data) {
390
+ return data.map(function (item) {
391
+ var _source = item._source;
392
+ return {
393
+ uuid: _source.uuid && _source.uuid[0],
394
+ created: _source.created && _source.created[0],
395
+ langcode: _source.langcode && _source.langcode[0],
396
+ updated: _source.updated && _source.updated[0],
397
+ days: [
398
+ {
399
+ monday: _source.monday_title &&
400
+ _source.monday_title.length > 0 &&
401
+ _source.monday_title.map(function (title, index) {
402
+ var _a, _b, _c;
403
+ return {
404
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.monday_end) === null || _a === void 0 ? void 0 : _a[index],
405
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.monday_start) === null || _b === void 0 ? void 0 : _b[index],
406
+ title: title,
407
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.monday_video) === null || _c === void 0 ? void 0 : _c[index],
408
+ };
409
+ }),
410
+ },
411
+ {
412
+ tuesday: _source.tuesday_title &&
413
+ _source.tuesday_title.length > 0 &&
414
+ _source.tuesday_title.map(function (title, index) {
415
+ var _a, _b, _c;
416
+ return {
417
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.tuesday_end) === null || _a === void 0 ? void 0 : _a[index],
418
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.tuesday_start) === null || _b === void 0 ? void 0 : _b[index],
419
+ title: title,
420
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.tuesday_video) === null || _c === void 0 ? void 0 : _c[index],
421
+ };
422
+ }),
423
+ },
424
+ {
425
+ wednesday: _source.wednesday_title &&
426
+ _source.wednesday_title.length > 0 &&
427
+ _source.wednesday_title.map(function (title, index) {
428
+ var _a, _b, _c;
429
+ return {
430
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.wednesday_end) === null || _a === void 0 ? void 0 : _a[index],
431
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.wednesday_start) === null || _b === void 0 ? void 0 : _b[index],
432
+ title: title,
433
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.wednesday_video) === null || _c === void 0 ? void 0 : _c[index],
434
+ };
435
+ }),
436
+ },
437
+ {
438
+ thursday: _source.thursday_title &&
439
+ _source.thursday_title.length > 0 &&
440
+ _source.thursday_title.map(function (title, index) {
441
+ var _a, _b, _c;
442
+ return {
443
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.thursday_end) === null || _a === void 0 ? void 0 : _a[index],
444
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.thursday_start) === null || _b === void 0 ? void 0 : _b[index],
445
+ title: title,
446
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.thursday_video) === null || _c === void 0 ? void 0 : _c[index],
447
+ };
448
+ }),
449
+ },
450
+ {
451
+ friday: _source.friday_title &&
452
+ _source.friday_title.length > 0 &&
453
+ _source.friday_title.map(function (title, index) {
454
+ var _a, _b, _c;
455
+ return {
456
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.friday_end) === null || _a === void 0 ? void 0 : _a[index],
457
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.friday_start) === null || _b === void 0 ? void 0 : _b[index],
458
+ title: title,
459
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.friday_video) === null || _c === void 0 ? void 0 : _c[index],
460
+ };
461
+ }),
462
+ },
463
+ {
464
+ saturday: _source.saturday_title &&
465
+ _source.saturday_title.length > 0 &&
466
+ _source.saturday_title.map(function (title, index) {
467
+ var _a, _b, _c;
468
+ return {
469
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.saturday_end) === null || _a === void 0 ? void 0 : _a[index],
470
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.saturday_start) === null || _b === void 0 ? void 0 : _b[index],
471
+ title: title,
472
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.saturday_video) === null || _c === void 0 ? void 0 : _c[index],
473
+ };
474
+ }),
475
+ },
476
+ {
477
+ sunday: _source.sunday_title &&
478
+ _source.sunday_title.length > 0 &&
479
+ _source.sunday_title.map(function (title, index) {
480
+ var _a, _b, _c;
481
+ return {
482
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.sunday_end) === null || _a === void 0 ? void 0 : _a[index],
483
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.sunday_start) === null || _b === void 0 ? void 0 : _b[index],
484
+ title: title,
485
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.sunday_video) === null || _c === void 0 ? void 0 : _c[index],
486
+ };
487
+ }),
488
+ },
489
+ ],
490
+ };
491
+ });
492
+ }
493
+ function formatChallenges(data) {
494
+ return data.map(function (item) {
495
+ var _source = item._source;
496
+ return {
497
+ uuid: _source.uuid && _source.uuid[0],
498
+ title: _source.title && _source.title[0],
499
+ body: _source.body && _source.body[0],
500
+ image: _source.image && _source.image[0],
501
+ challengeKey: _source.challenge_key && _source.challenge_key[0],
502
+ created: _source.created && _source.created[0],
503
+ days: _source.days,
504
+ updated: _source.updated && _source.updated[0],
505
+ purchaseButtonLabel: _source.purchase_button_label && _source.purchase_button_label[0],
506
+ price: _source.price && _source.price[0],
507
+ };
508
+ });
509
+ }
510
+ function formatChallengeDays(data) {
511
+ return data.map(function (item) {
512
+ var _source = item._source;
513
+ return {
514
+ uuid: _source.uuid && _source.uuid[0],
515
+ title: _source.title && _source.title[0],
516
+ body: _source.body && _source.body[0],
517
+ image: _source.image && _source.image[0],
518
+ created: _source.created && _source.created[0],
519
+ updated: _source.updated && _source.updated[0],
520
+ video: _source.video && _source.video[0],
521
+ workout: _source.workout && _source.workout[0],
522
+ };
523
+ });
524
+ }
216
525
 
217
526
  // console.log('process.env', process.env);
218
527
  // console.log('process.env?.WEB_APP', process.env?.WEB_APP);
@@ -527,10 +836,10 @@ var authApi = createApi({
527
836
  }); },
528
837
  });
529
838
  // Export hooks for usage in functional components.
530
- var useLoginQuery = authApi.useLoginQuery, useLazyLoginQuery = authApi.useLazyLoginQuery, useResetPasswordMutation = authApi.useResetPasswordMutation, useResetPasswordAuthMutation = authApi.useResetPasswordAuthMutation, useRefreshTokenQuery = authApi.useRefreshTokenQuery, useLazyRefreshTokenQuery = authApi.useLazyRefreshTokenQuery, useLogoutQuery = authApi.useLogoutQuery, useLazyLogoutQuery = authApi.useLazyLogoutQuery, useRegisterMutation = authApi.useRegisterMutation, useVerifyUserQuery = authApi.useVerifyUserQuery, useLazyVerifyUserQuery = authApi.useLazyVerifyUserQuery, useGetUserInfoQuery = authApi.useGetUserInfoQuery, useLazyGetUserInfoQuery = authApi.useLazyGetUserInfoQuery, useUpdateUserInfoMutation = authApi.useUpdateUserInfoMutation, useForgottenPasswordMutation = authApi.useForgottenPasswordMutation, useVerifyUserAttributesQuery = authApi.useVerifyUserAttributesQuery, useLazyVerifyUserAttributesQuery = authApi.useLazyVerifyUserAttributesQuery, useVerifyUserResendQuery = authApi.useVerifyUserResendQuery, useLazyVerifyUserResendQuery = authApi.useLazyVerifyUserResendQuery, useUpdateUserMutation = authApi.useUpdateUserMutation;
839
+ authApi.useLoginQuery; authApi.useLazyLoginQuery; authApi.useResetPasswordMutation; authApi.useResetPasswordAuthMutation; authApi.useRefreshTokenQuery; authApi.useLazyRefreshTokenQuery; authApi.useLogoutQuery; authApi.useLazyLogoutQuery; authApi.useRegisterMutation; authApi.useVerifyUserQuery; authApi.useLazyVerifyUserQuery; authApi.useGetUserInfoQuery; authApi.useLazyGetUserInfoQuery; authApi.useUpdateUserInfoMutation; authApi.useForgottenPasswordMutation; authApi.useVerifyUserAttributesQuery; authApi.useLazyVerifyUserAttributesQuery; authApi.useVerifyUserResendQuery; authApi.useLazyVerifyUserResendQuery; authApi.useUpdateUserMutation;
531
840
 
532
- console.log('APP_ES_INSTANCE', APP_ES_INSTANCE);
533
- console.log('APP_ES_AUTH', APP_ES_AUTH);
841
+ // console.log('APP_ES_INSTANCE', APP_ES_INSTANCE);
842
+ // console.log('APP_ES_AUTH', APP_ES_AUTH);
534
843
  var contentApi = createApi({
535
844
  reducerPath: 'contentApi',
536
845
  baseQuery: fetchBaseQuery({
@@ -540,58 +849,62 @@ var contentApi = createApi({
540
849
  return headers;
541
850
  },
542
851
  }),
543
- tagTypes: ['Data', 'Promos', 'Workouts'],
852
+ tagTypes: ['Data'],
544
853
  // keepUnusedDataFor: 300,
545
854
  endpoints: function (builder) { return ({
546
855
  getData: builder.query({
547
- query: function (index) { return ({
548
- url: "".concat(index, "/_search"),
549
- method: 'POST',
550
- body: {
551
- from: 0,
552
- size: 100,
553
- sort: [{ created: { order: 'desc' } }],
554
- query: {
555
- match_all: {},
556
- },
557
- },
558
- }); },
559
- // transformResponse: (response: ESPromoResponse) =>
560
- // formatPromos(response?.hits?.hits),
561
- providesTags: ['Promos'],
562
- }),
563
- getPromos: builder.query({
564
- query: function (index) { return ({
565
- url: "".concat(index, "/_search"),
566
- method: 'POST',
567
- body: {
568
- from: 0,
569
- size: 100,
570
- sort: [{ created: { order: 'desc' } }],
571
- query: {
572
- match_all: {},
573
- },
574
- },
575
- }); },
576
- transformResponse: function (response) { var _a; return formatPromos((_a = response === null || response === void 0 ? void 0 : response.hits) === null || _a === void 0 ? void 0 : _a.hits); },
577
- providesTags: ['Promos'],
578
- }),
579
- getWorkouts: builder.query({
580
- query: function (index) { return ({
581
- url: "".concat(index, "/_search"),
582
- method: 'POST',
583
- body: {
584
- from: 0,
585
- size: 100,
586
- sort: [{ created: { order: 'desc' } }],
587
- query: {
588
- match_all: {},
856
+ query: function (_a) {
857
+ var index = _a.index, _b = _a.options, options = _b === void 0 ? {} : _b;
858
+ return ({
859
+ url: "".concat(index, "/_search"),
860
+ method: 'POST',
861
+ body: {
862
+ from: 0,
863
+ size: options.size || 1000,
864
+ sort: options.sort || [{ created: { order: 'desc' } }],
865
+ query: options.query || {
866
+ match_all: {},
867
+ },
589
868
  },
590
- },
591
- }); },
592
- transformResponse: function (response) { var _a; return formatESWorkoutItems((_a = response === null || response === void 0 ? void 0 : response.hits) === null || _a === void 0 ? void 0 : _a.hits); },
593
- providesTags: ['Workouts'],
869
+ });
870
+ },
871
+ transformResponse: function (response) { var _a; return (_a = response === null || response === void 0 ? void 0 : response.hits) === null || _a === void 0 ? void 0 : _a.hits; },
872
+ providesTags: ['Data'],
594
873
  }),
874
+ // getPromos: builder.query<Promo[], string | undefined>({
875
+ // query: (index) => ({
876
+ // url: `${index}/_search`,
877
+ // method: 'POST',
878
+ // body: {
879
+ // from: 0,
880
+ // size: 100,
881
+ // sort: [{ created: { order: 'desc' } }],
882
+ // query: {
883
+ // match_all: {},
884
+ // },
885
+ // },
886
+ // }),
887
+ // transformResponse: (response: ESPromoResponse) =>
888
+ // formatPromos(response?.hits?.hits),
889
+ // providesTags: ['Promos'],
890
+ // }),
891
+ // getWorkouts: builder.query<Workout[], string | undefined>({
892
+ // query: (index) => ({
893
+ // url: `${index}/_search`,
894
+ // method: 'POST',
895
+ // body: {
896
+ // from: 0,
897
+ // size: 100,
898
+ // sort: [{ created: { order: 'desc' } }],
899
+ // query: {
900
+ // match_all: {},
901
+ // },
902
+ // },
903
+ // }),
904
+ // transformResponse: (response: ESWorkoutResponse) =>
905
+ // formatESWorkoutItems(response?.hits?.hits),
906
+ // providesTags: ['Workouts'],
907
+ // }),
595
908
  getWorkoutById: builder.query({
596
909
  query: function (_a) {
597
910
  var index = _a.index, id = _a.id;
@@ -610,7 +923,12 @@ var contentApi = createApi({
610
923
  }),
611
924
  }); },
612
925
  });
613
- var useGetDataQuery = contentApi.useGetDataQuery, useLazyGetDataQuery = contentApi.useLazyGetDataQuery, useGetPromosQuery = contentApi.useGetPromosQuery, useLazyGetPromosQuery = contentApi.useLazyGetPromosQuery, useGetWorkoutsQuery = contentApi.useGetWorkoutsQuery, useLazyGetWorkoutsQuery = contentApi.useLazyGetWorkoutsQuery, useGetWorkoutByIdQuery = contentApi.useGetWorkoutByIdQuery, useLazyGetWorkoutByIdQuery = contentApi.useLazyGetWorkoutByIdQuery;
926
+ contentApi.useGetDataQuery; contentApi.useLazyGetDataQuery;
927
+ // useGetPromosQuery,
928
+ // useLazyGetPromosQuery,
929
+ // useGetWorkoutsQuery,
930
+ // useLazyGetWorkoutsQuery,
931
+ contentApi.useGetWorkoutByIdQuery; contentApi.useLazyGetWorkoutByIdQuery;
614
932
 
615
933
  var useLoggedIn = function () {
616
934
  var isLoggedIn = useSelector(isAuthenticated);
@@ -724,5 +1042,5 @@ var makeWebStore = function () {
724
1042
  var nativeStore = !isWeb && makeNativeStore();
725
1043
  var webStore = isWeb && makeWebStore();
726
1044
 
727
- export { authApi, contentApi, formatESWorkoutItems, formatPromos, formatUserPayload, nativeStore, useAppDispatch, useAppSelector, useAppStore, useForgottenPasswordMutation, useGetDataQuery, useGetPromosQuery, useGetUserInfoQuery, useGetWorkoutByIdQuery, useGetWorkoutsQuery, useLazyGetDataQuery, useLazyGetPromosQuery, useLazyGetUserInfoQuery, useLazyGetWorkoutByIdQuery, useLazyGetWorkoutsQuery, useLazyLoginQuery, useLazyLogoutQuery, useLazyRefreshTokenQuery, useLazyVerifyUserAttributesQuery, useLazyVerifyUserQuery, useLazyVerifyUserResendQuery, useLoggedIn, useLoginQuery, useLogoutQuery, useRefreshTokenQuery, useRegisterMutation, useResetPasswordAuthMutation, useResetPasswordMutation, useUpdateUserInfoMutation, useUpdateUserMutation, useVerifyUserAttributesQuery, useVerifyUserQuery, useVerifyUserResendQuery, webStore };
1045
+ export { authApi, contentApi, formatChallengeDays, formatChallenges, formatFaqs, formatGuests, formatLongform, formatPages, formatPress, formatPromos, formatSchedule, formatSections, formatSeries, formatSettings, formatShortform, formatUserPayload, formatVideos, formatWorkout, nativeStore, useAppDispatch, useAppSelector, useAppStore, useLoggedIn, webStore };
728
1046
  //# sourceMappingURL=index.esm.js.map