@smartico/public-api 0.0.142 → 0.0.143

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 (33) hide show
  1. package/README.md +14 -1
  2. package/dist/CustomSections/AchCustomSection.d.ts +27 -0
  3. package/dist/CustomSections/GetCustomSectionsRequest.d.ts +3 -0
  4. package/dist/CustomSections/GetCustomSectionsResponse.d.ts +7 -0
  5. package/dist/CustomSections/UICustomSection.d.ts +15 -0
  6. package/dist/CustomSections/index.d.ts +4 -0
  7. package/dist/Missions/AchievementPublicMeta.d.ts +1 -0
  8. package/dist/Missions/UserAchievement.d.ts +1 -0
  9. package/dist/SmarticoAPI.d.ts +4 -1
  10. package/dist/WSAPI/WSAPI.d.ts +22 -1
  11. package/dist/WSAPI/WSAPITypes.d.ts +25 -0
  12. package/dist/index.js +202 -98
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.modern.mjs +83 -1
  15. package/dist/index.modern.mjs.map +1 -1
  16. package/docs/README.md +1 -0
  17. package/docs/classes/WSAPI.md +29 -0
  18. package/docs/enums/AchCustomLayoutTheme.md +27 -0
  19. package/docs/enums/AchCustomSectionType.md +43 -0
  20. package/docs/enums/AchMissionsTabsOptions.md +21 -0
  21. package/docs/enums/AchOverviewMissionsFilter.md +33 -0
  22. package/docs/interfaces/TUICustomSection.md +85 -0
  23. package/package.json +1 -1
  24. package/src/CustomSections/AchCustomSection.ts +30 -0
  25. package/src/CustomSections/GetCustomSectionsRequest.ts +5 -0
  26. package/src/CustomSections/GetCustomSectionsResponse.ts +7 -0
  27. package/src/CustomSections/UICustomSection.ts +34 -0
  28. package/src/CustomSections/index.ts +4 -0
  29. package/src/Missions/AchievementPublicMeta.ts +1 -0
  30. package/src/Missions/UserAchievement.ts +3 -1
  31. package/src/SmarticoAPI.ts +12 -2
  32. package/src/WSAPI/WSAPI.ts +26 -1
  33. package/src/WSAPI/WSAPITypes.ts +27 -0
@@ -802,7 +802,8 @@ const UserAchievementTransform = items => {
802
802
  complete_date_ts: r.complete_date_ts,
803
803
  completed_today: completedToday,
804
804
  completed_this_week: completedThisWeek,
805
- completed_this_month: completedThisMonth
805
+ completed_this_month: completedThisMonth,
806
+ custom_section_type_id: r.ach_public_meta.custom_section_type_id
806
807
  };
807
808
  return x;
808
809
  });
@@ -1115,6 +1116,7 @@ var onUpdateContextKey;
1115
1116
  onUpdateContextKey["StoreHistory"] = "storeHistory";
1116
1117
  onUpdateContextKey["Jackpots"] = "jackpots";
1117
1118
  onUpdateContextKey["Pots"] = "Pots";
1119
+ onUpdateContextKey["CustomSections"] = "customSections";
1118
1120
  })(onUpdateContextKey || (onUpdateContextKey = {}));
1119
1121
  /** @group General API */
1120
1122
  class WSAPI {
@@ -1275,6 +1277,7 @@ class WSAPI {
1275
1277
  * _smartico.vapi('EN').getStoreItems().then((result) => {
1276
1278
  * console.log(result);
1277
1279
  * });
1280
+ * ```
1278
1281
  */
1279
1282
  async getStoreItems() {
1280
1283
  return OCache.use(onUpdateContextKey.StoreItems, ECacheContext.WSAPI, () => this.api.storeGetItemsT(null), CACHE_DATA_SEC);
@@ -1313,6 +1316,7 @@ class WSAPI {
1313
1316
  * _smartico.vapi('EN').getStoreCategories().then((result) => {
1314
1317
  * console.log(result);
1315
1318
  * });
1319
+ * ```
1316
1320
  */
1317
1321
  async getStoreCategories() {
1318
1322
  return OCache.use(onUpdateContextKey.StoreCategories, ECacheContext.WSAPI, () => this.api.storeGetCategoriesT(null), CACHE_DATA_SEC);
@@ -1362,6 +1366,27 @@ class WSAPI {
1362
1366
  async getAchCategories() {
1363
1367
  return OCache.use(onUpdateContextKey.AchCategories, ECacheContext.WSAPI, () => this.api.achGetCategoriesT(null), CACHE_DATA_SEC);
1364
1368
  }
1369
+ /**
1370
+ * Returns list of custom sections
1371
+ *
1372
+ * **Example**:
1373
+ * ```
1374
+ * _smartico.api.getCustomSections().then((result) => {
1375
+ * console.log(result);
1376
+ * });
1377
+ * ```
1378
+ *
1379
+ * **Example in the Visitor mode**:
1380
+ * ```
1381
+ * _smartico.vapi('EN').getCustomSections().then((result) => {
1382
+ * console.log(result);
1383
+ * });
1384
+ * ```
1385
+ *
1386
+ * */
1387
+ async getCustomSections() {
1388
+ return OCache.use(onUpdateContextKey.CustomSections, ECacheContext.WSAPI, () => this.api.getCustomSectionsT(null), CACHE_DATA_SEC);
1389
+ }
1365
1390
  /**
1366
1391
  * Returns the list of mini-games available for user
1367
1392
  * The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMiniGames with a new onUpdate callback, the old one will be overwritten by the new one.
@@ -1799,6 +1824,56 @@ const getLeaderBoardTransform = board => {
1799
1824
  return null;
1800
1825
  };
1801
1826
 
1827
+ var AchCustomSectionType;
1828
+ (function (AchCustomSectionType) {
1829
+ AchCustomSectionType[AchCustomSectionType["HTML_PAGE"] = 1] = "HTML_PAGE";
1830
+ AchCustomSectionType[AchCustomSectionType["MISSIONS_CATEGORY"] = 2] = "MISSIONS_CATEGORY";
1831
+ AchCustomSectionType[AchCustomSectionType["TOURNAMENTS_CATEGORY"] = 3] = "TOURNAMENTS_CATEGORY";
1832
+ AchCustomSectionType[AchCustomSectionType["LEVELS"] = 4] = "LEVELS";
1833
+ AchCustomSectionType[AchCustomSectionType["MINI_GAMES"] = 5] = "MINI_GAMES";
1834
+ AchCustomSectionType[AchCustomSectionType["MISSION_CUSTOM_LAYOUT"] = 6] = "MISSION_CUSTOM_LAYOUT";
1835
+ AchCustomSectionType[AchCustomSectionType["MATCH_X"] = 7] = "MATCH_X";
1836
+ })(AchCustomSectionType || (AchCustomSectionType = {}));
1837
+ var AchCustomLayoutTheme;
1838
+ (function (AchCustomLayoutTheme) {
1839
+ AchCustomLayoutTheme["VALENTINES_LIGHT"] = "valentines-light";
1840
+ AchCustomLayoutTheme["VALENTINES_DARK"] = "valentines-dark";
1841
+ AchCustomLayoutTheme["EURO_2024"] = "euro-2024";
1842
+ AchCustomLayoutTheme["GENERIC"] = "generic";
1843
+ })(AchCustomLayoutTheme || (AchCustomLayoutTheme = {}));
1844
+ var AchMissionsTabsOptions;
1845
+ (function (AchMissionsTabsOptions) {
1846
+ AchMissionsTabsOptions[AchMissionsTabsOptions["ONLY_OVERVIEW"] = 1] = "ONLY_OVERVIEW";
1847
+ AchMissionsTabsOptions[AchMissionsTabsOptions["NO_OVERVIEW"] = 2] = "NO_OVERVIEW";
1848
+ AchMissionsTabsOptions[AchMissionsTabsOptions["ALL"] = 3] = "ALL";
1849
+ })(AchMissionsTabsOptions || (AchMissionsTabsOptions = {}));
1850
+ var AchOverviewMissionsFilter;
1851
+ (function (AchOverviewMissionsFilter) {
1852
+ AchOverviewMissionsFilter[AchOverviewMissionsFilter["ANY"] = 1] = "ANY";
1853
+ AchOverviewMissionsFilter[AchOverviewMissionsFilter["ALL_MISSIONS"] = 2] = "ALL_MISSIONS";
1854
+ AchOverviewMissionsFilter[AchOverviewMissionsFilter["ALL_EXCEPT_COMPLETED"] = 3] = "ALL_EXCEPT_COMPLETED";
1855
+ AchOverviewMissionsFilter[AchOverviewMissionsFilter["ALL_EXCEPT_LOCKED"] = 4] = "ALL_EXCEPT_LOCKED";
1856
+ AchOverviewMissionsFilter[AchOverviewMissionsFilter["ALL_EXCEPT_COMPLETED_AND_LOCKED"] = 5] = "ALL_EXCEPT_COMPLETED_AND_LOCKED";
1857
+ })(AchOverviewMissionsFilter || (AchOverviewMissionsFilter = {}));
1858
+
1859
+ const UICustomSectionTransform = items => {
1860
+ return items.filter(r => r.section_type_id !== undefined && r.section_type_id >= 1).map(r => {
1861
+ const x = {
1862
+ body: r.body,
1863
+ menu_img: r.menu_img,
1864
+ menu_name: r.menu_name,
1865
+ section_type_id: r.section_type_id,
1866
+ custom_skin_images: r.custom_skin_images,
1867
+ generic_custom_css: r.generic_custom_css,
1868
+ mission_tabs_options: r.mission_tabs_options,
1869
+ overview_missions_count: r.overview_missions_count,
1870
+ overview_missions_filter: r.overview_missions_filter,
1871
+ theme: r.theme
1872
+ };
1873
+ return x;
1874
+ });
1875
+ };
1876
+
1802
1877
  const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
1803
1878
  const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
1804
1879
  const AVATAR_DOMAIN = 'https://img{ENV_ID}.smr.vc';
@@ -2254,6 +2329,13 @@ class SmarticoAPI {
2254
2329
  async levelsGetT(user_ext_id) {
2255
2330
  return GetLevelMapResponseTransform(await this.levelsGet(user_ext_id));
2256
2331
  }
2332
+ async getCustomSections(user_ext_id) {
2333
+ const message = this.buildMessage(user_ext_id, ClassId.GET_CUSTOM_SECTIONS_REQUEST);
2334
+ return await this.send(message, ClassId.GET_CUSTOM_SECTIONS_RESPONSE);
2335
+ }
2336
+ async getCustomSectionsT(user_ext_id) {
2337
+ return UICustomSectionTransform(Object.values((await this.getCustomSections(user_ext_id)).customSections));
2338
+ }
2257
2339
  async getTranslationsT(user_ext_id, lang_code, areas, cacheSec = 60) {
2258
2340
  return await this.coreGetTranslations(user_ext_id, lang_code, areas, 30);
2259
2341
  }