SILENT KILLERPanel

Current Path: > home > transcarter > public_html > wp-content > plugins > leadin > scripts > > utils


Operation   : Linux host59.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Software     : Apache
Server IP    : 198.54.126.42 | Your IP: 216.73.216.135
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/transcarter/public_html/wp-content/plugins/leadin/scripts//utils

NameTypeSizeLast ModifiedActions
appUtils.ts File 296 bytes July 17 2025 21:06:25.
backgroundAppUtils.ts File 1305 bytes July 17 2025 21:06:25.
contentEmbedInstaller.ts File 743 bytes July 17 2025 21:06:25.
iframe.ts File 1011 bytes July 17 2025 21:06:25.
isRefreshTokenAvailable.ts File 155 bytes July 17 2025 21:06:25.
queryParams.ts File 413 bytes July 17 2025 21:06:25.
withMetaData.ts File 802 bytes July 17 2025 21:06:25.

Reading File: /home/transcarter/public_html/wp-content/plugins/leadin/scripts//utils/backgroundAppUtils.ts

import {
  deviceId,
  hubspotBaseUrl,
  locale,
  portalId,
  leadinPluginVersion,
} from '../constants/leadinConfig';
import { initApp } from './appUtils';

type CallbackFn = (...args: any[]) => void;

export function initBackgroundApp(initFn: CallbackFn | CallbackFn[]) {
  function main() {
    if (Array.isArray(initFn)) {
      initFn.forEach(callback => callback());
    } else {
      initFn();
    }
  }
  initApp(main);
}

const getLeadinConfig = () => {
  return {
    leadinPluginVersion,
  };
};

export const getOrCreateBackgroundApp = (refreshToken = '') => {
  if ((window as any).LeadinBackgroundApp) {
    return (window as any).LeadinBackgroundApp;
  }
  const { IntegratedAppEmbedder, IntegratedAppOptions }: any = window;
  const options = new IntegratedAppOptions()
    .setLocale(locale)
    .setDeviceId(deviceId)
    .setLeadinConfig(getLeadinConfig())
    .setRefreshToken(refreshToken.trim());

  const embedder = new IntegratedAppEmbedder(
    'integrated-plugin-proxy',
    portalId,
    hubspotBaseUrl,
    () => {}
  ).setOptions(options);

  embedder.attachTo(document.body, false);
  embedder.postStartAppMessage(); // lets the app know all all data has been passed to it

  (window as any).LeadinBackgroundApp = embedder;
  return (window as any).LeadinBackgroundApp;
};

SILENT KILLER Tool