@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.js CHANGED
@@ -149,7 +149,9 @@ authSlice.reducer;
149
149
  var formatUserPayload = function (payload) {
150
150
  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"];
151
151
  var parsedTermsAccepted = termsAccepted ? JSON.parse(termsAccepted) : null;
152
- var parsedContactPreference = contactPreference ? JSON.parse(contactPreference) : null;
152
+ var parsedContactPreference = contactPreference
153
+ ? JSON.parse(contactPreference)
154
+ : null;
153
155
  var data = {
154
156
  userEmail: userEmail,
155
157
  lastName: lastName,
@@ -191,11 +193,377 @@ function formatPromos(data) {
191
193
  };
192
194
  });
193
195
  }
196
+ function formatWorkout(data) {
197
+ var response = data.map(function (item) {
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;
199
+ return {
200
+ 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],
201
+ 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],
202
+ 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],
203
+ 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],
204
+ 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],
205
+ 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],
206
+ 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],
207
+ 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],
208
+ 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],
209
+ 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],
210
+ 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],
211
+ 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],
212
+ 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],
213
+ 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],
214
+ 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],
215
+ 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],
216
+ 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],
217
+ 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],
218
+ };
219
+ });
220
+ return response;
221
+ }
222
+ function formatSeries(data, channel) {
223
+ var formattedSeriesSelection = data.map(function (series) {
224
+ return {
225
+ uuid: series.uuid,
226
+ id: series.uuid,
227
+ title: series.title,
228
+ subtitle: series.subtitle,
229
+ thumb: series.imageThumbnailURL,
230
+ mainImage: series.imageURL,
231
+ description: series.summary.value,
232
+ body: series.body.value,
233
+ nid: series.nid,
234
+ seasonList: series.season,
235
+ channel: channel,
236
+ };
237
+ });
238
+ return formattedSeriesSelection;
239
+ }
240
+ function formatShortform(data) {
241
+ return data.map(function (item) {
242
+ var _source = item._source;
243
+ return {
244
+ uuid: _source.uuid && _source.uuid[0],
245
+ id: _source.uuid && _source.uuid[0],
246
+ nid: _source.nid && _source.nid[0],
247
+ title: _source.title && _source.title[0],
248
+ thumb: _source.field_image_thumb && _source.field_image_thumb[0],
249
+ mainImage: _source.field_image_poster && _source.field_image_poster[0],
250
+ description: _source.field_short_synopsis && _source.field_short_synopsis[0],
251
+ body: _source.field_body && _source.field_body[0],
252
+ channel: _source.field_channel && _source.field_channel[0],
253
+ updated: _source.revision_timestamp && _source.revision_timestamp[0],
254
+ langcode: _source.langcode && _source.langcode[0],
255
+ video: _source.field_videomanifest && _source.field_videomanifest[0],
256
+ duration: _source.field_duration && _source.field_duration[0],
257
+ category: _source.field_category && _source.field_category[0],
258
+ };
259
+ });
260
+ }
261
+ function formatLongform(data) {
262
+ return data.map(function (item) {
263
+ var _source = item._source;
264
+ return {
265
+ uuid: _source.uuid && _source.uuid[0],
266
+ id: _source.uuid && _source.uuid[0],
267
+ nid: _source.nid && _source.nid[0],
268
+ title: _source.title && _source.title[0],
269
+ image: _source.image && _source.image[0],
270
+ image_promo: _source.image_promo && _source.image_promo[0],
271
+ image_promo_large: _source.image_promo_large && _source.image_promo_large[0],
272
+ image_poster: _source.image_poster && _source.image_poster[0],
273
+ summary: _source.summary && _source.summary[0],
274
+ created: _source.created && _source.created[0],
275
+ updated: _source.revision_timestamp && _source.revision_timestamp[0],
276
+ video: _source.video_manifest && _source.video_manifest[0],
277
+ rating: _source.rating && _source.rating[0],
278
+ released: _source.released_date && _source.released_date[0],
279
+ source_id: _source.source_id && _source.source_id[0],
280
+ director: _source.director && _source.director[0],
281
+ duration: _source.duration && _source.duration[0],
282
+ path: _source.path && _source.path[0],
283
+ genres: _source.genres,
284
+ actors: _source.actors,
285
+ writers: _source.writers,
286
+ };
287
+ });
288
+ }
289
+ function formatFaqs(data) {
290
+ return data.map(function (item) {
291
+ var _source = item._source;
292
+ return {
293
+ uuid: _source.uuid && _source.uuid[0],
294
+ id: _source.uuid && _source.uuid[0],
295
+ title: _source.title && _source.title[0],
296
+ answer: _source.answer && _source.answer[0],
297
+ created: _source.created && _source.created[0],
298
+ updated: _source.updated && _source.updated[0],
299
+ };
300
+ });
301
+ }
302
+ function formatPages(data) {
303
+ return data.map(function (item) {
304
+ var _source = item._source;
305
+ return {
306
+ uuid: _source.uuid && _source.uuid[0],
307
+ id: _source.uuid && _source.uuid[0],
308
+ title: _source.title && _source.title[0],
309
+ body: _source.body && _source.body[0],
310
+ created: _source.created && _source.created[0],
311
+ updated: _source.updated && _source.updated[0],
312
+ langcode: _source.langcode && _source.langcode[0],
313
+ url: _source.url && _source.url[0],
314
+ };
315
+ });
316
+ }
317
+ function formatSettings(data) {
318
+ return data.map(function (item) {
319
+ var _source = item._source;
320
+ var fieldset = _source.fieldset && _source.fieldset[0].toLowerCase();
321
+ return {
322
+ uuid: _source.uuid && _source.uuid[0],
323
+ created: _source.created && _source.created[0],
324
+ updated: _source.updated && _source.updated[0],
325
+ status: _source.status && _source.status[0],
326
+ type: _source.type && _source.type[0],
327
+ video: _source.video && _source.video[0],
328
+ number: _source.number && _source.number[0],
329
+ pass: _source.pass && _source.pass[0],
330
+ fieldset: fieldset,
331
+ };
332
+ });
333
+ }
334
+ function formatPress(data) {
335
+ return data.map(function (item) {
336
+ var _source = item._source;
337
+ return {
338
+ uuid: _source.uuid && _source.uuid[0],
339
+ created: _source.created && _source.created[0],
340
+ updated: _source.updated && _source.updated[0],
341
+ image: _source.image && _source.image[0],
342
+ title: _source.title && _source.title[0],
343
+ };
344
+ });
345
+ }
346
+ function formatGuests(data) {
347
+ return data.map(function (item) {
348
+ var _source = item._source;
349
+ return {
350
+ uuid: _source.uuid && _source.uuid[0],
351
+ id: _source.id && _source.id[0],
352
+ title: _source.title && _source.title[0],
353
+ updated: _source.updated && _source.updated[0],
354
+ description: _source.description && _source.description[0],
355
+ image: _source.image_16_9 && _source.image_16_9[0],
356
+ display: _source.display && _source.display[0],
357
+ };
358
+ });
359
+ }
360
+ function formatVideos(data) {
361
+ return data.map(function (item) {
362
+ var _source = item._source;
363
+ return {
364
+ uuid: _source.uuid && _source.uuid[0],
365
+ title: _source.title && _source.title[0],
366
+ updated: _source.updated && _source.updated[0],
367
+ description: _source.description && _source.description[0],
368
+ image: _source.image && _source.image[0],
369
+ duration: _source.duration && _source.duration[0],
370
+ section: _source.section && _source.section[0],
371
+ video_poster: _source.video_poster && _source.video_poster[0],
372
+ video_url: _source.video_url && _source.video_url[0],
373
+ section_id: _source.section_id && _source.section_id[0],
374
+ };
375
+ });
376
+ }
377
+ function formatSections(data) {
378
+ return data.map(function (item) {
379
+ var _source = item._source;
380
+ return {
381
+ uuid: _source.uuid && _source.uuid[0],
382
+ title: _source.title && _source.title[0],
383
+ description: _source.description && _source.description[0],
384
+ image: _source.image && _source.image[0],
385
+ challenge: _source.challenge && _source.challenge[0],
386
+ display: _source.display && _source.display[0],
387
+ id: _source.id && _source.id[0],
388
+ };
389
+ });
390
+ }
391
+ function formatSchedule(data) {
392
+ return data.map(function (item) {
393
+ var _source = item._source;
394
+ return {
395
+ uuid: _source.uuid && _source.uuid[0],
396
+ created: _source.created && _source.created[0],
397
+ langcode: _source.langcode && _source.langcode[0],
398
+ updated: _source.updated && _source.updated[0],
399
+ days: [
400
+ {
401
+ monday: _source.monday_title &&
402
+ _source.monday_title.length > 0 &&
403
+ _source.monday_title.map(function (title, index) {
404
+ var _a, _b, _c;
405
+ return {
406
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.monday_end) === null || _a === void 0 ? void 0 : _a[index],
407
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.monday_start) === null || _b === void 0 ? void 0 : _b[index],
408
+ title: title,
409
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.monday_video) === null || _c === void 0 ? void 0 : _c[index],
410
+ };
411
+ }),
412
+ },
413
+ {
414
+ tuesday: _source.tuesday_title &&
415
+ _source.tuesday_title.length > 0 &&
416
+ _source.tuesday_title.map(function (title, index) {
417
+ var _a, _b, _c;
418
+ return {
419
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.tuesday_end) === null || _a === void 0 ? void 0 : _a[index],
420
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.tuesday_start) === null || _b === void 0 ? void 0 : _b[index],
421
+ title: title,
422
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.tuesday_video) === null || _c === void 0 ? void 0 : _c[index],
423
+ };
424
+ }),
425
+ },
426
+ {
427
+ wednesday: _source.wednesday_title &&
428
+ _source.wednesday_title.length > 0 &&
429
+ _source.wednesday_title.map(function (title, index) {
430
+ var _a, _b, _c;
431
+ return {
432
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.wednesday_end) === null || _a === void 0 ? void 0 : _a[index],
433
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.wednesday_start) === null || _b === void 0 ? void 0 : _b[index],
434
+ title: title,
435
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.wednesday_video) === null || _c === void 0 ? void 0 : _c[index],
436
+ };
437
+ }),
438
+ },
439
+ {
440
+ thursday: _source.thursday_title &&
441
+ _source.thursday_title.length > 0 &&
442
+ _source.thursday_title.map(function (title, index) {
443
+ var _a, _b, _c;
444
+ return {
445
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.thursday_end) === null || _a === void 0 ? void 0 : _a[index],
446
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.thursday_start) === null || _b === void 0 ? void 0 : _b[index],
447
+ title: title,
448
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.thursday_video) === null || _c === void 0 ? void 0 : _c[index],
449
+ };
450
+ }),
451
+ },
452
+ {
453
+ friday: _source.friday_title &&
454
+ _source.friday_title.length > 0 &&
455
+ _source.friday_title.map(function (title, index) {
456
+ var _a, _b, _c;
457
+ return {
458
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.friday_end) === null || _a === void 0 ? void 0 : _a[index],
459
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.friday_start) === null || _b === void 0 ? void 0 : _b[index],
460
+ title: title,
461
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.friday_video) === null || _c === void 0 ? void 0 : _c[index],
462
+ };
463
+ }),
464
+ },
465
+ {
466
+ saturday: _source.saturday_title &&
467
+ _source.saturday_title.length > 0 &&
468
+ _source.saturday_title.map(function (title, index) {
469
+ var _a, _b, _c;
470
+ return {
471
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.saturday_end) === null || _a === void 0 ? void 0 : _a[index],
472
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.saturday_start) === null || _b === void 0 ? void 0 : _b[index],
473
+ title: title,
474
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.saturday_video) === null || _c === void 0 ? void 0 : _c[index],
475
+ };
476
+ }),
477
+ },
478
+ {
479
+ sunday: _source.sunday_title &&
480
+ _source.sunday_title.length > 0 &&
481
+ _source.sunday_title.map(function (title, index) {
482
+ var _a, _b, _c;
483
+ return {
484
+ end: (_a = _source === null || _source === void 0 ? void 0 : _source.sunday_end) === null || _a === void 0 ? void 0 : _a[index],
485
+ start: (_b = _source === null || _source === void 0 ? void 0 : _source.sunday_start) === null || _b === void 0 ? void 0 : _b[index],
486
+ title: title,
487
+ video: (_c = _source === null || _source === void 0 ? void 0 : _source.sunday_video) === null || _c === void 0 ? void 0 : _c[index],
488
+ };
489
+ }),
490
+ },
491
+ ],
492
+ };
493
+ });
494
+ }
495
+ function formatChallenges(data) {
496
+ return data.map(function (item) {
497
+ var _source = item._source;
498
+ return {
499
+ uuid: _source.uuid && _source.uuid[0],
500
+ title: _source.title && _source.title[0],
501
+ body: _source.body && _source.body[0],
502
+ image: _source.image && _source.image[0],
503
+ challengeKey: _source.challenge_key && _source.challenge_key[0],
504
+ created: _source.created && _source.created[0],
505
+ days: _source.days,
506
+ updated: _source.updated && _source.updated[0],
507
+ purchaseButtonLabel: _source.purchase_button_label && _source.purchase_button_label[0],
508
+ price: _source.price && _source.price[0],
509
+ };
510
+ });
511
+ }
512
+ function formatChallengeDays(data) {
513
+ return data.map(function (item) {
514
+ var _source = item._source;
515
+ return {
516
+ uuid: _source.uuid && _source.uuid[0],
517
+ title: _source.title && _source.title[0],
518
+ body: _source.body && _source.body[0],
519
+ image: _source.image && _source.image[0],
520
+ created: _source.created && _source.created[0],
521
+ updated: _source.updated && _source.updated[0],
522
+ video: _source.video && _source.video[0],
523
+ workout: _source.workout && _source.workout[0],
524
+ };
525
+ });
526
+ }
527
+
528
+ // console.log('process.env', process.env);
529
+ // console.log('process.env?.WEB_APP', process.env?.WEB_APP);
530
+ // console.log(
531
+ // 'process.env?.NEXT_PUBLIC_WEB_APP',
532
+ // process.env?.NEXT_PUBLIC_WEB_APP,
533
+ // );
534
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
535
+ // Render the store based on the environment.
536
+ var isWeb = process.env.NEXT_PUBLIC_WEB_APP;
537
+ var ENV = isWeb ? process.env : require('react-native-config').default;
538
+ // export const ENV = process.env;
539
+ var API_PREFIX = ((_a = process.env) === null || _a === void 0 ? void 0 : _a.NEXT_PUBLIC_API_PREFIX) || ENV.API_PREFIX;
540
+ // Auth specific API
541
+ var API_AUTH_PREFIX = ((_b = process.env) === null || _b === void 0 ? void 0 : _b.NEXT_PUBLIC_API_AUTH_PREFIX) || ENV.API_AUTH_PREFIX;
542
+ // Payments specific API
543
+ ((_c = process.env) === null || _c === void 0 ? void 0 : _c.NEXT_PUBLIC_API_PAYMENTS_PREFIX) || ENV.API_PAYMENTS_PREFIX;
544
+ ((_d = process.env) === null || _d === void 0 ? void 0 : _d.NEXT_PUBLIC_APP_BASE_URL) || ENV.APP_BASE_URL;
545
+ var APP_ES_INSTANCE = ((_e = process.env) === null || _e === void 0 ? void 0 : _e.NEXT_PUBLIC_APP_ES_INSTANCE) || ENV.APP_ES_INSTANCE;
546
+ var APP_ES_AUTH = ((_f = process.env) === null || _f === void 0 ? void 0 : _f.NEXT_PUBLIC_APP_ES_AUTH) || ENV.APP_ES_AUTH;
547
+ ((_g = process.env) === null || _g === void 0 ? void 0 : _g.NEXT_PUBLIC_APP_ES_PROMO_PANEL_INDEX) ||
548
+ ENV.APP_ES_PROMO_PANEL_INDEX;
549
+ ((_h = process.env) === null || _h === void 0 ? void 0 : _h.NEXT_PUBLIC_APP_ES_FAQ_INDEX) || ENV.APP_ES_FAQ_INDEX;
550
+ ((_j = process.env) === null || _j === void 0 ? void 0 : _j.NEXT_PUBLIC_APP_ES_PAGES_INDEX) || ENV.APP_ES_PAGES_INDEX;
551
+ ((_k = process.env) === null || _k === void 0 ? void 0 : _k.NEXT_PUBLIC_APP_ES_SETTINGS_INDEX) || ENV.APP_ES_SETTINGS_INDEX;
552
+ ((_l = process.env) === null || _l === void 0 ? void 0 : _l.NEXT_PUBLIC_APP_ES_PRESS_INDEX) || ENV.APP_ES_PRESS_INDEX;
553
+ ((_m = process.env) === null || _m === void 0 ? void 0 : _m.NEXT_PUBLIC_APP_ES_GUESTS_INDEX) || ENV.APP_ES_GUESTS_INDEX;
554
+ ((_o = process.env) === null || _o === void 0 ? void 0 : _o.NEXT_PUBLIC_APP_ES_VIDEOS_INDEX) || ENV.APP_ES_VIDEOS_INDEX;
555
+ ((_p = process.env) === null || _p === void 0 ? void 0 : _p.NEXT_PUBLIC_APP_ES_SECTIONS_INDEX) || ENV.APP_ES_SECTIONS_INDEX;
556
+ ((_q = process.env) === null || _q === void 0 ? void 0 : _q.NEXT_PUBLIC_APP_ES_WORKOUTS_INDEX) || ENV.APP_ES_WORKOUTS_INDEX;
557
+ ((_r = process.env) === null || _r === void 0 ? void 0 : _r.NEXT_PUBLIC_APP_ES_SCHEDULE_INDEX) || ENV.APP_ES_SCHEDULE_INDEX;
558
+ ((_s = process.env) === null || _s === void 0 ? void 0 : _s.NEXT_PUBLIC_APP_ES_CHALLENGES_INDEX) ||
559
+ ENV.APP_ES_CHALLENGES_INDEX;
560
+ ((_t = process.env) === null || _t === void 0 ? void 0 : _t.NEXT_PUBLIC_APP_ES_CHALLENGE_DAYS_INDEX) ||
561
+ ENV.APP_ES_CHALLENGE_DAYS_INDEX;
194
562
 
195
563
  var authApi = react.createApi({
196
564
  reducerPath: 'authApi',
197
565
  baseQuery: react.fetchBaseQuery({
198
- baseUrl: process.env.API_PREFIX,
566
+ baseUrl: API_PREFIX || API_AUTH_PREFIX,
199
567
  prepareHeaders: function (headers) {
200
568
  return headers;
201
569
  },
@@ -209,7 +577,7 @@ var authApi = react.createApi({
209
577
  */
210
578
  login: builder.query({
211
579
  query: function (data) { return ({
212
- url: '/api/login',
580
+ url: '/user/login',
213
581
  method: 'POST',
214
582
  body: {
215
583
  email: data.email,
@@ -253,7 +621,7 @@ var authApi = react.createApi({
253
621
  }),
254
622
  refreshToken: builder.query({
255
623
  query: function (data) { return ({
256
- url: '/api/user/refreshtoken',
624
+ url: '/user/refreshtoken',
257
625
  method: 'POST',
258
626
  body: {
259
627
  sub: data.sub,
@@ -297,7 +665,7 @@ var authApi = react.createApi({
297
665
  }),
298
666
  resetPassword: builder.mutation({
299
667
  query: function (data) { return ({
300
- url: '/api/user/password/reset',
668
+ url: '/user/password/reset',
301
669
  method: 'POST',
302
670
  body: {
303
671
  sub: data.sub,
@@ -309,7 +677,7 @@ var authApi = react.createApi({
309
677
  }),
310
678
  resetPasswordAuth: builder.mutation({
311
679
  query: function (data) { return ({
312
- url: '/api/user/password/reset-auth',
680
+ url: '/user/password/reset',
313
681
  method: 'POST',
314
682
  body: {
315
683
  email: data.email,
@@ -320,7 +688,7 @@ var authApi = react.createApi({
320
688
  }),
321
689
  forgottenPassword: builder.mutation({
322
690
  query: function (data) { return ({
323
- url: '/api/user/password/forgot',
691
+ url: '/user/password/forgot',
324
692
  method: 'POST',
325
693
  body: {
326
694
  email: data.email,
@@ -329,7 +697,7 @@ var authApi = react.createApi({
329
697
  }),
330
698
  logout: builder.query({
331
699
  query: function (data) { return ({
332
- url: '/api/logout',
700
+ url: '/user/logout',
333
701
  method: 'POST',
334
702
  }); },
335
703
  onQueryStarted: function (arg_1, _a) {
@@ -357,7 +725,7 @@ var authApi = react.createApi({
357
725
  }),
358
726
  register: builder.mutation({
359
727
  query: function (data) { return ({
360
- url: '/api/user/register',
728
+ url: '/user/register',
361
729
  method: 'POST',
362
730
  body: data,
363
731
  }); },
@@ -386,7 +754,7 @@ var authApi = react.createApi({
386
754
  }),
387
755
  verifyUser: builder.query({
388
756
  query: function (data) { return ({
389
- url: '/api/user/verify',
757
+ url: '/user/verify',
390
758
  method: 'POST',
391
759
  body: data,
392
760
  }); },
@@ -435,34 +803,34 @@ var authApi = react.createApi({
435
803
  }),
436
804
  verifyUserAttributes: builder.query({
437
805
  query: function (data) { return ({
438
- url: '/api/user/verify/email',
806
+ url: '/user/verify/email',
439
807
  method: 'POST',
440
808
  body: data,
441
809
  }); },
442
810
  }),
443
811
  verifyUserResend: builder.query({
444
812
  query: function (data) { return ({
445
- url: '/api/user/verify/resend',
813
+ url: '/user/verify/resend',
446
814
  method: 'POST',
447
815
  body: data,
448
816
  }); },
449
817
  }),
450
818
  getUserInfo: builder.query({
451
819
  query: function (uuid) { return ({
452
- url: "/api/data/user/".concat(uuid),
820
+ url: "/user/".concat(uuid),
453
821
  method: 'GET',
454
822
  }); },
455
823
  }),
456
824
  updateUserInfo: builder.mutation({
457
825
  query: function (expressions) { return ({
458
- url: '/api/data/user',
826
+ url: '/data/user',
459
827
  method: 'PATCH',
460
828
  body: expressions,
461
829
  }); },
462
830
  }),
463
831
  updateUser: builder.mutation({
464
832
  query: function (data) { return ({
465
- url: '/api/user',
833
+ url: '/user',
466
834
  method: 'PATCH',
467
835
  body: data,
468
836
  }); },
@@ -470,41 +838,10 @@ var authApi = react.createApi({
470
838
  }); },
471
839
  });
472
840
  // Export hooks for usage in functional components.
473
- 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;
841
+ 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;
474
842
 
475
- // console.log('process.env', process.env);
476
- // console.log('process.env?.WEB_APP', process.env?.WEB_APP);
477
- // console.log(
478
- // 'process.env?.NEXT_PUBLIC_WEB_APP',
479
- // process.env?.NEXT_PUBLIC_WEB_APP,
480
- // );
481
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
482
- // Render the store based on the environment.
483
- var isWeb = process.env.NEXT_PUBLIC_WEB_APP;
484
- var ENV = isWeb ? process.env : require('react-native-config').default;
485
- // export const ENV = process.env;
486
- ((_a = process.env) === null || _a === void 0 ? void 0 : _a.NEXT_PUBLIC_API_PREFIX) || ENV.API_PREFIX;
487
- ((_b = process.env) === null || _b === void 0 ? void 0 : _b.NEXT_PUBLIC_APP_BASE_URL) || ENV.APP_BASE_URL;
488
- var APP_ES_INSTANCE = ((_c = process.env) === null || _c === void 0 ? void 0 : _c.NEXT_PUBLIC_APP_ES_INSTANCE) || ENV.APP_ES_INSTANCE;
489
- var APP_ES_AUTH = ((_d = process.env) === null || _d === void 0 ? void 0 : _d.NEXT_PUBLIC_APP_ES_AUTH) || ENV.APP_ES_AUTH;
490
- ((_e = process.env) === null || _e === void 0 ? void 0 : _e.NEXT_PUBLIC_APP_ES_PROMO_PANEL_INDEX) ||
491
- ENV.APP_ES_PROMO_PANEL_INDEX;
492
- ((_f = process.env) === null || _f === void 0 ? void 0 : _f.NEXT_PUBLIC_APP_ES_FAQ_INDEX) || ENV.APP_ES_FAQ_INDEX;
493
- ((_g = process.env) === null || _g === void 0 ? void 0 : _g.NEXT_PUBLIC_APP_ES_PAGES_INDEX) || ENV.APP_ES_PAGES_INDEX;
494
- ((_h = process.env) === null || _h === void 0 ? void 0 : _h.NEXT_PUBLIC_APP_ES_SETTINGS_INDEX) || ENV.APP_ES_SETTINGS_INDEX;
495
- ((_j = process.env) === null || _j === void 0 ? void 0 : _j.NEXT_PUBLIC_APP_ES_PRESS_INDEX) || ENV.APP_ES_PRESS_INDEX;
496
- ((_k = process.env) === null || _k === void 0 ? void 0 : _k.NEXT_PUBLIC_APP_ES_GUESTS_INDEX) || ENV.APP_ES_GUESTS_INDEX;
497
- ((_l = process.env) === null || _l === void 0 ? void 0 : _l.NEXT_PUBLIC_APP_ES_VIDEOS_INDEX) || ENV.APP_ES_VIDEOS_INDEX;
498
- ((_m = process.env) === null || _m === void 0 ? void 0 : _m.NEXT_PUBLIC_APP_ES_SECTIONS_INDEX) || ENV.APP_ES_SECTIONS_INDEX;
499
- ((_o = process.env) === null || _o === void 0 ? void 0 : _o.NEXT_PUBLIC_APP_ES_WORKOUTS_INDEX) || ENV.APP_ES_WORKOUTS_INDEX;
500
- ((_p = process.env) === null || _p === void 0 ? void 0 : _p.NEXT_PUBLIC_APP_ES_SCHEDULE_INDEX) || ENV.APP_ES_SCHEDULE_INDEX;
501
- ((_q = process.env) === null || _q === void 0 ? void 0 : _q.NEXT_PUBLIC_APP_ES_CHALLENGES_INDEX) ||
502
- ENV.APP_ES_CHALLENGES_INDEX;
503
- ((_r = process.env) === null || _r === void 0 ? void 0 : _r.NEXT_PUBLIC_APP_ES_CHALLENGE_DAYS_INDEX) ||
504
- ENV.APP_ES_CHALLENGE_DAYS_INDEX;
505
-
506
- console.log('APP_ES_INSTANCE', APP_ES_INSTANCE);
507
- console.log('APP_ES_AUTH', APP_ES_AUTH);
843
+ // console.log('APP_ES_INSTANCE', APP_ES_INSTANCE);
844
+ // console.log('APP_ES_AUTH', APP_ES_AUTH);
508
845
  var contentApi = react.createApi({
509
846
  reducerPath: 'contentApi',
510
847
  baseQuery: react.fetchBaseQuery({
@@ -514,28 +851,86 @@ var contentApi = react.createApi({
514
851
  return headers;
515
852
  },
516
853
  }),
517
- tagTypes: ['Promos'],
854
+ tagTypes: ['Data'],
518
855
  // keepUnusedDataFor: 300,
519
856
  endpoints: function (builder) { return ({
520
- getPromos: builder.query({
521
- query: function (index) { return ({
522
- url: "".concat(index, "/_search"),
523
- method: 'POST',
524
- body: {
525
- from: 0,
526
- size: 100,
527
- sort: [{ created: { order: 'desc' } }],
528
- query: {
529
- match_all: {},
857
+ getData: builder.query({
858
+ query: function (_a) {
859
+ var index = _a.index, _b = _a.options, options = _b === void 0 ? {} : _b;
860
+ return ({
861
+ url: "".concat(index, "/_search"),
862
+ method: 'POST',
863
+ body: {
864
+ from: 0,
865
+ size: options.size || 1000,
866
+ sort: options.sort || [{ created: { order: 'desc' } }],
867
+ query: options.query || {
868
+ match_all: {},
869
+ },
530
870
  },
531
- },
532
- }); },
533
- 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); },
534
- providesTags: ['Promos'],
871
+ });
872
+ },
873
+ transformResponse: function (response) { var _a; return (_a = response === null || response === void 0 ? void 0 : response.hits) === null || _a === void 0 ? void 0 : _a.hits; },
874
+ providesTags: ['Data'],
875
+ }),
876
+ // getPromos: builder.query<Promo[], string | undefined>({
877
+ // query: (index) => ({
878
+ // url: `${index}/_search`,
879
+ // method: 'POST',
880
+ // body: {
881
+ // from: 0,
882
+ // size: 100,
883
+ // sort: [{ created: { order: 'desc' } }],
884
+ // query: {
885
+ // match_all: {},
886
+ // },
887
+ // },
888
+ // }),
889
+ // transformResponse: (response: ESPromoResponse) =>
890
+ // formatPromos(response?.hits?.hits),
891
+ // providesTags: ['Promos'],
892
+ // }),
893
+ // getWorkouts: builder.query<Workout[], string | undefined>({
894
+ // query: (index) => ({
895
+ // url: `${index}/_search`,
896
+ // method: 'POST',
897
+ // body: {
898
+ // from: 0,
899
+ // size: 100,
900
+ // sort: [{ created: { order: 'desc' } }],
901
+ // query: {
902
+ // match_all: {},
903
+ // },
904
+ // },
905
+ // }),
906
+ // transformResponse: (response: ESWorkoutResponse) =>
907
+ // formatESWorkoutItems(response?.hits?.hits),
908
+ // providesTags: ['Workouts'],
909
+ // }),
910
+ getWorkoutById: builder.query({
911
+ query: function (_a) {
912
+ var index = _a.index, id = _a.id;
913
+ return ({
914
+ url: "".concat(index, "/_search"),
915
+ method: 'POST',
916
+ body: {
917
+ query: {
918
+ term: {
919
+ uuid: id,
920
+ },
921
+ },
922
+ },
923
+ });
924
+ },
535
925
  }),
536
926
  }); },
537
927
  });
538
- var useGetPromosQuery = contentApi.useGetPromosQuery; contentApi.useLazyGetPromosQuery;
928
+ contentApi.useGetDataQuery; contentApi.useLazyGetDataQuery;
929
+ // useGetPromosQuery,
930
+ // useLazyGetPromosQuery,
931
+ // useGetWorkoutsQuery,
932
+ // useLazyGetWorkoutsQuery,
933
+ contentApi.useGetWorkoutByIdQuery; contentApi.useLazyGetWorkoutByIdQuery;
539
934
 
540
935
  var useLoggedIn = function () {
541
936
  var isLoggedIn = reactRedux.useSelector(isAuthenticated);
@@ -651,31 +1046,26 @@ var webStore = isWeb && makeWebStore();
651
1046
 
652
1047
  exports.authApi = authApi;
653
1048
  exports.contentApi = contentApi;
1049
+ exports.formatChallengeDays = formatChallengeDays;
1050
+ exports.formatChallenges = formatChallenges;
1051
+ exports.formatFaqs = formatFaqs;
1052
+ exports.formatGuests = formatGuests;
1053
+ exports.formatLongform = formatLongform;
1054
+ exports.formatPages = formatPages;
1055
+ exports.formatPress = formatPress;
1056
+ exports.formatPromos = formatPromos;
1057
+ exports.formatSchedule = formatSchedule;
1058
+ exports.formatSections = formatSections;
1059
+ exports.formatSeries = formatSeries;
1060
+ exports.formatSettings = formatSettings;
1061
+ exports.formatShortform = formatShortform;
1062
+ exports.formatUserPayload = formatUserPayload;
1063
+ exports.formatVideos = formatVideos;
1064
+ exports.formatWorkout = formatWorkout;
654
1065
  exports.nativeStore = nativeStore;
655
1066
  exports.useAppDispatch = useAppDispatch;
656
1067
  exports.useAppSelector = useAppSelector;
657
1068
  exports.useAppStore = useAppStore;
658
- exports.useForgottenPasswordMutation = useForgottenPasswordMutation;
659
- exports.useGetPromosQuery = useGetPromosQuery;
660
- exports.useGetUserInfoQuery = useGetUserInfoQuery;
661
- exports.useLazyGetUserInfoQuery = useLazyGetUserInfoQuery;
662
- exports.useLazyLoginQuery = useLazyLoginQuery;
663
- exports.useLazyLogoutQuery = useLazyLogoutQuery;
664
- exports.useLazyRefreshTokenQuery = useLazyRefreshTokenQuery;
665
- exports.useLazyVerifyUserAttributesQuery = useLazyVerifyUserAttributesQuery;
666
- exports.useLazyVerifyUserQuery = useLazyVerifyUserQuery;
667
- exports.useLazyVerifyUserResendQuery = useLazyVerifyUserResendQuery;
668
1069
  exports.useLoggedIn = useLoggedIn;
669
- exports.useLoginQuery = useLoginQuery;
670
- exports.useLogoutQuery = useLogoutQuery;
671
- exports.useRefreshTokenQuery = useRefreshTokenQuery;
672
- exports.useRegisterMutation = useRegisterMutation;
673
- exports.useResetPasswordAuthMutation = useResetPasswordAuthMutation;
674
- exports.useResetPasswordMutation = useResetPasswordMutation;
675
- exports.useUpdateUserInfoMutation = useUpdateUserInfoMutation;
676
- exports.useUpdateUserMutation = useUpdateUserMutation;
677
- exports.useVerifyUserAttributesQuery = useVerifyUserAttributesQuery;
678
- exports.useVerifyUserQuery = useVerifyUserQuery;
679
- exports.useVerifyUserResendQuery = useVerifyUserResendQuery;
680
1070
  exports.webStore = webStore;
681
1071
  //# sourceMappingURL=index.js.map