@getenginex/sdk-igaming 0.7.0 → 0.8.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
@@ -1495,66 +1495,123 @@ interface MissionsApi {
1495
1495
  }
1496
1496
 
1497
1497
  /**
1498
- * Status of a referral: `pending`, `qualified`, `completed` or `expired` (the gateway's `REFERRAL_STATUS_*`,
1499
- * in lowercase). The contract does not describe what takes a referral from one status to another (the
1500
- * "Referrals" page only has assumptions). Handle the default case: a new value arrives raw in
1501
- * `validation: 'warn'`.
1498
+ * Where a referred player stands, as the referrer sees it, in lowercase (the bonus service's
1499
+ * `CAMPAIGN_REFERRAL_STATUS_*`):
1500
+ * - `registered`: signed up, no deposit yet;
1501
+ * - `deposited`: deposited, real net loss still below the target;
1502
+ * - `in_hold`: qualified, waiting for the hold to end;
1503
+ * - `paid`: the referrer's reward is pending or granted;
1504
+ * - `not_eligible`: closed without reward by a block;
1505
+ * - `expired`: the window ended without qualifying;
1506
+ * - `cancelled`: paid, then cancelled.
1507
+ *
1508
+ * A status the SDK does not know yet arrives as the gateway sent it, in lowercase: handle the default case.
1509
+ * @category Referrals
1510
+ */
1511
+ type ReferralStatus = 'registered' | 'deposited' | 'in_hold' | 'paid' | 'not_eligible' | 'expired' | 'cancelled' | (string & {});
1512
+ /**
1513
+ * Money of the referral program, in minor units of `currency` (the gateway sends the amount as text; the SDK
1514
+ * converts).
1502
1515
  * @category Referrals
1503
1516
  */
1504
- type ReferralStatus = 'pending' | 'qualified' | 'completed' | 'expired' | 'unspecified' | (string & {});
1517
+ interface ReferralMoney {
1518
+ /** Value in minor units of `currency`. */
1519
+ amount: number;
1520
+ /** Currency code, e.g. `BRL`; `''` when the gateway sent none. */
1521
+ currency: string;
1522
+ }
1505
1523
  /**
1506
- * The player's referral code, link and totals (`GET /referrals`). Money values in minor units
1507
- * (integers): the gateway sends them as a float in major units and the SDK converts.
1524
+ * Rules of the operator's active referral campaign (part of {@link ReferralInfo}).
1525
+ * @category Referrals
1526
+ */
1527
+ interface ReferralRules {
1528
+ /** The referrer's reward per qualified referral. */
1529
+ reward: ReferralMoney;
1530
+ /** Real net loss the referred player must reach (bets minus wins with real money) to qualify. */
1531
+ minimumRealNetLoss: ReferralMoney;
1532
+ /** Days the referred player has, from the sign-up, to qualify. */
1533
+ refereeWindowDays: number;
1534
+ /** Hours a qualified referral waits before the reward is paid. */
1535
+ holdHours: number;
1536
+ /** Wagering multiplier of the reward, as an exact decimal in text (e.g. `"80"`). */
1537
+ wageringMultiplier: string;
1538
+ /** Most of the reward that can be converted into withdrawable money; `null` without a cap. */
1539
+ maximumConversion: ReferralMoney | null;
1540
+ }
1541
+ /**
1542
+ * How many of the player's referrals are in each status (integers), across all pages.
1543
+ * @category Referrals
1544
+ */
1545
+ interface ReferralTotals {
1546
+ /** In `registered`. */
1547
+ registered: number;
1548
+ /** In `deposited`. */
1549
+ deposited: number;
1550
+ /** In `in_hold`. */
1551
+ inHold: number;
1552
+ /** In `paid`. */
1553
+ paid: number;
1554
+ /** In `not_eligible`. */
1555
+ notEligible: number;
1556
+ /** In `expired`. */
1557
+ expired: number;
1558
+ /** In `cancelled`. */
1559
+ cancelled: number;
1560
+ }
1561
+ /**
1562
+ * The player's referral code, the active program rules and the totals per status (`GET /referrals`).
1508
1563
  * @category Referrals
1509
1564
  */
1510
1565
  interface ReferralInfo {
1511
- /** The player's referral code; `null` when the gateway sends it empty. */
1566
+ /**
1567
+ * `false` when the operator has no active referral campaign (and `rules` is `null`). Referrals already made keep
1568
+ * their windows open, so the totals and the history may still have rows.
1569
+ */
1570
+ enabled: boolean;
1571
+ /** The player's referral code, from the profile; `null` when the gateway sends it empty. */
1512
1572
  code: string | null;
1513
- /** Referral link ready to share; `null` when the gateway sends it empty. */
1514
- link: string | null;
1515
- /** Total referrals (integer). */
1516
- totalReferrals: number;
1517
- /** Completed referrals (integer). */
1518
- completedReferrals: number;
1519
- /** Pending referrals (integer). */
1520
- pendingReferrals: number;
1521
- /** Total earned from referrals, in minor units (the currency does not come with it). */
1522
- totalEarned: number;
1523
- /** Bonus per referral, in minor units (the currency does not come with it). */
1524
- bonusPerReferral: number;
1525
- /** Referee's minimum deposit, in minor units (the currency does not come with it). */
1526
- minDeposit: number;
1527
- }
1528
- /**
1529
- * A referral from the history (`GET /referrals/history`). Referee data: the email only comes out
1530
- * masked and the gateway's `referee_id` is not exposed.
1573
+ /**
1574
+ * Rules of the active campaign; `null` when there is none, and also when the gateway sends them without the
1575
+ * reward or the minimum real net loss (the program cannot be described without them).
1576
+ */
1577
+ rules: ReferralRules | null;
1578
+ /** Totals per status. */
1579
+ totals: ReferralTotals;
1580
+ }
1581
+ /**
1582
+ * The referred player's progress toward qualifying, in the campaign's currency.
1583
+ * @category Referrals
1584
+ */
1585
+ interface ReferralProgress {
1586
+ /** Whether the referred player already deposited. */
1587
+ depositDone: boolean;
1588
+ /** Real net loss accumulated so far (`0` when the gateway sends none). */
1589
+ realNetLoss: ReferralMoney;
1590
+ /** Real net loss required to qualify (the campaign's minimum). */
1591
+ target: ReferralMoney;
1592
+ /** `max(0, target - realNetLoss)`; computed by the SDK when the gateway leaves it out. */
1593
+ remaining: ReferralMoney;
1594
+ }
1595
+ /**
1596
+ * A referral of the history (`GET /referrals/history`): one row per referred player.
1531
1597
  * @category Referrals
1532
1598
  */
1533
1599
  interface Referral {
1534
1600
  /** Referral id. */
1535
1601
  id: string;
1536
- /** Referee's name, as the gateway sends it; `null` when empty. It is personal data: do not log it. */
1537
- refereeName: string | null;
1538
1602
  /**
1539
- * Referee's masked email: first character of the local part and one `*` per remaining character,
1540
- * whole domain (`ana@exemplo.com` → `a**@exemplo.com`; a 1-character local part becomes `*`).
1541
- * `null` when the gateway sends empty or something that is not an email. The raw email is never exposed.
1603
+ * The referred player's name, **already masked by the bonus service** (e.g. `"Ma••• R."`): show it as it is,
1604
+ * never mask it again. `null` when empty.
1542
1605
  */
1543
- refereeEmailMasked: string | null;
1544
- /** Referral code used. */
1545
- code: string;
1546
- /** Status. */
1606
+ refereeName: string | null;
1607
+ /** Where the referred player stands (see {@link ReferralStatus}). */
1547
1608
  status: ReferralStatus;
1548
- /** Referrer's bonus, in minor units. */
1549
- referrerBonus: number;
1550
- /** Referee's bonus, in minor units. */
1551
- refereeBonus: number;
1552
- /** When the referral was created (ISO 8601, UTC); `null` if the gateway does not send it. */
1609
+ /** Sign-up of the referred player (ISO 8601, UTC); `null` if the gateway does not send it. */
1553
1610
  createdAt: string | null;
1554
- /** When it was completed (ISO 8601, UTC); `null` while not completed. */
1555
- completedAt: string | null;
1556
- /** When it expires (ISO 8601, UTC); `null` when it does not expire or the gateway does not send it. */
1557
- expiresAt: string | null;
1611
+ /** End of the window to qualify (ISO 8601, UTC); `null` if the gateway does not send it. */
1612
+ deadlineAt: string | null;
1613
+ /** Progress toward qualifying; `null` when the gateway sends no target. */
1614
+ progress: ReferralProgress | null;
1558
1615
  }
1559
1616
  /**
1560
1617
  * Input of {@link ReferralsApi.listHistory}.
@@ -1563,81 +1620,47 @@ interface Referral {
1563
1620
  interface ListReferralsInput {
1564
1621
  /** Page (starts at 1; integer ≥ 1). Gateway default: 1. */
1565
1622
  page?: number;
1566
- /** Items per page (integer from 1 to 100). Gateway default: 20 (out of range also becomes 20). */
1623
+ /** Items per page (integer from 1 to 100). Gateway default: 20. On the wire it goes as `limit`. */
1567
1624
  perPage?: number;
1568
1625
  }
1569
1626
  /**
1570
- * Page of the referral history, with the totals across all pages.
1627
+ * Page of the referral history, with the player's referral code.
1571
1628
  * @category Referrals
1572
1629
  */
1573
1630
  type ReferralHistory = Page<Referral> & {
1574
- /** How many referrals are completed, across all pages (integer). */
1575
- completedCount: number;
1576
- /** Total earned from referrals, in minor units (the currency does not come with it). */
1577
- totalEarned: number;
1631
+ /** The player's referral code; `null` when the gateway sends it empty. */
1632
+ code: string | null;
1578
1633
  };
1579
1634
  /**
1580
- * Input of {@link ReferralsApi.register}.
1581
- * @category Referrals
1582
- */
1583
- interface RegisterReferralInput {
1584
- /** Another player's referral code (non-empty text; leading and trailing spaces are removed). */
1585
- code: string;
1586
- }
1587
- /**
1588
- * Referral registered by {@link ReferralsApi.register}.
1589
- * @category Referrals
1590
- */
1591
- interface RegisteredReferral {
1592
- /** Referral id. */
1593
- id: string;
1594
- /** Referral code registered. */
1595
- code: string;
1596
- /** Initial status (probably `pending`; the contract does not say). */
1597
- status: ReferralStatus;
1598
- /** Referee's bonus, in minor units. */
1599
- refereeBonus: number;
1600
- /** When it was created (ISO 8601, UTC); `null` if the gateway does not send it. */
1601
- createdAt: string | null;
1602
- }
1603
- /**
1604
- * The player's referrals. All three methods require login. Whoever is signing up passes the code in the core's
1605
- * `auth.register({ referralCode })`; the `register` here is for someone who already has an account.
1635
+ * The player's referrals. Both methods require login. A new player passes the code they were invited with in
1636
+ * the core's `auth.register({ referralCode })`: that is the only way to register a referral.
1606
1637
  * @category Referrals
1607
1638
  */
1608
1639
  interface ReferralsApi {
1609
1640
  /**
1610
- * The player's referral code, link and totals.
1641
+ * The player's referral code, the active program rules and the totals per status. Build the invitation
1642
+ * link in the app (your sign-up route with the code), so it always points at your site.
1611
1643
  * @example
1612
- * const referral = await igaming.referrals.get()
1613
- * console.log(referral.code, referral.link, referral.totalEarned)
1614
- * @throws {EnginexError} `UNAUTHENTICATED` without a session; `VALIDATION_ERROR` in `validation: 'strict'`
1615
- * if a money value is not a finite number or if a counter is not an integer ≥ 0.
1644
+ * const info = await igaming.referrals.get()
1645
+ * if (!info.enabled) showProgramUnavailable()
1646
+ * else showInvite(`${location.origin}/sign-up?ref=${info.code}`, info.rules)
1647
+ * @throws {EnginexError} `UNAUTHENTICATED` without a session; `UNAVAILABLE` when the bonus service does not
1648
+ * answer; `VALIDATION_ERROR`, also in `'warn'`, with money or currency outside the format.
1616
1649
  */
1617
1650
  get(params?: NoParams, options?: CallOptions): Promise<ReferralInfo>;
1618
1651
  /**
1619
- * Referral history, paginated. Pagination comes inside `data` (not in the envelope's `meta`):
1620
- * the SDK builds the `Page` and computes `totalPages` (`0` without items); a page beyond the end returns
1621
- * `items: []`.
1652
+ * Referral history, paginated, one row per referred player. Pagination comes inside `data` (not in the
1653
+ * envelope's `meta`): the SDK builds the `Page` and computes `totalPages` (`0` without items); a page beyond the
1654
+ * end returns `items: []`.
1622
1655
  * @example
1623
- * const { items, totalPages, completedCount } = await igaming.referrals.listHistory({ perPage: 20 })
1624
- * items.forEach((r) => console.log(r.refereeEmailMasked, r.status))
1656
+ * const { items, totalPages } = await igaming.referrals.listHistory({ perPage: 20 })
1657
+ * items.forEach((r) => console.log(r.refereeName, r.status, r.progress?.remaining.amount))
1625
1658
  * @throws {EnginexError} `CONFIGURATION_ERROR` (without a request) for a `page` that is not an integer ≥ 1 or
1626
- * a `perPage` outside 1–100 or not an integer; `UNAUTHENTICATED` without a session; `VALIDATION_ERROR` in
1627
- * `validation: 'strict'` if the status is unknown or the money is not a finite number.
1659
+ * a `perPage` outside 1–100 or not an integer; `UNAUTHENTICATED` without a session; `UNAVAILABLE` when the
1660
+ * bonus service does not answer; `VALIDATION_ERROR`, also in `'warn'`, with money or currency outside the
1661
+ * format.
1628
1662
  */
1629
1663
  listHistory(input?: ListReferralsInput, options?: CallOptions): Promise<ReferralHistory>;
1630
- /**
1631
- * Registers another player's referral code on the logged-in account (after signup). Answers
1632
- * HTTP 201.
1633
- * @example
1634
- * const result = await igaming.referrals.register({ code: 'ANA123' })
1635
- * console.log(result.status, result.refereeBonus)
1636
- * @throws {EnginexError} `CONFIGURATION_ERROR` (without a request) if `code` is not non-empty text;
1637
- * `UNAUTHENTICATED` without a session; the service refuses a nonexistent, already used or out-of-rule code:
1638
- * decide by `error.code` (the contract does not list the codes).
1639
- */
1640
- register(input: RegisterReferralInput, options?: CallOptions): Promise<RegisteredReferral>;
1641
1664
  }
1642
1665
 
1643
1666
  /**
@@ -1707,7 +1730,7 @@ interface IgamingClient {
1707
1730
  missions: MissionsApi;
1708
1731
  /** Loyalty: points balance, tier, benefits and redemption. */
1709
1732
  loyalty: LoyaltyApi;
1710
- /** Referrals: code and link, history (the referee's email masked) and code registration. */
1733
+ /** Referrals: code, program rules, totals per status and history with each referral's progress. */
1711
1734
  referrals: ReferralsApi;
1712
1735
  /** FIRST sportsbook: session to open the sportsbook in an iframe. */
1713
1736
  sportsbook: SportsbookApi;
@@ -1734,4 +1757,4 @@ interface IgamingClient {
1734
1757
  */
1735
1758
  declare function createIgaming(client: EnginexClient): IgamingClient;
1736
1759
 
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 };
1760
+ 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 ReferralMoney, type ReferralProgress, type ReferralRules, type ReferralStatus, type ReferralTotals, type ReferralsApi, 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
@@ -1495,66 +1495,123 @@ interface MissionsApi {
1495
1495
  }
1496
1496
 
1497
1497
  /**
1498
- * Status of a referral: `pending`, `qualified`, `completed` or `expired` (the gateway's `REFERRAL_STATUS_*`,
1499
- * in lowercase). The contract does not describe what takes a referral from one status to another (the
1500
- * "Referrals" page only has assumptions). Handle the default case: a new value arrives raw in
1501
- * `validation: 'warn'`.
1498
+ * Where a referred player stands, as the referrer sees it, in lowercase (the bonus service's
1499
+ * `CAMPAIGN_REFERRAL_STATUS_*`):
1500
+ * - `registered`: signed up, no deposit yet;
1501
+ * - `deposited`: deposited, real net loss still below the target;
1502
+ * - `in_hold`: qualified, waiting for the hold to end;
1503
+ * - `paid`: the referrer's reward is pending or granted;
1504
+ * - `not_eligible`: closed without reward by a block;
1505
+ * - `expired`: the window ended without qualifying;
1506
+ * - `cancelled`: paid, then cancelled.
1507
+ *
1508
+ * A status the SDK does not know yet arrives as the gateway sent it, in lowercase: handle the default case.
1509
+ * @category Referrals
1510
+ */
1511
+ type ReferralStatus = 'registered' | 'deposited' | 'in_hold' | 'paid' | 'not_eligible' | 'expired' | 'cancelled' | (string & {});
1512
+ /**
1513
+ * Money of the referral program, in minor units of `currency` (the gateway sends the amount as text; the SDK
1514
+ * converts).
1502
1515
  * @category Referrals
1503
1516
  */
1504
- type ReferralStatus = 'pending' | 'qualified' | 'completed' | 'expired' | 'unspecified' | (string & {});
1517
+ interface ReferralMoney {
1518
+ /** Value in minor units of `currency`. */
1519
+ amount: number;
1520
+ /** Currency code, e.g. `BRL`; `''` when the gateway sent none. */
1521
+ currency: string;
1522
+ }
1505
1523
  /**
1506
- * The player's referral code, link and totals (`GET /referrals`). Money values in minor units
1507
- * (integers): the gateway sends them as a float in major units and the SDK converts.
1524
+ * Rules of the operator's active referral campaign (part of {@link ReferralInfo}).
1525
+ * @category Referrals
1526
+ */
1527
+ interface ReferralRules {
1528
+ /** The referrer's reward per qualified referral. */
1529
+ reward: ReferralMoney;
1530
+ /** Real net loss the referred player must reach (bets minus wins with real money) to qualify. */
1531
+ minimumRealNetLoss: ReferralMoney;
1532
+ /** Days the referred player has, from the sign-up, to qualify. */
1533
+ refereeWindowDays: number;
1534
+ /** Hours a qualified referral waits before the reward is paid. */
1535
+ holdHours: number;
1536
+ /** Wagering multiplier of the reward, as an exact decimal in text (e.g. `"80"`). */
1537
+ wageringMultiplier: string;
1538
+ /** Most of the reward that can be converted into withdrawable money; `null` without a cap. */
1539
+ maximumConversion: ReferralMoney | null;
1540
+ }
1541
+ /**
1542
+ * How many of the player's referrals are in each status (integers), across all pages.
1543
+ * @category Referrals
1544
+ */
1545
+ interface ReferralTotals {
1546
+ /** In `registered`. */
1547
+ registered: number;
1548
+ /** In `deposited`. */
1549
+ deposited: number;
1550
+ /** In `in_hold`. */
1551
+ inHold: number;
1552
+ /** In `paid`. */
1553
+ paid: number;
1554
+ /** In `not_eligible`. */
1555
+ notEligible: number;
1556
+ /** In `expired`. */
1557
+ expired: number;
1558
+ /** In `cancelled`. */
1559
+ cancelled: number;
1560
+ }
1561
+ /**
1562
+ * The player's referral code, the active program rules and the totals per status (`GET /referrals`).
1508
1563
  * @category Referrals
1509
1564
  */
1510
1565
  interface ReferralInfo {
1511
- /** The player's referral code; `null` when the gateway sends it empty. */
1566
+ /**
1567
+ * `false` when the operator has no active referral campaign (and `rules` is `null`). Referrals already made keep
1568
+ * their windows open, so the totals and the history may still have rows.
1569
+ */
1570
+ enabled: boolean;
1571
+ /** The player's referral code, from the profile; `null` when the gateway sends it empty. */
1512
1572
  code: string | null;
1513
- /** Referral link ready to share; `null` when the gateway sends it empty. */
1514
- link: string | null;
1515
- /** Total referrals (integer). */
1516
- totalReferrals: number;
1517
- /** Completed referrals (integer). */
1518
- completedReferrals: number;
1519
- /** Pending referrals (integer). */
1520
- pendingReferrals: number;
1521
- /** Total earned from referrals, in minor units (the currency does not come with it). */
1522
- totalEarned: number;
1523
- /** Bonus per referral, in minor units (the currency does not come with it). */
1524
- bonusPerReferral: number;
1525
- /** Referee's minimum deposit, in minor units (the currency does not come with it). */
1526
- minDeposit: number;
1527
- }
1528
- /**
1529
- * A referral from the history (`GET /referrals/history`). Referee data: the email only comes out
1530
- * masked and the gateway's `referee_id` is not exposed.
1573
+ /**
1574
+ * Rules of the active campaign; `null` when there is none, and also when the gateway sends them without the
1575
+ * reward or the minimum real net loss (the program cannot be described without them).
1576
+ */
1577
+ rules: ReferralRules | null;
1578
+ /** Totals per status. */
1579
+ totals: ReferralTotals;
1580
+ }
1581
+ /**
1582
+ * The referred player's progress toward qualifying, in the campaign's currency.
1583
+ * @category Referrals
1584
+ */
1585
+ interface ReferralProgress {
1586
+ /** Whether the referred player already deposited. */
1587
+ depositDone: boolean;
1588
+ /** Real net loss accumulated so far (`0` when the gateway sends none). */
1589
+ realNetLoss: ReferralMoney;
1590
+ /** Real net loss required to qualify (the campaign's minimum). */
1591
+ target: ReferralMoney;
1592
+ /** `max(0, target - realNetLoss)`; computed by the SDK when the gateway leaves it out. */
1593
+ remaining: ReferralMoney;
1594
+ }
1595
+ /**
1596
+ * A referral of the history (`GET /referrals/history`): one row per referred player.
1531
1597
  * @category Referrals
1532
1598
  */
1533
1599
  interface Referral {
1534
1600
  /** Referral id. */
1535
1601
  id: string;
1536
- /** Referee's name, as the gateway sends it; `null` when empty. It is personal data: do not log it. */
1537
- refereeName: string | null;
1538
1602
  /**
1539
- * Referee's masked email: first character of the local part and one `*` per remaining character,
1540
- * whole domain (`ana@exemplo.com` → `a**@exemplo.com`; a 1-character local part becomes `*`).
1541
- * `null` when the gateway sends empty or something that is not an email. The raw email is never exposed.
1603
+ * The referred player's name, **already masked by the bonus service** (e.g. `"Ma••• R."`): show it as it is,
1604
+ * never mask it again. `null` when empty.
1542
1605
  */
1543
- refereeEmailMasked: string | null;
1544
- /** Referral code used. */
1545
- code: string;
1546
- /** Status. */
1606
+ refereeName: string | null;
1607
+ /** Where the referred player stands (see {@link ReferralStatus}). */
1547
1608
  status: ReferralStatus;
1548
- /** Referrer's bonus, in minor units. */
1549
- referrerBonus: number;
1550
- /** Referee's bonus, in minor units. */
1551
- refereeBonus: number;
1552
- /** When the referral was created (ISO 8601, UTC); `null` if the gateway does not send it. */
1609
+ /** Sign-up of the referred player (ISO 8601, UTC); `null` if the gateway does not send it. */
1553
1610
  createdAt: string | null;
1554
- /** When it was completed (ISO 8601, UTC); `null` while not completed. */
1555
- completedAt: string | null;
1556
- /** When it expires (ISO 8601, UTC); `null` when it does not expire or the gateway does not send it. */
1557
- expiresAt: string | null;
1611
+ /** End of the window to qualify (ISO 8601, UTC); `null` if the gateway does not send it. */
1612
+ deadlineAt: string | null;
1613
+ /** Progress toward qualifying; `null` when the gateway sends no target. */
1614
+ progress: ReferralProgress | null;
1558
1615
  }
1559
1616
  /**
1560
1617
  * Input of {@link ReferralsApi.listHistory}.
@@ -1563,81 +1620,47 @@ interface Referral {
1563
1620
  interface ListReferralsInput {
1564
1621
  /** Page (starts at 1; integer ≥ 1). Gateway default: 1. */
1565
1622
  page?: number;
1566
- /** Items per page (integer from 1 to 100). Gateway default: 20 (out of range also becomes 20). */
1623
+ /** Items per page (integer from 1 to 100). Gateway default: 20. On the wire it goes as `limit`. */
1567
1624
  perPage?: number;
1568
1625
  }
1569
1626
  /**
1570
- * Page of the referral history, with the totals across all pages.
1627
+ * Page of the referral history, with the player's referral code.
1571
1628
  * @category Referrals
1572
1629
  */
1573
1630
  type ReferralHistory = Page<Referral> & {
1574
- /** How many referrals are completed, across all pages (integer). */
1575
- completedCount: number;
1576
- /** Total earned from referrals, in minor units (the currency does not come with it). */
1577
- totalEarned: number;
1631
+ /** The player's referral code; `null` when the gateway sends it empty. */
1632
+ code: string | null;
1578
1633
  };
1579
1634
  /**
1580
- * Input of {@link ReferralsApi.register}.
1581
- * @category Referrals
1582
- */
1583
- interface RegisterReferralInput {
1584
- /** Another player's referral code (non-empty text; leading and trailing spaces are removed). */
1585
- code: string;
1586
- }
1587
- /**
1588
- * Referral registered by {@link ReferralsApi.register}.
1589
- * @category Referrals
1590
- */
1591
- interface RegisteredReferral {
1592
- /** Referral id. */
1593
- id: string;
1594
- /** Referral code registered. */
1595
- code: string;
1596
- /** Initial status (probably `pending`; the contract does not say). */
1597
- status: ReferralStatus;
1598
- /** Referee's bonus, in minor units. */
1599
- refereeBonus: number;
1600
- /** When it was created (ISO 8601, UTC); `null` if the gateway does not send it. */
1601
- createdAt: string | null;
1602
- }
1603
- /**
1604
- * The player's referrals. All three methods require login. Whoever is signing up passes the code in the core's
1605
- * `auth.register({ referralCode })`; the `register` here is for someone who already has an account.
1635
+ * The player's referrals. Both methods require login. A new player passes the code they were invited with in
1636
+ * the core's `auth.register({ referralCode })`: that is the only way to register a referral.
1606
1637
  * @category Referrals
1607
1638
  */
1608
1639
  interface ReferralsApi {
1609
1640
  /**
1610
- * The player's referral code, link and totals.
1641
+ * The player's referral code, the active program rules and the totals per status. Build the invitation
1642
+ * link in the app (your sign-up route with the code), so it always points at your site.
1611
1643
  * @example
1612
- * const referral = await igaming.referrals.get()
1613
- * console.log(referral.code, referral.link, referral.totalEarned)
1614
- * @throws {EnginexError} `UNAUTHENTICATED` without a session; `VALIDATION_ERROR` in `validation: 'strict'`
1615
- * if a money value is not a finite number or if a counter is not an integer ≥ 0.
1644
+ * const info = await igaming.referrals.get()
1645
+ * if (!info.enabled) showProgramUnavailable()
1646
+ * else showInvite(`${location.origin}/sign-up?ref=${info.code}`, info.rules)
1647
+ * @throws {EnginexError} `UNAUTHENTICATED` without a session; `UNAVAILABLE` when the bonus service does not
1648
+ * answer; `VALIDATION_ERROR`, also in `'warn'`, with money or currency outside the format.
1616
1649
  */
1617
1650
  get(params?: NoParams, options?: CallOptions): Promise<ReferralInfo>;
1618
1651
  /**
1619
- * Referral history, paginated. Pagination comes inside `data` (not in the envelope's `meta`):
1620
- * the SDK builds the `Page` and computes `totalPages` (`0` without items); a page beyond the end returns
1621
- * `items: []`.
1652
+ * Referral history, paginated, one row per referred player. Pagination comes inside `data` (not in the
1653
+ * envelope's `meta`): the SDK builds the `Page` and computes `totalPages` (`0` without items); a page beyond the
1654
+ * end returns `items: []`.
1622
1655
  * @example
1623
- * const { items, totalPages, completedCount } = await igaming.referrals.listHistory({ perPage: 20 })
1624
- * items.forEach((r) => console.log(r.refereeEmailMasked, r.status))
1656
+ * const { items, totalPages } = await igaming.referrals.listHistory({ perPage: 20 })
1657
+ * items.forEach((r) => console.log(r.refereeName, r.status, r.progress?.remaining.amount))
1625
1658
  * @throws {EnginexError} `CONFIGURATION_ERROR` (without a request) for a `page` that is not an integer ≥ 1 or
1626
- * a `perPage` outside 1–100 or not an integer; `UNAUTHENTICATED` without a session; `VALIDATION_ERROR` in
1627
- * `validation: 'strict'` if the status is unknown or the money is not a finite number.
1659
+ * a `perPage` outside 1–100 or not an integer; `UNAUTHENTICATED` without a session; `UNAVAILABLE` when the
1660
+ * bonus service does not answer; `VALIDATION_ERROR`, also in `'warn'`, with money or currency outside the
1661
+ * format.
1628
1662
  */
1629
1663
  listHistory(input?: ListReferralsInput, options?: CallOptions): Promise<ReferralHistory>;
1630
- /**
1631
- * Registers another player's referral code on the logged-in account (after signup). Answers
1632
- * HTTP 201.
1633
- * @example
1634
- * const result = await igaming.referrals.register({ code: 'ANA123' })
1635
- * console.log(result.status, result.refereeBonus)
1636
- * @throws {EnginexError} `CONFIGURATION_ERROR` (without a request) if `code` is not non-empty text;
1637
- * `UNAUTHENTICATED` without a session; the service refuses a nonexistent, already used or out-of-rule code:
1638
- * decide by `error.code` (the contract does not list the codes).
1639
- */
1640
- register(input: RegisterReferralInput, options?: CallOptions): Promise<RegisteredReferral>;
1641
1664
  }
1642
1665
 
1643
1666
  /**
@@ -1707,7 +1730,7 @@ interface IgamingClient {
1707
1730
  missions: MissionsApi;
1708
1731
  /** Loyalty: points balance, tier, benefits and redemption. */
1709
1732
  loyalty: LoyaltyApi;
1710
- /** Referrals: code and link, history (the referee's email masked) and code registration. */
1733
+ /** Referrals: code, program rules, totals per status and history with each referral's progress. */
1711
1734
  referrals: ReferralsApi;
1712
1735
  /** FIRST sportsbook: session to open the sportsbook in an iframe. */
1713
1736
  sportsbook: SportsbookApi;
@@ -1734,4 +1757,4 @@ interface IgamingClient {
1734
1757
  */
1735
1758
  declare function createIgaming(client: EnginexClient): IgamingClient;
1736
1759
 
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 };
1760
+ 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 ReferralMoney, type ReferralProgress, type ReferralRules, type ReferralStatus, type ReferralTotals, type ReferralsApi, type SportsActivitySelector, type SportsBetCoverageReward, type SportsBetType, type SportsBonusBetReward, type SportsbookApi, type SportsbookSession, type UserEventQualification, type UserMission, type UserMissionStatus, createIgaming };