@smartico/public-api 0.0.436 → 0.0.438

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.436",
3
+ "version": "0.0.438",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,6 +31,15 @@ const sawPrizeValue = (p: SAWPrize): number => {
31
31
  return n > 0 ? n : p.prize_value;
32
32
  };
33
33
 
34
+ const GEMS_DIAMONDS_TYPES: TMiniGamePrize['gems_diamonds_type'][] = ['gems', 'diamonds', 'gems-and-diamonds'];
35
+
36
+ /** Which currency a gems-and-diamonds prize gives (`_gems_diamonds_type`: 0 gems, 1 diamonds, 2 both). */
37
+ const sawGemsDiamondsType = (p: SAWPrize): TMiniGamePrize['gems_diamonds_type'] => {
38
+ if (p.prize_type_id !== SAWPrizeType.GEMS_AND_DIAMONDS) return undefined;
39
+ const d = p.prize_details_json;
40
+ return GEMS_DIAMONDS_TYPES[d?._gems_diamonds_type] ?? (d?.gems && d?.diamonds ? 'gems-and-diamonds' : d?.diamonds ? 'diamonds' : 'gems');
41
+ };
42
+
34
43
  export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[] => {
35
44
  return items.map((r) => {
36
45
  const x: TMiniGameTemplate = {
@@ -85,6 +94,7 @@ export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[]
85
94
  name: p.saw_prize_ui_definition.name,
86
95
  prize_type: MiniGamePrizeTypeNamed(p.prize_type_id),
87
96
  prize_value: sawPrizeValue(p),
97
+ gems_diamonds_type: sawGemsDiamondsType(p),
88
98
  font_size: p.saw_prize_ui_definition.font_size,
89
99
  font_size_mobile: p.saw_prize_ui_definition.font_size_mobile,
90
100
  icon: p.saw_prize_ui_definition.icon,
@@ -77,6 +77,7 @@ declare enum PushClientPlatform {
77
77
  FIREFOX_MOBILE = 9,
78
78
  SAFARI_MOBILE = 10,
79
79
  OPERA_MOBILE = 11,
80
+ NATIVE_HARMONY = 12,
80
81
  }
81
82
  declare enum ClientActivityRequestId {
82
83
  MINI_WIDGET_SHOWN = 1,
@@ -33,6 +33,8 @@ export interface TMiniGamePrize {
33
33
  * For example for prize '100 points' the prize_value will be 100, for '100 free spins' 100, for '50 Diamonds' 50.
34
34
  */
35
35
  prize_value?: number;
36
+ /** For 'gems-and-diamonds' prizes — which currency the prize gives: 'gems', 'diamonds', or 'gems-and-diamonds' (both; `prize_value` is then their sum). Absent for other types */
37
+ gems_diamonds_type?: 'gems' | 'diamonds' | 'gems-and-diamonds';
36
38
  /** Custom font size in px for rendering the prize name on the game surface (e.g. a wheel sector), desktop */
37
39
  font_size?: number;
38
40
  /** Custom font size in px for the prize name, mobile; falls back to `font_size` when absent */