@smartico/public-api 0.0.435 → 0.0.437

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.
@@ -480,6 +480,22 @@ const MiniGamePrizeTypeNamed = type => {
480
480
  }[type] || MiniGamePrizeTypeName.UNKNOWN;
481
481
  };
482
482
 
483
+ /**
484
+ * The amount a prize gives. Gems/diamonds and raffle-ticket prizes carry it in
485
+ * `prize_details_json` (their `prize_value` is only a default), the same way the
486
+ * default Smartico UI reads it; every other type keeps `prize_value`.
487
+ */
488
+ const sawPrizeValue = p => {
489
+ const d = p.prize_details_json;
490
+ let n = 0;
491
+ if (p.prize_type_id === SAWPrizeType.GEMS_AND_DIAMONDS && d) {
492
+ // _gems_diamonds_type: 0 gems, 1 diamonds, 2 both
493
+ n = (d._gems_diamonds_type === 1 ? 0 : d.gems || 0) + (d._gems_diamonds_type === 0 ? 0 : d.diamonds || 0);
494
+ } else if (p.prize_type_id === SAWPrizeType.RAFFLE_TICKET && d) {
495
+ n = d.tickets_count || 0;
496
+ }
497
+ return n > 0 ? n : p.prize_value;
498
+ };
483
499
  const SAWTemplatesTransform = items => {
484
500
  return items.map(r => {
485
501
  var _r$saw_skin_ui_defini;
@@ -533,7 +549,7 @@ const SAWTemplatesTransform = items => {
533
549
  id: p.saw_prize_id,
534
550
  name: p.saw_prize_ui_definition.name,
535
551
  prize_type: MiniGamePrizeTypeNamed(p.prize_type_id),
536
- prize_value: p.prize_value,
552
+ prize_value: sawPrizeValue(p),
537
553
  font_size: p.saw_prize_ui_definition.font_size,
538
554
  font_size_mobile: p.saw_prize_ui_definition.font_size_mobile,
539
555
  icon: p.saw_prize_ui_definition.icon,