PHP WebShell

Текущая директория: /usr/lib/node_modules/bitgo/node_modules/@expo/cli/build/src/utils/analytics

Просмотр файла: rudderstackClient.js

"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.setUserDataAsync = setUserDataAsync;
exports.logEvent = logEvent;
exports.getContext = getContext;
var _rudderSdkNode = _interopRequireDefault(require("@expo/rudder-sdk-node"));
var ciInfo = _interopRequireWildcard(require("ci-info"));
var _os = _interopRequireDefault(require("os"));
var _uuid = require("uuid");
var _userSettings = _interopRequireDefault(require("../../api/user/UserSettings"));
var _env = require("../env");
function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
function _interopRequireWildcard(obj) {
    if (obj && obj.__esModule) {
        return obj;
    } else {
        var newObj = {};
        if (obj != null) {
            for(var key in obj){
                if (Object.prototype.hasOwnProperty.call(obj, key)) {
                    var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
                    if (desc.get || desc.set) {
                        Object.defineProperty(newObj, key, desc);
                    } else {
                        newObj[key] = obj[key];
                    }
                }
            }
        }
        newObj.default = obj;
        return newObj;
    }
}
const PLATFORM_TO_ANALYTICS_PLATFORM = {
    darwin: "Mac",
    win32: "Windows",
    linux: "Linux"
};
let client = null;
let identified = false;
let identifyData = null;
function getClient() {
    if (client) {
        return client;
    }
    client = new _rudderSdkNode.default(_env.env.EXPO_STAGING || _env.env.EXPO_LOCAL ? "24TKICqYKilXM480mA7ktgVDdea" : "24TKR7CQAaGgIrLTgu3Fp4OdOkI", "https://cdp.expo.dev/v1/batch", {
        flushInterval: 300
    });
    // Install flush on exit...
    process.on("SIGINT", ()=>{
        return client == null ? void 0 : client.flush == null ? void 0 : client.flush();
    });
    process.on("SIGTERM", ()=>{
        return client == null ? void 0 : client.flush == null ? void 0 : client.flush();
    });
    return client;
}
async function setUserDataAsync(userId, traits) {
    if (_env.env.EXPO_NO_TELEMETRY) {
        return;
    }
    const deviceId = await _userSettings.default.getAnonymousIdentifierAsync();
    identifyData = {
        userId,
        deviceId,
        traits
    };
    ensureIdentified();
}
function logEvent(event, properties = {}) {
    if (_env.env.EXPO_NO_TELEMETRY) {
        return;
    }
    ensureIdentified();
    const { userId , deviceId  } = identifyData != null ? identifyData : {};
    const commonEventProperties = {
        source_version: "0.1.7",
        source: "expo"
    };
    const identity = {
        userId: userId != null ? userId : undefined,
        anonymousId: deviceId != null ? deviceId : (0, _uuid).v4()
    };
    getClient().track({
        event,
        properties: {
            ...properties,
            ...commonEventProperties
        },
        ...identity,
        context: getContext()
    });
}
function ensureIdentified() {
    if (_env.env.EXPO_NO_TELEMETRY || identified || !identifyData) {
        return;
    }
    getClient().identify({
        userId: identifyData.userId,
        anonymousId: identifyData.deviceId,
        traits: identifyData.traits
    });
    identified = true;
}
function getContext() {
    const platform = PLATFORM_TO_ANALYTICS_PLATFORM[_os.default.platform()] || _os.default.platform();
    return {
        os: {
            name: platform,
            version: _os.default.release()
        },
        device: {
            type: platform,
            model: platform
        },
        app: {
            name: "expo",
            version: "0.1.7"
        },
        ci: ciInfo.isCI ? {
            name: ciInfo.name,
            isPr: ciInfo.isPR
        } : undefined
    };
}

//# sourceMappingURL=rudderstackClient.js.map

Выполнить команду


Для локальной разработки. Не используйте в интернете!