@orbit-software/sdk 1.83.3 → 1.83.4

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/dist/esm/sdk.d.ts CHANGED
@@ -1,4 +1,18 @@
1
1
  import { InventoryItem, ServiceInvoiceCreatedResponse } from './types/api';
2
+ interface CloudStorageValueValidationResult {
3
+ isValid: boolean;
4
+ error?: string;
5
+ byteSize?: number;
6
+ characterCount?: number;
7
+ }
8
+ /**
9
+ * Валидирует значение для Telegram CloudStorage
10
+ * Проверяет:
11
+ * - Максимальный размер в байтах: 4096 байт (не символов!)
12
+ * - Корректная UTF-8 кодировка
13
+ * - Отсутствие нулевых байтов и проблемных управляющих символов
14
+ */
15
+ export declare function validateCloudStorageValue(value: string): CloudStorageValueValidationResult;
2
16
  export declare const BASE_URL = "https://app.portalapp.games/sdk";
3
17
  interface LaunchResponse {
4
18
  tma_ads_key: string;
package/dist/esm/sdk.mjs CHANGED
@@ -1867,7 +1867,7 @@ function promisify(e) {
1867
1867
  };
1868
1868
  }
1869
1869
  promisify.argumentNames = "__ES6-PROMISIFY--CUSTOM-ARGUMENTS__", promisify.Promise = void 0;
1870
- const version = "1.83.3";
1870
+ const version = "1.83.4";
1871
1871
  var jsxRuntime = { exports: {} }, reactJsxRuntime_development = {}, hasRequiredReactJsxRuntime_development;
1872
1872
  function requireReactJsxRuntime_development() {
1873
1873
  if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
@@ -21957,7 +21957,7 @@ var Rr, F0, Removable = (F0 = class {
21957
21957
  clearGcTimeout() {
21958
21958
  J(this, Rr) && (timeoutManager.clearTimeout(J(this, Rr)), Te(this, Rr, void 0));
21959
21959
  }
21960
- }, Rr = new WeakMap(), F0), define_process_env_default$3 = { NODE_ENV: '"production"', version: '"1.83.3"' }, Ir, Ur, Jt, Mr, Ft, $r, Or, Zt, or, B0, Query = (B0 = class extends Removable {
21960
+ }, Rr = new WeakMap(), F0), define_process_env_default$3 = { NODE_ENV: '"production"', version: '"1.83.4"' }, Ir, Ur, Jt, Mr, Ft, $r, Or, Zt, or, B0, Query = (B0 = class extends Removable {
21961
21961
  constructor(t) {
21962
21962
  super();
21963
21963
  Ke(this, Zt);
@@ -37576,7 +37576,7 @@ function delay(e, { signal: t } = {}) {
37576
37576
  t == null || t.addEventListener("abort", o, { once: !0 });
37577
37577
  });
37578
37578
  }
37579
- var define_process_env_default$2 = { NODE_ENV: '"production"', version: '"1.83.3"' }, win;
37579
+ var define_process_env_default$2 = { NODE_ENV: '"production"', version: '"1.83.4"' }, win;
37580
37580
  if (typeof window > "u") {
37581
37581
  var loc = {
37582
37582
  hostname: ""
@@ -52811,7 +52811,7 @@ const balance$4 = "Balance", topUp$4 = "Top Up", ads$4 = "Ads", adsOn$4 = "On",
52811
52811
  topUpModal,
52812
52812
  inventoryModal
52813
52813
  };
52814
- var define_process_env_default$1 = { NODE_ENV: '"production"', version: '"1.83.3"' };
52814
+ var define_process_env_default$1 = { NODE_ENV: '"production"', version: '"1.83.4"' };
52815
52815
  const resources = {
52816
52816
  en: {
52817
52817
  translation: en
@@ -53342,12 +53342,74 @@ function throttleLeading(e, t) {
53342
53342
  return a - i >= t ? (i = a, e.apply(this, s)) : (console.log(`Function is throttled. Next call available in ${t - (a - i)}ms`), Promise.resolve(!1));
53343
53343
  };
53344
53344
  }
53345
- var define_process_env_default = { NODE_ENV: '"production"', version: '"1.83.3"' };
53345
+ var define_process_env_default = { NODE_ENV: '"production"', version: '"1.83.4"' };
53346
53346
  init({
53347
53347
  dsn: "https://b52384170118e5a8b1f43ca653975198@o4509677809172480.ingest.de.sentry.io/4509677817364560",
53348
53348
  sendDefaultPii: !0
53349
53349
  });
53350
- const CloudStorageGetItem = promisify(WebApp.CloudStorage.getItem), CloudStorageSetItem = promisify(WebApp.CloudStorage.setItem), CloudStorageRemoveItem = promisify(WebApp.CloudStorage.removeItem), BASE_URL = "https://app.portalapp.games/sdk", G_MEASUREMENT_ID = "G-4RMXVE2K75", BANNER_HEIGHT = 60, bannerManager = new BannerManager({
53350
+ const CloudStorageGetItem = promisify(WebApp.CloudStorage.getItem), CloudStorageSetItem = promisify(WebApp.CloudStorage.setItem), CloudStorageRemoveItem = promisify(WebApp.CloudStorage.removeItem);
53351
+ function validateCloudStorageValue(e) {
53352
+ if (e == null)
53353
+ return {
53354
+ isValid: !1,
53355
+ error: "Value cannot be null or undefined"
53356
+ };
53357
+ const t = e.length;
53358
+ let i;
53359
+ try {
53360
+ i = new TextEncoder().encode(e);
53361
+ } catch {
53362
+ return {
53363
+ isValid: !1,
53364
+ error: "Value cannot be encoded as UTF-8",
53365
+ characterCount: t
53366
+ };
53367
+ }
53368
+ const s = i.length;
53369
+ if (s > 4096)
53370
+ return {
53371
+ isValid: !1,
53372
+ error: `Value exceeds maximum size: ${s} bytes (limit: 4096 bytes)`,
53373
+ byteSize: s,
53374
+ characterCount: t
53375
+ };
53376
+ if (e.includes("\0"))
53377
+ return {
53378
+ isValid: !1,
53379
+ error: "Value contains null bytes (\\0) which are not allowed",
53380
+ byteSize: s,
53381
+ characterCount: t
53382
+ };
53383
+ if (/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]/.test(e))
53384
+ return {
53385
+ isValid: !1,
53386
+ error: "Value contains invalid control characters",
53387
+ byteSize: s,
53388
+ characterCount: t
53389
+ };
53390
+ try {
53391
+ if (new TextDecoder("utf-8", { fatal: !0 }).decode(i) !== e)
53392
+ return {
53393
+ isValid: !1,
53394
+ error: "Value encoding/decoding mismatch",
53395
+ byteSize: s,
53396
+ characterCount: t
53397
+ };
53398
+ } catch {
53399
+ return {
53400
+ isValid: !1,
53401
+ error: "Value contains invalid UTF-8 sequences",
53402
+ byteSize: s,
53403
+ characterCount: t
53404
+ };
53405
+ }
53406
+ return {
53407
+ isValid: !0,
53408
+ byteSize: s,
53409
+ characterCount: t
53410
+ };
53411
+ }
53412
+ const BASE_URL = "https://app.portalapp.games/sdk", G_MEASUREMENT_ID = "G-4RMXVE2K75", BANNER_HEIGHT = 60, bannerManager = new BannerManager({
53351
53413
  height: BANNER_HEIGHT
53352
53414
  });
53353
53415
  let timer;
@@ -53355,14 +53417,20 @@ const pending = {};
53355
53417
  let state = {};
53356
53418
  const CLOUD_STORAGE_PREFIX = "sdk_pending_", LOCAL_STORAGE_PREFIX = "portal_sdk_pending_";
53357
53419
  function setValueSync(e, t) {
53358
- state[e] = pending[e] = t;
53420
+ const i = String(t);
53421
+ state[e] = pending[e] = i;
53359
53422
  try {
53360
- localStorage.setItem(`${LOCAL_STORAGE_PREFIX}${e}`, t);
53361
- } catch (i) {
53362
- console.error(`Failed to save ${e} to localStorage:`, i);
53423
+ localStorage.setItem(`${LOCAL_STORAGE_PREFIX}${e}`, i);
53424
+ } catch (o) {
53425
+ console.error(`Failed to save ${e} to localStorage:`, o);
53426
+ }
53427
+ const { isValid: s, error: a } = validateCloudStorageValue(i);
53428
+ if (!s) {
53429
+ console.error(`Failed to save ${e} to CloudStorage: invalid value`, i, a);
53430
+ return;
53363
53431
  }
53364
- CloudStorageSetItem(`${CLOUD_STORAGE_PREFIX}${e}`, t).catch((i) => {
53365
- console.error(`Failed to save ${e} to CloudStorage:`, i);
53432
+ CloudStorageSetItem(`${CLOUD_STORAGE_PREFIX}${e}`, i).catch((o) => {
53433
+ console.error(`Failed to save ${e} to CloudStorage:`, o);
53366
53434
  });
53367
53435
  }
53368
53436
  function removeValueSync(e) {
@@ -54054,5 +54122,6 @@ export {
54054
54122
  TelegramWebApp,
54055
54123
  CryptoSteamSDK as default,
54056
54124
  makeRequest,
54057
- startGameTimeTrack
54125
+ startGameTimeTrack,
54126
+ validateCloudStorageValue
54058
54127
  };