package.cjs.initializers.index.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof3 = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = initializeApplication;
exports.globalProps = void 0;
Object.defineProperty(exports, "taxonomies", {
enumerable: true,
get: function get() {
return _i18n.taxonomies;
}
});
Object.defineProperty(exports, "useDisplayErrorPage", {
enumerable: true,
get: function get() {
return _useDisplayErrorPage["default"];
}
});
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _useDisplayErrorPage = _interopRequireDefault(require("../react-utils/useDisplayErrorPage"));
var _axios = _interopRequireDefault(require("./axios"));
var _dayjs = _interopRequireDefault(require("./dayjs"));
var _globalProps = _interopRequireDefault(require("./globalProps"));
var _i18n = _interopRequireWildcard(require("./i18n"));
var _logger = _interopRequireDefault(require("./logger"));
var _mixpanel = _interopRequireDefault(require("./mixpanel"));
var _reactDevTools = _interopRequireDefault(require("./reactDevTools"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
// TODO: kept for backward compatibility.
// eslint-disable-next-line import/no-mutable-exports
var globalProps = {};
exports.globalProps = globalProps;
function initializeApplication(_ref) {
var translationResources = _ref.translationResources,
skip = _ref.skip;
if (!(skip !== null && skip !== void 0 && skip.globalProps)) {
(0, _globalProps["default"])();
// eslint-disable-next-line @bigbinary/neeto/no-globalProps-reassignment
exports.globalProps = globalProps = window.globalProps;
}
if ((0, _typeof2["default"])(skip === null || skip === void 0 ? void 0 : skip.axios) === "object" || !(skip !== null && skip !== void 0 && skip.axios)) {
(0, _axios["default"])(skip === null || skip === void 0 ? void 0 : skip.axios);
}
if (!(skip !== null && skip !== void 0 && skip.i18n)) (0, _i18n["default"])(translationResources);
if (!(skip !== null && skip !== void 0 && skip.logger)) (0, _logger["default"])();
if (!(skip !== null && skip !== void 0 && skip.dayjs)) (0, _dayjs["default"])(skip === null || skip === void 0 ? void 0 : skip.timezone);
if (process.env.NODE_ENV === "production") (0, _reactDevTools["default"])();
var pageLoader = document.getElementById("neeto-page-loader");
if (pageLoader) pageLoader.remove();
(0, _mixpanel["default"])(skip);
}
//# sourceMappingURL=index.js.map