@mcp-fe/react-event-tracker 0.0.13 → 0.0.15
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/LICENSE +203 -0
- package/hooks/useReactRouterEventTracker.d.ts +3 -1
- package/hooks/useReactRouterEventTracker.d.ts.map +1 -1
- package/hooks/useTanstackRouterEventTracker.d.ts +3 -1
- package/hooks/useTanstackRouterEventTracker.d.ts.map +1 -1
- package/index.d.ts +15 -0
- package/index.d.ts.map +1 -1
- package/index.mjs +116 -109
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity granting the License.
|
|
13
|
+
|
|
14
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
15
|
+
other entities that control, are controlled by, or are under common
|
|
16
|
+
control with that entity. For the purposes of this definition,
|
|
17
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
18
|
+
direction or management of such entity, whether by contract or
|
|
19
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
20
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
21
|
+
|
|
22
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
23
|
+
exercising permissions granted by this License.
|
|
24
|
+
|
|
25
|
+
"Source" shall mean the preferred form for making modifications,
|
|
26
|
+
including but not limited to software source code, documentation
|
|
27
|
+
source, and configuration files.
|
|
28
|
+
|
|
29
|
+
"Object" shall mean any form resulting from mechanical
|
|
30
|
+
transformation or translation of a Source form, including but
|
|
31
|
+
not limited to compiled object code, generated documentation,
|
|
32
|
+
and conversions to other media types.
|
|
33
|
+
|
|
34
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
35
|
+
Object form, made available under the License, as indicated by a
|
|
36
|
+
copyright notice that is included in or attached to the work
|
|
37
|
+
(which shall not include communications that are solely about
|
|
38
|
+
and bear an appropriate legal notice).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based upon (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and derivative works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control
|
|
57
|
+
systems, and issue tracking systems that are managed by, or on behalf
|
|
58
|
+
of, the Licensor for the purpose of discussing and improving the Work,
|
|
59
|
+
but excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to use, reproduce, modify, merge, publish,
|
|
70
|
+
distribute, sublicense, and/or sell copies of the Work, and to
|
|
71
|
+
permit persons to whom the Work is furnished to do so, subject to
|
|
72
|
+
the following conditions:
|
|
73
|
+
|
|
74
|
+
The above copyright notice and this permission notice shall be
|
|
75
|
+
included in all copies or substantial portions of the Work.
|
|
76
|
+
|
|
77
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
78
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
79
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
80
|
+
(except as stated in this section) patent license to make, have made,
|
|
81
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
82
|
+
where such license applies only to those patent claims licensable
|
|
83
|
+
by such Contributor that are necessarily infringed by their
|
|
84
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
85
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
86
|
+
institute patent litigation against any entity (including a
|
|
87
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
88
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
89
|
+
or contributory patent infringement, then any patent licenses
|
|
90
|
+
granted to You under this License for that Work shall terminate
|
|
91
|
+
as of the date such litigation is filed.
|
|
92
|
+
|
|
93
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
94
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
95
|
+
modifications, and in Source or Object form, provided that You
|
|
96
|
+
meet the following conditions:
|
|
97
|
+
|
|
98
|
+
(a) You must give any other recipients of the Work or
|
|
99
|
+
Derivative Works a copy of this License; and
|
|
100
|
+
|
|
101
|
+
(b) You must cause any modified files to carry prominent notices
|
|
102
|
+
stating that You changed the files; and
|
|
103
|
+
|
|
104
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
105
|
+
that You distribute, all copyright, patent, trademark, and
|
|
106
|
+
attribution notices from the Source form of the Work,
|
|
107
|
+
excluding those notices that do not pertain to any part of
|
|
108
|
+
the Derivative Works; and
|
|
109
|
+
|
|
110
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
111
|
+
distribution, then any Derivative Works that You distribute must
|
|
112
|
+
include a readable copy of the attribution notices contained
|
|
113
|
+
within such NOTICE file, excluding those notices that do not
|
|
114
|
+
pertain to any part of the Derivative Works, in at least one
|
|
115
|
+
of the following places: within a NOTICE text file distributed
|
|
116
|
+
as part of the Derivative Works; within the Source form or
|
|
117
|
+
documentation, if provided along with the Derivative Works; or,
|
|
118
|
+
within a display generated by the Derivative Works, if and
|
|
119
|
+
wherever such third-party notices normally appear. The contents
|
|
120
|
+
of the NOTICE file are for informational purposes only and
|
|
121
|
+
do not modify the License. You may add Your own attribution
|
|
122
|
+
notices within Derivative Works that You distribute, alongside
|
|
123
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
124
|
+
that such additional attribution notices cannot be construed
|
|
125
|
+
as modifying the License.
|
|
126
|
+
|
|
127
|
+
You may add Your own copyright notice to Your modifications and
|
|
128
|
+
may provide additional or different license terms and conditions
|
|
129
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
130
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
131
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
132
|
+
the conditions stated in this License.
|
|
133
|
+
|
|
134
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
135
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
136
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
137
|
+
this License, without any additional terms or conditions.
|
|
138
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
139
|
+
the terms of any separate license agreement you may have executed
|
|
140
|
+
with Licensor regarding such Contributions.
|
|
141
|
+
|
|
142
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
143
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
144
|
+
except as required for reasonable and customary use in describing the
|
|
145
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
146
|
+
|
|
147
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
148
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
149
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
150
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
151
|
+
implied, including, without limitation, any warranties or conditions
|
|
152
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
153
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
154
|
+
appropriateness of using or redistributing the Work and assume any
|
|
155
|
+
risks associated with Your exercise of permissions under this License.
|
|
156
|
+
|
|
157
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
158
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
159
|
+
unless required by applicable law (such as deliberate and grossly
|
|
160
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
161
|
+
liable to You for damages, including any direct, indirect, special,
|
|
162
|
+
incidental, or consequential damages of any character arising as a
|
|
163
|
+
result of this License or out of the use or inability to use the
|
|
164
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
165
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
166
|
+
other commercial damages or losses), even if such Contributor
|
|
167
|
+
has been advised of the possibility of such damages.
|
|
168
|
+
|
|
169
|
+
9. Accepting Warranty or Support. You may choose to offer, and to
|
|
170
|
+
charge a fee for, warranty, support, indemnity or other liability
|
|
171
|
+
obligations and/or rights consistent with this License. However, in
|
|
172
|
+
accepting such obligations, You may act only on Your own behalf and on
|
|
173
|
+
Your sole responsibility, not on behalf of any other Contributor, and
|
|
174
|
+
only if You agree to indemnify, defend, and hold each Contributor
|
|
175
|
+
harmless for any liability incurred by, or claims asserted against,
|
|
176
|
+
such Contributor by reason of your accepting any such warranty or support.
|
|
177
|
+
|
|
178
|
+
END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following
|
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
184
|
+
replaced with your own identifying information. (Don't include
|
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
186
|
+
comment syntax for the file format. We also recommend that a
|
|
187
|
+
file or class name and description of purpose be included on the
|
|
188
|
+
same page as the copyright notice for easier identification within
|
|
189
|
+
third-party archives.
|
|
190
|
+
|
|
191
|
+
Copyright 2026 [name of copyright owner]
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { WorkerClientInitOptions } from '@mcp-fe/event-tracker';
|
|
2
|
-
export declare function useReactRouterEventTracker(initOptions?: WorkerClientInitOptions):
|
|
2
|
+
export declare function useReactRouterEventTracker(initOptions?: WorkerClientInitOptions): {
|
|
3
|
+
setAuthToken: (token: string) => void;
|
|
4
|
+
};
|
|
3
5
|
//# sourceMappingURL=useReactRouterEventTracker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactRouterEventTracker.d.ts","sourceRoot":"","sources":["../../../../libs/react-event-tracker/src/hooks/useReactRouterEventTracker.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"useReactRouterEventTracker.d.ts","sourceRoot":"","sources":["../../../../libs/react-event-tracker/src/hooks/useReactRouterEventTracker.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAE/B,wBAAgB,0BAA0B,CAAC,WAAW,CAAC,EAAE,uBAAuB,GAAG;IAAE,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CA2F3H"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { WorkerClientInitOptions } from '@mcp-fe/event-tracker';
|
|
2
|
-
export declare function useTanstackRouterEventTracker(initOptions?: WorkerClientInitOptions):
|
|
2
|
+
export declare function useTanstackRouterEventTracker(initOptions?: WorkerClientInitOptions): {
|
|
3
|
+
setAuthToken: (token: string) => void;
|
|
4
|
+
};
|
|
3
5
|
//# sourceMappingURL=useTanstackRouterEventTracker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTanstackRouterEventTracker.d.ts","sourceRoot":"","sources":["../../../../libs/react-event-tracker/src/hooks/useTanstackRouterEventTracker.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"useTanstackRouterEventTracker.d.ts","sourceRoot":"","sources":["../../../../libs/react-event-tracker/src/hooks/useTanstackRouterEventTracker.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAE/B,wBAAgB,6BAA6B,CAAC,WAAW,CAAC,EAAE,uBAAuB,GAAG;IAAE,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CA2F9H"}
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 MCP-FE Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
1
16
|
export * from './hooks/useTanstackRouterEventTracker';
|
|
2
17
|
export * from './hooks/useReactRouterEventTracker';
|
|
3
18
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../libs/react-event-tracker/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../libs/react-event-tracker/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC"}
|
package/index.mjs
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import * as S from "react";
|
|
2
|
-
import L, { useRef as R, useState as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
2
|
+
import L, { useRef as R, useState as Z, useEffect as _ } from "react";
|
|
3
|
+
const ce = Object.prototype.hasOwnProperty;
|
|
4
|
+
function ee(t, e, r = 0) {
|
|
5
5
|
if (t === e)
|
|
6
6
|
return t;
|
|
7
7
|
if (r > 500) return e;
|
|
8
|
-
const o = e, n =
|
|
9
|
-
if (!n && !(
|
|
10
|
-
const l = n ? t :
|
|
8
|
+
const o = e, n = K(t) && K(o);
|
|
9
|
+
if (!n && !(z(t) && z(o))) return o;
|
|
10
|
+
const l = n ? t : V(t);
|
|
11
11
|
if (!l) return o;
|
|
12
|
-
const a = n ? o :
|
|
12
|
+
const a = n ? o : V(o);
|
|
13
13
|
if (!a) return o;
|
|
14
14
|
const c = l.length, i = a.length, s = n ? new Array(i) : {};
|
|
15
15
|
let h = 0;
|
|
16
16
|
for (let v = 0; v < i; v++) {
|
|
17
17
|
const p = n ? v : a[v], u = t[p], f = o[p];
|
|
18
18
|
if (u === f) {
|
|
19
|
-
s[p] = u, (n ? v < c :
|
|
19
|
+
s[p] = u, (n ? v < c : ce.call(t, p)) && h++;
|
|
20
20
|
continue;
|
|
21
21
|
}
|
|
22
22
|
if (u === null || f === null || typeof u != "object" || typeof f != "object") {
|
|
23
23
|
s[p] = f;
|
|
24
24
|
continue;
|
|
25
25
|
}
|
|
26
|
-
const d =
|
|
26
|
+
const d = ee(u, f, r + 1);
|
|
27
27
|
s[p] = d, d === u && h++;
|
|
28
28
|
}
|
|
29
29
|
return c === i && h === c ? t : s;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function V(t) {
|
|
32
32
|
const e = [], r = Object.getOwnPropertyNames(t);
|
|
33
33
|
for (const n of r) {
|
|
34
34
|
if (!Object.prototype.propertyIsEnumerable.call(t, n)) return !1;
|
|
@@ -41,24 +41,24 @@ function M(t) {
|
|
|
41
41
|
}
|
|
42
42
|
return e;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
if (!
|
|
44
|
+
function z(t) {
|
|
45
|
+
if (!G(t))
|
|
46
46
|
return !1;
|
|
47
47
|
const e = t.constructor;
|
|
48
48
|
if (typeof e > "u")
|
|
49
49
|
return !0;
|
|
50
50
|
const r = e.prototype;
|
|
51
|
-
return !(!
|
|
51
|
+
return !(!G(r) || !r.hasOwnProperty("isPrototypeOf"));
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function G(t) {
|
|
54
54
|
return Object.prototype.toString.call(t) === "[object Object]";
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function K(t) {
|
|
57
57
|
return Array.isArray(t) && t.length === Object.keys(t).length;
|
|
58
58
|
}
|
|
59
|
-
var
|
|
60
|
-
function
|
|
61
|
-
if (!
|
|
59
|
+
var ue = process.env.NODE_ENV === "production";
|
|
60
|
+
function le(t, e) {
|
|
61
|
+
if (!ue) {
|
|
62
62
|
if (t)
|
|
63
63
|
return;
|
|
64
64
|
var r = "Warning: " + e;
|
|
@@ -70,10 +70,10 @@ function ue(t, e) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
var C = { exports: {} }, A = {}, N = { exports: {} }, b = {};
|
|
73
|
-
var
|
|
74
|
-
function
|
|
75
|
-
if (
|
|
76
|
-
|
|
73
|
+
var H;
|
|
74
|
+
function fe() {
|
|
75
|
+
if (H) return b;
|
|
76
|
+
H = 1;
|
|
77
77
|
var t = L;
|
|
78
78
|
function e(v, p) {
|
|
79
79
|
return v === p && (v !== 0 || 1 / v === 1 / p) || v !== v && p !== p;
|
|
@@ -112,9 +112,9 @@ function le() {
|
|
|
112
112
|
return b.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : h, b;
|
|
113
113
|
}
|
|
114
114
|
var I = {};
|
|
115
|
-
var
|
|
116
|
-
function
|
|
117
|
-
return
|
|
115
|
+
var F;
|
|
116
|
+
function de() {
|
|
117
|
+
return F || (F = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
118
118
|
function t(u, f) {
|
|
119
119
|
return u === f && (u !== 0 || 1 / u === 1 / f) || u !== u && f !== f;
|
|
120
120
|
}
|
|
@@ -165,15 +165,15 @@ function fe() {
|
|
|
165
165
|
I.useSyncExternalStore = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : p, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
166
166
|
})()), I;
|
|
167
167
|
}
|
|
168
|
-
var F;
|
|
169
|
-
function ee() {
|
|
170
|
-
return F || (F = 1, process.env.NODE_ENV === "production" ? N.exports = le() : N.exports = fe()), N.exports;
|
|
171
|
-
}
|
|
172
168
|
var q;
|
|
173
|
-
function
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
169
|
+
function te() {
|
|
170
|
+
return q || (q = 1, process.env.NODE_ENV === "production" ? N.exports = fe() : N.exports = de()), N.exports;
|
|
171
|
+
}
|
|
172
|
+
var X;
|
|
173
|
+
function he() {
|
|
174
|
+
if (X) return A;
|
|
175
|
+
X = 1;
|
|
176
|
+
var t = L, e = te();
|
|
177
177
|
function r(s, h) {
|
|
178
178
|
return s === h && (s !== 0 || 1 / s === 1 / h) || s !== s && h !== h;
|
|
179
179
|
}
|
|
@@ -221,14 +221,14 @@ function de() {
|
|
|
221
221
|
}, A;
|
|
222
222
|
}
|
|
223
223
|
var P = {};
|
|
224
|
-
var
|
|
225
|
-
function
|
|
226
|
-
return
|
|
224
|
+
var $;
|
|
225
|
+
function ve() {
|
|
226
|
+
return $ || ($ = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
227
227
|
function t(s, h) {
|
|
228
228
|
return s === h && (s !== 0 || 1 / s === 1 / h) || s !== s && h !== h;
|
|
229
229
|
}
|
|
230
230
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
231
|
-
var e = L, r =
|
|
231
|
+
var e = L, r = te(), o = typeof Object.is == "function" ? Object.is : t, n = r.useSyncExternalStore, l = e.useRef, a = e.useEffect, c = e.useMemo, i = e.useDebugValue;
|
|
232
232
|
P.useSyncExternalStoreWithSelector = function(s, h, v, p, u) {
|
|
233
233
|
var f = l(null);
|
|
234
234
|
if (f.current === null) {
|
|
@@ -273,14 +273,14 @@ function he() {
|
|
|
273
273
|
}, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
274
274
|
})()), P;
|
|
275
275
|
}
|
|
276
|
-
var
|
|
277
|
-
function
|
|
278
|
-
return
|
|
276
|
+
var j;
|
|
277
|
+
function pe() {
|
|
278
|
+
return j || (j = 1, process.env.NODE_ENV === "production" ? C.exports = he() : C.exports = ve()), C.exports;
|
|
279
279
|
}
|
|
280
|
-
var
|
|
281
|
-
function
|
|
282
|
-
const o = r.equal ??
|
|
283
|
-
return
|
|
280
|
+
var ke = pe();
|
|
281
|
+
function me(t, e = (o) => o, r = {}) {
|
|
282
|
+
const o = r.equal ?? ge;
|
|
283
|
+
return ke.useSyncExternalStoreWithSelector(
|
|
284
284
|
t.subscribe,
|
|
285
285
|
() => t.state,
|
|
286
286
|
() => t.state,
|
|
@@ -288,7 +288,7 @@ function ke(t, e = (o) => o, r = {}) {
|
|
|
288
288
|
o
|
|
289
289
|
);
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function ge(t, e) {
|
|
292
292
|
if (Object.is(t, e))
|
|
293
293
|
return !0;
|
|
294
294
|
if (typeof t != "object" || t === null || typeof e != "object" || e === null)
|
|
@@ -307,38 +307,38 @@ function me(t, e) {
|
|
|
307
307
|
}
|
|
308
308
|
if (t instanceof Date && e instanceof Date)
|
|
309
309
|
return t.getTime() === e.getTime();
|
|
310
|
-
const r =
|
|
311
|
-
if (r.length !==
|
|
310
|
+
const r = Y(t);
|
|
311
|
+
if (r.length !== Y(e).length)
|
|
312
312
|
return !1;
|
|
313
313
|
for (let o = 0; o < r.length; o++)
|
|
314
314
|
if (!Object.prototype.hasOwnProperty.call(e, r[o]) || !Object.is(t[r[o]], e[r[o]]))
|
|
315
315
|
return !1;
|
|
316
316
|
return !0;
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function Y(t) {
|
|
319
319
|
return Object.keys(t).concat(
|
|
320
320
|
Object.getOwnPropertySymbols(t)
|
|
321
321
|
);
|
|
322
322
|
}
|
|
323
323
|
const U = S.createContext(null);
|
|
324
|
-
function
|
|
324
|
+
function Ee() {
|
|
325
325
|
return typeof document > "u" ? U : window.__TSR_ROUTER_CONTEXT__ ? window.__TSR_ROUTER_CONTEXT__ : (window.__TSR_ROUTER_CONTEXT__ = U, U);
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
const e = S.useContext(
|
|
329
|
-
return
|
|
327
|
+
function Se(t) {
|
|
328
|
+
const e = S.useContext(Ee());
|
|
329
|
+
return le(
|
|
330
330
|
!((t?.warn ?? !0) && !e),
|
|
331
331
|
"useRouter must be used inside a <RouterProvider> component!"
|
|
332
332
|
), e;
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
const e =
|
|
334
|
+
function _e(t) {
|
|
335
|
+
const e = Se({
|
|
336
336
|
warn: t?.router === void 0
|
|
337
337
|
}), r = t?.router || e, o = R(void 0);
|
|
338
|
-
return
|
|
338
|
+
return me(r.__store, (n) => {
|
|
339
339
|
if (t?.select) {
|
|
340
340
|
if (t.structuralSharing ?? r.options.defaultStructuralSharing) {
|
|
341
|
-
const l =
|
|
341
|
+
const l = ee(
|
|
342
342
|
o.current,
|
|
343
343
|
t.select(n)
|
|
344
344
|
);
|
|
@@ -349,12 +349,12 @@ function Se(t) {
|
|
|
349
349
|
return n;
|
|
350
350
|
});
|
|
351
351
|
}
|
|
352
|
-
function
|
|
353
|
-
return
|
|
352
|
+
function ye(t) {
|
|
353
|
+
return _e({
|
|
354
354
|
select: (e) => e.location
|
|
355
355
|
});
|
|
356
356
|
}
|
|
357
|
-
class
|
|
357
|
+
class Te {
|
|
358
358
|
// Configurable worker script URLs (defaults kept for backward compatibility)
|
|
359
359
|
sharedWorkerUrl = "/mcp-shared-worker.js";
|
|
360
360
|
serviceWorkerUrl = "/mcp-service-worker.js";
|
|
@@ -633,20 +633,23 @@ class ye {
|
|
|
633
633
|
else this.workerType === "service" && (this.sendAuthTokenToServiceWorker(e), this.pendingAuthToken = null);
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
-
const
|
|
636
|
+
const D = new Te();
|
|
637
637
|
async function re(t) {
|
|
638
|
-
return
|
|
638
|
+
return D.init(t);
|
|
639
639
|
}
|
|
640
|
-
async function
|
|
640
|
+
async function x(t) {
|
|
641
641
|
const e = { ...t, timestamp: Date.now() };
|
|
642
|
-
await
|
|
642
|
+
await D.request("STORE_EVENT", { event: e });
|
|
643
643
|
}
|
|
644
|
-
|
|
645
|
-
|
|
644
|
+
function ne(t) {
|
|
645
|
+
D.setAuthToken(t);
|
|
646
646
|
}
|
|
647
647
|
async function oe(t, e, r) {
|
|
648
|
+
return x({ type: "navigation", from: t, to: e, path: r || e });
|
|
649
|
+
}
|
|
650
|
+
async function ie(t, e, r) {
|
|
648
651
|
const o = t.id || void 0, n = t.className || void 0, l = t.textContent?.trim().substring(0, 100) || void 0, a = t.tagName.toLowerCase();
|
|
649
|
-
return
|
|
652
|
+
return x({
|
|
650
653
|
type: "click",
|
|
651
654
|
element: a,
|
|
652
655
|
elementId: o,
|
|
@@ -656,9 +659,9 @@ async function oe(t, e, r) {
|
|
|
656
659
|
metadata: r
|
|
657
660
|
});
|
|
658
661
|
}
|
|
659
|
-
async function
|
|
662
|
+
async function se(t, e, r) {
|
|
660
663
|
const o = t.id || void 0, n = t.className || void 0, l = t.tagName.toLowerCase();
|
|
661
|
-
return
|
|
664
|
+
return x({
|
|
662
665
|
type: "input",
|
|
663
666
|
element: l,
|
|
664
667
|
elementId: o,
|
|
@@ -670,9 +673,9 @@ async function ie(t, e, r) {
|
|
|
670
673
|
}
|
|
671
674
|
});
|
|
672
675
|
}
|
|
673
|
-
function
|
|
674
|
-
const e =
|
|
675
|
-
_(() => {
|
|
676
|
+
function Pe(t) {
|
|
677
|
+
const e = ye(), [r, o] = Z(!1), n = R(e.pathname), l = R(null);
|
|
678
|
+
return _(() => {
|
|
676
679
|
n.current !== e.pathname && (l.current = n.current, n.current = e.pathname);
|
|
677
680
|
}, [e.pathname]), _(() => {
|
|
678
681
|
re(t).then(() => o(!0)).catch((a) => {
|
|
@@ -681,7 +684,7 @@ function Ie(t) {
|
|
|
681
684
|
}, [t]), _(() => {
|
|
682
685
|
if (!r) return;
|
|
683
686
|
const a = l.current, c = n.current;
|
|
684
|
-
a && a !== c &&
|
|
687
|
+
a && a !== c && oe(a, c, c).catch((i) => {
|
|
685
688
|
console.error("Failed to track navigation:", i);
|
|
686
689
|
});
|
|
687
690
|
}, [e.pathname, r]), _(() => {
|
|
@@ -689,7 +692,7 @@ function Ie(t) {
|
|
|
689
692
|
const a = (c) => {
|
|
690
693
|
const i = c.target;
|
|
691
694
|
if (!i) return;
|
|
692
|
-
i.tagName === "BUTTON" || i.tagName === "A" || i.closest("button") || i.closest("a") ||
|
|
695
|
+
i.tagName === "BUTTON" || i.tagName === "A" || i.closest("button") || i.closest("a") || ie(i, n.current).catch((h) => {
|
|
693
696
|
console.error("Failed to track click:", h);
|
|
694
697
|
});
|
|
695
698
|
};
|
|
@@ -700,7 +703,7 @@ function Ie(t) {
|
|
|
700
703
|
const c = (i) => {
|
|
701
704
|
const s = i.target;
|
|
702
705
|
s && (s.tagName === "INPUT" || s.tagName === "TEXTAREA") && (clearTimeout(a), a = setTimeout(() => {
|
|
703
|
-
|
|
706
|
+
se(s, s.value, n.current).catch(
|
|
704
707
|
(h) => {
|
|
705
708
|
console.error("Failed to track input:", h);
|
|
706
709
|
}
|
|
@@ -710,57 +713,59 @@ function Ie(t) {
|
|
|
710
713
|
return document.addEventListener("input", c, !0), () => {
|
|
711
714
|
clearTimeout(a), document.removeEventListener("input", c, !0);
|
|
712
715
|
};
|
|
713
|
-
}, [r])
|
|
716
|
+
}, [r]), {
|
|
717
|
+
setAuthToken: ne
|
|
718
|
+
};
|
|
714
719
|
}
|
|
715
|
-
var
|
|
720
|
+
var B;
|
|
716
721
|
(function(t) {
|
|
717
722
|
t.Pop = "POP", t.Push = "PUSH", t.Replace = "REPLACE";
|
|
718
|
-
})(
|
|
719
|
-
function
|
|
723
|
+
})(B || (B = {}));
|
|
724
|
+
function J(t, e) {
|
|
720
725
|
throw new Error(e);
|
|
721
726
|
}
|
|
722
|
-
var
|
|
727
|
+
var Q;
|
|
723
728
|
(function(t) {
|
|
724
729
|
t.data = "data", t.deferred = "deferred", t.redirect = "redirect", t.error = "error";
|
|
725
|
-
})(
|
|
726
|
-
const
|
|
727
|
-
new Set(
|
|
728
|
-
const
|
|
729
|
-
new Set(
|
|
730
|
-
const Oe = /* @__PURE__ */ S.createContext(null);
|
|
731
|
-
process.env.NODE_ENV !== "production" && (Oe.displayName = "DataRouter");
|
|
730
|
+
})(Q || (Q = {}));
|
|
731
|
+
const ae = ["post", "put", "patch", "delete"];
|
|
732
|
+
new Set(ae);
|
|
733
|
+
const Oe = ["get", ...ae];
|
|
734
|
+
new Set(Oe);
|
|
732
735
|
const We = /* @__PURE__ */ S.createContext(null);
|
|
733
|
-
process.env.NODE_ENV !== "production" && (We.displayName = "
|
|
736
|
+
process.env.NODE_ENV !== "production" && (We.displayName = "DataRouter");
|
|
734
737
|
const we = /* @__PURE__ */ S.createContext(null);
|
|
735
|
-
process.env.NODE_ENV !== "production" && (we.displayName = "
|
|
738
|
+
process.env.NODE_ENV !== "production" && (we.displayName = "DataRouterState");
|
|
736
739
|
const Re = /* @__PURE__ */ S.createContext(null);
|
|
737
|
-
process.env.NODE_ENV !== "production" && (Re.displayName = "
|
|
738
|
-
const
|
|
739
|
-
process.env.NODE_ENV !== "production" && (
|
|
740
|
-
const
|
|
740
|
+
process.env.NODE_ENV !== "production" && (Re.displayName = "Await");
|
|
741
|
+
const Ce = /* @__PURE__ */ S.createContext(null);
|
|
742
|
+
process.env.NODE_ENV !== "production" && (Ce.displayName = "Navigation");
|
|
743
|
+
const M = /* @__PURE__ */ S.createContext(null);
|
|
744
|
+
process.env.NODE_ENV !== "production" && (M.displayName = "Location");
|
|
745
|
+
const Ne = /* @__PURE__ */ S.createContext({
|
|
741
746
|
outlet: null,
|
|
742
747
|
matches: [],
|
|
743
748
|
isDataRoute: !1
|
|
744
749
|
});
|
|
745
|
-
process.env.NODE_ENV !== "production" && (
|
|
746
|
-
const
|
|
747
|
-
process.env.NODE_ENV !== "production" && (
|
|
748
|
-
function Le() {
|
|
749
|
-
return S.useContext(x) != null;
|
|
750
|
-
}
|
|
750
|
+
process.env.NODE_ENV !== "production" && (Ne.displayName = "Route");
|
|
751
|
+
const Le = /* @__PURE__ */ S.createContext(null);
|
|
752
|
+
process.env.NODE_ENV !== "production" && (Le.displayName = "RouteError");
|
|
751
753
|
function Ae() {
|
|
752
|
-
return
|
|
754
|
+
return S.useContext(M) != null;
|
|
755
|
+
}
|
|
756
|
+
function be() {
|
|
757
|
+
return Ae() || (process.env.NODE_ENV !== "production" ? J(
|
|
753
758
|
!1,
|
|
754
759
|
// TODO: This error is probably because they somehow have 2 versions of the
|
|
755
760
|
// router loaded. We can help them understand how to avoid that.
|
|
756
761
|
"useLocation() may be used only in the context of a <Router> component."
|
|
757
|
-
) :
|
|
762
|
+
) : J()), S.useContext(M).location;
|
|
758
763
|
}
|
|
759
764
|
new Promise(() => {
|
|
760
765
|
});
|
|
761
|
-
function
|
|
762
|
-
const e =
|
|
763
|
-
_(() => {
|
|
766
|
+
function Ue(t) {
|
|
767
|
+
const e = be(), [r, o] = Z(!1), n = R(e.pathname), l = R(null);
|
|
768
|
+
return _(() => {
|
|
764
769
|
l.current = n.current, n.current = e.pathname;
|
|
765
770
|
}, [e.pathname]), _(() => {
|
|
766
771
|
re(t).then(() => {
|
|
@@ -771,7 +776,7 @@ function Pe(t) {
|
|
|
771
776
|
}, [t]), _(() => {
|
|
772
777
|
if (!r) return;
|
|
773
778
|
const a = l.current, c = n.current;
|
|
774
|
-
a && a !== c &&
|
|
779
|
+
a && a !== c && oe(a, c, c).catch((i) => {
|
|
775
780
|
console.error("Failed to track navigation:", i);
|
|
776
781
|
});
|
|
777
782
|
}, [e.pathname, r]), _(() => {
|
|
@@ -779,7 +784,7 @@ function Pe(t) {
|
|
|
779
784
|
const a = (c) => {
|
|
780
785
|
const i = c.target;
|
|
781
786
|
if (!i) return;
|
|
782
|
-
i.tagName === "BUTTON" || i.tagName === "A" || i.closest("button") || i.closest("a") ||
|
|
787
|
+
i.tagName === "BUTTON" || i.tagName === "A" || i.closest("button") || i.closest("a") || ie(i, n.current).catch((h) => {
|
|
783
788
|
console.error("Failed to track click:", h);
|
|
784
789
|
});
|
|
785
790
|
};
|
|
@@ -790,7 +795,7 @@ function Pe(t) {
|
|
|
790
795
|
const c = (i) => {
|
|
791
796
|
const s = i.target;
|
|
792
797
|
s && (s.tagName === "INPUT" || s.tagName === "TEXTAREA") && (clearTimeout(a), a = setTimeout(() => {
|
|
793
|
-
|
|
798
|
+
se(s, s.value, n.current).catch(
|
|
794
799
|
(h) => {
|
|
795
800
|
console.error("Failed to track input:", h);
|
|
796
801
|
}
|
|
@@ -800,9 +805,11 @@ function Pe(t) {
|
|
|
800
805
|
return document.addEventListener("input", c, !0), () => {
|
|
801
806
|
clearTimeout(a), document.removeEventListener("input", c, !0);
|
|
802
807
|
};
|
|
803
|
-
}, [r])
|
|
808
|
+
}, [r]), {
|
|
809
|
+
setAuthToken: ne
|
|
810
|
+
};
|
|
804
811
|
}
|
|
805
812
|
export {
|
|
806
|
-
|
|
807
|
-
|
|
813
|
+
Ue as useReactRouterEventTracker,
|
|
814
|
+
Pe as useTanstackRouterEventTracker
|
|
808
815
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-fe/react-event-tracker",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
|
+
"license": "Apache-2.0",
|
|
4
5
|
"main": "./index.js",
|
|
5
6
|
"types": "./index.d.ts",
|
|
6
7
|
"exports": {
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
}
|
|
12
13
|
},
|
|
13
14
|
"dependencies": {
|
|
14
|
-
"@mcp-fe/event-tracker": "0.0.
|
|
15
|
+
"@mcp-fe/event-tracker": "0.0.15"
|
|
15
16
|
},
|
|
16
17
|
"peerDependencies": {
|
|
17
18
|
"react": ">=19.0.0",
|