humanbehavior-js 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/api.js +312 -0
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/api.js.map +1 -0
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/index.js +19 -0
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/index.js.map +1 -0
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/react/index.js +222 -0
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/react/index.js.map +1 -0
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/redact.js +416 -0
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/redact.js.map +1 -0
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/tracker.js +950 -0
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/tracker.js.map +1 -0
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/utils/logger.js +117 -0
- package/.rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist/utils/logger.js.map +1 -0
- package/dist/cjs/index.js +2 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react/index.js +26 -451
- package/dist/cjs/react/index.js.map +1 -1
- package/dist/esm/index.js +2 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react/index.js +5 -430
- package/dist/esm/react/index.js.map +1 -1
- package/dist/index.min.js +15 -1
- package/dist/index.min.js.map +1 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/react/index.d.ts +2 -3
- package/package.json +10 -32
- package/rollup.config.js +106 -0
- package/simple-demo.html +26 -0
- package/simple-spa.html +658 -0
- package/src/index.ts +2 -2
- package/tsconfig.json +24 -0
- /package/{dist → .rollup.cache/Users/hudsonch/Desktop/HumanBehaviorInternship/humanbehavior-js/dist}/.tsbuildinfo +0 -0
package/dist/cjs/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React = require('react');
|
|
4
4
|
var src = require('..');
|
|
5
5
|
|
|
6
6
|
/******************************************************************************
|
|
@@ -35,433 +35,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
35
35
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
var jsxRuntime = {exports: {}};
|
|
39
|
-
|
|
40
|
-
var reactJsxRuntime_production = {};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @license React
|
|
44
|
-
* react-jsx-runtime.production.js
|
|
45
|
-
*
|
|
46
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
47
|
-
*
|
|
48
|
-
* This source code is licensed under the MIT license found in the
|
|
49
|
-
* LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
var hasRequiredReactJsxRuntime_production;
|
|
53
|
-
|
|
54
|
-
function requireReactJsxRuntime_production () {
|
|
55
|
-
if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
|
|
56
|
-
hasRequiredReactJsxRuntime_production = 1;
|
|
57
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
58
|
-
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
59
|
-
function jsxProd(type, config, maybeKey) {
|
|
60
|
-
var key = null;
|
|
61
|
-
void 0 !== maybeKey && (key = "" + maybeKey);
|
|
62
|
-
void 0 !== config.key && (key = "" + config.key);
|
|
63
|
-
if ("key" in config) {
|
|
64
|
-
maybeKey = {};
|
|
65
|
-
for (var propName in config)
|
|
66
|
-
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
67
|
-
} else maybeKey = config;
|
|
68
|
-
config = maybeKey.ref;
|
|
69
|
-
return {
|
|
70
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
71
|
-
type: type,
|
|
72
|
-
key: key,
|
|
73
|
-
ref: void 0 !== config ? config : null,
|
|
74
|
-
props: maybeKey
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
78
|
-
reactJsxRuntime_production.jsx = jsxProd;
|
|
79
|
-
reactJsxRuntime_production.jsxs = jsxProd;
|
|
80
|
-
return reactJsxRuntime_production;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
var reactJsxRuntime_development = {};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @license React
|
|
87
|
-
* react-jsx-runtime.development.js
|
|
88
|
-
*
|
|
89
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
90
|
-
*
|
|
91
|
-
* This source code is licensed under the MIT license found in the
|
|
92
|
-
* LICENSE file in the root directory of this source tree.
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
|
-
var hasRequiredReactJsxRuntime_development;
|
|
96
|
-
|
|
97
|
-
function requireReactJsxRuntime_development () {
|
|
98
|
-
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
99
|
-
hasRequiredReactJsxRuntime_development = 1;
|
|
100
|
-
"production" !== process.env.NODE_ENV &&
|
|
101
|
-
(function () {
|
|
102
|
-
function getComponentNameFromType(type) {
|
|
103
|
-
if (null == type) return null;
|
|
104
|
-
if ("function" === typeof type)
|
|
105
|
-
return type.$$typeof === REACT_CLIENT_REFERENCE
|
|
106
|
-
? null
|
|
107
|
-
: type.displayName || type.name || null;
|
|
108
|
-
if ("string" === typeof type) return type;
|
|
109
|
-
switch (type) {
|
|
110
|
-
case REACT_FRAGMENT_TYPE:
|
|
111
|
-
return "Fragment";
|
|
112
|
-
case REACT_PROFILER_TYPE:
|
|
113
|
-
return "Profiler";
|
|
114
|
-
case REACT_STRICT_MODE_TYPE:
|
|
115
|
-
return "StrictMode";
|
|
116
|
-
case REACT_SUSPENSE_TYPE:
|
|
117
|
-
return "Suspense";
|
|
118
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
119
|
-
return "SuspenseList";
|
|
120
|
-
case REACT_ACTIVITY_TYPE:
|
|
121
|
-
return "Activity";
|
|
122
|
-
}
|
|
123
|
-
if ("object" === typeof type)
|
|
124
|
-
switch (
|
|
125
|
-
("number" === typeof type.tag &&
|
|
126
|
-
console.error(
|
|
127
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
128
|
-
),
|
|
129
|
-
type.$$typeof)
|
|
130
|
-
) {
|
|
131
|
-
case REACT_PORTAL_TYPE:
|
|
132
|
-
return "Portal";
|
|
133
|
-
case REACT_CONTEXT_TYPE:
|
|
134
|
-
return (type.displayName || "Context") + ".Provider";
|
|
135
|
-
case REACT_CONSUMER_TYPE:
|
|
136
|
-
return (type._context.displayName || "Context") + ".Consumer";
|
|
137
|
-
case REACT_FORWARD_REF_TYPE:
|
|
138
|
-
var innerType = type.render;
|
|
139
|
-
type = type.displayName;
|
|
140
|
-
type ||
|
|
141
|
-
((type = innerType.displayName || innerType.name || ""),
|
|
142
|
-
(type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
|
|
143
|
-
return type;
|
|
144
|
-
case REACT_MEMO_TYPE:
|
|
145
|
-
return (
|
|
146
|
-
(innerType = type.displayName || null),
|
|
147
|
-
null !== innerType
|
|
148
|
-
? innerType
|
|
149
|
-
: getComponentNameFromType(type.type) || "Memo"
|
|
150
|
-
);
|
|
151
|
-
case REACT_LAZY_TYPE:
|
|
152
|
-
innerType = type._payload;
|
|
153
|
-
type = type._init;
|
|
154
|
-
try {
|
|
155
|
-
return getComponentNameFromType(type(innerType));
|
|
156
|
-
} catch (x) {}
|
|
157
|
-
}
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
function testStringCoercion(value) {
|
|
161
|
-
return "" + value;
|
|
162
|
-
}
|
|
163
|
-
function checkKeyStringCoercion(value) {
|
|
164
|
-
try {
|
|
165
|
-
testStringCoercion(value);
|
|
166
|
-
var JSCompiler_inline_result = !1;
|
|
167
|
-
} catch (e) {
|
|
168
|
-
JSCompiler_inline_result = true;
|
|
169
|
-
}
|
|
170
|
-
if (JSCompiler_inline_result) {
|
|
171
|
-
JSCompiler_inline_result = console;
|
|
172
|
-
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
173
|
-
var JSCompiler_inline_result$jscomp$0 =
|
|
174
|
-
("function" === typeof Symbol &&
|
|
175
|
-
Symbol.toStringTag &&
|
|
176
|
-
value[Symbol.toStringTag]) ||
|
|
177
|
-
value.constructor.name ||
|
|
178
|
-
"Object";
|
|
179
|
-
JSCompiler_temp_const.call(
|
|
180
|
-
JSCompiler_inline_result,
|
|
181
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
182
|
-
JSCompiler_inline_result$jscomp$0
|
|
183
|
-
);
|
|
184
|
-
return testStringCoercion(value);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
function getTaskName(type) {
|
|
188
|
-
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
189
|
-
if (
|
|
190
|
-
"object" === typeof type &&
|
|
191
|
-
null !== type &&
|
|
192
|
-
type.$$typeof === REACT_LAZY_TYPE
|
|
193
|
-
)
|
|
194
|
-
return "<...>";
|
|
195
|
-
try {
|
|
196
|
-
var name = getComponentNameFromType(type);
|
|
197
|
-
return name ? "<" + name + ">" : "<...>";
|
|
198
|
-
} catch (x) {
|
|
199
|
-
return "<...>";
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
function getOwner() {
|
|
203
|
-
var dispatcher = ReactSharedInternals.A;
|
|
204
|
-
return null === dispatcher ? null : dispatcher.getOwner();
|
|
205
|
-
}
|
|
206
|
-
function UnknownOwner() {
|
|
207
|
-
return Error("react-stack-top-frame");
|
|
208
|
-
}
|
|
209
|
-
function hasValidKey(config) {
|
|
210
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
211
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
212
|
-
if (getter && getter.isReactWarning) return false;
|
|
213
|
-
}
|
|
214
|
-
return void 0 !== config.key;
|
|
215
|
-
}
|
|
216
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
217
|
-
function warnAboutAccessingKey() {
|
|
218
|
-
specialPropKeyWarningShown ||
|
|
219
|
-
((specialPropKeyWarningShown = true),
|
|
220
|
-
console.error(
|
|
221
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
222
|
-
displayName
|
|
223
|
-
));
|
|
224
|
-
}
|
|
225
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
226
|
-
Object.defineProperty(props, "key", {
|
|
227
|
-
get: warnAboutAccessingKey,
|
|
228
|
-
configurable: true
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
function elementRefGetterWithDeprecationWarning() {
|
|
232
|
-
var componentName = getComponentNameFromType(this.type);
|
|
233
|
-
didWarnAboutElementRef[componentName] ||
|
|
234
|
-
((didWarnAboutElementRef[componentName] = true),
|
|
235
|
-
console.error(
|
|
236
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
237
|
-
));
|
|
238
|
-
componentName = this.props.ref;
|
|
239
|
-
return void 0 !== componentName ? componentName : null;
|
|
240
|
-
}
|
|
241
|
-
function ReactElement(
|
|
242
|
-
type,
|
|
243
|
-
key,
|
|
244
|
-
self,
|
|
245
|
-
source,
|
|
246
|
-
owner,
|
|
247
|
-
props,
|
|
248
|
-
debugStack,
|
|
249
|
-
debugTask
|
|
250
|
-
) {
|
|
251
|
-
self = props.ref;
|
|
252
|
-
type = {
|
|
253
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
254
|
-
type: type,
|
|
255
|
-
key: key,
|
|
256
|
-
props: props,
|
|
257
|
-
_owner: owner
|
|
258
|
-
};
|
|
259
|
-
null !== (void 0 !== self ? self : null)
|
|
260
|
-
? Object.defineProperty(type, "ref", {
|
|
261
|
-
enumerable: false,
|
|
262
|
-
get: elementRefGetterWithDeprecationWarning
|
|
263
|
-
})
|
|
264
|
-
: Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
265
|
-
type._store = {};
|
|
266
|
-
Object.defineProperty(type._store, "validated", {
|
|
267
|
-
configurable: false,
|
|
268
|
-
enumerable: false,
|
|
269
|
-
writable: true,
|
|
270
|
-
value: 0
|
|
271
|
-
});
|
|
272
|
-
Object.defineProperty(type, "_debugInfo", {
|
|
273
|
-
configurable: false,
|
|
274
|
-
enumerable: false,
|
|
275
|
-
writable: true,
|
|
276
|
-
value: null
|
|
277
|
-
});
|
|
278
|
-
Object.defineProperty(type, "_debugStack", {
|
|
279
|
-
configurable: false,
|
|
280
|
-
enumerable: false,
|
|
281
|
-
writable: true,
|
|
282
|
-
value: debugStack
|
|
283
|
-
});
|
|
284
|
-
Object.defineProperty(type, "_debugTask", {
|
|
285
|
-
configurable: false,
|
|
286
|
-
enumerable: false,
|
|
287
|
-
writable: true,
|
|
288
|
-
value: debugTask
|
|
289
|
-
});
|
|
290
|
-
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
291
|
-
return type;
|
|
292
|
-
}
|
|
293
|
-
function jsxDEVImpl(
|
|
294
|
-
type,
|
|
295
|
-
config,
|
|
296
|
-
maybeKey,
|
|
297
|
-
isStaticChildren,
|
|
298
|
-
source,
|
|
299
|
-
self,
|
|
300
|
-
debugStack,
|
|
301
|
-
debugTask
|
|
302
|
-
) {
|
|
303
|
-
var children = config.children;
|
|
304
|
-
if (void 0 !== children)
|
|
305
|
-
if (isStaticChildren)
|
|
306
|
-
if (isArrayImpl(children)) {
|
|
307
|
-
for (
|
|
308
|
-
isStaticChildren = 0;
|
|
309
|
-
isStaticChildren < children.length;
|
|
310
|
-
isStaticChildren++
|
|
311
|
-
)
|
|
312
|
-
validateChildKeys(children[isStaticChildren]);
|
|
313
|
-
Object.freeze && Object.freeze(children);
|
|
314
|
-
} else
|
|
315
|
-
console.error(
|
|
316
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
317
|
-
);
|
|
318
|
-
else validateChildKeys(children);
|
|
319
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
320
|
-
children = getComponentNameFromType(type);
|
|
321
|
-
var keys = Object.keys(config).filter(function (k) {
|
|
322
|
-
return "key" !== k;
|
|
323
|
-
});
|
|
324
|
-
isStaticChildren =
|
|
325
|
-
0 < keys.length
|
|
326
|
-
? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
|
|
327
|
-
: "{key: someKey}";
|
|
328
|
-
didWarnAboutKeySpread[children + isStaticChildren] ||
|
|
329
|
-
((keys =
|
|
330
|
-
0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
|
|
331
|
-
console.error(
|
|
332
|
-
'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
|
|
333
|
-
isStaticChildren,
|
|
334
|
-
children,
|
|
335
|
-
keys,
|
|
336
|
-
children
|
|
337
|
-
),
|
|
338
|
-
(didWarnAboutKeySpread[children + isStaticChildren] = true));
|
|
339
|
-
}
|
|
340
|
-
children = null;
|
|
341
|
-
void 0 !== maybeKey &&
|
|
342
|
-
(checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
|
|
343
|
-
hasValidKey(config) &&
|
|
344
|
-
(checkKeyStringCoercion(config.key), (children = "" + config.key));
|
|
345
|
-
if ("key" in config) {
|
|
346
|
-
maybeKey = {};
|
|
347
|
-
for (var propName in config)
|
|
348
|
-
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
349
|
-
} else maybeKey = config;
|
|
350
|
-
children &&
|
|
351
|
-
defineKeyPropWarningGetter(
|
|
352
|
-
maybeKey,
|
|
353
|
-
"function" === typeof type
|
|
354
|
-
? type.displayName || type.name || "Unknown"
|
|
355
|
-
: type
|
|
356
|
-
);
|
|
357
|
-
return ReactElement(
|
|
358
|
-
type,
|
|
359
|
-
children,
|
|
360
|
-
self,
|
|
361
|
-
source,
|
|
362
|
-
getOwner(),
|
|
363
|
-
maybeKey,
|
|
364
|
-
debugStack,
|
|
365
|
-
debugTask
|
|
366
|
-
);
|
|
367
|
-
}
|
|
368
|
-
function validateChildKeys(node) {
|
|
369
|
-
"object" === typeof node &&
|
|
370
|
-
null !== node &&
|
|
371
|
-
node.$$typeof === REACT_ELEMENT_TYPE &&
|
|
372
|
-
node._store &&
|
|
373
|
-
(node._store.validated = 1);
|
|
374
|
-
}
|
|
375
|
-
var React = require$$0,
|
|
376
|
-
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
377
|
-
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
378
|
-
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
379
|
-
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
380
|
-
REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
381
|
-
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
382
|
-
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
383
|
-
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
384
|
-
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
385
|
-
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
386
|
-
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
387
|
-
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
388
|
-
REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
|
|
389
|
-
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
|
|
390
|
-
ReactSharedInternals =
|
|
391
|
-
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
|
392
|
-
hasOwnProperty = Object.prototype.hasOwnProperty,
|
|
393
|
-
isArrayImpl = Array.isArray,
|
|
394
|
-
createTask = console.createTask
|
|
395
|
-
? console.createTask
|
|
396
|
-
: function () {
|
|
397
|
-
return null;
|
|
398
|
-
};
|
|
399
|
-
React = {
|
|
400
|
-
"react-stack-bottom-frame": function (callStackForError) {
|
|
401
|
-
return callStackForError();
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
var specialPropKeyWarningShown;
|
|
405
|
-
var didWarnAboutElementRef = {};
|
|
406
|
-
var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind(
|
|
407
|
-
React,
|
|
408
|
-
UnknownOwner
|
|
409
|
-
)();
|
|
410
|
-
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
411
|
-
var didWarnAboutKeySpread = {};
|
|
412
|
-
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
413
|
-
reactJsxRuntime_development.jsx = function (type, config, maybeKey, source, self) {
|
|
414
|
-
var trackActualOwner =
|
|
415
|
-
1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
416
|
-
return jsxDEVImpl(
|
|
417
|
-
type,
|
|
418
|
-
config,
|
|
419
|
-
maybeKey,
|
|
420
|
-
false,
|
|
421
|
-
source,
|
|
422
|
-
self,
|
|
423
|
-
trackActualOwner
|
|
424
|
-
? Error("react-stack-top-frame")
|
|
425
|
-
: unknownOwnerDebugStack,
|
|
426
|
-
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
427
|
-
);
|
|
428
|
-
};
|
|
429
|
-
reactJsxRuntime_development.jsxs = function (type, config, maybeKey, source, self) {
|
|
430
|
-
var trackActualOwner =
|
|
431
|
-
1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
432
|
-
return jsxDEVImpl(
|
|
433
|
-
type,
|
|
434
|
-
config,
|
|
435
|
-
maybeKey,
|
|
436
|
-
true,
|
|
437
|
-
source,
|
|
438
|
-
self,
|
|
439
|
-
trackActualOwner
|
|
440
|
-
? Error("react-stack-top-frame")
|
|
441
|
-
: unknownOwnerDebugStack,
|
|
442
|
-
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
443
|
-
);
|
|
444
|
-
};
|
|
445
|
-
})();
|
|
446
|
-
return reactJsxRuntime_development;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
var hasRequiredJsxRuntime;
|
|
450
|
-
|
|
451
|
-
function requireJsxRuntime () {
|
|
452
|
-
if (hasRequiredJsxRuntime) return jsxRuntime.exports;
|
|
453
|
-
hasRequiredJsxRuntime = 1;
|
|
454
|
-
|
|
455
|
-
if (process.env.NODE_ENV === 'production') {
|
|
456
|
-
jsxRuntime.exports = requireReactJsxRuntime_production();
|
|
457
|
-
} else {
|
|
458
|
-
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
459
|
-
}
|
|
460
|
-
return jsxRuntime.exports;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
var jsxRuntimeExports = requireJsxRuntime();
|
|
464
|
-
|
|
465
38
|
var LogLevel;
|
|
466
39
|
(function (LogLevel) {
|
|
467
40
|
LogLevel[LogLevel["NONE"] = 0] = "NONE";
|
|
@@ -579,34 +152,34 @@ const logDebug = (message, ...args) => logger.debug(message, ...args);
|
|
|
579
152
|
|
|
580
153
|
// Check if we're in a browser environment
|
|
581
154
|
const isBrowser = () => typeof window !== 'undefined';
|
|
582
|
-
const HumanBehaviorContext =
|
|
155
|
+
const HumanBehaviorContext = React.createContext(null);
|
|
583
156
|
const HumanBehaviorProvider = ({ apiKey, client, children, options }) => {
|
|
584
|
-
const [humanBehavior, setHumanBehavior] =
|
|
585
|
-
const [eventQueue, setEventQueue] =
|
|
586
|
-
const [isMounted, setIsMounted] =
|
|
587
|
-
const [isInitialized, setIsInitialized] =
|
|
157
|
+
const [humanBehavior, setHumanBehavior] = React.useState(client || null);
|
|
158
|
+
const [eventQueue, setEventQueue] = React.useState([]);
|
|
159
|
+
const [isMounted, setIsMounted] = React.useState(false);
|
|
160
|
+
const [isInitialized, setIsInitialized] = React.useState(false);
|
|
588
161
|
// Use refs to avoid dependency issues in useEffect
|
|
589
|
-
const apiKeyRef =
|
|
590
|
-
const clientRef =
|
|
591
|
-
const eventQueueRef =
|
|
162
|
+
const apiKeyRef = React.useRef(apiKey);
|
|
163
|
+
const clientRef = React.useRef(client);
|
|
164
|
+
const eventQueueRef = React.useRef(eventQueue);
|
|
592
165
|
// Update refs when props change
|
|
593
|
-
|
|
166
|
+
React.useEffect(() => {
|
|
594
167
|
apiKeyRef.current = apiKey;
|
|
595
168
|
clientRef.current = client;
|
|
596
169
|
}, [apiKey, client]);
|
|
597
170
|
// Update eventQueue ref when queue changes
|
|
598
|
-
|
|
171
|
+
React.useEffect(() => {
|
|
599
172
|
eventQueueRef.current = eventQueue;
|
|
600
173
|
}, [eventQueue]);
|
|
601
174
|
// Memoized queueEvent function to prevent unnecessary re-renders
|
|
602
|
-
|
|
175
|
+
React.useCallback((event) => {
|
|
603
176
|
setEventQueue(prev => [...prev, event]);
|
|
604
177
|
}, []);
|
|
605
178
|
// Handle mounting state
|
|
606
|
-
|
|
179
|
+
React.useEffect(() => {
|
|
607
180
|
setIsMounted(true);
|
|
608
181
|
}, []);
|
|
609
|
-
|
|
182
|
+
React.useEffect(() => {
|
|
610
183
|
var _a;
|
|
611
184
|
// Only run in browser
|
|
612
185
|
if (!(isBrowser())) {
|
|
@@ -661,7 +234,7 @@ const HumanBehaviorProvider = ({ apiKey, client, children, options }) => {
|
|
|
661
234
|
});
|
|
662
235
|
}, [isMounted, humanBehavior]); // Removed apiKey, client, eventQueue from dependencies
|
|
663
236
|
// Memoized context value to prevent unnecessary re-renders
|
|
664
|
-
const contextValue =
|
|
237
|
+
const contextValue = React.useMemo(() => {
|
|
665
238
|
if (!isMounted) {
|
|
666
239
|
return null;
|
|
667
240
|
}
|
|
@@ -672,12 +245,14 @@ const HumanBehaviorProvider = ({ apiKey, client, children, options }) => {
|
|
|
672
245
|
}, [isMounted, isInitialized, humanBehavior]);
|
|
673
246
|
// If not in browser, render children without context
|
|
674
247
|
if (!(isBrowser())) {
|
|
675
|
-
return
|
|
248
|
+
return React.createElement(React.Fragment, null, children);
|
|
676
249
|
}
|
|
677
|
-
return (
|
|
250
|
+
return (React.createElement(HumanBehaviorContext.Provider, { value: contextValue },
|
|
251
|
+
React.createElement(HumanBehaviorPageView, null),
|
|
252
|
+
children));
|
|
678
253
|
};
|
|
679
254
|
const useHumanBehavior = () => {
|
|
680
|
-
const tracker =
|
|
255
|
+
const tracker = React.useContext(HumanBehaviorContext);
|
|
681
256
|
if (!tracker) {
|
|
682
257
|
throw new Error('useHumanBehavior must be used within a HumanBehaviorProvider');
|
|
683
258
|
}
|
|
@@ -686,13 +261,13 @@ const useHumanBehavior = () => {
|
|
|
686
261
|
// Custom hook for managing redaction fields dynamically
|
|
687
262
|
const useRedaction = () => {
|
|
688
263
|
const tracker = useHumanBehavior();
|
|
689
|
-
const setRedactedFields =
|
|
264
|
+
const setRedactedFields = React.useCallback((fields) => {
|
|
690
265
|
tracker.setRedactedFields(fields);
|
|
691
266
|
}, [tracker]);
|
|
692
|
-
const isRedactionActive =
|
|
267
|
+
const isRedactionActive = React.useCallback(() => {
|
|
693
268
|
return tracker.isRedactionActive();
|
|
694
269
|
}, [tracker]);
|
|
695
|
-
const getRedactedFields =
|
|
270
|
+
const getRedactedFields = React.useCallback(() => {
|
|
696
271
|
return tracker.getRedactedFields();
|
|
697
272
|
}, [tracker]);
|
|
698
273
|
return {
|
|
@@ -704,7 +279,7 @@ const useRedaction = () => {
|
|
|
704
279
|
// Custom hook for managing user info
|
|
705
280
|
const useUserTracking = () => {
|
|
706
281
|
const tracker = useHumanBehavior();
|
|
707
|
-
const addUserInfo =
|
|
282
|
+
const addUserInfo = React.useCallback((userId, userProperties) => __awaiter(void 0, void 0, void 0, function* () {
|
|
708
283
|
try {
|
|
709
284
|
yield tracker.addUserInfo({ userId, userProperties });
|
|
710
285
|
return { success: true };
|
|
@@ -720,8 +295,8 @@ const useUserTracking = () => {
|
|
|
720
295
|
};
|
|
721
296
|
// Automatic page tracking component (similar to PostHog's PostHogPageView)
|
|
722
297
|
function HumanBehaviorPageView() {
|
|
723
|
-
const tracker =
|
|
724
|
-
|
|
298
|
+
const tracker = React.useContext(HumanBehaviorContext);
|
|
299
|
+
React.useEffect(() => {
|
|
725
300
|
if (tracker && typeof window !== 'undefined') {
|
|
726
301
|
// Track initial page load
|
|
727
302
|
tracker.trackPageView();
|