@fingerprintjs/fingerprintjs-pro-react-native
Version:
Official React Native client for Fingerprint. Best identification solution for React Native.
125 lines • 3.99 kB
JavaScript
/**
FingerprintJS Pro React Native v3.14.0 - Copyright (c) FingerprintJS, Inc, 2026 (https://fingerprint.com)
Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var FingerprintJsProAgent_web_exports = {};
__export(FingerprintJsProAgent_web_exports, {
FingerprintJsProAgent: () => FingerprintJsProAgent
});
module.exports = __toCommonJS(FingerprintJsProAgent_web_exports);
var import_errors = require("./errors");
var import_fingerprintjs_pro_spa = require("@fingerprintjs/fingerprintjs-pro-spa");
var import_unwrapError = require("./unwrapError");
const packageVersion = "3.14.0";
class FingerprintJsProAgent {
constructor({
apiKey,
region,
endpointUrl,
fallbackEndpointUrls = [],
extendedResponseFormat = false,
requestOptions = {},
scriptUrlPattern,
storageKey,
urlHashing,
remoteControlDetection,
cache,
cachePrefix,
cacheLocation,
cacheTimeInSeconds
}) {
this.requestOptions = {};
this.extendedResponseFormat = false;
const endpoints = [];
if (endpointUrl) {
endpoints.push(endpointUrl);
}
endpoints.push(...fallbackEndpointUrls);
this.client = new import_fingerprintjs_pro_spa.FpjsClient({
loadOptions: {
apiKey,
region,
endpoint: endpoints.length > 0 ? endpoints : void 0,
scriptUrlPattern,
storageKey,
urlHashing,
remoteControlDetection,
integrationInfo: [`fingerprint-pro-react-native/${packageVersion}/web`]
},
cache,
cachePrefix,
cacheLocation,
cacheTimeInSeconds
});
this.agentPromise = this.client.init();
this.requestOptions = requestOptions;
this.extendedResponseFormat = extendedResponseFormat;
}
/**
* @inheritDoc
* */
async getVisitorId(tags, linkedId, options) {
var _a;
try {
const timeout = (_a = options == null ? void 0 : options.timeout) != null ? _a : this.requestOptions.timeout;
const agent = await this.agentPromise;
const result = await agent.get({
extendedResult: this.extendedResponseFormat,
tag: tags,
linkedId,
timeout
});
return result.visitorId;
} catch (error) {
if (error instanceof Error) {
throw (0, import_unwrapError.unwrapError)(error);
}
throw new import_errors.UnknownError(String(error));
}
}
/**
* @inheritDoc
* */
async getVisitorData(tags, linkedId, options) {
var _a;
try {
const timeout = (_a = options == null ? void 0 : options.timeout) != null ? _a : this.requestOptions.timeout;
const agent = await this.agentPromise;
return await agent.get({
tag: tags,
linkedId,
extendedResult: this.extendedResponseFormat,
timeout
});
} catch (error) {
if (error instanceof Error) {
throw (0, import_unwrapError.unwrapError)(error);
} else {
throw new import_errors.UnknownError(String(error));
}
}
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
FingerprintJsProAgent
});
//# sourceMappingURL=FingerprintJsProAgent.web.js.map