@smartico/public-api 0.0.186 → 0.0.188

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.
@@ -141,3 +141,19 @@ ___
141
141
  ### relative\_period\_timezone
142
142
 
143
143
  • `Optional` **relative\_period\_timezone**: `number`
144
+
145
+ ___
146
+
147
+ ### out\_of\_stock\_message
148
+
149
+ • `Optional` **out\_of\_stock\_message**: `string`
150
+
151
+ Message when the prize pool is empty for that specific prize
152
+
153
+ ___
154
+
155
+ ### is\_surcharge
156
+
157
+ • `Optional` **is\_surcharge**: `boolean`
158
+
159
+ Flag indicating that the prize is surcharged (available all the time, despite pool numbers)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.186",
3
+ "version": "0.0.188",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -2,21 +2,39 @@ import { TInboxMessageBody } from '../WSAPI/WSAPITypes';
2
2
  import { InboxMessageType } from './InboxMessageType';
3
3
 
4
4
  export interface InboxMessageBody {
5
+ // URL or deep-link that neeed to be executed when user clicks on the message
5
6
  action: string;
7
+ // the body of the message in case it's 'simple' inbox message
6
8
  body: string;
9
+ // type of message, deprecated
7
10
  type: InboxMessageType;
11
+ // image of the icon
8
12
  image: string;
13
+ // title of the message
9
14
  title: string;
15
+ // HTML body of the message in case it's 'rich' inbox message
10
16
  html_body: string;
17
+ // set of the buttons with text on the button and action that could be URL or deep-link
11
18
  additional_buttons?: { inbox_cta_text: string; action: string }[];
19
+ // indicator if the message need to be shown when sent and overlay or it should be shown only in the inbox, when user open 'inbox' interface explicitly
20
+ // default is 'true'
21
+ show_preview?: boolean;
22
+ // duration in seconds for how long to show preview, default is 7 seconds
23
+ show_duration_sec?: number;
12
24
  }
13
25
 
14
26
  export interface InboxMessage {
27
+ // date when the message was created
15
28
  createDate: string;
29
+ // body of the message according to the interface
16
30
  body: InboxMessageBody;
31
+ // unique identifier of the message that connects it to the campaign from which it was sent
17
32
  engagement_uid: string;
33
+ // flag that indicates if the message was read by the user
18
34
  is_read: boolean;
35
+ // flag that indicates if the message was marked as favorite by the user
19
36
  is_starred: boolean;
37
+ // flag that indicates if the message was deleted by the user. Such messages are not returned in the response and property is used only internaly in Smartico
20
38
  is_deleted?: boolean;
21
39
  }
22
40
 
@@ -54,6 +54,7 @@ export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[]
54
54
  acknowledge_action_title: p.saw_prize_ui_definition.acknowledge_action_title,
55
55
  acknowledge_dp_additional: p.saw_prize_ui_definition.acknowledge_dp_additional,
56
56
  acknowledge_action_title_additional: p.saw_prize_ui_definition.acknowledge_action_title_additional,
57
+ out_of_stock_message: p.saw_prize_ui_definition.out_of_stock_message,
57
58
  pool: p.pool,
58
59
  pool_initial: p.pool_initial,
59
60
  wins_count: p.wins_count,
@@ -61,6 +62,7 @@ export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[]
61
62
  active_from_ts: p.active_from_ts,
62
63
  active_till_ts: p.active_till_ts,
63
64
  relative_period_timezone: p.relative_period_timezone,
65
+ is_surcharge: p.is_surcharge,
64
66
  };
65
67
  return y;
66
68
  }),
@@ -16,4 +16,5 @@ export interface SAWPrize {
16
16
  active_from_ts?: number;
17
17
  active_till_ts?: number;
18
18
  relative_period_timezone?: number;
19
+ is_surcharge?: boolean;
19
20
  }
@@ -18,4 +18,5 @@ export interface SAWPrizeUI {
18
18
  replace_name_with_image?: boolean;
19
19
  acknowledge_action_title?: string;
20
20
  custom_win_sound?: string;
21
+ out_of_stock_message?: string;
21
22
  }
@@ -1,3 +1,4 @@
1
+ import { IntUtils } from '../IntUtils';
1
2
  import { TStoreItem } from '../WSAPI/WSAPITypes';
2
3
  import { StoreItemPublicMeta } from './StoreItemPublicMeta';
3
4
  import { StoreItemType, StoreItemTypeNamed } from './StoreItemType';
@@ -30,6 +31,7 @@ export const StoreItemTransform = (items: StoreItem[]): TStoreItem[] => {
30
31
  can_buy: r.canBuy,
31
32
  category_ids: r.categoryIds ?? [],
32
33
  pool: r.shopPool,
34
+ custom_data: IntUtils.JsonOrText(r.itemPublicMeta.custom_data),
33
35
  };
34
36
  return x;
35
37
  });
@@ -9,4 +9,5 @@ export interface StoreItemPublicMeta {
9
9
  priority: number;
10
10
  related_items: number[];
11
11
  hint_text: string;
12
+ custom_data: string;
12
13
  }
@@ -510,7 +510,7 @@ export class WSAPI {
510
510
  *
511
511
  * **Visitor mode: not supported**
512
512
  */
513
- public async playMiniGame(template_id: number, { onUpdate }: { onUpdate?: (data: TMissionOrBadge[]) => void } = {}): Promise<TMiniGamePlayResult> {
513
+ public async playMiniGame(template_id: number, { onUpdate }: { onUpdate?: (data: TMiniGameTemplate[]) => void } = {}): Promise<TMiniGamePlayResult> {
514
514
 
515
515
  if (onUpdate) {
516
516
  this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
@@ -41,6 +41,8 @@ export interface TMiniGamePrize {
41
41
  acknowledge_dp_additional?: string;
42
42
  /* The name of the action button in modal pop-up (additional) */
43
43
  acknowledge_action_title_additional?: string;
44
+ /* Message when the prize pool is empty for that specific prize */
45
+ out_of_stock_message?: string;
44
46
  /* Number of items in stock */
45
47
  pool?: number;
46
48
  /* Initial number of items in stock */
@@ -55,6 +57,8 @@ export interface TMiniGamePrize {
55
57
  active_till_ts?: number;
56
58
  /* Time zone to ensure each day aligns with your local midnight. */
57
59
  relative_period_timezone?: number;
60
+ /* Flag indicating that the prize is surcharged (available all the time, despite pool numbers) */
61
+ is_surcharge?: boolean;
58
62
  }
59
63
 
60
64
  /**
@@ -412,6 +416,8 @@ export interface TStoreItem {
412
416
  category_ids: number[];
413
417
  /** Number of items in the pool avaliable for the purchase.*/
414
418
  pool?: number;
419
+ /** The custom data of the store item defined by operator. Can be a JSON object, string or number */
420
+ custom_data: any;
415
421
  /** The T&C text for the store item */
416
422
  hint_text?: string;
417
423
  /** Purchase time to show in purchase history screen */
@@ -494,6 +500,7 @@ export interface TMissionOrBadge {
494
500
  custom_section_id: number;
495
501
  /** The indicator if the mission or badge is visible only in the custom section and should be hidden from the main overview of missions/badges */
496
502
  only_in_custom_section: boolean;
503
+
497
504
  /** The custom data of the mission or badge defined by operator. Can be a JSON object, string or number */
498
505
  custom_data: any;
499
506