@getenginex/sdk-igaming 0.6.0 → 0.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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { CursorPageInput, CallOptions, CursorPage, Page, NoParams, EnginexClient } from '@getenginex/sdk';
1
+ import { CursorPageInput, CallOptions, CursorPage, NoParams, Page, EnginexClient } from '@getenginex/sdk';
2
2
 
3
3
  /**
4
4
  * Money value of a campaign, in minor units of the currency (e.g. cents). The decimal places
@@ -577,6 +577,44 @@ interface CampaignTermsAcceptanceRecord {
577
577
  /** Acceptance date, ISO 8601 (UTC). */
578
578
  acceptedAt?: string;
579
579
  }
580
+ /**
581
+ * Where the bonus balance granted by a participation stands: `active` (still to wager or to use),
582
+ * `converted` (became real balance), `expired` or `forfeited` (e.g. lost to a withdrawal). A new value the SDK
583
+ * does not know yet may arrive: handle the default case.
584
+ * @category Bonus
585
+ */
586
+ type CampaignRewardGrantState = 'active' | 'converted' | 'expired' | 'forfeited' | 'unspecified' | (string & {});
587
+ /**
588
+ * Rollover progress of a granted bonus.
589
+ * @category Bonus
590
+ */
591
+ interface CampaignWageringProgress {
592
+ /** Amount to wager. */
593
+ required: CampaignMoney;
594
+ /** Amount already wagered. */
595
+ accumulated: CampaignMoney;
596
+ /** When the rollover was completed, ISO 8601 (UTC). */
597
+ completedAt?: string;
598
+ }
599
+ /**
600
+ * The bonus balance a participation granted. protojson leaves zeros out: a missing amount comes as `0` in the
601
+ * currency of the grant's other amounts (or `''` when none has one).
602
+ * @category Bonus
603
+ */
604
+ interface CampaignRewardGrant {
605
+ /** Where the balance stands. An `active` grant keeps the bonus among the player's active ones even after the participation completed. */
606
+ state: CampaignRewardGrantState;
607
+ /** Amount granted. */
608
+ granted: CampaignMoney;
609
+ /** Bonus balance left. */
610
+ balance: CampaignMoney;
611
+ /** Amount converted to real balance. */
612
+ converted: CampaignMoney;
613
+ /** When the bonus balance expires, ISO 8601 (UTC). */
614
+ expiresAt?: string;
615
+ /** Rollover progress, when the bonus has a wagering requirement. */
616
+ wagering?: CampaignWageringProgress;
617
+ }
580
618
  /**
581
619
  * The player's participation in a campaign, with the reward and the texts as they were when they joined.
582
620
  * @category Bonus
@@ -609,6 +647,8 @@ interface CampaignParticipation {
609
647
  /** Terms acceptance, if there was one. */
610
648
  termsAcceptance?: CampaignTermsAcceptanceRecord;
611
649
  };
650
+ /** The bonus balance granted, once the reward was credited; missing before that. */
651
+ rewardGrant?: CampaignRewardGrant;
612
652
  }
613
653
  /**
614
654
  * Terms acceptance of the campaign, sent on opt-in or on promo code redemption.
@@ -642,6 +682,95 @@ interface PromoCodeOffer {
642
682
  /** The texts in the requested language. */
643
683
  localizedContent: CampaignLocalizedContent;
644
684
  }
685
+ /**
686
+ * The player's restricted bonus balance in one currency (amounts in minor units of `currency`; amounts of
687
+ * different currencies are never added).
688
+ * @category Bonus
689
+ */
690
+ interface BonusOverviewCurrency {
691
+ /** Currency code, e.g. `BRL`. */
692
+ currency: string;
693
+ /** Decimal places of the currency, to format the amounts. */
694
+ decimalPlaces: number;
695
+ /** Bonus balance in open positions. */
696
+ restrictedTotal: number;
697
+ /** Part of `restrictedTotal` whose position expires in the next 7 days. */
698
+ expiring7d: number;
699
+ /** Open bonus positions. */
700
+ openPositions: number;
701
+ /** Nearest expiry among the open positions, ISO 8601 (UTC). */
702
+ nextExpiresAt?: string;
703
+ /** Bonus balance already converted to real balance. */
704
+ converted: number;
705
+ /** Campaigns with a conversion above zero. */
706
+ convertedCampaigns: number;
707
+ }
708
+ /**
709
+ * Result of {@link BonusApi.getOverview}.
710
+ * @category Bonus
711
+ */
712
+ interface BonusOverview {
713
+ /** One line per currency; empty for a player without bonus history. */
714
+ currencies: BonusOverviewCurrency[];
715
+ /** When the figures were computed, ISO 8601 (UTC). */
716
+ asOf?: string;
717
+ }
718
+ /**
719
+ * State of a bonus position: `open` or `terminal`. A new value may arrive.
720
+ * @category Bonus
721
+ */
722
+ type BonusPositionState = 'open' | 'terminal' | (string & {});
723
+ /**
724
+ * How a terminal position ended, in lowercase: `expire`, `forfeit`, `convert` or `admin_cancel`.
725
+ * @category Bonus
726
+ */
727
+ type BonusPositionTerminalAction = 'expire' | 'forfeit' | 'convert' | 'admin_cancel' | (string & {});
728
+ /**
729
+ * One bonus position of the player (the restricted balance of one grant) with its rollover progress. Amounts
730
+ * in minor units of `currency`.
731
+ * @category Bonus
732
+ */
733
+ interface BonusPosition {
734
+ /** Position id. */
735
+ positionId: string;
736
+ /** Campaign id: the name to show comes from the campaign's offer (`localizedContent`). */
737
+ campaignId: string;
738
+ /** Currency code, e.g. `BRL`. */
739
+ currency: string;
740
+ /** Decimal places of the currency. */
741
+ decimalPlaces: number;
742
+ /** Amount granted. */
743
+ granted: number;
744
+ /** Bonus balance left. */
745
+ restricted: number;
746
+ /** Converted to real balance. */
747
+ converted: number;
748
+ /** Amount to wager. */
749
+ required: number;
750
+ /** Already wagered. */
751
+ wagered: number;
752
+ /** Still to wager. */
753
+ remaining: number;
754
+ /** `open` or `terminal`. */
755
+ state: BonusPositionState;
756
+ /** How it ended (terminal positions only). */
757
+ terminalAction?: BonusPositionTerminalAction;
758
+ /** When the bonus balance expires, ISO 8601 (UTC). */
759
+ expiresAt?: string;
760
+ /** When the position was created, ISO 8601 (UTC). */
761
+ createdAt?: string;
762
+ }
763
+ /**
764
+ * Filters and pagination of {@link BonusApi.listPositions}. On the wire `pageSize` goes as `limit` (1 to 100,
765
+ * gateway default 25).
766
+ * @category Bonus
767
+ */
768
+ interface ListBonusPositionsInput extends CursorPageInput {
769
+ /** Only open or only terminal positions. Default: all. */
770
+ state?: 'open' | 'terminal';
771
+ /** Currency code. Default: all. */
772
+ currency?: string;
773
+ }
645
774
  /**
646
775
  * Bonus campaigns and promo codes. Only `listPublicOffers` is public; the other methods require login.
647
776
  * @category Bonus
@@ -764,6 +893,26 @@ interface BonusApi {
764
893
  getParticipation(input: {
765
894
  participationId: string;
766
895
  }, options?: CallOptions): Promise<CampaignParticipation>;
896
+ /**
897
+ * The player's restricted bonus balance, one line per currency: total, what expires in 7 days, open
898
+ * positions and what was converted to real balance.
899
+ * @example
900
+ * const { currencies } = await igaming.bonus.getOverview()
901
+ * const brl = currencies.find((c) => c.currency === 'BRL')
902
+ * @throws {EnginexError} `UNAUTHENTICATED` without a session; `VALIDATION_ERROR`, also in `'warn'`, with money
903
+ * outside the format.
904
+ */
905
+ getOverview(params?: NoParams, options?: CallOptions): Promise<BonusOverview>;
906
+ /**
907
+ * The player's bonus positions with their rollover progress, newest first. Cursor-paginated.
908
+ * @example
909
+ * const { items } = await igaming.bonus.listPositions({ state: 'open' })
910
+ * items.forEach((p) => showProgress(p.wagered, p.required))
911
+ * @throws {EnginexError} `INVALID_ARGUMENT` (400) for a `pageSize` outside 1-100, an unknown `state` or an
912
+ * unsupported currency; `UNAUTHENTICATED` without a session; `VALIDATION_ERROR`, also in `'warn'`, with money
913
+ * outside the format.
914
+ */
915
+ listPositions(input?: ListBonusPositionsInput, options?: CallOptions): Promise<CursorPage<BonusPosition>>;
767
916
  }
768
917
 
769
918
  /**
@@ -1585,4 +1734,4 @@ interface IgamingClient {
1585
1734
  */
1586
1735
  declare function createIgaming(client: EnginexClient): IgamingClient;
1587
1736
 
1588
- export { type ActivityAggregateQualification, type BalanceCreditReward, type BiggestWinner, type BonusApi, type CampaignCashoutMode, type CampaignContent, type CampaignEntryPolicyCode, type CampaignExactRatio, type CampaignLocalizedContent, type CampaignMaximumBet, type CampaignMoney, type CampaignOddsPolicy, type CampaignOffer, type CampaignParticipation, type CampaignParticipationStatus, type CampaignPercentCalculation, type CampaignPolicy, type CampaignProductScope, type CampaignQualification, type CampaignReward, type CampaignRewardClaimPolicyCode, type CampaignRewardKind, type CampaignRewardValidity, type CampaignRoundingMode, type CampaignStackingPolicy, type CampaignTermsAcceptance, type CampaignTermsAcceptanceRecord, type CampaignTimeWindow, type CampaignUsePolicy, type CampaignWageringPolicy, type CasinoActivitySelector, type CasinoApi, type CasinoFreeSpinsReward, type CasinoPageInput, type CasinoTransaction, type CasinoTransactionType, type DepositSettledQualification, type Game, type GameCategory, type GameLaunch, type GameProvider, type GameSession, type GameSessionStatus, type GameSort, type GetBiggestWinnersInput, type IgamingClient, type LaunchGameInput, type LaunchTarget, type ListGamesInput, type ListMissionsInput, type ListReferralsInput, type LoyaltyApi, type LoyaltyStatus, type Mission, type MissionObjectiveType, type MissionRewardType, type MissionType, type MissionsApi, type OptInInput, type PromoCodeOffer, type RedeemPointsInput, type RedeemedPoints, type RedemptionType, type Referral, type ReferralHistory, type ReferralInfo, type ReferralStatus, type ReferralsApi, type RegisterReferralInput, type RegisteredReferral, type SportsActivitySelector, type SportsBetCoverageReward, type SportsBetType, type SportsBonusBetReward, type SportsbookApi, type SportsbookSession, type UserEventQualification, type UserMission, type UserMissionStatus, createIgaming };
1737
+ export { type ActivityAggregateQualification, type BalanceCreditReward, type BiggestWinner, type BonusApi, type BonusOverview, type BonusOverviewCurrency, type BonusPosition, type BonusPositionState, type BonusPositionTerminalAction, type CampaignCashoutMode, type CampaignContent, type CampaignEntryPolicyCode, type CampaignExactRatio, type CampaignLocalizedContent, type CampaignMaximumBet, type CampaignMoney, type CampaignOddsPolicy, type CampaignOffer, type CampaignParticipation, type CampaignParticipationStatus, type CampaignPercentCalculation, type CampaignPolicy, type CampaignProductScope, type CampaignQualification, type CampaignReward, type CampaignRewardClaimPolicyCode, type CampaignRewardGrant, type CampaignRewardGrantState, type CampaignRewardKind, type CampaignRewardValidity, type CampaignRoundingMode, type CampaignStackingPolicy, type CampaignTermsAcceptance, type CampaignTermsAcceptanceRecord, type CampaignTimeWindow, type CampaignUsePolicy, type CampaignWageringPolicy, type CampaignWageringProgress, type CasinoActivitySelector, type CasinoApi, type CasinoFreeSpinsReward, type CasinoPageInput, type CasinoTransaction, type CasinoTransactionType, type DepositSettledQualification, type Game, type GameCategory, type GameLaunch, type GameProvider, type GameSession, type GameSessionStatus, type GameSort, type GetBiggestWinnersInput, type IgamingClient, type LaunchGameInput, type LaunchTarget, type ListBonusPositionsInput, type ListGamesInput, type ListMissionsInput, type ListReferralsInput, type LoyaltyApi, type LoyaltyStatus, type Mission, type MissionObjectiveType, type MissionRewardType, type MissionType, type MissionsApi, type OptInInput, type PromoCodeOffer, type RedeemPointsInput, type RedeemedPoints, type RedemptionType, type Referral, type ReferralHistory, type ReferralInfo, type ReferralStatus, type ReferralsApi, type RegisterReferralInput, type RegisteredReferral, type SportsActivitySelector, type SportsBetCoverageReward, type SportsBetType, type SportsBonusBetReward, type SportsbookApi, type SportsbookSession, type UserEventQualification, type UserMission, type UserMissionStatus, createIgaming };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CursorPageInput, CallOptions, CursorPage, Page, NoParams, EnginexClient } from '@getenginex/sdk';
1
+ import { CursorPageInput, CallOptions, CursorPage, NoParams, Page, EnginexClient } from '@getenginex/sdk';
2
2
 
3
3
  /**
4
4
  * Money value of a campaign, in minor units of the currency (e.g. cents). The decimal places
@@ -577,6 +577,44 @@ interface CampaignTermsAcceptanceRecord {
577
577
  /** Acceptance date, ISO 8601 (UTC). */
578
578
  acceptedAt?: string;
579
579
  }
580
+ /**
581
+ * Where the bonus balance granted by a participation stands: `active` (still to wager or to use),
582
+ * `converted` (became real balance), `expired` or `forfeited` (e.g. lost to a withdrawal). A new value the SDK
583
+ * does not know yet may arrive: handle the default case.
584
+ * @category Bonus
585
+ */
586
+ type CampaignRewardGrantState = 'active' | 'converted' | 'expired' | 'forfeited' | 'unspecified' | (string & {});
587
+ /**
588
+ * Rollover progress of a granted bonus.
589
+ * @category Bonus
590
+ */
591
+ interface CampaignWageringProgress {
592
+ /** Amount to wager. */
593
+ required: CampaignMoney;
594
+ /** Amount already wagered. */
595
+ accumulated: CampaignMoney;
596
+ /** When the rollover was completed, ISO 8601 (UTC). */
597
+ completedAt?: string;
598
+ }
599
+ /**
600
+ * The bonus balance a participation granted. protojson leaves zeros out: a missing amount comes as `0` in the
601
+ * currency of the grant's other amounts (or `''` when none has one).
602
+ * @category Bonus
603
+ */
604
+ interface CampaignRewardGrant {
605
+ /** Where the balance stands. An `active` grant keeps the bonus among the player's active ones even after the participation completed. */
606
+ state: CampaignRewardGrantState;
607
+ /** Amount granted. */
608
+ granted: CampaignMoney;
609
+ /** Bonus balance left. */
610
+ balance: CampaignMoney;
611
+ /** Amount converted to real balance. */
612
+ converted: CampaignMoney;
613
+ /** When the bonus balance expires, ISO 8601 (UTC). */
614
+ expiresAt?: string;
615
+ /** Rollover progress, when the bonus has a wagering requirement. */
616
+ wagering?: CampaignWageringProgress;
617
+ }
580
618
  /**
581
619
  * The player's participation in a campaign, with the reward and the texts as they were when they joined.
582
620
  * @category Bonus
@@ -609,6 +647,8 @@ interface CampaignParticipation {
609
647
  /** Terms acceptance, if there was one. */
610
648
  termsAcceptance?: CampaignTermsAcceptanceRecord;
611
649
  };
650
+ /** The bonus balance granted, once the reward was credited; missing before that. */
651
+ rewardGrant?: CampaignRewardGrant;
612
652
  }
613
653
  /**
614
654
  * Terms acceptance of the campaign, sent on opt-in or on promo code redemption.
@@ -642,6 +682,95 @@ interface PromoCodeOffer {
642
682
  /** The texts in the requested language. */
643
683
  localizedContent: CampaignLocalizedContent;
644
684
  }
685
+ /**
686
+ * The player's restricted bonus balance in one currency (amounts in minor units of `currency`; amounts of
687
+ * different currencies are never added).
688
+ * @category Bonus
689
+ */
690
+ interface BonusOverviewCurrency {
691
+ /** Currency code, e.g. `BRL`. */
692
+ currency: string;
693
+ /** Decimal places of the currency, to format the amounts. */
694
+ decimalPlaces: number;
695
+ /** Bonus balance in open positions. */
696
+ restrictedTotal: number;
697
+ /** Part of `restrictedTotal` whose position expires in the next 7 days. */
698
+ expiring7d: number;
699
+ /** Open bonus positions. */
700
+ openPositions: number;
701
+ /** Nearest expiry among the open positions, ISO 8601 (UTC). */
702
+ nextExpiresAt?: string;
703
+ /** Bonus balance already converted to real balance. */
704
+ converted: number;
705
+ /** Campaigns with a conversion above zero. */
706
+ convertedCampaigns: number;
707
+ }
708
+ /**
709
+ * Result of {@link BonusApi.getOverview}.
710
+ * @category Bonus
711
+ */
712
+ interface BonusOverview {
713
+ /** One line per currency; empty for a player without bonus history. */
714
+ currencies: BonusOverviewCurrency[];
715
+ /** When the figures were computed, ISO 8601 (UTC). */
716
+ asOf?: string;
717
+ }
718
+ /**
719
+ * State of a bonus position: `open` or `terminal`. A new value may arrive.
720
+ * @category Bonus
721
+ */
722
+ type BonusPositionState = 'open' | 'terminal' | (string & {});
723
+ /**
724
+ * How a terminal position ended, in lowercase: `expire`, `forfeit`, `convert` or `admin_cancel`.
725
+ * @category Bonus
726
+ */
727
+ type BonusPositionTerminalAction = 'expire' | 'forfeit' | 'convert' | 'admin_cancel' | (string & {});
728
+ /**
729
+ * One bonus position of the player (the restricted balance of one grant) with its rollover progress. Amounts
730
+ * in minor units of `currency`.
731
+ * @category Bonus
732
+ */
733
+ interface BonusPosition {
734
+ /** Position id. */
735
+ positionId: string;
736
+ /** Campaign id: the name to show comes from the campaign's offer (`localizedContent`). */
737
+ campaignId: string;
738
+ /** Currency code, e.g. `BRL`. */
739
+ currency: string;
740
+ /** Decimal places of the currency. */
741
+ decimalPlaces: number;
742
+ /** Amount granted. */
743
+ granted: number;
744
+ /** Bonus balance left. */
745
+ restricted: number;
746
+ /** Converted to real balance. */
747
+ converted: number;
748
+ /** Amount to wager. */
749
+ required: number;
750
+ /** Already wagered. */
751
+ wagered: number;
752
+ /** Still to wager. */
753
+ remaining: number;
754
+ /** `open` or `terminal`. */
755
+ state: BonusPositionState;
756
+ /** How it ended (terminal positions only). */
757
+ terminalAction?: BonusPositionTerminalAction;
758
+ /** When the bonus balance expires, ISO 8601 (UTC). */
759
+ expiresAt?: string;
760
+ /** When the position was created, ISO 8601 (UTC). */
761
+ createdAt?: string;
762
+ }
763
+ /**
764
+ * Filters and pagination of {@link BonusApi.listPositions}. On the wire `pageSize` goes as `limit` (1 to 100,
765
+ * gateway default 25).
766
+ * @category Bonus
767
+ */
768
+ interface ListBonusPositionsInput extends CursorPageInput {
769
+ /** Only open or only terminal positions. Default: all. */
770
+ state?: 'open' | 'terminal';
771
+ /** Currency code. Default: all. */
772
+ currency?: string;
773
+ }
645
774
  /**
646
775
  * Bonus campaigns and promo codes. Only `listPublicOffers` is public; the other methods require login.
647
776
  * @category Bonus
@@ -764,6 +893,26 @@ interface BonusApi {
764
893
  getParticipation(input: {
765
894
  participationId: string;
766
895
  }, options?: CallOptions): Promise<CampaignParticipation>;
896
+ /**
897
+ * The player's restricted bonus balance, one line per currency: total, what expires in 7 days, open
898
+ * positions and what was converted to real balance.
899
+ * @example
900
+ * const { currencies } = await igaming.bonus.getOverview()
901
+ * const brl = currencies.find((c) => c.currency === 'BRL')
902
+ * @throws {EnginexError} `UNAUTHENTICATED` without a session; `VALIDATION_ERROR`, also in `'warn'`, with money
903
+ * outside the format.
904
+ */
905
+ getOverview(params?: NoParams, options?: CallOptions): Promise<BonusOverview>;
906
+ /**
907
+ * The player's bonus positions with their rollover progress, newest first. Cursor-paginated.
908
+ * @example
909
+ * const { items } = await igaming.bonus.listPositions({ state: 'open' })
910
+ * items.forEach((p) => showProgress(p.wagered, p.required))
911
+ * @throws {EnginexError} `INVALID_ARGUMENT` (400) for a `pageSize` outside 1-100, an unknown `state` or an
912
+ * unsupported currency; `UNAUTHENTICATED` without a session; `VALIDATION_ERROR`, also in `'warn'`, with money
913
+ * outside the format.
914
+ */
915
+ listPositions(input?: ListBonusPositionsInput, options?: CallOptions): Promise<CursorPage<BonusPosition>>;
767
916
  }
768
917
 
769
918
  /**
@@ -1585,4 +1734,4 @@ interface IgamingClient {
1585
1734
  */
1586
1735
  declare function createIgaming(client: EnginexClient): IgamingClient;
1587
1736
 
1588
- export { type ActivityAggregateQualification, type BalanceCreditReward, type BiggestWinner, type BonusApi, type CampaignCashoutMode, type CampaignContent, type CampaignEntryPolicyCode, type CampaignExactRatio, type CampaignLocalizedContent, type CampaignMaximumBet, type CampaignMoney, type CampaignOddsPolicy, type CampaignOffer, type CampaignParticipation, type CampaignParticipationStatus, type CampaignPercentCalculation, type CampaignPolicy, type CampaignProductScope, type CampaignQualification, type CampaignReward, type CampaignRewardClaimPolicyCode, type CampaignRewardKind, type CampaignRewardValidity, type CampaignRoundingMode, type CampaignStackingPolicy, type CampaignTermsAcceptance, type CampaignTermsAcceptanceRecord, type CampaignTimeWindow, type CampaignUsePolicy, type CampaignWageringPolicy, type CasinoActivitySelector, type CasinoApi, type CasinoFreeSpinsReward, type CasinoPageInput, type CasinoTransaction, type CasinoTransactionType, type DepositSettledQualification, type Game, type GameCategory, type GameLaunch, type GameProvider, type GameSession, type GameSessionStatus, type GameSort, type GetBiggestWinnersInput, type IgamingClient, type LaunchGameInput, type LaunchTarget, type ListGamesInput, type ListMissionsInput, type ListReferralsInput, type LoyaltyApi, type LoyaltyStatus, type Mission, type MissionObjectiveType, type MissionRewardType, type MissionType, type MissionsApi, type OptInInput, type PromoCodeOffer, type RedeemPointsInput, type RedeemedPoints, type RedemptionType, type Referral, type ReferralHistory, type ReferralInfo, type ReferralStatus, type ReferralsApi, type RegisterReferralInput, type RegisteredReferral, type SportsActivitySelector, type SportsBetCoverageReward, type SportsBetType, type SportsBonusBetReward, type SportsbookApi, type SportsbookSession, type UserEventQualification, type UserMission, type UserMissionStatus, createIgaming };
1737
+ export { type ActivityAggregateQualification, type BalanceCreditReward, type BiggestWinner, type BonusApi, type BonusOverview, type BonusOverviewCurrency, type BonusPosition, type BonusPositionState, type BonusPositionTerminalAction, type CampaignCashoutMode, type CampaignContent, type CampaignEntryPolicyCode, type CampaignExactRatio, type CampaignLocalizedContent, type CampaignMaximumBet, type CampaignMoney, type CampaignOddsPolicy, type CampaignOffer, type CampaignParticipation, type CampaignParticipationStatus, type CampaignPercentCalculation, type CampaignPolicy, type CampaignProductScope, type CampaignQualification, type CampaignReward, type CampaignRewardClaimPolicyCode, type CampaignRewardGrant, type CampaignRewardGrantState, type CampaignRewardKind, type CampaignRewardValidity, type CampaignRoundingMode, type CampaignStackingPolicy, type CampaignTermsAcceptance, type CampaignTermsAcceptanceRecord, type CampaignTimeWindow, type CampaignUsePolicy, type CampaignWageringPolicy, type CampaignWageringProgress, type CasinoActivitySelector, type CasinoApi, type CasinoFreeSpinsReward, type CasinoPageInput, type CasinoTransaction, type CasinoTransactionType, type DepositSettledQualification, type Game, type GameCategory, type GameLaunch, type GameProvider, type GameSession, type GameSessionStatus, type GameSort, type GetBiggestWinnersInput, type IgamingClient, type LaunchGameInput, type LaunchTarget, type ListBonusPositionsInput, type ListGamesInput, type ListMissionsInput, type ListReferralsInput, type LoyaltyApi, type LoyaltyStatus, type Mission, type MissionObjectiveType, type MissionRewardType, type MissionType, type MissionsApi, type OptInInput, type PromoCodeOffer, type RedeemPointsInput, type RedeemedPoints, type RedemptionType, type Referral, type ReferralHistory, type ReferralInfo, type ReferralStatus, type ReferralsApi, type RegisterReferralInput, type RegisteredReferral, type SportsActivitySelector, type SportsBetCoverageReward, type SportsBetType, type SportsBonusBetReward, type SportsbookApi, type SportsbookSession, type UserEventQualification, type UserMission, type UserMissionStatus, createIgaming };
package/dist/index.js CHANGED
@@ -273,6 +273,39 @@ var offerSchema = /* @__PURE__ */ lazy(
273
273
  content: z.optional(content())
274
274
  })
275
275
  );
276
+ function grantMoney(value, currency) {
277
+ return { amount: value?.amount ?? 0, currency: value?.currency || currency };
278
+ }
279
+ var rewardGrant = () => z.pipe(
280
+ wire({
281
+ state: protoEnum("CAMPAIGN_PLAYER_REWARD_GRANT_STATE_"),
282
+ granted: z.optional(money()),
283
+ balance: z.optional(money()),
284
+ converted: z.optional(money()),
285
+ expires_at: z.optional(z.string()),
286
+ wagering: z.optional(
287
+ wire({ required: z.optional(money()), accumulated: z.optional(money()), completed_at: z.optional(z.string()) })
288
+ )
289
+ }),
290
+ z.transform(({ state, granted, balance, converted, expiresAt, wagering }) => {
291
+ const currency = [granted, balance, converted, wagering?.required, wagering?.accumulated].find((m) => m?.currency)?.currency ?? "";
292
+ const out = {
293
+ state,
294
+ granted: grantMoney(granted, currency),
295
+ balance: grantMoney(balance, currency),
296
+ converted: grantMoney(converted, currency)
297
+ };
298
+ if (expiresAt !== void 0) out.expiresAt = expiresAt;
299
+ if (wagering) {
300
+ out.wagering = {
301
+ required: grantMoney(wagering.required, currency),
302
+ accumulated: grantMoney(wagering.accumulated, currency)
303
+ };
304
+ if (wagering.completedAt !== void 0) out.wagering.completedAt = wagering.completedAt;
305
+ }
306
+ return out;
307
+ })
308
+ );
276
309
  var participationSchema = /* @__PURE__ */ lazy(
277
310
  () => z.pipe(
278
311
  wire({
@@ -290,6 +323,7 @@ var participationSchema = /* @__PURE__ */ lazy(
290
323
  reward_failed: z.optional(empty()),
291
324
  expired: z.optional(wire({ expired_at: z.optional(z.string()) })),
292
325
  cancelled: z.optional(empty()),
326
+ reward_grant: z.optional(rewardGrant()),
293
327
  snapshot: z.optional(
294
328
  wire({
295
329
  reward: z.optional(reward()),
@@ -341,6 +375,66 @@ function toCursorPage(key, data) {
341
375
  if (data.nextCursor) page.nextCursor = data.nextCursor;
342
376
  return page;
343
377
  }
378
+ var nullableDate = () => z.pipe(
379
+ z.nullish(z.string()),
380
+ z.transform((value) => value ?? void 0)
381
+ );
382
+ function compact(value) {
383
+ return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0));
384
+ }
385
+ var overviewSchema = /* @__PURE__ */ lazy(
386
+ () => z.pipe(
387
+ wire({
388
+ currencies: list(
389
+ z.pipe(
390
+ wire({
391
+ currency: currencyOrEmpty(),
392
+ decimal_places: z.number(),
393
+ restricted_total: minorUnits(),
394
+ expiring_7d: minorUnits(),
395
+ open_positions: z.number(),
396
+ next_expires_at: nullableDate(),
397
+ converted: minorUnits(),
398
+ converted_campaigns: z.number()
399
+ }),
400
+ z.transform(compact)
401
+ )
402
+ ),
403
+ as_of: nullableDate()
404
+ }),
405
+ z.transform(compact)
406
+ )
407
+ );
408
+ var positionsPage = /* @__PURE__ */ lazy(
409
+ () => wire({
410
+ rows: list(
411
+ z.pipe(
412
+ wire({
413
+ position_id: z.string(),
414
+ campaign_id: z.string(),
415
+ currency: currencyOrEmpty(),
416
+ decimal_places: z.number(),
417
+ granted: minorUnits(),
418
+ restricted: minorUnits(),
419
+ converted: minorUnits(),
420
+ required: minorUnits(),
421
+ wagered: minorUnits(),
422
+ remaining: minorUnits(),
423
+ state: z.string(),
424
+ // The gateway answers `null` for an action it does not know; known ones are uppercase (`CONVERT`).
425
+ terminal_action: z.pipe(
426
+ z.nullish(z.string()),
427
+ z.transform((value) => value ? value.toLowerCase() : void 0)
428
+ ),
429
+ expires_at: nullableDate(),
430
+ created_at: nullableDate()
431
+ }),
432
+ z.transform((row) => compact(row))
433
+ )
434
+ ),
435
+ next_cursor: z.optional(z.string())
436
+ })
437
+ );
344
438
  var terms = (acceptance) => acceptance && { locale: acceptance.locale, terms_revision: acceptance.termsRevision };
345
439
  function createBonusApi(transport) {
346
440
  const listPage = (path, key, schema, auth, input, options) => transport.request({
@@ -408,7 +502,26 @@ function createBonusApi(transport) {
408
502
  auth: "required",
409
503
  schema: participationEnvelope(),
410
504
  options
411
- }).then((data) => data.participation)
505
+ }).then((data) => data.participation),
506
+ getOverview: (_params, options) => transport.request({
507
+ method: "GET",
508
+ path: "/bonus/overview",
509
+ auth: "required",
510
+ schema: overviewSchema(),
511
+ options
512
+ }),
513
+ listPositions: (input, options) => transport.request({
514
+ method: "GET",
515
+ path: "/bonus/positions",
516
+ query: { limit: input?.pageSize, cursor: input?.cursor, state: input?.state, currency: input?.currency },
517
+ auth: "required",
518
+ schema: positionsPage(),
519
+ options
520
+ }).then(({ rows, nextCursor }) => {
521
+ const page = { items: rows };
522
+ if (nextCursor) page.nextCursor = nextCursor;
523
+ return page;
524
+ })
412
525
  };
413
526
  }
414
527
  var gameSchema = /* @__PURE__ */ lazy(