%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emergentqj/actioncivile/pre-auth/.f81b4c9eb38fd76cdf20462cf2027aa3/static/js/utils/
Upload File :
Create Path :
Current File : /home/emergentqj/actioncivile/pre-auth/.f81b4c9eb38fd76cdf20462cf2027aa3/static/js/utils/index.js

export { default as isDomEnabled } from "./isDomEnabled";
export { default as getEnvConstant } from "./getEnvConstant";

export {
  mixpanel,
  trackMixpanelActions,
} from "./mixpanel";

export {
  isLoggedIn,
  isPrivate,
  deleteCookie,
} from "./cookies";

export * from "./countries";

export * from "./getTranslations";

export const serialize = (obj) => {
  const str = [];
  for (const p in obj) {
    if (Object.prototype.hasOwnProperty.call(obj, p)) {
      str.push(`${encodeURIComponent(p)}=${encodeURIComponent(obj[p])}`);
    }
  }
  return str.join("&");
};

export const capitalizeFirstLetter = (string) => {
  if (string && string.length) {
    string = string.toLowerCase();
    return string.charAt(0).toUpperCase() + string.slice(1);
  }
  return "";
};

export function findGetParameter(parameterName) {
  let result = null;
  let tmp = [];
  window.location.search
    .substr(1)
    .split("&")
    .forEach((item) => {
      tmp = item.split("=");
      if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
    });
  return result;
}

export const isLocalhost = () => {
  const { hostname } = window.location;
  return (
    hostname === "localhost"
    || hostname === "127.0.0.1"
  );
};

export const replaceJSX = (string, find, replace) => {
  const parts = string.split(find);
  parts.splice(1, 0, replace);

  return parts;
};

export const formDataForMixPanel = (data) => ({
  city: data.city,
  countryCode: data.countryCode,
  email: data.email,
  organization: data.organisation,
  organizationnumber: data.organizationnumber,
  phone: data.phone,
  postalCode: data.postalCode,
  street: data.street,
  firstName: data.firstName,
  lastName: data.lastName,
});

Zerion Mini Shell 1.0