@smartico/public-api 0.0.252 → 0.0.253

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.
Files changed (45) hide show
  1. package/dist/Base/ClassId.d.ts +2 -0
  2. package/dist/Jackpots/GetJackpotWinnersRequest.d.ts +10 -0
  3. package/dist/Jackpots/GetJackpotWinnersResponse.d.ts +20 -0
  4. package/dist/Jackpots/index.d.ts +2 -0
  5. package/dist/Raffle/GetDrawRunResponse.d.ts +2 -0
  6. package/dist/Raffle/GetRaffleDrawRunsHistoryResponse.d.ts +2 -0
  7. package/dist/Raffle/GetRafflesResponse.d.ts +10 -0
  8. package/dist/Raffle/RaffleClaimPrizeResponse.d.ts +4 -0
  9. package/dist/Raffle/RaffleDraw.d.ts +2 -2
  10. package/dist/SmarticoAPI.d.ts +17 -5
  11. package/dist/WSAPI/WSAPI.d.ts +94 -8
  12. package/dist/WSAPI/WSAPITypes.d.ts +272 -0
  13. package/dist/index.js +559 -199
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.modern.mjs +322 -14
  16. package/dist/index.modern.mjs.map +1 -1
  17. package/docs/README.md +140 -0
  18. package/docs/classes/WSAPI.md +102 -12
  19. package/docs/enums/RaffleDrawInstanceState.md +25 -0
  20. package/docs/enums/RaffleDrawTypeExecution.md +27 -0
  21. package/docs/interfaces/GetJackpotWinnersRequest.md +91 -0
  22. package/docs/interfaces/GetJackpotWinnersResponse.md +73 -0
  23. package/docs/interfaces/JackpotWinnerHistory.md +25 -0
  24. package/docs/interfaces/RaffleClaimPrizeResponse.md +3 -3
  25. package/docs/interfaces/RaffleDraw.md +2 -2
  26. package/docs/interfaces/TRaffle.md +101 -0
  27. package/docs/interfaces/TRaffleDraw.md +181 -0
  28. package/docs/interfaces/TRaffleDrawRun.md +125 -0
  29. package/docs/interfaces/TRafflePrize.md +159 -0
  30. package/docs/interfaces/TRafflePrizeWinner.md +50 -0
  31. package/docs/interfaces/TRaffleTicket.md +13 -0
  32. package/docs/interfaces/TransformedRaffleClaimPrizeResponse.md +17 -0
  33. package/package.json +1 -1
  34. package/src/Base/ClassId.ts +2 -1
  35. package/src/Jackpots/GetJackpotWinnersRequest.ts +12 -0
  36. package/src/Jackpots/GetJackpotWinnersResponse.ts +33 -0
  37. package/src/Jackpots/index.ts +2 -0
  38. package/src/Raffle/GetDrawRunResponse.ts +30 -0
  39. package/src/Raffle/GetRaffleDrawRunsHistoryResponse.ts +23 -0
  40. package/src/Raffle/GetRafflesResponse.ts +97 -0
  41. package/src/Raffle/RaffleClaimPrizeResponse.ts +16 -1
  42. package/src/Raffle/RaffleDraw.ts +2 -2
  43. package/src/SmarticoAPI.ts +45 -24
  44. package/src/WSAPI/WSAPI.ts +144 -9
  45. package/src/WSAPI/WSAPITypes.ts +307 -0
@@ -99,6 +99,8 @@ export declare enum ClassId {
99
99
  JP_OPTOUT_REQUEST = 806,
100
100
  JP_OPTOUT_RESPONSE = 807,
101
101
  JP_WIN_PUSH = 808,
102
+ JP_GET_WINNERS_REQUEST = 809,
103
+ JP_GET_WINNERS_RESPONSE = 810,
102
104
  RAF_GET_RAFFLES_REQUEST = 902,
103
105
  RAF_GET_RAFFLES_RESPONSE = 903,
104
106
  RAF_GET_DRAW_RUN_REQUEST = 904,
@@ -0,0 +1,10 @@
1
+ import { ProtocolRequest } from "src/Base/ProtocolRequest";
2
+ interface GetJackpotWinnersRequest extends ProtocolRequest {
3
+ /** The ID of the jackpot template */
4
+ jp_template_id: number;
5
+ /** The number of winners to return */
6
+ limit: number;
7
+ /** The offset of the winners to return */
8
+ offset: number;
9
+ }
10
+ export { GetJackpotWinnersRequest };
@@ -0,0 +1,20 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ import { JackPotWinner } from "./JackPotWinner";
3
+ export interface GetJackpotWinnersResponse extends ProtocolResponse {
4
+ /** The list of jackpot winners */
5
+ winners: JackpotWinnerHistory[];
6
+ /** Whether there are more winners to fetch */
7
+ has_more: boolean;
8
+ }
9
+ export interface JackpotWinnerHistory {
10
+ /** Id of the jackpot pot */
11
+ jp_pot_id: number;
12
+ /** Date of winning in milliseconds */
13
+ win_date_ts: number;
14
+ /** Info about jackpot winner */
15
+ winner: JackPotWinner;
16
+ }
17
+ /**
18
+ * @ignore
19
+ */
20
+ export declare const GetJackpotWinnersResponseTransform: (items: JackpotWinnerHistory[]) => JackpotWinnerHistory[];
@@ -14,3 +14,5 @@ export * from './JackpotsOptinResponse';
14
14
  export * from './JackpotsOptoutRequest';
15
15
  export * from './JackpotsOptoutResponse';
16
16
  export * from './JackpotHtmlTemplate';
17
+ export * from './GetJackpotWinnersRequest';
18
+ export * from './GetJackpotWinnersResponse';
@@ -1,5 +1,7 @@
1
+ import { TRaffleDraw } from 'src/WSAPI/WSAPITypes';
1
2
  import { ProtocolResponse } from '../Base/ProtocolResponse';
2
3
  import { RaffleDraw } from './RaffleDraw';
3
4
  export interface GetDrawRunResponse extends ProtocolResponse {
4
5
  draw: RaffleDraw;
5
6
  }
7
+ export declare const drawRunTransform: (res: GetDrawRunResponse) => TRaffleDraw;
@@ -1,5 +1,7 @@
1
+ import { TRaffleDrawRun } from 'src/WSAPI/WSAPITypes';
1
2
  import { ProtocolResponse } from '../Base/ProtocolResponse';
2
3
  import { RaffleDrawRun } from './RaffleDrawRun';
3
4
  export interface GetRaffleDrawRunsHistoryResponse extends ProtocolResponse {
4
5
  draw_runs: RaffleDrawRun[];
5
6
  }
7
+ export declare const drawRunHistoryTransform: (res: GetRaffleDrawRunsHistoryResponse) => TRaffleDrawRun[];
@@ -1,5 +1,15 @@
1
+ import { TRaffle, TRaffleDraw, TRafflePrize, TRafflePrizeWinner, TRaffleTicket } from 'src/WSAPI/WSAPITypes';
1
2
  import { ProtocolResponse } from '../Base/ProtocolResponse';
2
3
  import { Raffle } from './Raffle';
4
+ import { RaffleDraw } from './RaffleDraw';
5
+ import { RafflePrize } from './RafflePrize';
6
+ import { RafflePrizeWinner } from './RafflePrizeWinner';
7
+ import { RaffleTicket } from './RaffleTicket';
3
8
  export interface GetRafflesResponse extends ProtocolResponse {
4
9
  items: Raffle[];
5
10
  }
11
+ export declare const ticketsTransform: (items: RaffleTicket[]) => TRaffleTicket[];
12
+ export declare const winnersTransform: (items: RafflePrizeWinner[]) => TRafflePrizeWinner[];
13
+ export declare const prizeTransform: (items: RafflePrize[]) => TRafflePrize[];
14
+ export declare const drawTransform: (items: RaffleDraw[]) => TRaffleDraw[];
15
+ export declare const raffleTransform: (items: Raffle[]) => TRaffle[];
@@ -1,3 +1,7 @@
1
+ import { TransformedRaffleClaimPrizeResponse } from "src/WSAPI/WSAPITypes";
1
2
  import { ProtocolResponse } from "../Base/ProtocolResponse";
2
3
  export interface RaffleClaimPrizeResponse extends ProtocolResponse {
4
+ errCode: number;
5
+ errMsg?: string;
3
6
  }
7
+ export declare const raffleClaimPrizeResponseTransform: (info: RaffleClaimPrizeResponse) => TransformedRaffleClaimPrizeResponse;
@@ -1,7 +1,7 @@
1
1
  import { RaffleDrawPublicMeta } from "./RaffleDrawPublicMeta";
2
2
  import { RafflePrize } from "./RafflePrize";
3
3
  import { RaffleTicket } from "./RaffleTicket";
4
- declare enum RaffleDrawInstanceState {
4
+ export declare enum RaffleDrawInstanceState {
5
5
  /** Draw is open for the tickets collection */
6
6
  Open = 1,
7
7
  /** Winner selection is in progress */
@@ -9,7 +9,7 @@ declare enum RaffleDrawInstanceState {
9
9
  /** Draw is executed and the winners are selected */
10
10
  Executed = 3
11
11
  }
12
- declare enum RaffleDrawTypeExecution {
12
+ export declare enum RaffleDrawTypeExecution {
13
13
  /** Draw is executed only once */
14
14
  ExecDate = 0,
15
15
  /** Draw is executed on a recurring basis */
@@ -11,7 +11,7 @@ import { GetTournamentInfoResponse, GetTournamentsResponse, TournamentRegisterRe
11
11
  import { LeaderBoardDetails, LeaderBoardPeriodType } from './Leaderboard';
12
12
  import { GetLevelMapResponse } from './Level';
13
13
  import { WSAPI } from './WSAPI/WSAPI';
14
- import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT, TSegmentCheckResult, TUICustomSection, TBonus } from './WSAPI/WSAPITypes';
14
+ import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT, TSegmentCheckResult, TUICustomSection, TBonus, TRaffle } from './WSAPI/WSAPITypes';
15
15
  import { GetAchievementsUserInfoResponse } from './Core/GetAchievementsUserInfoResponse';
16
16
  import { GetJackpotsPotsResponse, GetJackpotsResponse, JackpotsOptinResponse, JackpotsOptoutResponse } from './Jackpots';
17
17
  import { GetCustomSectionsResponse } from './CustomSections';
@@ -21,7 +21,8 @@ import { SAWDoAcknowledgeBatchResponse } from './MiniGames/SAWDoAcknowledgeBatch
21
21
  import { GetRelatedAchTourResponse } from './Missions/GetRelatedAchTourResponse';
22
22
  import { GetRafflesResponse } from './Raffle/GetRafflesResponse';
23
23
  import { InboxCategories } from './Inbox/InboxCategories';
24
- import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeRequest, RaffleClaimPrizeResponse } from './Raffle';
24
+ import { GetDrawRunResponse, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeResponse } from './Raffle';
25
+ import { GetJackpotWinnersResponse, JackpotWinnerHistory } from './Jackpots/GetJackpotWinnersResponse';
25
26
  interface Tracker {
26
27
  label_api_key: string;
27
28
  userPublicProps: any;
@@ -81,6 +82,8 @@ declare class SmarticoAPI {
81
82
  jackpotOptOut(user_ext_id: string, payload: {
82
83
  jp_template_id: number;
83
84
  }): Promise<JackpotsOptoutResponse>;
85
+ getJackpotWinners(user_ext_id: string, limit: number, offset: number, jp_template_id: number): Promise<GetJackpotWinnersResponse>;
86
+ getJackpotWinnersT(user_ext_id: string, limit: number, offset: number, jp_template_id: number): Promise<JackpotWinnerHistory[]>;
84
87
  sawGetTemplates(user_ext_id: string, force_language?: string, is_visitor_mode?: boolean): Promise<SAWGetTemplatesResponse>;
85
88
  sawGetTemplatesT(user_ext_id: string): Promise<TMiniGameTemplate[]>;
86
89
  doAcknowledgeRequest(user_ext_id: string, request_id: string): Promise<SAWDoAknowledgeResponse>;
@@ -133,9 +136,18 @@ declare class SmarticoAPI {
133
136
  deleteAllInboxMessages(user_ext_id: string): Promise<MarkInboxMessageDeletedResponse>;
134
137
  getWSCalls(): WSAPI;
135
138
  getRelatedItemsForGame(user_ext_id: string, related_game_id: string): Promise<GetRelatedAchTourResponse>;
139
+ getRafflesT(user_ext_id: string): Promise<TRaffle[]>;
136
140
  getRaffles(user_ext_id: string): Promise<GetRafflesResponse>;
137
- getDrawRun(user_ext_id: string, payload: GetDrawRunRequest): Promise<GetDrawRunResponse>;
138
- getRaffleDrawRunsHistory(user_ext_id: string, payload: GetRaffleDrawRunsHistoryRequest): Promise<GetRaffleDrawRunsHistoryResponse>;
139
- claimRafflePrize(user_ext_id: string, payload: RaffleClaimPrizeRequest): Promise<RaffleClaimPrizeResponse>;
141
+ getRaffleDrawRun(user_ext_id: string, payload: {
142
+ raffle_id: number;
143
+ run_id: number;
144
+ }): Promise<GetDrawRunResponse>;
145
+ getRaffleDrawRunsHistory(user_ext_id: string, props: {
146
+ raffle_id: number;
147
+ draw_id?: number;
148
+ }): Promise<GetRaffleDrawRunsHistoryResponse>;
149
+ claimRafflePrize(user_ext_id: string, props: {
150
+ won_id: number;
151
+ }): Promise<RaffleClaimPrizeResponse>;
140
152
  }
141
153
  export { SmarticoAPI, MessageSender };
@@ -1,11 +1,9 @@
1
1
  import { SmarticoAPI } from '../SmarticoAPI';
2
- import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT, TBonus, TClaimBonusResult, TMiniGamePlayBatchResult, TSawHistory } from './WSAPITypes';
2
+ import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT, TBonus, TClaimBonusResult, TMiniGamePlayBatchResult, TSawHistory, TRaffle, TRaffleDraw, TRaffleDrawRun, TransformedRaffleClaimPrizeResponse } from './WSAPITypes';
3
3
  import { LeaderBoardPeriodType } from '../Leaderboard';
4
- import { JackpotDetails, JackpotsOptinResponse, JackpotsOptoutResponse } from '../Jackpots';
4
+ import { JackpotDetails, JackpotWinnerHistory, JackpotsOptinResponse, JackpotsOptoutResponse } from '../Jackpots';
5
5
  import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
6
- import { GetRafflesResponse } from '../Raffle/GetRafflesResponse';
7
6
  import { InboxCategories } from '../Inbox/InboxCategories';
8
- import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeRequest, RaffleClaimPrizeResponse } from '../Raffle';
9
7
  /** @group General API */
10
8
  export declare class WSAPI {
11
9
  private api;
@@ -467,6 +465,7 @@ export declare class WSAPI {
467
465
  private updateBonuses;
468
466
  private updateTournaments;
469
467
  private updateInboxMessages;
468
+ private updateRaffles;
470
469
  private updateEntity;
471
470
  private jackpotClearCache;
472
471
  /** Returns list of Jackpots that are active in the systen and matching to the filter definition.
@@ -526,6 +525,26 @@ export declare class WSAPI {
526
525
  jackpotOptOut(filter: {
527
526
  jp_template_id: number;
528
527
  }): Promise<JackpotsOptoutResponse>;
528
+ /**
529
+ * Returns the winners of the jackpot with the specified jp_template_id.
530
+ *
531
+ * **Example**:
532
+ * ```
533
+ * _smartico.api.getJackpotWinners({
534
+ * jp_template_id: 123,
535
+ * }).then((result) => {
536
+ * console.log(result);
537
+ * });
538
+ * ```
539
+ *
540
+ * **Visitor mode: not supported**
541
+ *
542
+ */
543
+ getJackpotWinners({ limit, offset, jp_template_id, }: {
544
+ limit?: number;
545
+ offset?: number;
546
+ jp_template_id?: number;
547
+ }): Promise<JackpotWinnerHistory[]>;
529
548
  /**
530
549
  * Returns all the related tournaments and missions for the provided game id for the current user
531
550
  * The provided Game ID should correspond to the ID from the Games Catalog - https://help.smartico.ai/welcome/technical-guides/games-catalog-api
@@ -545,8 +564,75 @@ export declare class WSAPI {
545
564
  * ```
546
565
  */
547
566
  getRelatedItemsForGame(related_game_id: string): Promise<GetRelatedAchTourResponse>;
548
- getRaffles(): Promise<GetRafflesResponse>;
549
- getDrawRun(payload: GetDrawRunRequest): Promise<GetDrawRunResponse>;
550
- getRaffleDrawRunsHistory(payload: GetRaffleDrawRunsHistoryRequest): Promise<GetRaffleDrawRunsHistoryResponse>;
551
- claimRafflePrize(payload: RaffleClaimPrizeRequest): Promise<RaffleClaimPrizeResponse>;
567
+ /**
568
+ * Returns the list of Raffles available for user
569
+ * The returned list of Raffles is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getRaffles with a new onUpdate callback, the old one will be overwritten by the new one.
570
+ * The onUpdate callback will be called on claiming prize. Updated Raffles will be passed to onUpdate callback.
571
+ *
572
+ * **Example**:
573
+ * ```
574
+ * _smartico.api.getRaffles().then((result) => {
575
+ * console.log(result);
576
+ * });
577
+ * ```
578
+ *
579
+ * **Visitor mode: not supported**
580
+ *
581
+ */
582
+ getRaffles({ onUpdate }?: {
583
+ onUpdate?: (data: TRaffle[]) => void;
584
+ }): Promise<TRaffle[]>;
585
+ /**
586
+ * Returns draw run for provided raffle_id and run_id
587
+ *
588
+ *
589
+ * **Example**:
590
+ * ```
591
+ * _smartico.api.getRaffleDrawRun({raffle_id:156, run_id: 145}).then((result) => {
592
+ * console.log(result);
593
+ * });
594
+ * ```
595
+ *
596
+ * **Visitor mode: not supported**
597
+ *
598
+ */
599
+ getRaffleDrawRun(props: {
600
+ raffle_id: number;
601
+ run_id: number;
602
+ }): Promise<TRaffleDraw>;
603
+ /**
604
+ * Returns history of draw runs for the provided raffle_id and draw_id, if the draw_id is not provided will return history of all the draws for the provided raffle_id
605
+ *
606
+ *
607
+ * **Example**:
608
+ * ```
609
+ * _smartico.api.getRaffleDrawRunHistory({raffle_id:156, draw_id: 432}).then((result) => {
610
+ * console.log(result);
611
+ * });
612
+ * ```
613
+ *
614
+ * **Visitor mode: not supported**
615
+ *
616
+ */
617
+ getRaffleDrawRunsHistory(props: {
618
+ raffle_id: number;
619
+ draw_id?: number;
620
+ }): Promise<TRaffleDrawRun[]>;
621
+ /**
622
+ * Returns error code, and error Message after calling the function, error message 0 - means that the request was successful
623
+ *
624
+ *
625
+ * **Example**:
626
+ * ```
627
+ * _smartico.api.claimRafflePrize({won_id:251}).then((result) => {
628
+ * console.log(result);
629
+ * });
630
+ * ```
631
+ *
632
+ * **Visitor mode: not supported**
633
+ *
634
+ */
635
+ claimRafflePrize(props: {
636
+ won_id: number;
637
+ }): Promise<TransformedRaffleClaimPrizeResponse>;
552
638
  }
@@ -7,6 +7,7 @@ import { AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, Ach
7
7
  import { BonusStatus, BonusTemplateMetaMap, BonusMetaMap } from '../Bonuses';
8
8
  import { PrizeModifiers } from '../MiniGames/PrizeModifiers';
9
9
  import { InboxCategories } from '../Inbox/InboxCategories';
10
+ import { RaffleDrawInstanceState, RaffleDrawTypeExecution } from 'src/Raffle';
10
11
  type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string;
11
12
  /**
12
13
  * TMiniGamePrize describes the information of prize in the array of prizes in the TMiniGameTemplate
@@ -790,4 +791,275 @@ export interface TSawHistory {
790
791
  /** Claimed prize date in milliseconds */
791
792
  acknowledge_date_ts: number;
792
793
  }
794
+ export interface TRaffle {
795
+ /** ID of the Raffle template */
796
+ id: number;
797
+ /** Name of the raffle */
798
+ name: string;
799
+ /** Description of the raffle */
800
+ description: string;
801
+ /** ID of the custom section that is linked to the raffle in the Gamification widget */
802
+ custom_section_id: number;
803
+ /** URL of the image that represents the raffle */
804
+ image_url: string;
805
+ /** URL of the mobile image that represents the raffle */
806
+ image_url_mobile: string;
807
+ /**
808
+ * Custom data as string or JSON string that can be used in API to build custom UI
809
+ * You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
810
+ * Read more here - https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes
811
+ */
812
+ custom_data: string;
813
+ /** Date of start */
814
+ start_date: number;
815
+ /** Date of end */
816
+ end_date: number;
817
+ /** Maximum numer of tickets that can be given to all users for the whole period of raffle */
818
+ max_tickets_count: number;
819
+ /**
820
+ * Number of tickets that are already given to all users for this raffle
821
+ */
822
+ current_tickets_count: number;
823
+ /**
824
+ * List of draws that are available for this raffle.
825
+ * For example, if the raffle is containg one hourly draw, one daily draw and one draw on fixed date like 01/01/2022,
826
+ * Then the list will always return 3 draws, no matter if the draws are already executed or they are in the future.
827
+ */
828
+ draws: TRaffleDraw[];
829
+ }
830
+ export interface TRaffleTicket {
831
+ ticekt_id: number;
832
+ ticket_id_string: string;
833
+ }
834
+ export interface TRafflePrize {
835
+ /**
836
+ * The unique identifier for the prize definition
837
+ */
838
+ id: string;
839
+ /** Name of the prize */
840
+ name: string;
841
+ /** Description of the prize */
842
+ description: string;
843
+ /** URL of the image that represents the prize */
844
+ image_url: string;
845
+ /**
846
+ * The number of prizes available per run of the draw.
847
+ * E.g. if the draw is run daily, this is the number of prizes available each day, for example 3 iPhones.
848
+ */
849
+ prizes_per_run: number;
850
+ /**
851
+ * The actual number of prizes for the current instance.
852
+ * This value is taking into account follwing values:
853
+ * - min_required_total_tickets,
854
+ * - add_one_prize_per_each_x_tickets
855
+ * - stock_items_per_draw
856
+ * - total_tickets_count (from Draw instance)
857
+ * - cap_prizes_per_run
858
+ * For example:
859
+ * - prizes_per_run = 1
860
+ * - min_required_total_tickets = 1000
861
+ * - add_one_prize_per_each_x_tickets = 1000
862
+ * - stock_items_per_draw = 5
863
+ * - total_tickets_count = 7000
864
+ * - cap_prizes_per_run = 6
865
+ * prizes_per_run_actual will be 5, because
866
+ * 7000 tickets are collected, so 7 iPhones are available, but the cap is 6 and the stock is 5.
867
+ */
868
+ prizes_per_run_actual: number;
869
+ /**
870
+ *
871
+ * The chances to win the prize by current player.
872
+ * Calculated as the ratio of the number of tickets collected by the current player to the
873
+ * total number of tickets collected by all players and multiplied by number of actual prizes of this kind.
874
+ */
875
+ chances_to_win_perc: number;
876
+ /**
877
+ * The minimum number of total tickets collected during draw period required to unlock the prize.
878
+ * If the number of tickets collected is less than this value, the prize is not available.
879
+ * Under total tickets we understand the number of tickets collected by all users.
880
+ * The 'draw period' is the time between the ticket_start_date value of the draw and the current time.
881
+ */
882
+ min_required_total_tickets?: number;
883
+ /**
884
+ * One additional prize will be awarded for each X tickets.
885
+ * E.g. if the prize is 1 iPhone and the value is set to 1000, then for every 1000 tickets collected, an additional iPhone is awarded.
886
+ * If min_required_total_tickets is set to 1000, then next iPhone is awarded when 2000 tickets are collected, and so on.
887
+ * If min_required_total_tickets is not set, then the next iPhone will be awarded when 1000 tickets are collected.
888
+ */
889
+ add_one_prize_per_each_x_tickets?: number;
890
+ /**
891
+ * Indicates whether the prize requires a claim action from the user.
892
+ */
893
+ requires_claim: boolean;
894
+ /**
895
+ * The minimum number of tickets a user must have to be eligible for the prize.
896
+ * For example iPhone prize may require 10 tickets to be collected, only users with 10 or more tickets will be eligible for the prize.
897
+ * More tickets are better, as they increase the chances of winning.
898
+ */
899
+ min_required_tickets_for_user: number;
900
+ /**
901
+ * The maximum number of prizes that can be given withing one instance/run of draw.
902
+ * For example the prize is iPhone and add_one_prize_per_each_x_tickets is set to 1000,
903
+ * cap_prizes_per_run is set to 3, and the total number of tickets collected is 7000.
904
+ * In this case, the prizes_per_run_actual will be limitted by 3
905
+ */
906
+ cap_prizes_per_run?: number;
907
+ /**
908
+ * The priority of the prize. The low number means higher priority (e.g. 1 is higher priority than 2).
909
+ * If there are multiple prizes available, the prize with the highest priority (lowest number) will be awarded first.
910
+ */
911
+ priority: number;
912
+ /**
913
+ * Optional field that indicates total remaining number of the prize for all draws of the type.
914
+ * For example, the Daily draw has 1 iPhone daily, and the total number of iPhones is 10.
915
+ * the stock_items_per_draw will be decreasing by 1 each day (assuming there is enough tickets and it is won every day), and when it reaches 0, the prize is not available anymore.
916
+ */
917
+ stock_items_per_draw?: number;
918
+ /**
919
+ * Shows if the prize has been claimed
920
+ */
921
+ should_claim: boolean;
922
+ winners: TRafflePrizeWinner[];
923
+ }
924
+ export interface TRafflePrizeWinner {
925
+ /**
926
+ * Id of the winner definition, for the repetative winners (e.g. same winner won two prizes), this number will be the same for all winner that are repeating
927
+ * (internal name: schedule_id)
928
+ */
929
+ id: number;
930
+ /** Winner user name */
931
+ username?: string;
932
+ /** URL of the image of user avatar*/
933
+ avatar_url?: string;
934
+ /** Ticket information (number string and integer)*/
935
+ ticket: TRaffleTicket;
936
+ /** Unique ID of winning*/
937
+ raf_won_id: number;
938
+ /** Date when the prize was claimed*/
939
+ claimed_date: number;
940
+ }
941
+ export interface TRaffleDraw {
942
+ /**
943
+ * Id of the Draw definition, for the repetative draws (e.g. daily), this number will be the same for all draws that are repeating daily
944
+ * (internal name: schedule_id)
945
+ */
946
+ id: number;
947
+ /** Name of the draw, e.g. 'Daily draw' */
948
+ name: string;
949
+ /** Description of the draw */
950
+ description: string;
951
+ /** URL of the image that represents the draw */
952
+ image_url: string;
953
+ /** URL of the moible image that represents the draw */
954
+ image_url_mobile: string;
955
+ /** URL of the icon that represents the draw */
956
+ icon_url: string;
957
+ /** URL of the background image that will be used in the draw list item */
958
+ background_image_url: string;
959
+ /** URL of the moible background image that will be used in the draw list item */
960
+ background_image_url_mobile: string;
961
+ /** Show if the draw is grand and is marked as special */
962
+ is_grand: boolean;
963
+ /** Information about prizes in the draw */
964
+ prizes: TRafflePrize[];
965
+ /**
966
+ * State of current instance of Draw
967
+ */
968
+ current_state: RaffleDrawInstanceState;
969
+ /**
970
+ * Field indicates the ID of the latest instance/run of draw
971
+ */
972
+ run_id: number;
973
+ /**
974
+ * Type of the draw execution, indicating how and when the draw is executed.
975
+ * - ExecDate: Draw is executed only once at a specific date and time.
976
+ * - Recurring: Draw is executed on a recurring basis (e.g., daily, weekly).
977
+ * - Grand: Draw is executed once and is marked as grand, often with larger prizes or more importance.
978
+ */
979
+ execution_type: RaffleDrawTypeExecution;
980
+ /** Date/time of the draw execution */
981
+ execution_ts: number;
982
+ /** Date of the previously executed draw (if there is such) */
983
+ previous_run_ts?: number;
984
+ /** Unique ID of the previusly executed draw (if there is such) */
985
+ previous_run_id?: number;
986
+ /**
987
+ * Date/time starting from which the tickets will participate in the upcoming draw
988
+ * This value need to be taken into account with next_execute_ts field value, for example
989
+ * Next draw is at 10:00, ticket_start_date is 9:00, so all tickets that are collected after 9:00 will participate in the draw at 10:00
990
+ * (internally this value is calculated as next_execute_ts - ticket_start_date)
991
+ */
992
+ ticket_start_ts: number;
993
+ /** Field is indicating if same ticket can win multiple prizes in the same draw
994
+ * For example there are 3 types of prizes in the draw - iPhone, iPad, MacBook
995
+ * If this field is true, then one ticket can win all 3 prizes (depending on the chances of course),
996
+ * if false, then one ticket can win only one prize.
997
+ * The distribution of the prizes is start from top (assuming on top are the most valuable prizes) to bottom (less valuable prizes)
998
+ * If specific prize has multiple values, e.g. we have 3 iPhones,
999
+ * then the same ticket can win only one prize of a kind, but can win multiple prizes of different kind (if allow_multi_prize_per_ticket is true)
1000
+ */
1001
+ allow_multi_prize_per_ticket: boolean;
1002
+ /**
1003
+ * The number of tickets that are already given to all users for this instance of draw.
1004
+ * In other words tickets that are collected between ticket_start_date and current time (or till current_execution_ts is the instance is executed).
1005
+ */
1006
+ total_tickets_count: number;
1007
+ /**
1008
+ * The number of tickets collected by current user for this instance of draw.
1009
+ */
1010
+ my_tickets_count: number;
1011
+ my_last_tickets: TRaffleTicket[];
1012
+ }
1013
+ export interface TRaffleDrawRun {
1014
+ /**
1015
+ * Id of the Draw definition, for the repetative draws (e.g. daily), this number will be the same for all draws that are repeating daily
1016
+ * (internal name: schedule_id)
1017
+ */
1018
+ id: number;
1019
+ /**
1020
+ * Field indicates the ID of the latest instance/run of draw
1021
+ */
1022
+ run_id: number;
1023
+ /** Name of the draw, e.g. 'Daily draw' */
1024
+ name: string;
1025
+ /** Description of the draw */
1026
+ description: string;
1027
+ /** URL of the image that represents the draw */
1028
+ image_url: string;
1029
+ /** URL of the moible image that represents the draw */
1030
+ image_url_mobile: string;
1031
+ /** URL of the icon that represents the draw */
1032
+ icon_url: string;
1033
+ /** URL of the background image that will be used in the draw list item */
1034
+ background_image_url: string;
1035
+ /** URL of the moible background image that will be used in the draw list item */
1036
+ background_image_url_mobile: string;
1037
+ /** Show if the draw is grand and is marked as special */
1038
+ is_grand: boolean;
1039
+ /** Date/time of the draw execution */
1040
+ execution_ts: number;
1041
+ /** Actual Date/time of the draw execution */
1042
+ actual_execution_ts: number;
1043
+ /**
1044
+ * Date/time starting from which the tickets will participate in the upcoming draw
1045
+ * This value need to be taken into account with next_execute_ts field value, for example
1046
+ * Next draw is at 10:00, ticket_start_date is 9:00, so all tickets that are collected after 9:00 will participate in the draw at 10:00
1047
+ * (internally this value is calculated as next_execute_ts - ticket_start_date)
1048
+ */
1049
+ ticket_start_ts: number;
1050
+ /**
1051
+ * Shows if user has won a prize in a current run
1052
+ */
1053
+ is_winner: boolean;
1054
+ /**
1055
+ * Shows if user has unclaimed prize
1056
+ */
1057
+ has_unclaimed_prize: boolean;
1058
+ }
1059
+ export interface TransformedRaffleClaimPrizeResponse {
1060
+ /** Error code, 0 means no error */
1061
+ errorCode: number;
1062
+ /** Error message, will be exposed only if ErrorCode is not 0 */
1063
+ errorMessage?: string;
1064
+ }
793
1065
  export {};