@orbit-software/sdk 1.84.0 → 1.84.2

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
@@ -150,6 +150,7 @@ export interface OverlayConfig {
150
150
  variant?: 'light' | 'dark' | 'translucent';
151
151
  initialPosition?: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
152
152
  botId?: string;
153
+ authData?: string;
153
154
  }
154
155
  export interface CryptoSteamSDKTask {
155
156
  id: number;
@@ -201,6 +202,7 @@ interface RequestWageValueParams {
201
202
  }
202
203
  export interface InitializeOptions {
203
204
  mode: 'portal';
205
+ authData?: string;
204
206
  }
205
207
  export interface StartupConfig {
206
208
  isFullscreen: boolean;
package/dist/esm/sdk.mjs CHANGED
@@ -38,7 +38,7 @@ function promisify(e) {
38
38
  };
39
39
  }
40
40
  promisify.argumentNames = "__ES6-PROMISIFY--CUSTOM-ARGUMENTS__", promisify.Promise = void 0;
41
- const version = "1.84.0";
41
+ const version = "1.84.2";
42
42
  function getDefaultExportFromCjs$3(e) {
43
43
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
44
44
  }
@@ -20131,7 +20131,7 @@ var Rr, F0, Removable = (F0 = class {
20131
20131
  clearGcTimeout() {
20132
20132
  J(this, Rr) && (timeoutManager.clearTimeout(J(this, Rr)), Te(this, Rr, void 0));
20133
20133
  }
20134
- }, Rr = new WeakMap(), F0), define_process_env_default$3 = { NODE_ENV: '"production"', version: '"1.84.0"' }, Ir, Ur, Jt, Mr, Ft, $r, Or, Zt, or, B0, Query = (B0 = class extends Removable {
20134
+ }, Rr = new WeakMap(), F0), define_process_env_default$3 = { NODE_ENV: '"production"', version: '"1.84.2"' }, Ir, Ur, Jt, Mr, Ft, $r, Or, Zt, or, B0, Query = (B0 = class extends Removable {
20135
20135
  constructor(t) {
20136
20136
  super();
20137
20137
  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.84.0"' }, win;
37579
+ var define_process_env_default$2 = { NODE_ENV: '"production"', version: '"1.84.2"' }, 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.84.0"' };
52814
+ var define_process_env_default$1 = { NODE_ENV: '"production"', version: '"1.84.2"' };
52815
52815
  const resources = {
52816
52816
  en: {
52817
52817
  translation: en
@@ -53342,7 +53342,7 @@ 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.84.0"' };
53345
+ var define_process_env_default = { NODE_ENV: '"production"', version: '"1.84.2"' };
53346
53346
  init({
53347
53347
  dsn: "https://b52384170118e5a8b1f43ca653975198@o4509677809172480.ingest.de.sentry.io/4509677817364560",
53348
53348
  sendDefaultPii: !0
@@ -53380,7 +53380,7 @@ function validateCloudStorageValue(e) {
53380
53380
  byteSize: s,
53381
53381
  characterCount: t
53382
53382
  };
53383
- if (/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]/.test(e))
53383
+ if (/[\x01-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/.test(e))
53384
53384
  return {
53385
53385
  isValid: !1,
53386
53386
  error: "Value contains invalid control characters",
@@ -53417,7 +53417,15 @@ const pending = {};
53417
53417
  let state = {};
53418
53418
  const CLOUD_STORAGE_PREFIX = "sdk_pending_", LOCAL_STORAGE_PREFIX = "portal_sdk_pending_";
53419
53419
  function setValueSync(e, t) {
53420
- const i = String(t);
53420
+ let i;
53421
+ if (typeof t == "object" && t !== null)
53422
+ try {
53423
+ i = JSON.stringify(t);
53424
+ } catch (o) {
53425
+ console.error(`Failed to serialize value for ${e}:`, o), i = String(t);
53426
+ }
53427
+ else
53428
+ i = String(t);
53421
53429
  state[e] = pending[e] = i;
53422
53430
  try {
53423
53431
  localStorage.setItem(`${LOCAL_STORAGE_PREFIX}${e}`, i);
@@ -53426,7 +53434,7 @@ function setValueSync(e, t) {
53426
53434
  }
53427
53435
  const { isValid: s, error: a } = validateCloudStorageValue(i);
53428
53436
  if (!s) {
53429
- console.error(`Failed to save ${e} to CloudStorage: invalid value`, i, a);
53437
+ console.warn(`Value for ${e} cannot be saved to CloudStorage:`, a);
53430
53438
  return;
53431
53439
  }
53432
53440
  CloudStorageSetItem(`${CLOUD_STORAGE_PREFIX}${e}`, i).catch((o) => {
@@ -53546,7 +53554,7 @@ async function savePendingChanges() {
53546
53554
  }
53547
53555
  let configCache = null;
53548
53556
  const CACHE_DURATION_MS = 5 * 60 * 1e3;
53549
- let adType = null, monetagShowAdFnName = null, adsgramAdController = null, countRequestAd = 1, externalBotId = null, isPortal = !1, launchResponseCache = null;
53557
+ let adType = null, monetagShowAdFnName = null, adsgramAdController = null, countRequestAd = 1, externalBotId = null, externalAuthData = null, isPortal = !1, launchResponseCache = null;
53550
53558
  class APIRequestError extends Error {
53551
53559
  constructor({
53552
53560
  message: t,
@@ -53560,10 +53568,10 @@ async function makeRequest(e, t, i) {
53560
53568
  const s = `${BASE_URL}/${e}`;
53561
53569
  try {
53562
53570
  const a = {
53563
- "X-Auth": TelegramWebApp.initData,
53571
+ "X-Auth": externalAuthData || TelegramWebApp.initData,
53564
53572
  "Content-Type": "application/json"
53565
53573
  };
53566
- externalBotId && (a["X-Bot-ID"] = externalBotId);
53574
+ externalBotId && (a["X-Bot-ID"] = externalBotId), externalAuthData && console.warn("WARNING: AUTH_DATA is used for requests!!!");
53567
53575
  const o = await fetch(s, {
53568
53576
  method: t,
53569
53577
  headers: a,
@@ -53623,7 +53631,7 @@ const CryptoSteamSDK = {
53623
53631
  var i, s, a;
53624
53632
  isPortal = (t == null ? void 0 : t.mode) === "portal";
53625
53633
  try {
53626
- e && (externalBotId = e, queryClient.invalidateQueries({ queryKey: [PROFILE_TAG] }), queryClient.invalidateQueries({ queryKey: [PRICES_TAG] })), isPortal || startSaveTick();
53634
+ t != null && t.authData && (console.error("USE AUTH_DATA FOR REQUESTS!!!"), externalAuthData = t.authData), e && (externalBotId = e, queryClient.invalidateQueries({ queryKey: [PROFILE_TAG] }), queryClient.invalidateQueries({ queryKey: [PRICES_TAG] })), isPortal || startSaveTick();
53627
53635
  const o = await CryptoSteamSDK.getProfile();
53628
53636
  libExports.isMobile && ((i = getStartupConfig()) != null && i.isFullscreen) && (TelegramWebApp.setHeaderColor("#000"), TelegramWebApp.setBackgroundColor("#000"), TelegramWebApp.requestFullscreen()), console.log("FOOTBAR", define_process_env_default.version), console.log("Starting SDK and TMANetwork initialization...");
53629
53637
  const l = await makeRequest("launch", "POST");
@@ -53828,7 +53836,7 @@ const CryptoSteamSDK = {
53828
53836
  },
53829
53837
  getVersion: () => version,
53830
53838
  initializeOverlay: (e) => {
53831
- startGameTimeTrack(), e != null && e.botId && (externalBotId = e.botId, queryClient.invalidateQueries({ queryKey: [PROFILE_TAG] }), queryClient.invalidateQueries({ queryKey: [PRICES_TAG] }));
53839
+ e != null && e.authData && (console.error("USE AUTH_DATA FOR REQUESTS!!!"), externalAuthData = e.authData), startGameTimeTrack(), e != null && e.botId && (externalBotId = e.botId, queryClient.invalidateQueries({ queryKey: [PROFILE_TAG] }), queryClient.invalidateQueries({ queryKey: [PRICES_TAG] }));
53832
53840
  const t = getStartupConfig(), i = {
53833
53841
  ...e,
53834
53842
  initialPosition: (e == null ? void 0 : e.initialPosition) ?? (t == null ? void 0 : t.overlayPosition) ?? "topLeft"