@techstuff-dev/foundation-api-utils 1.5.4 → 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,11 +191,377 @@ function formatPromos(data) {
189
191
  };
190
192
  });
191
193
  }
194
+ function formatWorkout(data) {
195
+ var response = data.map(function (item) {
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;
197
+ return {
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],
216
+ };
217
+ });
218
+ return response;
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
+ }
525
+
526
+ // console.log('process.env', process.env);
527
+ // console.log('process.env?.WEB_APP', process.env?.WEB_APP);
528
+ // console.log(
529
+ // 'process.env?.NEXT_PUBLIC_WEB_APP',
530
+ // process.env?.NEXT_PUBLIC_WEB_APP,
531
+ // );
532
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
533
+ // Render the store based on the environment.
534
+ var isWeb = process.env.NEXT_PUBLIC_WEB_APP;
535
+ var ENV = isWeb ? process.env : require('react-native-config').default;
536
+ // export const ENV = process.env;
537
+ var API_PREFIX = ((_a = process.env) === null || _a === void 0 ? void 0 : _a.NEXT_PUBLIC_API_PREFIX) || ENV.API_PREFIX;
538
+ // Auth specific API
539
+ var API_AUTH_PREFIX = ((_b = process.env) === null || _b === void 0 ? void 0 : _b.NEXT_PUBLIC_API_AUTH_PREFIX) || ENV.API_AUTH_PREFIX;
540
+ // Payments specific API
541
+ ((_c = process.env) === null || _c === void 0 ? void 0 : _c.NEXT_PUBLIC_API_PAYMENTS_PREFIX) || ENV.API_PAYMENTS_PREFIX;
542
+ ((_d = process.env) === null || _d === void 0 ? void 0 : _d.NEXT_PUBLIC_APP_BASE_URL) || ENV.APP_BASE_URL;
543
+ var APP_ES_INSTANCE = ((_e = process.env) === null || _e === void 0 ? void 0 : _e.NEXT_PUBLIC_APP_ES_INSTANCE) || ENV.APP_ES_INSTANCE;
544
+ var APP_ES_AUTH = ((_f = process.env) === null || _f === void 0 ? void 0 : _f.NEXT_PUBLIC_APP_ES_AUTH) || ENV.APP_ES_AUTH;
545
+ ((_g = process.env) === null || _g === void 0 ? void 0 : _g.NEXT_PUBLIC_APP_ES_PROMO_PANEL_INDEX) ||
546
+ ENV.APP_ES_PROMO_PANEL_INDEX;
547
+ ((_h = process.env) === null || _h === void 0 ? void 0 : _h.NEXT_PUBLIC_APP_ES_FAQ_INDEX) || ENV.APP_ES_FAQ_INDEX;
548
+ ((_j = process.env) === null || _j === void 0 ? void 0 : _j.NEXT_PUBLIC_APP_ES_PAGES_INDEX) || ENV.APP_ES_PAGES_INDEX;
549
+ ((_k = process.env) === null || _k === void 0 ? void 0 : _k.NEXT_PUBLIC_APP_ES_SETTINGS_INDEX) || ENV.APP_ES_SETTINGS_INDEX;
550
+ ((_l = process.env) === null || _l === void 0 ? void 0 : _l.NEXT_PUBLIC_APP_ES_PRESS_INDEX) || ENV.APP_ES_PRESS_INDEX;
551
+ ((_m = process.env) === null || _m === void 0 ? void 0 : _m.NEXT_PUBLIC_APP_ES_GUESTS_INDEX) || ENV.APP_ES_GUESTS_INDEX;
552
+ ((_o = process.env) === null || _o === void 0 ? void 0 : _o.NEXT_PUBLIC_APP_ES_VIDEOS_INDEX) || ENV.APP_ES_VIDEOS_INDEX;
553
+ ((_p = process.env) === null || _p === void 0 ? void 0 : _p.NEXT_PUBLIC_APP_ES_SECTIONS_INDEX) || ENV.APP_ES_SECTIONS_INDEX;
554
+ ((_q = process.env) === null || _q === void 0 ? void 0 : _q.NEXT_PUBLIC_APP_ES_WORKOUTS_INDEX) || ENV.APP_ES_WORKOUTS_INDEX;
555
+ ((_r = process.env) === null || _r === void 0 ? void 0 : _r.NEXT_PUBLIC_APP_ES_SCHEDULE_INDEX) || ENV.APP_ES_SCHEDULE_INDEX;
556
+ ((_s = process.env) === null || _s === void 0 ? void 0 : _s.NEXT_PUBLIC_APP_ES_CHALLENGES_INDEX) ||
557
+ ENV.APP_ES_CHALLENGES_INDEX;
558
+ ((_t = process.env) === null || _t === void 0 ? void 0 : _t.NEXT_PUBLIC_APP_ES_CHALLENGE_DAYS_INDEX) ||
559
+ ENV.APP_ES_CHALLENGE_DAYS_INDEX;
192
560
 
193
561
  var authApi = createApi({
194
562
  reducerPath: 'authApi',
195
563
  baseQuery: fetchBaseQuery({
196
- baseUrl: process.env.API_PREFIX,
564
+ baseUrl: API_PREFIX || API_AUTH_PREFIX,
197
565
  prepareHeaders: function (headers) {
198
566
  return headers;
199
567
  },
@@ -207,7 +575,7 @@ var authApi = createApi({
207
575
  */
208
576
  login: builder.query({
209
577
  query: function (data) { return ({
210
- url: '/api/login',
578
+ url: '/user/login',
211
579
  method: 'POST',
212
580
  body: {
213
581
  email: data.email,
@@ -251,7 +619,7 @@ var authApi = createApi({
251
619
  }),
252
620
  refreshToken: builder.query({
253
621
  query: function (data) { return ({
254
- url: '/api/user/refreshtoken',
622
+ url: '/user/refreshtoken',
255
623
  method: 'POST',
256
624
  body: {
257
625
  sub: data.sub,
@@ -295,7 +663,7 @@ var authApi = createApi({
295
663
  }),
296
664
  resetPassword: builder.mutation({
297
665
  query: function (data) { return ({
298
- url: '/api/user/password/reset',
666
+ url: '/user/password/reset',
299
667
  method: 'POST',
300
668
  body: {
301
669
  sub: data.sub,
@@ -307,7 +675,7 @@ var authApi = createApi({
307
675
  }),
308
676
  resetPasswordAuth: builder.mutation({
309
677
  query: function (data) { return ({
310
- url: '/api/user/password/reset-auth',
678
+ url: '/user/password/reset',
311
679
  method: 'POST',
312
680
  body: {
313
681
  email: data.email,
@@ -318,7 +686,7 @@ var authApi = createApi({
318
686
  }),
319
687
  forgottenPassword: builder.mutation({
320
688
  query: function (data) { return ({
321
- url: '/api/user/password/forgot',
689
+ url: '/user/password/forgot',
322
690
  method: 'POST',
323
691
  body: {
324
692
  email: data.email,
@@ -327,7 +695,7 @@ var authApi = createApi({
327
695
  }),
328
696
  logout: builder.query({
329
697
  query: function (data) { return ({
330
- url: '/api/logout',
698
+ url: '/user/logout',
331
699
  method: 'POST',
332
700
  }); },
333
701
  onQueryStarted: function (arg_1, _a) {
@@ -355,7 +723,7 @@ var authApi = createApi({
355
723
  }),
356
724
  register: builder.mutation({
357
725
  query: function (data) { return ({
358
- url: '/api/user/register',
726
+ url: '/user/register',
359
727
  method: 'POST',
360
728
  body: data,
361
729
  }); },
@@ -384,7 +752,7 @@ var authApi = createApi({
384
752
  }),
385
753
  verifyUser: builder.query({
386
754
  query: function (data) { return ({
387
- url: '/api/user/verify',
755
+ url: '/user/verify',
388
756
  method: 'POST',
389
757
  body: data,
390
758
  }); },
@@ -433,34 +801,34 @@ var authApi = createApi({
433
801
  }),
434
802
  verifyUserAttributes: builder.query({
435
803
  query: function (data) { return ({
436
- url: '/api/user/verify/email',
804
+ url: '/user/verify/email',
437
805
  method: 'POST',
438
806
  body: data,
439
807
  }); },
440
808
  }),
441
809
  verifyUserResend: builder.query({
442
810
  query: function (data) { return ({
443
- url: '/api/user/verify/resend',
811
+ url: '/user/verify/resend',
444
812
  method: 'POST',
445
813
  body: data,
446
814
  }); },
447
815
  }),
448
816
  getUserInfo: builder.query({
449
817
  query: function (uuid) { return ({
450
- url: "/api/data/user/".concat(uuid),
818
+ url: "/user/".concat(uuid),
451
819
  method: 'GET',
452
820
  }); },
453
821
  }),
454
822
  updateUserInfo: builder.mutation({
455
823
  query: function (expressions) { return ({
456
- url: '/api/data/user',
824
+ url: '/data/user',
457
825
  method: 'PATCH',
458
826
  body: expressions,
459
827
  }); },
460
828
  }),
461
829
  updateUser: builder.mutation({
462
830
  query: function (data) { return ({
463
- url: '/api/user',
831
+ url: '/user',
464
832
  method: 'PATCH',
465
833
  body: data,
466
834
  }); },
@@ -468,41 +836,10 @@ var authApi = createApi({
468
836
  }); },
469
837
  });
470
838
  // Export hooks for usage in functional components.
471
- 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;
472
840
 
473
- // console.log('process.env', process.env);
474
- // console.log('process.env?.WEB_APP', process.env?.WEB_APP);
475
- // console.log(
476
- // 'process.env?.NEXT_PUBLIC_WEB_APP',
477
- // process.env?.NEXT_PUBLIC_WEB_APP,
478
- // );
479
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
480
- // Render the store based on the environment.
481
- var isWeb = process.env.NEXT_PUBLIC_WEB_APP;
482
- var ENV = isWeb ? process.env : require('react-native-config').default;
483
- // export const ENV = process.env;
484
- ((_a = process.env) === null || _a === void 0 ? void 0 : _a.NEXT_PUBLIC_API_PREFIX) || ENV.API_PREFIX;
485
- ((_b = process.env) === null || _b === void 0 ? void 0 : _b.NEXT_PUBLIC_APP_BASE_URL) || ENV.APP_BASE_URL;
486
- var APP_ES_INSTANCE = ((_c = process.env) === null || _c === void 0 ? void 0 : _c.NEXT_PUBLIC_APP_ES_INSTANCE) || ENV.APP_ES_INSTANCE;
487
- var APP_ES_AUTH = ((_d = process.env) === null || _d === void 0 ? void 0 : _d.NEXT_PUBLIC_APP_ES_AUTH) || ENV.APP_ES_AUTH;
488
- ((_e = process.env) === null || _e === void 0 ? void 0 : _e.NEXT_PUBLIC_APP_ES_PROMO_PANEL_INDEX) ||
489
- ENV.APP_ES_PROMO_PANEL_INDEX;
490
- ((_f = process.env) === null || _f === void 0 ? void 0 : _f.NEXT_PUBLIC_APP_ES_FAQ_INDEX) || ENV.APP_ES_FAQ_INDEX;
491
- ((_g = process.env) === null || _g === void 0 ? void 0 : _g.NEXT_PUBLIC_APP_ES_PAGES_INDEX) || ENV.APP_ES_PAGES_INDEX;
492
- ((_h = process.env) === null || _h === void 0 ? void 0 : _h.NEXT_PUBLIC_APP_ES_SETTINGS_INDEX) || ENV.APP_ES_SETTINGS_INDEX;
493
- ((_j = process.env) === null || _j === void 0 ? void 0 : _j.NEXT_PUBLIC_APP_ES_PRESS_INDEX) || ENV.APP_ES_PRESS_INDEX;
494
- ((_k = process.env) === null || _k === void 0 ? void 0 : _k.NEXT_PUBLIC_APP_ES_GUESTS_INDEX) || ENV.APP_ES_GUESTS_INDEX;
495
- ((_l = process.env) === null || _l === void 0 ? void 0 : _l.NEXT_PUBLIC_APP_ES_VIDEOS_INDEX) || ENV.APP_ES_VIDEOS_INDEX;
496
- ((_m = process.env) === null || _m === void 0 ? void 0 : _m.NEXT_PUBLIC_APP_ES_SECTIONS_INDEX) || ENV.APP_ES_SECTIONS_INDEX;
497
- ((_o = process.env) === null || _o === void 0 ? void 0 : _o.NEXT_PUBLIC_APP_ES_WORKOUTS_INDEX) || ENV.APP_ES_WORKOUTS_INDEX;
498
- ((_p = process.env) === null || _p === void 0 ? void 0 : _p.NEXT_PUBLIC_APP_ES_SCHEDULE_INDEX) || ENV.APP_ES_SCHEDULE_INDEX;
499
- ((_q = process.env) === null || _q === void 0 ? void 0 : _q.NEXT_PUBLIC_APP_ES_CHALLENGES_INDEX) ||
500
- ENV.APP_ES_CHALLENGES_INDEX;
501
- ((_r = process.env) === null || _r === void 0 ? void 0 : _r.NEXT_PUBLIC_APP_ES_CHALLENGE_DAYS_INDEX) ||
502
- ENV.APP_ES_CHALLENGE_DAYS_INDEX;
503
-
504
- console.log('APP_ES_INSTANCE', APP_ES_INSTANCE);
505
- 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);
506
843
  var contentApi = createApi({
507
844
  reducerPath: 'contentApi',
508
845
  baseQuery: fetchBaseQuery({
@@ -512,28 +849,86 @@ var contentApi = createApi({
512
849
  return headers;
513
850
  },
514
851
  }),
515
- tagTypes: ['Promos'],
852
+ tagTypes: ['Data'],
516
853
  // keepUnusedDataFor: 300,
517
854
  endpoints: function (builder) { return ({
518
- getPromos: builder.query({
519
- query: function (index) { return ({
520
- url: "".concat(index, "/_search"),
521
- method: 'POST',
522
- body: {
523
- from: 0,
524
- size: 100,
525
- sort: [{ created: { order: 'desc' } }],
526
- query: {
527
- match_all: {},
855
+ getData: builder.query({
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
+ },
528
868
  },
529
- },
530
- }); },
531
- 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); },
532
- providesTags: ['Promos'],
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'],
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
+ // }),
908
+ getWorkoutById: builder.query({
909
+ query: function (_a) {
910
+ var index = _a.index, id = _a.id;
911
+ return ({
912
+ url: "".concat(index, "/_search"),
913
+ method: 'POST',
914
+ body: {
915
+ query: {
916
+ term: {
917
+ uuid: id,
918
+ },
919
+ },
920
+ },
921
+ });
922
+ },
533
923
  }),
534
924
  }); },
535
925
  });
536
- var useGetPromosQuery = contentApi.useGetPromosQuery; contentApi.useLazyGetPromosQuery;
926
+ contentApi.useGetDataQuery; contentApi.useLazyGetDataQuery;
927
+ // useGetPromosQuery,
928
+ // useLazyGetPromosQuery,
929
+ // useGetWorkoutsQuery,
930
+ // useLazyGetWorkoutsQuery,
931
+ contentApi.useGetWorkoutByIdQuery; contentApi.useLazyGetWorkoutByIdQuery;
537
932
 
538
933
  var useLoggedIn = function () {
539
934
  var isLoggedIn = useSelector(isAuthenticated);
@@ -647,5 +1042,5 @@ var makeWebStore = function () {
647
1042
  var nativeStore = !isWeb && makeNativeStore();
648
1043
  var webStore = isWeb && makeWebStore();
649
1044
 
650
- export { authApi, contentApi, nativeStore, useAppDispatch, useAppSelector, useAppStore, useForgottenPasswordMutation, useGetPromosQuery, useGetUserInfoQuery, useLazyGetUserInfoQuery, 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 };
651
1046
  //# sourceMappingURL=index.esm.js.map