@fingerprintjs/fingerprintjs-pro-react-native
Version:
Official React Native client for Fingerprint. Best identification solution for React Native.
77 lines • 3.38 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 __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var FingerprintJsProProvider_exports = {};
__export(FingerprintJsProProvider_exports, {
FingerprintJsProProvider: () => FingerprintJsProProvider
});
module.exports = __toCommonJS(FingerprintJsProProvider_exports);
var import_react = __toESM(require("react"));
var import_FingerprintJsProAgent = require("./FingerprintJsProAgent");
var import_FingerprintJsProContext = require("./FingerprintJsProContext");
function FingerprintJsProProvider({
children,
...fingerprintJsProAgentParams
}) {
const [client, setClient] = (0, import_react.useState)(
() => new import_FingerprintJsProAgent.FingerprintJsProAgent(fingerprintJsProAgentParams)
);
const [visitorId, updateVisitorId] = (0, import_react.useState)("");
const getVisitorData = (0, import_react.useCallback)(
async (tags, linkedId, requestOptions) => {
const result = await client.getVisitorData(tags, linkedId, requestOptions);
updateVisitorId(result.visitorId);
return result;
},
[client]
);
const firstRender = (0, import_react.useRef)(true);
(0, import_react.useEffect)(() => {
if (firstRender) {
firstRender.current = false;
} else {
setClient(new import_FingerprintJsProAgent.FingerprintJsProAgent(fingerprintJsProAgentParams));
}
}, [fingerprintJsProAgentParams]);
const contextValue = (0, import_react.useMemo)(() => {
return {
visitorId,
getVisitorData
};
}, [visitorId, getVisitorData]);
return /* @__PURE__ */ import_react.default.createElement(import_FingerprintJsProContext.FingerprintJsProContext.Provider, { value: contextValue }, children);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
FingerprintJsProProvider
});
//# sourceMappingURL=FingerprintJsProProvider.js.map