@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
@@ -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';import { JackPotWinner } from 'src/Jackpots/JackPotWinner';
10
11
 
11
12
 
12
13
  type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string;
@@ -867,3 +868,309 @@ export interface TSawHistory {
867
868
  /** Claimed prize date in milliseconds */
868
869
  acknowledge_date_ts: number;
869
870
  }
871
+
872
+ export interface TRaffle {
873
+ /** ID of the Raffle template */
874
+ id: number;
875
+ /** Name of the raffle */
876
+ name: string;
877
+ /** Description of the raffle */
878
+ description: string;
879
+ /** ID of the custom section that is linked to the raffle in the Gamification widget */
880
+ custom_section_id: number;
881
+ /** URL of the image that represents the raffle */
882
+ image_url: string;
883
+ /** URL of the mobile image that represents the raffle */
884
+ image_url_mobile: string;
885
+ /**
886
+ * Custom data as string or JSON string that can be used in API to build custom UI
887
+ * You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
888
+ * Read more here - https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes
889
+ */
890
+ custom_data: string;
891
+ /** Date of start */
892
+ start_date: number;
893
+ /** Date of end */
894
+ end_date: number;
895
+ /** Maximum numer of tickets that can be given to all users for the whole period of raffle */
896
+ max_tickets_count: number;
897
+ /**
898
+ * Number of tickets that are already given to all users for this raffle
899
+ */
900
+ current_tickets_count: number;
901
+ /**
902
+ * List of draws that are available for this raffle.
903
+ * For example, if the raffle is containg one hourly draw, one daily draw and one draw on fixed date like 01/01/2022,
904
+ * Then the list will always return 3 draws, no matter if the draws are already executed or they are in the future.
905
+ */
906
+ draws: TRaffleDraw[];
907
+ }
908
+
909
+ export interface TRaffleTicket {
910
+ /* int presentation of the ticket */
911
+ ticekt_id: number;
912
+ /* String presentation of ticket */
913
+ ticket_id_string: string;
914
+ }
915
+
916
+ export interface TRafflePrize {
917
+ /**
918
+ * The unique identifier for the prize definition
919
+ */
920
+ id: string;
921
+
922
+ /** Name of the prize */
923
+ name: string;
924
+ /** Description of the prize */
925
+ description: string;
926
+ /** URL of the image that represents the prize */
927
+ image_url: string;
928
+ /**
929
+ * The number of prizes available per run of the draw.
930
+ * E.g. if the draw is run daily, this is the number of prizes available each day, for example 3 iPhones.
931
+ */
932
+ prizes_per_run: number;
933
+
934
+ /**
935
+ * The actual number of prizes for the current instance.
936
+ * This value is taking into account follwing values:
937
+ * - min_required_total_tickets,
938
+ * - add_one_prize_per_each_x_tickets
939
+ * - stock_items_per_draw
940
+ * - total_tickets_count (from Draw instance)
941
+ * - cap_prizes_per_run
942
+ * For example:
943
+ * - prizes_per_run = 1
944
+ * - min_required_total_tickets = 1000
945
+ * - add_one_prize_per_each_x_tickets = 1000
946
+ * - stock_items_per_draw = 5
947
+ * - total_tickets_count = 7000
948
+ * - cap_prizes_per_run = 6
949
+ * prizes_per_run_actual will be 5, because
950
+ * 7000 tickets are collected, so 7 iPhones are available, but the cap is 6 and the stock is 5.
951
+ */
952
+ prizes_per_run_actual: number;
953
+
954
+ /**
955
+ *
956
+ * The chances to win the prize by current player.
957
+ * Calculated as the ratio of the number of tickets collected by the current player to the
958
+ * total number of tickets collected by all players and multiplied by number of actual prizes of this kind.
959
+ */
960
+ chances_to_win_perc: number;
961
+
962
+ /**
963
+ * The minimum number of total tickets collected during draw period required to unlock the prize.
964
+ * If the number of tickets collected is less than this value, the prize is not available.
965
+ * Under total tickets we understand the number of tickets collected by all users.
966
+ * The 'draw period' is the time between the ticket_start_date value of the draw and the current time.
967
+ */
968
+ min_required_total_tickets?: number;
969
+
970
+ /**
971
+ * One additional prize will be awarded for each X tickets.
972
+ * 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.
973
+ * If min_required_total_tickets is set to 1000, then next iPhone is awarded when 2000 tickets are collected, and so on.
974
+ * If min_required_total_tickets is not set, then the next iPhone will be awarded when 1000 tickets are collected.
975
+ */
976
+ add_one_prize_per_each_x_tickets?: number;
977
+
978
+ /**
979
+ * Indicates whether the prize requires a claim action from the user.
980
+ */
981
+ requires_claim: boolean;
982
+
983
+ /**
984
+ * The minimum number of tickets a user must have to be eligible for the prize.
985
+ * For example iPhone prize may require 10 tickets to be collected, only users with 10 or more tickets will be eligible for the prize.
986
+ * More tickets are better, as they increase the chances of winning.
987
+ */
988
+ min_required_tickets_for_user: number;
989
+
990
+ /**
991
+ * The maximum number of prizes that can be given withing one instance/run of draw.
992
+ * For example the prize is iPhone and add_one_prize_per_each_x_tickets is set to 1000,
993
+ * cap_prizes_per_run is set to 3, and the total number of tickets collected is 7000.
994
+ * In this case, the prizes_per_run_actual will be limitted by 3
995
+ */
996
+ cap_prizes_per_run?: number;
997
+
998
+ /**
999
+ * The priority of the prize. The low number means higher priority (e.g. 1 is higher priority than 2).
1000
+ * If there are multiple prizes available, the prize with the highest priority (lowest number) will be awarded first.
1001
+ */
1002
+ priority: number;
1003
+
1004
+ /**
1005
+ * Optional field that indicates total remaining number of the prize for all draws of the type.
1006
+ * For example, the Daily draw has 1 iPhone daily, and the total number of iPhones is 10.
1007
+ * 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.
1008
+ */
1009
+ stock_items_per_draw?: number;
1010
+
1011
+ /**
1012
+ * Shows if the prize has been claimed
1013
+ */
1014
+ should_claim: boolean;
1015
+
1016
+ winners: TRafflePrizeWinner[];
1017
+ }
1018
+
1019
+ export interface TRafflePrizeWinner {
1020
+ /**
1021
+ * 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
1022
+ * (internal name: schedule_id)
1023
+ */
1024
+ id: number;
1025
+ /** Winner user name */
1026
+ username?: string;
1027
+ /** URL of the image of user avatar*/
1028
+ avatar_url?: string;
1029
+ /** Ticket information (number string and integer)*/
1030
+ ticket: TRaffleTicket;
1031
+ /** Unique ID of winning*/
1032
+ raf_won_id: number;
1033
+ /** Date when the prize was claimed*/
1034
+ claimed_date: number;
1035
+ }
1036
+
1037
+ export interface TRaffleDraw {
1038
+ /**
1039
+ * 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
1040
+ * (internal name: schedule_id)
1041
+ */
1042
+ id: number;
1043
+ /** Name of the draw, e.g. 'Daily draw' */
1044
+ name: string;
1045
+ /** Description of the draw */
1046
+ description: string;
1047
+ /** URL of the image that represents the draw */
1048
+ image_url: string;
1049
+ /** URL of the moible image that represents the draw */
1050
+ image_url_mobile: string;
1051
+ /** URL of the icon that represents the draw */
1052
+ icon_url: string;
1053
+ /** URL of the background image that will be used in the draw list item */
1054
+ background_image_url: string;
1055
+ /** URL of the moible background image that will be used in the draw list item */
1056
+ background_image_url_mobile: string;
1057
+ /** Show if the draw is grand and is marked as special */
1058
+ is_grand: boolean;
1059
+
1060
+ /** Information about prizes in the draw */
1061
+ prizes: TRafflePrize[];
1062
+
1063
+ /**
1064
+ * State of current instance of Draw
1065
+ */
1066
+ current_state: RaffleDrawInstanceState;
1067
+
1068
+ /**
1069
+ * Field indicates the ID of the latest instance/run of draw
1070
+ */
1071
+ run_id: number;
1072
+
1073
+ /**
1074
+ * Type of the draw execution, indicating how and when the draw is executed.
1075
+ * - ExecDate: Draw is executed only once at a specific date and time.
1076
+ * - Recurring: Draw is executed on a recurring basis (e.g., daily, weekly).
1077
+ * - Grand: Draw is executed once and is marked as grand, often with larger prizes or more importance.
1078
+ */
1079
+ execution_type: RaffleDrawTypeExecution;
1080
+
1081
+ /** Date/time of the draw execution */
1082
+ execution_ts: number;
1083
+
1084
+ /** Date of the previously executed draw (if there is such) */
1085
+ previous_run_ts?: number;
1086
+
1087
+ /** Unique ID of the previusly executed draw (if there is such) */
1088
+ previous_run_id?: number;
1089
+
1090
+ /**
1091
+ * Date/time starting from which the tickets will participate in the upcoming draw
1092
+ * This value need to be taken into account with next_execute_ts field value, for example
1093
+ * 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
1094
+ * (internally this value is calculated as next_execute_ts - ticket_start_date)
1095
+ */
1096
+ ticket_start_ts: number;
1097
+ /** Field is indicating if same ticket can win multiple prizes in the same draw
1098
+ * For example there are 3 types of prizes in the draw - iPhone, iPad, MacBook
1099
+ * If this field is true, then one ticket can win all 3 prizes (depending on the chances of course),
1100
+ * if false, then one ticket can win only one prize.
1101
+ * The distribution of the prizes is start from top (assuming on top are the most valuable prizes) to bottom (less valuable prizes)
1102
+ * If specific prize has multiple values, e.g. we have 3 iPhones,
1103
+ * 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)
1104
+ */
1105
+ allow_multi_prize_per_ticket: boolean;
1106
+ /**
1107
+ * The number of tickets that are already given to all users for this instance of draw.
1108
+ * In other words tickets that are collected between ticket_start_date and current time (or till current_execution_ts is the instance is executed).
1109
+ */
1110
+ total_tickets_count: number;
1111
+ /**
1112
+ * The number of tickets collected by current user for this instance of draw.
1113
+ */
1114
+ my_tickets_count: number;
1115
+ /*
1116
+ * List of last 5 tickets are collected by current user for this instance of draw.
1117
+ */
1118
+ my_last_tickets: TRaffleTicket[];
1119
+ }
1120
+
1121
+ export interface TRaffleDrawRun {
1122
+ /**
1123
+ * 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
1124
+ * (internal name: schedule_id)
1125
+ */
1126
+ id: number;
1127
+ /**
1128
+ * Field indicates the ID of the latest instance/run of draw
1129
+ */
1130
+ run_id:number;
1131
+ /** Name of the draw, e.g. 'Daily draw' */
1132
+ name: string;
1133
+ /** Description of the draw */
1134
+ description: string;
1135
+ /** URL of the image that represents the draw */
1136
+ image_url: string;
1137
+ /** URL of the moible image that represents the draw */
1138
+ image_url_mobile: string;
1139
+ /** URL of the icon that represents the draw */
1140
+ icon_url: string;
1141
+ /** URL of the background image that will be used in the draw list item */
1142
+ background_image_url: string;
1143
+ /** URL of the moible background image that will be used in the draw list item */
1144
+ background_image_url_mobile: string;
1145
+ /** Show if the draw is grand and is marked as special */
1146
+ is_grand: boolean;
1147
+ /** Date/time of the draw execution */
1148
+ execution_ts: number;
1149
+ /** Actual Date/time of the draw execution */
1150
+ actual_execution_ts: number;
1151
+ /**
1152
+ * Date/time starting from which the tickets will participate in the upcoming draw
1153
+ * This value need to be taken into account with next_execute_ts field value, for example
1154
+ * 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
1155
+ * (internally this value is calculated as next_execute_ts - ticket_start_date)
1156
+ */
1157
+ ticket_start_ts: number;
1158
+ /**
1159
+ * Shows if user has won a prize in a current run
1160
+ */
1161
+ is_winner: boolean;
1162
+ /**
1163
+ * Shows if user has unclaimed prize
1164
+ */
1165
+ has_unclaimed_prize: boolean;
1166
+
1167
+ }
1168
+
1169
+ export interface TransformedRaffleClaimPrizeResponse {
1170
+ /** Error code, 0 means no error */
1171
+ errorCode: number
1172
+ /** Error message, will be exposed only if ErrorCode is not 0 */
1173
+ errorMessage?: string
1174
+ }
1175
+
1176
+