@opexa/portal-sdk 0.59.114 → 0.59.115

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
@@ -3456,7 +3456,9 @@ var _GAMES_NEXT_QUERY = gql`
3456
3456
  hidden
3457
3457
  hasFreeBet
3458
3458
  hasJackpot
3459
- image
3459
+ image {
3460
+ url
3461
+ }
3460
3462
  groups {
3461
3463
  id
3462
3464
  name
@@ -3492,7 +3494,9 @@ var _GAMES_NEXT_QUERY__STAGING = gql`
3492
3494
  returnToPlayer
3493
3495
  minimumBet
3494
3496
  maximumBet
3495
- image
3497
+ image {
3498
+ url
3499
+ }
3496
3500
  groups {
3497
3501
  id
3498
3502
  name
@@ -3533,6 +3537,7 @@ var GAME_GROUPS_QUERY = gql`
3533
3537
  edges {
3534
3538
  cursor
3535
3539
  node {
3540
+ __typename
3536
3541
  ... on GameGroup {
3537
3542
  id
3538
3543
  name
@@ -3549,7 +3554,9 @@ var GAME_GROUPS_QUERY = gql`
3549
3554
  hidden
3550
3555
  hasFreeBet
3551
3556
  hasJackpot
3552
- image
3557
+ image {
3558
+ url
3559
+ }
3553
3560
  }
3554
3561
  dateTimeLastUpdated
3555
3562
  dateTimeCreated
@@ -3562,6 +3569,7 @@ var GAME_GROUPS_QUERY = gql`
3562
3569
  var GAME_GROUP_QUERY = gql`
3563
3570
  query GameGroup($id: ObjectId!) {
3564
3571
  node(id: $id) {
3572
+ __typename
3565
3573
  ... on GameGroup {
3566
3574
  id
3567
3575
  name
@@ -3576,7 +3584,9 @@ var GAME_GROUP_QUERY = gql`
3576
3584
  hidden
3577
3585
  hasFreeBet
3578
3586
  hasJackpot
3579
- image
3587
+ image {
3588
+ url
3589
+ }
3580
3590
  }
3581
3591
  dateTimeLastUpdated
3582
3592
  dateTimeCreated
@@ -6035,6 +6045,18 @@ var TriggerService = class {
6035
6045
  };
6036
6046
 
6037
6047
  // src/services/wallet.service.ts
6048
+ function isWalletGameGroup(node) {
6049
+ return node.__typename === "GameGroup" && "id" in node && typeof node.id === "string" && "name" in node && typeof node.name === "string" && "games" in node && Array.isArray(node.games) && "dateTimeCreated" in node && typeof node.dateTimeCreated === "string" && "dateTimeLastUpdated" in node && typeof node.dateTimeLastUpdated === "string";
6050
+ }
6051
+ function invalidWalletGameGroup(node) {
6052
+ return {
6053
+ ok: false,
6054
+ error: {
6055
+ name: "UnknownError",
6056
+ message: node.__typename && node.__typename !== "GameGroup" ? `Wallet returned ${node.__typename} instead of GameGroup.` : "Wallet returned invalid GameGroup data."
6057
+ }
6058
+ };
6059
+ }
6038
6060
  var WalletService = class {
6039
6061
  client;
6040
6062
  environment;
@@ -7011,14 +7033,26 @@ var WalletService = class {
7011
7033
  }
7012
7034
  };
7013
7035
  }
7036
+ const edges = [];
7037
+ for (const { cursor, node } of res.data.gameGroups.edges) {
7038
+ if (!isWalletGameGroup(node)) return invalidWalletGameGroup(node);
7039
+ const { __typename, ...group } = node;
7040
+ edges.push({ cursor, node: group });
7041
+ }
7014
7042
  return {
7015
7043
  ok: true,
7016
- data: res.data.gameGroups
7044
+ data: { ...res.data.gameGroups, edges }
7017
7045
  };
7018
7046
  }
7019
7047
  async gameGroup(variables) {
7020
7048
  const res = await this.client.request(GAME_GROUP_QUERY, variables);
7021
- return res.ok ? { ok: res.ok, data: res.data.node } : res;
7049
+ if (!res.ok) return res;
7050
+ if (!res.data.node) return { ok: true, data: res.data.node };
7051
+ if (!isWalletGameGroup(res.data.node)) {
7052
+ return invalidWalletGameGroup(res.data.node);
7053
+ }
7054
+ const { __typename, ...group } = res.data.node;
7055
+ return { ok: true, data: group };
7022
7056
  }
7023
7057
  };
7024
7058
 
@@ -9913,7 +9947,9 @@ var Transformer = class {
9913
9947
  name,
9914
9948
  type: node.type,
9915
9949
  provider: node.provider,
9916
- images: [...new Set(node.image ? [node.image, fallback] : [fallback])],
9950
+ images: [
9951
+ ...new Set(node.image?.url ? [node.image.url, fallback] : [fallback])
9952
+ ],
9917
9953
  tags: [],
9918
9954
  favorite: false
9919
9955
  };
@@ -9935,7 +9971,7 @@ var Transformer = class {
9935
9971
  ...data,
9936
9972
  games: data.games.flatMap((node) => {
9937
9973
  const game = this.walletGame(node);
9938
- return game ? [{ ...node, ...game }] : [];
9974
+ return game ? [{ ...node, ...game, image: node.image?.url ?? null }] : [];
9939
9975
  })
9940
9976
  };
9941
9977
  }