@opexa/portal-sdk 0.4.1 → 0.5.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.cjs CHANGED
@@ -1995,11 +1995,9 @@ var UNMARK_GAME_AS_FAVORITE = gql`
1995
1995
  `;
1996
1996
  var FAVORITE_GAMES_QUERY = gql`
1997
1997
  query favoriteGames {
1998
- id
1999
- name
2000
- type
2001
- provider
2002
- favorite
1998
+ favoriteGames {
1999
+ id
2000
+ }
2003
2001
  }
2004
2002
  `;
2005
2003
 
@@ -6329,7 +6327,29 @@ var Sdk = class {
6329
6327
  return await this.walletService.unmarkGameAsFavorite({ input });
6330
6328
  }
6331
6329
  async favoriteGames() {
6332
- return await this.walletService.favoriteGames();
6330
+ const res0 = await this.walletService.favoriteGames();
6331
+ const ids = res0.data?.length ? [...new Set(res0.data.map((e) => e.id))] : [];
6332
+ if (ids.length <= 0) {
6333
+ return {
6334
+ ok: true,
6335
+ data: []
6336
+ };
6337
+ }
6338
+ const res1 = await this.cmsPortalService.games({
6339
+ filter: {
6340
+ reference: {
6341
+ in: ids
6342
+ }
6343
+ }
6344
+ });
6345
+ if (!res1.ok) return res1;
6346
+ return {
6347
+ ok: true,
6348
+ data: res0.data?.map(({ id }) => {
6349
+ const game = res1.data.edges.find((e) => id === e.node.reference)?.node;
6350
+ return game ? this.transformer.transform.game(game) : null;
6351
+ }).filter(Boolean) ?? []
6352
+ };
6333
6353
  }
6334
6354
  /**/
6335
6355
  /*+----------------------------------------+*/