@cbnsndwch/react-tracking 0.1.0
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.md +9 -0
- package/README.md +250 -0
- package/dist/ReactTrackingContext.d.ts +4 -0
- package/dist/ReactTrackingContext.d.ts.map +1 -0
- package/dist/TrackingPropType.d.ts +3 -0
- package/dist/TrackingPropType.d.ts.map +1 -0
- package/dist/dispatchTrackingEvent.d.ts +8 -0
- package/dist/dispatchTrackingEvent.d.ts.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +610 -0
- package/dist/index.js.map +1 -0
- package/dist/makeClassMemberDecorator.d.ts +11 -0
- package/dist/makeClassMemberDecorator.d.ts.map +1 -0
- package/dist/trackEventMethodDecorator.d.ts +5 -0
- package/dist/trackEventMethodDecorator.d.ts.map +1 -0
- package/dist/trackingHoC.d.ts +6 -0
- package/dist/trackingHoC.d.ts.map +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/useTracking.d.ts +11 -0
- package/dist/useTracking.d.ts.map +1 -0
- package/dist/useTrackingImpl.d.ts +11 -0
- package/dist/useTrackingImpl.d.ts.map +1 -0
- package/dist/withTrackingComponentDecorator.d.ts +7 -0
- package/dist/withTrackingComponentDecorator.d.ts.map +1 -0
- package/package.json +119 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright 2026-present **cbnsndwch LLC**
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# @cbnsndwch/react-tracking
|
|
2
|
+
|
|
3
|
+
> **Fork Notice:** This is a modernized fork of [nytimes/react-tracking](https://github.com/nytimes/react-tracking). See [ACKNOWLEDGEMENTS.md](ACKNOWLEDGEMENTS.md) for attribution and license details.
|
|
4
|
+
|
|
5
|
+
Declarative tracking for React apps.
|
|
6
|
+
|
|
7
|
+
- React Hook (`useTracking`) and Higher-Order Component (`track()`) APIs
|
|
8
|
+
- Compartmentalize tracking concerns to individual components
|
|
9
|
+
- Analytics platform agnostic
|
|
10
|
+
- Full TypeScript support with bundled type declarations
|
|
11
|
+
- ESM-only, tree-shakeable
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install @cbnsndwch/react-tracking
|
|
17
|
+
# or
|
|
18
|
+
pnpm add @cbnsndwch/react-tracking
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import track, { useTracking } from '@cbnsndwch/react-tracking';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Both `track()` and `useTracking()` accept two arguments: `trackingData` and `options`.
|
|
28
|
+
|
|
29
|
+
- `trackingData` — the data to be tracked (or a function returning that data)
|
|
30
|
+
- `options` — an optional object with the following properties:
|
|
31
|
+
- `dispatch` — a function to use instead of the default dispatch behavior. See [Custom dispatch](#custom-optionsdispatch-for-tracking-data) below.
|
|
32
|
+
- `dispatchOnMount` — when `true`, dispatches tracking data when the component mounts. When a function, it is called with all contextual tracking data on initial render.
|
|
33
|
+
- `process` — a function defined once at some top-level component, used for selectively dispatching tracking events based on each component's tracking data. See [Top level process](#top-level-optionsprocess) below.
|
|
34
|
+
- `forwardRef` (HoC only) — when `true`, a ref on the wrapped component returns the underlying component instance. Default: `false`.
|
|
35
|
+
- `mergeOptions` — [deepmerge options](https://github.com/TehShrike/deepmerge#options).
|
|
36
|
+
|
|
37
|
+
### `useTracking` Hook
|
|
38
|
+
|
|
39
|
+
The recommended API. Returns `trackEvent`, `getTrackingData`, and a `<Track />` provider component:
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { useTracking } from '@cbnsndwch/react-tracking';
|
|
43
|
+
|
|
44
|
+
function FooPage() {
|
|
45
|
+
const { Track, trackEvent } = useTracking({ page: 'FooPage' });
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Track>
|
|
49
|
+
<button onClick={() => trackEvent({ action: 'click' })}>
|
|
50
|
+
Click Me
|
|
51
|
+
</button>
|
|
52
|
+
</Track>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Wrap your returned markup with `<Track />` to pass contextual tracking data to child components via [deepmerge]. Leaf components that don't have tracked children can skip `<Track />`:
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { useTracking } from '@cbnsndwch/react-tracking';
|
|
61
|
+
|
|
62
|
+
function Child() {
|
|
63
|
+
const { trackEvent } = useTracking();
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<button onClick={() => trackEvent({ action: 'childClick' })}>
|
|
67
|
+
Click
|
|
68
|
+
</button>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function FooPage() {
|
|
73
|
+
const { Track, trackEvent } = useTracking({ page: 'FooPage' });
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<Track>
|
|
77
|
+
<Child />
|
|
78
|
+
<button onClick={() => trackEvent({ action: 'click' })}>
|
|
79
|
+
Click Me
|
|
80
|
+
</button>
|
|
81
|
+
</Track>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
In this example, clicking the button in `Child` dispatches:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{ "page": "FooPage", "action": "childClick" }
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### `track()` Higher-Order Component
|
|
93
|
+
|
|
94
|
+
The `track()` export wraps a component and injects a `tracking` prop with `trackEvent()` and `getTrackingData()` methods:
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import track from '@cbnsndwch/react-tracking';
|
|
98
|
+
|
|
99
|
+
function FooPage({ tracking }) {
|
|
100
|
+
return (
|
|
101
|
+
<button onClick={() => tracking.trackEvent({ action: 'click' })}>
|
|
102
|
+
Click Me
|
|
103
|
+
</button>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export default track({ page: 'FooPage' })(FooPage);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Custom `options.dispatch()` for tracking data
|
|
111
|
+
|
|
112
|
+
By default, tracking data is pushed to `window.dataLayer[]` (see [src/dispatchTrackingEvent.ts](src/dispatchTrackingEvent.ts)), which works well with Google Tag Manager.
|
|
113
|
+
|
|
114
|
+
Override this by passing a `dispatch` function at a top-level component:
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { useTracking } from '@cbnsndwch/react-tracking';
|
|
118
|
+
|
|
119
|
+
export default function App({ children }) {
|
|
120
|
+
const { Track } = useTracking(
|
|
121
|
+
{},
|
|
122
|
+
{ dispatch: data => window.myCustomDataLayer.push(data) }
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
return <Track>{children}</Track>;
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Every child component will inherit this dispatch function.
|
|
130
|
+
|
|
131
|
+
### `options.dispatchOnMount`
|
|
132
|
+
|
|
133
|
+
#### As a boolean
|
|
134
|
+
|
|
135
|
+
Dispatches tracking data when a component mounts — useful for page-level tracking:
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
function FooPage() {
|
|
139
|
+
useTracking({ page: 'FooPage' }, { dispatchOnMount: true });
|
|
140
|
+
return <div>Foo</div>;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### As a function
|
|
145
|
+
|
|
146
|
+
Called with all contextual tracking data on mount. The returned object is [deepmerge]d with context data and dispatched:
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
function FooPage() {
|
|
150
|
+
useTracking(
|
|
151
|
+
{ page: 'FooPage' },
|
|
152
|
+
{ dispatchOnMount: contextData => ({ event: 'pageDataReady' }) }
|
|
153
|
+
);
|
|
154
|
+
return <div>Foo</div>;
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Dispatches: `{ event: 'pageDataReady', page: 'FooPage' }`
|
|
159
|
+
|
|
160
|
+
### Top level `options.process`
|
|
161
|
+
|
|
162
|
+
Define an `options.process` function once at a top-level component to implicitly dispatch events based on each component's tracking data. Return a falsy value to skip dispatch:
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
function App() {
|
|
166
|
+
const { Track } = useTracking(
|
|
167
|
+
{},
|
|
168
|
+
{
|
|
169
|
+
process: ownTrackingData =>
|
|
170
|
+
ownTrackingData.page ? { event: 'pageview' } : null
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<Track>
|
|
176
|
+
<Page1 />
|
|
177
|
+
<Page2 />
|
|
178
|
+
</Track>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function Page1() {
|
|
183
|
+
useTracking({ page: 'Page1' });
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function Page2() {
|
|
187
|
+
useTracking({});
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
When `Page1` mounts, `{ page: 'Page1', event: 'pageview' }` is dispatched. `Page2` dispatches nothing.
|
|
192
|
+
|
|
193
|
+
### Dynamic Tracking Data
|
|
194
|
+
|
|
195
|
+
Pass a function to compute tracking data from props at render time:
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
import track from '@cbnsndwch/react-tracking';
|
|
199
|
+
|
|
200
|
+
const FooPage = track(props => ({
|
|
201
|
+
page: props.isNew ? 'new' : 'existing'
|
|
202
|
+
}))(({ tracking }) => (
|
|
203
|
+
<button onClick={() => tracking.trackEvent({ action: 'click' })}>
|
|
204
|
+
Click
|
|
205
|
+
</button>
|
|
206
|
+
));
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### `getTrackingData()`
|
|
210
|
+
|
|
211
|
+
Access all contextual tracking data accumulated up the component tree:
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
import { useMemo } from 'react';
|
|
215
|
+
import { useTracking } from '@cbnsndwch/react-tracking';
|
|
216
|
+
|
|
217
|
+
function AdComponent() {
|
|
218
|
+
const randomId = useMemo(() => Math.floor(Math.random() * 100), []);
|
|
219
|
+
const { getTrackingData } = useTracking({ page_view_id: randomId });
|
|
220
|
+
const { page_view_id } = getTrackingData();
|
|
221
|
+
|
|
222
|
+
return <Ad pageViewId={page_view_id} />;
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Tracking Data Format
|
|
227
|
+
|
|
228
|
+
There are no restrictions on the shape of tracking data objects. **The format is a contract between your app and the consumer of the tracking data.**
|
|
229
|
+
|
|
230
|
+
This library merges tracking data objects (via [deepmerge]) as they flow through your React component hierarchy into a single object sent to the tracking agent.
|
|
231
|
+
|
|
232
|
+
### TypeScript
|
|
233
|
+
|
|
234
|
+
Types are bundled with the package — no need for `@types/*`. All public APIs are fully typed.
|
|
235
|
+
|
|
236
|
+
### Deepmerge
|
|
237
|
+
|
|
238
|
+
You can use the copy of deepmerge bundled with this library:
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
import { deepmerge } from '@cbnsndwch/react-tracking';
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
[MIT](LICENSE)
|
|
247
|
+
|
|
248
|
+
This project is a fork of [nytimes/react-tracking](https://github.com/nytimes/react-tracking), originally licensed under Apache 2.0. See [ACKNOWLEDGEMENTS.md](ACKNOWLEDGEMENTS.md).
|
|
249
|
+
|
|
250
|
+
[deepmerge]: https://www.npmjs.com/package/deepmerge
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactTrackingContext.d.ts","sourceRoot":"","sources":["../src/ReactTrackingContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,QAAA,MAAM,oBAAoB,wDAAmD,CAAC;AAE9E,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrackingPropType.d.ts","sourceRoot":"","sources":["../src/TrackingPropType.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,IAAI,OAAO,EAAE,MAAM,SAAS,CAAC;AACvD,YAAY,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatchTrackingEvent.d.ts","sourceRoot":"","sources":["../src/dispatchTrackingEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;KAC9B;CACJ;AAED,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAItE"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as track } from './trackingHoC';
|
|
2
|
+
export { default as deepmerge } from 'deepmerge';
|
|
3
|
+
export { default as withTracking } from './withTrackingComponentDecorator';
|
|
4
|
+
export { default as trackEvent } from './trackEventMethodDecorator';
|
|
5
|
+
export { default as useTracking } from './useTracking';
|
|
6
|
+
export type { TrackingPropType } from './TrackingPropType';
|
|
7
|
+
export type { TrackingData, TrackingDataInput, TrackingOptions, TrackingProp, TrackingContextValue, WithTrackingProps } from './types';
|
|
8
|
+
export { track };
|
|
9
|
+
export default track;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,eAAe,CAAC;AAElC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AAEvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,YAAY,EACR,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACpB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,eAAe,KAAK,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,610 @@
|
|
|
1
|
+
import React, { createContext, useCallback, useContext, useDebugValue, useEffect, useMemo, useRef } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
|
+
key = keys[i];
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
+
value: mod,
|
|
23
|
+
enumerable: true
|
|
24
|
+
}) : target, mod));
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js
|
|
27
|
+
/** @license React v16.13.1
|
|
28
|
+
* react-is.production.min.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/
|
|
35
|
+
var require_react_is_production_min = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
36
|
+
var b = "function" === typeof Symbol && Symbol.for, c = b ? Symbol.for("react.element") : 60103, d = b ? Symbol.for("react.portal") : 60106, e = b ? Symbol.for("react.fragment") : 60107, f = b ? Symbol.for("react.strict_mode") : 60108, g = b ? Symbol.for("react.profiler") : 60114, h = b ? Symbol.for("react.provider") : 60109, k = b ? Symbol.for("react.context") : 60110, l = b ? Symbol.for("react.async_mode") : 60111, m = b ? Symbol.for("react.concurrent_mode") : 60111, n = b ? Symbol.for("react.forward_ref") : 60112, p = b ? Symbol.for("react.suspense") : 60113, q = b ? Symbol.for("react.suspense_list") : 60120, r = b ? Symbol.for("react.memo") : 60115, t = b ? Symbol.for("react.lazy") : 60116, v = b ? Symbol.for("react.block") : 60121, w = b ? Symbol.for("react.fundamental") : 60117, x = b ? Symbol.for("react.responder") : 60118, y = b ? Symbol.for("react.scope") : 60119;
|
|
37
|
+
function z(a) {
|
|
38
|
+
if ("object" === typeof a && null !== a) {
|
|
39
|
+
var u = a.$$typeof;
|
|
40
|
+
switch (u) {
|
|
41
|
+
case c: switch (a = a.type, a) {
|
|
42
|
+
case l:
|
|
43
|
+
case m:
|
|
44
|
+
case e:
|
|
45
|
+
case g:
|
|
46
|
+
case f:
|
|
47
|
+
case p: return a;
|
|
48
|
+
default: switch (a = a && a.$$typeof, a) {
|
|
49
|
+
case k:
|
|
50
|
+
case n:
|
|
51
|
+
case t:
|
|
52
|
+
case r:
|
|
53
|
+
case h: return a;
|
|
54
|
+
default: return u;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
case d: return u;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function A(a) {
|
|
62
|
+
return z(a) === m;
|
|
63
|
+
}
|
|
64
|
+
exports.AsyncMode = l;
|
|
65
|
+
exports.ConcurrentMode = m;
|
|
66
|
+
exports.ContextConsumer = k;
|
|
67
|
+
exports.ContextProvider = h;
|
|
68
|
+
exports.Element = c;
|
|
69
|
+
exports.ForwardRef = n;
|
|
70
|
+
exports.Fragment = e;
|
|
71
|
+
exports.Lazy = t;
|
|
72
|
+
exports.Memo = r;
|
|
73
|
+
exports.Portal = d;
|
|
74
|
+
exports.Profiler = g;
|
|
75
|
+
exports.StrictMode = f;
|
|
76
|
+
exports.Suspense = p;
|
|
77
|
+
exports.isAsyncMode = function(a) {
|
|
78
|
+
return A(a) || z(a) === l;
|
|
79
|
+
};
|
|
80
|
+
exports.isConcurrentMode = A;
|
|
81
|
+
exports.isContextConsumer = function(a) {
|
|
82
|
+
return z(a) === k;
|
|
83
|
+
};
|
|
84
|
+
exports.isContextProvider = function(a) {
|
|
85
|
+
return z(a) === h;
|
|
86
|
+
};
|
|
87
|
+
exports.isElement = function(a) {
|
|
88
|
+
return "object" === typeof a && null !== a && a.$$typeof === c;
|
|
89
|
+
};
|
|
90
|
+
exports.isForwardRef = function(a) {
|
|
91
|
+
return z(a) === n;
|
|
92
|
+
};
|
|
93
|
+
exports.isFragment = function(a) {
|
|
94
|
+
return z(a) === e;
|
|
95
|
+
};
|
|
96
|
+
exports.isLazy = function(a) {
|
|
97
|
+
return z(a) === t;
|
|
98
|
+
};
|
|
99
|
+
exports.isMemo = function(a) {
|
|
100
|
+
return z(a) === r;
|
|
101
|
+
};
|
|
102
|
+
exports.isPortal = function(a) {
|
|
103
|
+
return z(a) === d;
|
|
104
|
+
};
|
|
105
|
+
exports.isProfiler = function(a) {
|
|
106
|
+
return z(a) === g;
|
|
107
|
+
};
|
|
108
|
+
exports.isStrictMode = function(a) {
|
|
109
|
+
return z(a) === f;
|
|
110
|
+
};
|
|
111
|
+
exports.isSuspense = function(a) {
|
|
112
|
+
return z(a) === p;
|
|
113
|
+
};
|
|
114
|
+
exports.isValidElementType = function(a) {
|
|
115
|
+
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
|
116
|
+
};
|
|
117
|
+
exports.typeOf = z;
|
|
118
|
+
}));
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js
|
|
121
|
+
/** @license React v16.13.1
|
|
122
|
+
* react-is.development.js
|
|
123
|
+
*
|
|
124
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
125
|
+
*
|
|
126
|
+
* This source code is licensed under the MIT license found in the
|
|
127
|
+
* LICENSE file in the root directory of this source tree.
|
|
128
|
+
*/
|
|
129
|
+
var require_react_is_development = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
130
|
+
if (process.env.NODE_ENV !== "production") (function() {
|
|
131
|
+
"use strict";
|
|
132
|
+
var hasSymbol = typeof Symbol === "function" && Symbol.for;
|
|
133
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
|
|
134
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
|
|
135
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
|
|
136
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
|
|
137
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
|
|
138
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
|
|
139
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
|
|
140
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
|
|
141
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
|
|
142
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
|
|
143
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
|
|
144
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
|
|
145
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
|
|
146
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
|
|
147
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
|
|
148
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
|
|
149
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
|
|
150
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
|
|
151
|
+
function isValidElementType(type) {
|
|
152
|
+
return typeof type === "string" || typeof type === "function" || type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
153
|
+
}
|
|
154
|
+
function typeOf(object) {
|
|
155
|
+
if (typeof object === "object" && object !== null) {
|
|
156
|
+
var $$typeof = object.$$typeof;
|
|
157
|
+
switch ($$typeof) {
|
|
158
|
+
case REACT_ELEMENT_TYPE:
|
|
159
|
+
var type = object.type;
|
|
160
|
+
switch (type) {
|
|
161
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
162
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
163
|
+
case REACT_FRAGMENT_TYPE:
|
|
164
|
+
case REACT_PROFILER_TYPE:
|
|
165
|
+
case REACT_STRICT_MODE_TYPE:
|
|
166
|
+
case REACT_SUSPENSE_TYPE: return type;
|
|
167
|
+
default:
|
|
168
|
+
var $$typeofType = type && type.$$typeof;
|
|
169
|
+
switch ($$typeofType) {
|
|
170
|
+
case REACT_CONTEXT_TYPE:
|
|
171
|
+
case REACT_FORWARD_REF_TYPE:
|
|
172
|
+
case REACT_LAZY_TYPE:
|
|
173
|
+
case REACT_MEMO_TYPE:
|
|
174
|
+
case REACT_PROVIDER_TYPE: return $$typeofType;
|
|
175
|
+
default: return $$typeof;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
case REACT_PORTAL_TYPE: return $$typeof;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
183
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
184
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
185
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
186
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
187
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
188
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
189
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
190
|
+
var Memo = REACT_MEMO_TYPE;
|
|
191
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
192
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
193
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
194
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
195
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
196
|
+
function isAsyncMode(object) {
|
|
197
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
198
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
199
|
+
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
|
|
200
|
+
}
|
|
201
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
202
|
+
}
|
|
203
|
+
function isConcurrentMode(object) {
|
|
204
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
205
|
+
}
|
|
206
|
+
function isContextConsumer(object) {
|
|
207
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
208
|
+
}
|
|
209
|
+
function isContextProvider(object) {
|
|
210
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
211
|
+
}
|
|
212
|
+
function isElement(object) {
|
|
213
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
214
|
+
}
|
|
215
|
+
function isForwardRef(object) {
|
|
216
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
217
|
+
}
|
|
218
|
+
function isFragment(object) {
|
|
219
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
220
|
+
}
|
|
221
|
+
function isLazy(object) {
|
|
222
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
223
|
+
}
|
|
224
|
+
function isMemo(object) {
|
|
225
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
226
|
+
}
|
|
227
|
+
function isPortal(object) {
|
|
228
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
229
|
+
}
|
|
230
|
+
function isProfiler(object) {
|
|
231
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
232
|
+
}
|
|
233
|
+
function isStrictMode(object) {
|
|
234
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
235
|
+
}
|
|
236
|
+
function isSuspense(object) {
|
|
237
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
238
|
+
}
|
|
239
|
+
exports.AsyncMode = AsyncMode;
|
|
240
|
+
exports.ConcurrentMode = ConcurrentMode;
|
|
241
|
+
exports.ContextConsumer = ContextConsumer;
|
|
242
|
+
exports.ContextProvider = ContextProvider;
|
|
243
|
+
exports.Element = Element;
|
|
244
|
+
exports.ForwardRef = ForwardRef;
|
|
245
|
+
exports.Fragment = Fragment;
|
|
246
|
+
exports.Lazy = Lazy;
|
|
247
|
+
exports.Memo = Memo;
|
|
248
|
+
exports.Portal = Portal;
|
|
249
|
+
exports.Profiler = Profiler;
|
|
250
|
+
exports.StrictMode = StrictMode;
|
|
251
|
+
exports.Suspense = Suspense;
|
|
252
|
+
exports.isAsyncMode = isAsyncMode;
|
|
253
|
+
exports.isConcurrentMode = isConcurrentMode;
|
|
254
|
+
exports.isContextConsumer = isContextConsumer;
|
|
255
|
+
exports.isContextProvider = isContextProvider;
|
|
256
|
+
exports.isElement = isElement;
|
|
257
|
+
exports.isForwardRef = isForwardRef;
|
|
258
|
+
exports.isFragment = isFragment;
|
|
259
|
+
exports.isLazy = isLazy;
|
|
260
|
+
exports.isMemo = isMemo;
|
|
261
|
+
exports.isPortal = isPortal;
|
|
262
|
+
exports.isProfiler = isProfiler;
|
|
263
|
+
exports.isStrictMode = isStrictMode;
|
|
264
|
+
exports.isSuspense = isSuspense;
|
|
265
|
+
exports.isValidElementType = isValidElementType;
|
|
266
|
+
exports.typeOf = typeOf;
|
|
267
|
+
})();
|
|
268
|
+
}));
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js
|
|
271
|
+
var require_react_is = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
272
|
+
if (process.env.NODE_ENV === "production") module.exports = require_react_is_production_min();
|
|
273
|
+
else module.exports = require_react_is_development();
|
|
274
|
+
}));
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/ReactTrackingContext.ts
|
|
277
|
+
var import_hoist_non_react_statics_cjs = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
278
|
+
var reactIs = require_react_is();
|
|
279
|
+
/**
|
|
280
|
+
* Copyright 2015, Yahoo! Inc.
|
|
281
|
+
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
|
282
|
+
*/
|
|
283
|
+
var REACT_STATICS = {
|
|
284
|
+
childContextTypes: true,
|
|
285
|
+
contextType: true,
|
|
286
|
+
contextTypes: true,
|
|
287
|
+
defaultProps: true,
|
|
288
|
+
displayName: true,
|
|
289
|
+
getDefaultProps: true,
|
|
290
|
+
getDerivedStateFromError: true,
|
|
291
|
+
getDerivedStateFromProps: true,
|
|
292
|
+
mixins: true,
|
|
293
|
+
propTypes: true,
|
|
294
|
+
type: true
|
|
295
|
+
};
|
|
296
|
+
var KNOWN_STATICS = {
|
|
297
|
+
name: true,
|
|
298
|
+
length: true,
|
|
299
|
+
prototype: true,
|
|
300
|
+
caller: true,
|
|
301
|
+
callee: true,
|
|
302
|
+
arguments: true,
|
|
303
|
+
arity: true
|
|
304
|
+
};
|
|
305
|
+
var FORWARD_REF_STATICS = {
|
|
306
|
+
"$$typeof": true,
|
|
307
|
+
render: true,
|
|
308
|
+
defaultProps: true,
|
|
309
|
+
displayName: true,
|
|
310
|
+
propTypes: true
|
|
311
|
+
};
|
|
312
|
+
var MEMO_STATICS = {
|
|
313
|
+
"$$typeof": true,
|
|
314
|
+
compare: true,
|
|
315
|
+
defaultProps: true,
|
|
316
|
+
displayName: true,
|
|
317
|
+
propTypes: true,
|
|
318
|
+
type: true
|
|
319
|
+
};
|
|
320
|
+
var TYPE_STATICS = {};
|
|
321
|
+
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
322
|
+
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
|
|
323
|
+
function getStatics(component) {
|
|
324
|
+
if (reactIs.isMemo(component)) return MEMO_STATICS;
|
|
325
|
+
return TYPE_STATICS[component["$$typeof"]] || REACT_STATICS;
|
|
326
|
+
}
|
|
327
|
+
var defineProperty = Object.defineProperty;
|
|
328
|
+
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
329
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
330
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
331
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
332
|
+
var objectPrototype = Object.prototype;
|
|
333
|
+
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
334
|
+
if (typeof sourceComponent !== "string") {
|
|
335
|
+
if (objectPrototype) {
|
|
336
|
+
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
337
|
+
if (inheritedComponent && inheritedComponent !== objectPrototype) hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
|
338
|
+
}
|
|
339
|
+
var keys = getOwnPropertyNames(sourceComponent);
|
|
340
|
+
if (getOwnPropertySymbols) keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
|
341
|
+
var targetStatics = getStatics(targetComponent);
|
|
342
|
+
var sourceStatics = getStatics(sourceComponent);
|
|
343
|
+
for (var i = 0; i < keys.length; ++i) {
|
|
344
|
+
var key = keys[i];
|
|
345
|
+
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
|
346
|
+
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
347
|
+
try {
|
|
348
|
+
defineProperty(targetComponent, key, descriptor);
|
|
349
|
+
} catch (e) {}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return targetComponent;
|
|
354
|
+
}
|
|
355
|
+
module.exports = hoistNonReactStatics;
|
|
356
|
+
})))(), 1);
|
|
357
|
+
var ReactTrackingContext = createContext({});
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/dispatchTrackingEvent.ts
|
|
360
|
+
var import_cjs = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
361
|
+
var isMergeableObject = function isMergeableObject(value) {
|
|
362
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
363
|
+
};
|
|
364
|
+
function isNonNullObject(value) {
|
|
365
|
+
return !!value && typeof value === "object";
|
|
366
|
+
}
|
|
367
|
+
function isSpecial(value) {
|
|
368
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
369
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
370
|
+
}
|
|
371
|
+
var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.element") : 60103;
|
|
372
|
+
function isReactElement(value) {
|
|
373
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
374
|
+
}
|
|
375
|
+
function emptyTarget(val) {
|
|
376
|
+
return Array.isArray(val) ? [] : {};
|
|
377
|
+
}
|
|
378
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
379
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
380
|
+
}
|
|
381
|
+
function defaultArrayMerge(target, source, options) {
|
|
382
|
+
return target.concat(source).map(function(element) {
|
|
383
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
function getMergeFunction(key, options) {
|
|
387
|
+
if (!options.customMerge) return deepmerge;
|
|
388
|
+
var customMerge = options.customMerge(key);
|
|
389
|
+
return typeof customMerge === "function" ? customMerge : deepmerge;
|
|
390
|
+
}
|
|
391
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
392
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
393
|
+
return Object.propertyIsEnumerable.call(target, symbol);
|
|
394
|
+
}) : [];
|
|
395
|
+
}
|
|
396
|
+
function getKeys(target) {
|
|
397
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
398
|
+
}
|
|
399
|
+
function propertyIsOnObject(object, property) {
|
|
400
|
+
try {
|
|
401
|
+
return property in object;
|
|
402
|
+
} catch (_) {
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function propertyIsUnsafe(target, key) {
|
|
407
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
408
|
+
}
|
|
409
|
+
function mergeObject(target, source, options) {
|
|
410
|
+
var destination = {};
|
|
411
|
+
if (options.isMergeableObject(target)) getKeys(target).forEach(function(key) {
|
|
412
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
413
|
+
});
|
|
414
|
+
getKeys(source).forEach(function(key) {
|
|
415
|
+
if (propertyIsUnsafe(target, key)) return;
|
|
416
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
417
|
+
else destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
418
|
+
});
|
|
419
|
+
return destination;
|
|
420
|
+
}
|
|
421
|
+
function deepmerge(target, source, options) {
|
|
422
|
+
options = options || {};
|
|
423
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
424
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
425
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
426
|
+
var sourceIsArray = Array.isArray(source);
|
|
427
|
+
if (!(sourceIsArray === Array.isArray(target))) return cloneUnlessOtherwiseSpecified(source, options);
|
|
428
|
+
else if (sourceIsArray) return options.arrayMerge(target, source, options);
|
|
429
|
+
else return mergeObject(target, source, options);
|
|
430
|
+
}
|
|
431
|
+
deepmerge.all = function deepmergeAll(array, options) {
|
|
432
|
+
if (!Array.isArray(array)) throw new Error("first argument should be an array");
|
|
433
|
+
return array.reduce(function(prev, next) {
|
|
434
|
+
return deepmerge(prev, next, options);
|
|
435
|
+
}, {});
|
|
436
|
+
};
|
|
437
|
+
module.exports = deepmerge;
|
|
438
|
+
})))(), 1);
|
|
439
|
+
function dispatchTrackingEvent(data) {
|
|
440
|
+
if (typeof window !== "undefined" && Object.keys(data).length > 0) (window.dataLayer = window.dataLayer || []).push(data);
|
|
441
|
+
}
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region src/useTrackingImpl.ts
|
|
444
|
+
function useTrackingImpl(trackingData, options) {
|
|
445
|
+
const { tracking } = useContext(ReactTrackingContext);
|
|
446
|
+
const latestData = useRef(trackingData);
|
|
447
|
+
const latestOptions = useRef(options);
|
|
448
|
+
useEffect(() => {
|
|
449
|
+
latestData.current = trackingData;
|
|
450
|
+
latestOptions.current = options;
|
|
451
|
+
});
|
|
452
|
+
const { dispatch = dispatchTrackingEvent, dispatchOnMount = false, process } = useMemo(() => latestOptions.current || {}, []);
|
|
453
|
+
const getProcessFn = useCallback(() => tracking && tracking.process, [tracking]);
|
|
454
|
+
const getOwnTrackingData = useCallback(() => {
|
|
455
|
+
const data = latestData.current;
|
|
456
|
+
return (typeof data === "function" ? data() : data) || {};
|
|
457
|
+
}, []);
|
|
458
|
+
const getTrackingDataFn = useCallback(() => {
|
|
459
|
+
const contextGetTrackingData = tracking && tracking.getTrackingData || getOwnTrackingData;
|
|
460
|
+
return () => contextGetTrackingData === getOwnTrackingData ? getOwnTrackingData() : (0, import_cjs.default)(contextGetTrackingData(), getOwnTrackingData(), (latestOptions.current || {}).mergeOptions);
|
|
461
|
+
}, [getOwnTrackingData, tracking]);
|
|
462
|
+
const getTrackingDispatcher = useCallback(() => {
|
|
463
|
+
const contextDispatch = tracking && tracking.dispatch || dispatch;
|
|
464
|
+
return (data) => contextDispatch((0, import_cjs.default)(getOwnTrackingData(), data || {}, (latestOptions.current || {}).mergeOptions));
|
|
465
|
+
}, [
|
|
466
|
+
getOwnTrackingData,
|
|
467
|
+
tracking,
|
|
468
|
+
dispatch
|
|
469
|
+
]);
|
|
470
|
+
const trackEvent = useCallback((data) => {
|
|
471
|
+
getTrackingDispatcher()(data);
|
|
472
|
+
}, [getTrackingDispatcher]);
|
|
473
|
+
useEffect(() => {
|
|
474
|
+
const contextProcess = getProcessFn();
|
|
475
|
+
const getTrackingData = getTrackingDataFn();
|
|
476
|
+
if (contextProcess && process) console.error("[react-tracking] options.process should be defined once on a top-level component");
|
|
477
|
+
if (typeof contextProcess === "function" && typeof dispatchOnMount === "function") trackEvent((0, import_cjs.default)(contextProcess(getOwnTrackingData()) || {}, dispatchOnMount(getTrackingData()) || {}, (latestOptions.current || {}).mergeOptions));
|
|
478
|
+
else if (typeof contextProcess === "function") {
|
|
479
|
+
const processed = contextProcess(getOwnTrackingData());
|
|
480
|
+
if (processed || dispatchOnMount === true) trackEvent(processed);
|
|
481
|
+
} else if (typeof dispatchOnMount === "function") trackEvent(dispatchOnMount(getTrackingData()));
|
|
482
|
+
else if (dispatchOnMount === true) trackEvent();
|
|
483
|
+
}, [
|
|
484
|
+
getOwnTrackingData,
|
|
485
|
+
getProcessFn,
|
|
486
|
+
getTrackingDataFn,
|
|
487
|
+
trackEvent,
|
|
488
|
+
dispatchOnMount,
|
|
489
|
+
process
|
|
490
|
+
]);
|
|
491
|
+
return useMemo(() => ({ tracking: {
|
|
492
|
+
dispatch: getTrackingDispatcher(),
|
|
493
|
+
getTrackingData: getTrackingDataFn(),
|
|
494
|
+
process: getProcessFn() || process
|
|
495
|
+
} }), [
|
|
496
|
+
getTrackingDispatcher,
|
|
497
|
+
getTrackingDataFn,
|
|
498
|
+
getProcessFn,
|
|
499
|
+
process
|
|
500
|
+
]);
|
|
501
|
+
}
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region src/withTrackingComponentDecorator.tsx
|
|
504
|
+
function withTrackingComponentDecorator(trackingData = {}, { forwardRef: shouldForwardRef = false, ...options } = {}) {
|
|
505
|
+
return (DecoratedComponent) => {
|
|
506
|
+
const decoratedComponentName = DecoratedComponent.displayName || DecoratedComponent.name || "Component";
|
|
507
|
+
function WithTracking(props, ref) {
|
|
508
|
+
const latestProps = useRef(props);
|
|
509
|
+
useEffect(() => {
|
|
510
|
+
latestProps.current = props;
|
|
511
|
+
});
|
|
512
|
+
const contextValue = useTrackingImpl(useCallback(() => typeof trackingData === "function" ? trackingData(latestProps.current) : trackingData, []), options);
|
|
513
|
+
const trackingProp = useMemo(() => ({
|
|
514
|
+
trackEvent: contextValue.tracking.dispatch,
|
|
515
|
+
getTrackingData: contextValue.tracking.getTrackingData
|
|
516
|
+
}), [contextValue]);
|
|
517
|
+
return /* @__PURE__ */ jsx(ReactTrackingContext.Provider, {
|
|
518
|
+
value: contextValue,
|
|
519
|
+
children: React.createElement(DecoratedComponent, {
|
|
520
|
+
...props,
|
|
521
|
+
...shouldForwardRef ? { ref } : {},
|
|
522
|
+
tracking: trackingProp
|
|
523
|
+
})
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
if (shouldForwardRef) {
|
|
527
|
+
const forwarded = React.forwardRef(WithTracking);
|
|
528
|
+
forwarded.displayName = `WithTracking(${decoratedComponentName})`;
|
|
529
|
+
(0, import_hoist_non_react_statics_cjs.default)(forwarded, DecoratedComponent);
|
|
530
|
+
return forwarded;
|
|
531
|
+
}
|
|
532
|
+
WithTracking.displayName = `WithTracking(${decoratedComponentName})`;
|
|
533
|
+
(0, import_hoist_non_react_statics_cjs.default)(WithTracking, DecoratedComponent);
|
|
534
|
+
return WithTracking;
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
//#endregion
|
|
538
|
+
//#region src/trackingHoC.ts
|
|
539
|
+
function track(trackingData, options) {
|
|
540
|
+
return withTrackingComponentDecorator(trackingData, options);
|
|
541
|
+
}
|
|
542
|
+
//#endregion
|
|
543
|
+
//#region src/makeClassMemberDecorator.ts
|
|
544
|
+
function makeClassMemberDecorator(decorate) {
|
|
545
|
+
return function decorateClassMember(target, name, descriptor) {
|
|
546
|
+
const { configurable, enumerable, value, get, initializer } = descriptor;
|
|
547
|
+
if (value) return {
|
|
548
|
+
configurable,
|
|
549
|
+
enumerable,
|
|
550
|
+
value: decorate(value)
|
|
551
|
+
};
|
|
552
|
+
if (get || initializer) return {
|
|
553
|
+
configurable,
|
|
554
|
+
enumerable,
|
|
555
|
+
get() {
|
|
556
|
+
if (this === target) return;
|
|
557
|
+
const decoratedValue = decorate(initializer ? Reflect.apply(initializer, this, []) : Reflect.apply(get, this, [])).bind(this);
|
|
558
|
+
Reflect.defineProperty(this, name, {
|
|
559
|
+
configurable,
|
|
560
|
+
enumerable,
|
|
561
|
+
value: decoratedValue
|
|
562
|
+
});
|
|
563
|
+
return decoratedValue;
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
throw new Error("called makeClassMemberDecorator on unsupported descriptor");
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
//#endregion
|
|
570
|
+
//#region src/trackEventMethodDecorator.ts
|
|
571
|
+
function trackEventMethodDecorator(trackingData = {}) {
|
|
572
|
+
return makeClassMemberDecorator((decoratedFn) => function(...args) {
|
|
573
|
+
const trackEvent = (...promiseArguments) => {
|
|
574
|
+
if (this.props && this.props.tracking && typeof this.props.tracking.trackEvent === "function") {
|
|
575
|
+
const thisTrackingData = typeof trackingData === "function" ? trackingData(this.props, this.state, args, promiseArguments) : trackingData;
|
|
576
|
+
if (thisTrackingData) this.props.tracking.trackEvent(thisTrackingData);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
const fn = Reflect.apply(decoratedFn, this, args);
|
|
580
|
+
if (Promise && Promise.resolve(fn) === fn) return fn.then(trackEvent.bind(this)).then(() => fn).catch((error) => {
|
|
581
|
+
trackEvent({}, error);
|
|
582
|
+
throw error;
|
|
583
|
+
});
|
|
584
|
+
trackEvent();
|
|
585
|
+
return fn;
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
//#endregion
|
|
589
|
+
//#region src/useTracking.tsx
|
|
590
|
+
function useTracking(trackingData = {}, options) {
|
|
591
|
+
const contextValue = useTrackingImpl(trackingData, options);
|
|
592
|
+
const Track = useCallback(({ children }) => /* @__PURE__ */ jsx(ReactTrackingContext.Provider, {
|
|
593
|
+
value: contextValue,
|
|
594
|
+
children
|
|
595
|
+
}), [contextValue]);
|
|
596
|
+
useDebugValue(contextValue.tracking.getTrackingData, (getTrackingData) => getTrackingData());
|
|
597
|
+
return useMemo(() => ({
|
|
598
|
+
Track,
|
|
599
|
+
getTrackingData: contextValue.tracking.getTrackingData,
|
|
600
|
+
trackEvent: contextValue.tracking.dispatch
|
|
601
|
+
}), [contextValue, Track]);
|
|
602
|
+
}
|
|
603
|
+
//#endregion
|
|
604
|
+
//#region src/index.ts
|
|
605
|
+
var src_default = track;
|
|
606
|
+
//#endregion
|
|
607
|
+
var deepmerge = import_cjs.default;
|
|
608
|
+
export { deepmerge, src_default as default, track, trackEventMethodDecorator as trackEvent, useTracking, withTrackingComponentDecorator as withTracking };
|
|
609
|
+
|
|
610
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js","../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js","../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js","../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../src/ReactTrackingContext.ts","../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js","../src/dispatchTrackingEvent.ts","../src/useTrackingImpl.ts","../src/withTrackingComponentDecorator.tsx","../src/trackingHoC.ts","../src/makeClassMemberDecorator.ts","../src/trackEventMethodDecorator.ts","../src/useTracking.tsx","../src/index.ts"],"sourcesContent":["/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","'use strict';\n\nvar reactIs = require('react-is');\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nvar REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true\n};\nvar KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true\n};\nvar FORWARD_REF_STATICS = {\n '$$typeof': true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true\n};\nvar MEMO_STATICS = {\n '$$typeof': true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true\n};\nvar TYPE_STATICS = {};\nTYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;\nTYPE_STATICS[reactIs.Memo] = MEMO_STATICS;\n\nfunction getStatics(component) {\n // React v16.11 and below\n if (reactIs.isMemo(component)) {\n return MEMO_STATICS;\n } // React v16.12 and above\n\n\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;\n}\n\nvar defineProperty = Object.defineProperty;\nvar getOwnPropertyNames = Object.getOwnPropertyNames;\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar getPrototypeOf = Object.getPrototypeOf;\nvar objectPrototype = Object.prototype;\nfunction hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n if (objectPrototype) {\n var inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n }\n }\n\n var keys = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n var targetStatics = getStatics(targetComponent);\n var sourceStatics = getStatics(sourceComponent);\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {\n var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {}\n }\n }\n }\n\n return targetComponent;\n}\n\nmodule.exports = hoistNonReactStatics;\n","import { createContext } from 'react';\nimport type { TrackingContextValue } from './types';\n\nconst ReactTrackingContext = createContext<Partial<TrackingContextValue>>({});\n\nexport default ReactTrackingContext;\n","'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn Object.propertyIsEnumerable.call(target, symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\n","import type { TrackingData } from './types';\n\ndeclare global {\n interface Window {\n dataLayer?: TrackingData[];\n }\n}\n\nexport default function dispatchTrackingEvent(data: TrackingData): void {\n if (typeof window !== 'undefined' && Object.keys(data).length > 0) {\n (window.dataLayer = window.dataLayer || []).push(data);\n }\n}\n","import { useCallback, useContext, useEffect, useMemo, useRef } from 'react';\nimport merge from 'deepmerge';\nimport type { Options as DeepmergeOptions } from 'deepmerge';\n\nimport ReactTrackingContext from './ReactTrackingContext';\nimport dispatchTrackingEvent from './dispatchTrackingEvent';\nimport type { TrackingData, TrackingContextValue } from './types';\n\ninterface UseTrackingImplOptions {\n dispatch?: (data: TrackingData) => void;\n dispatchOnMount?:\n | boolean\n | ((contextData: TrackingData) => TrackingData | null);\n process?: (data: TrackingData) => TrackingData | null;\n mergeOptions?: DeepmergeOptions;\n}\n\nexport default function useTrackingImpl(\n trackingData: TrackingData | ((...args: unknown[]) => TrackingData),\n options?: UseTrackingImplOptions\n): TrackingContextValue {\n const { tracking } = useContext(ReactTrackingContext);\n const latestData = useRef(trackingData);\n const latestOptions = useRef(options);\n\n useEffect(() => {\n latestData.current = trackingData;\n latestOptions.current = options;\n });\n\n const {\n dispatch = dispatchTrackingEvent,\n dispatchOnMount = false,\n process\n } = useMemo(() => latestOptions.current || {}, []);\n\n const getProcessFn = useCallback(\n () => tracking && tracking.process,\n [tracking]\n );\n\n const getOwnTrackingData = useCallback(() => {\n const data = latestData.current;\n const ownTrackingData = typeof data === 'function' ? data() : data;\n return ownTrackingData || {};\n }, []);\n\n const getTrackingDataFn = useCallback(() => {\n const contextGetTrackingData =\n (tracking && tracking.getTrackingData) || getOwnTrackingData;\n\n return () =>\n contextGetTrackingData === getOwnTrackingData\n ? getOwnTrackingData()\n : merge(\n contextGetTrackingData(),\n getOwnTrackingData(),\n (latestOptions.current || ({} as UseTrackingImplOptions))\n .mergeOptions\n );\n }, [getOwnTrackingData, tracking]);\n\n const getTrackingDispatcher = useCallback(() => {\n const contextDispatch = (tracking && tracking.dispatch) || dispatch;\n return (data?: TrackingData) =>\n contextDispatch(\n merge(\n getOwnTrackingData(),\n data || {},\n (latestOptions.current || ({} as UseTrackingImplOptions))\n .mergeOptions\n )\n );\n }, [getOwnTrackingData, tracking, dispatch]);\n\n const trackEvent = useCallback(\n (data?: TrackingData) => {\n getTrackingDispatcher()(data);\n },\n [getTrackingDispatcher]\n );\n\n useEffect(() => {\n const contextProcess = getProcessFn();\n const getTrackingData = getTrackingDataFn();\n\n if (contextProcess && process) {\n console.error(\n '[react-tracking] options.process should be defined once on a top-level component'\n );\n }\n\n if (\n typeof contextProcess === 'function' &&\n typeof dispatchOnMount === 'function'\n ) {\n trackEvent(\n merge(\n contextProcess(getOwnTrackingData()) || {},\n dispatchOnMount(getTrackingData()) || {},\n (latestOptions.current || ({} as UseTrackingImplOptions))\n .mergeOptions\n )\n );\n } else if (typeof contextProcess === 'function') {\n const processed = contextProcess(getOwnTrackingData());\n if (processed || dispatchOnMount === true) {\n trackEvent(processed!);\n }\n } else if (typeof dispatchOnMount === 'function') {\n trackEvent(dispatchOnMount(getTrackingData())!);\n } else if (dispatchOnMount === true) {\n trackEvent();\n }\n }, [\n getOwnTrackingData,\n getProcessFn,\n getTrackingDataFn,\n trackEvent,\n dispatchOnMount,\n process\n ]);\n\n return useMemo(\n () => ({\n tracking: {\n dispatch: getTrackingDispatcher(),\n getTrackingData: getTrackingDataFn(),\n process: getProcessFn() || process\n }\n }),\n [getTrackingDispatcher, getTrackingDataFn, getProcessFn, process]\n );\n}\n","import React, { useCallback, useEffect, useMemo, useRef } from 'react';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\n\nimport ReactTrackingContext from './ReactTrackingContext';\nimport useTrackingImpl from './useTrackingImpl';\nimport type { TrackingDataInput, TrackingOptions } from './types';\n\nexport default function withTrackingComponentDecorator(\n trackingData: TrackingDataInput = {},\n { forwardRef: shouldForwardRef = false, ...options }: TrackingOptions = {}\n) {\n return (DecoratedComponent: React.ComponentType<any>) => {\n const decoratedComponentName =\n DecoratedComponent.displayName ||\n DecoratedComponent.name ||\n 'Component';\n\n function WithTracking(\n props: Record<string, unknown>,\n ref?: React.Ref<unknown>\n ) {\n const latestProps = useRef(props);\n\n useEffect(() => {\n latestProps.current = props;\n });\n\n const trackingDataFn = useCallback(\n () =>\n typeof trackingData === 'function'\n ? trackingData(latestProps.current)\n : trackingData,\n []\n );\n\n const contextValue = useTrackingImpl(trackingDataFn, options);\n\n const trackingProp = useMemo(\n () => ({\n trackEvent: contextValue.tracking.dispatch,\n getTrackingData: contextValue.tracking.getTrackingData\n }),\n [contextValue]\n );\n\n return (\n <ReactTrackingContext.Provider value={contextValue}>\n {React.createElement(DecoratedComponent, {\n ...props,\n ...(shouldForwardRef ? { ref } : {}),\n tracking: trackingProp\n })}\n </ReactTrackingContext.Provider>\n );\n }\n\n if (shouldForwardRef) {\n const forwarded = React.forwardRef(WithTracking);\n forwarded.displayName = `WithTracking(${decoratedComponentName})`;\n hoistNonReactStatics(forwarded, DecoratedComponent);\n return forwarded;\n }\n\n WithTracking.displayName = `WithTracking(${decoratedComponentName})`;\n hoistNonReactStatics(WithTracking, DecoratedComponent);\n return WithTracking;\n };\n}\n","import withTrackingComponentDecorator from './withTrackingComponentDecorator';\nimport type { TrackingDataInput, TrackingOptions } from './types';\n\nexport default function track(\n trackingData?: TrackingDataInput,\n options?: TrackingOptions\n) {\n return withTrackingComponentDecorator(trackingData, options);\n}\n","type DecoratorFn = (decoratedFn: Function) => Function;\n\nexport interface MemberDescriptor {\n configurable?: boolean;\n enumerable?: boolean;\n value?: Function;\n get?: () => Function;\n initializer?: () => Function;\n}\n\nexport default function makeClassMemberDecorator(decorate: DecoratorFn) {\n return function decorateClassMember(\n target: object,\n name: string,\n descriptor: MemberDescriptor\n ): MemberDescriptor {\n const { configurable, enumerable, value, get, initializer } =\n descriptor;\n\n if (value) {\n return {\n configurable,\n enumerable,\n value: decorate(value)\n };\n }\n\n // support lazy initializer\n if (get || initializer) {\n return {\n configurable,\n enumerable,\n get(this: unknown) {\n // This happens if someone accesses the\n // property directly on the prototype\n if (this === target) {\n return undefined;\n }\n\n const resolvedValue = initializer\n ? Reflect.apply(initializer, this, [])\n : Reflect.apply(get!, this, []);\n const decoratedValue = decorate(resolvedValue).bind(this);\n\n Reflect.defineProperty(this as object, name, {\n configurable,\n enumerable,\n value: decoratedValue\n });\n\n return decoratedValue;\n }\n };\n }\n\n throw new Error(\n 'called makeClassMemberDecorator on unsupported descriptor'\n );\n };\n}\n","import type { TrackingData, TrackingProp } from './types';\nimport makeClassMemberDecorator from './makeClassMemberDecorator';\n\ntype TrackEventDataInput =\n | TrackingData\n | ((\n props: Record<string, unknown>,\n state: unknown,\n args: unknown[],\n promiseArgs: unknown[]\n ) => TrackingData | null);\n\ninterface DecoratedThis {\n props?: { tracking?: TrackingProp } & Record<string, unknown>;\n state?: unknown;\n}\n\nexport default function trackEventMethodDecorator(\n trackingData: TrackEventDataInput = {}\n) {\n return makeClassMemberDecorator(\n (decoratedFn: Function) =>\n function (this: DecoratedThis, ...args: unknown[]) {\n const trackEvent = (...promiseArguments: unknown[]) => {\n if (\n this.props &&\n this.props.tracking &&\n typeof this.props.tracking.trackEvent === 'function'\n ) {\n const thisTrackingData =\n typeof trackingData === 'function'\n ? trackingData(\n this.props,\n this.state,\n args,\n promiseArguments\n )\n : trackingData;\n if (thisTrackingData) {\n this.props.tracking.trackEvent(thisTrackingData);\n }\n }\n };\n\n const fn = Reflect.apply(decoratedFn, this, args);\n if (Promise && Promise.resolve(fn) === fn) {\n return fn\n .then(trackEvent.bind(this))\n .then(() => fn)\n .catch((error: Error) => {\n trackEvent({}, error);\n throw error;\n });\n }\n trackEvent();\n return fn;\n }\n );\n}\n","import { useCallback, useDebugValue, useMemo } from 'react';\n\nimport ReactTrackingContext from './ReactTrackingContext';\nimport useTrackingImpl from './useTrackingImpl';\nimport type { TrackingData, TrackingDataInput, TrackingOptions } from './types';\n\ninterface UseTrackingResult {\n Track: React.FC<{ children: React.ReactNode }>;\n getTrackingData: () => TrackingData;\n trackEvent: (data?: TrackingData) => void;\n}\n\nexport default function useTracking(\n trackingData: TrackingDataInput = {},\n options?: Omit<TrackingOptions, 'forwardRef'>\n): UseTrackingResult {\n const contextValue = useTrackingImpl(trackingData as TrackingData, options);\n\n const Track = useCallback(\n ({ children }: { children: React.ReactNode }) => (\n <ReactTrackingContext.Provider value={contextValue}>\n {children}\n </ReactTrackingContext.Provider>\n ),\n [contextValue]\n );\n\n useDebugValue(contextValue.tracking.getTrackingData, getTrackingData =>\n getTrackingData()\n );\n\n return useMemo(\n () => ({\n Track,\n getTrackingData: contextValue.tracking.getTrackingData,\n trackEvent: contextValue.tracking.dispatch\n }),\n [contextValue, Track]\n );\n}\n","import track from './trackingHoC';\n\nexport { default as deepmerge } from 'deepmerge';\n\nexport { default as withTracking } from './withTrackingComponentDecorator';\nexport { default as trackEvent } from './trackEventMethodDecorator';\nexport { default as useTracking } from './useTracking';\n\nexport type { TrackingPropType } from './TrackingPropType';\n\nexport type {\n TrackingData,\n TrackingDataInput,\n TrackingOptions,\n TrackingProp,\n TrackingContextValue,\n WithTrackingProps\n} from './types';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AAY,aAAa,SAAS;EACrC,GACD,CAAC,cAAc,MAAM,CACxB;;;;AClBL,IAAA,cAAe"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type DecoratorFn = (decoratedFn: Function) => Function;
|
|
2
|
+
export interface MemberDescriptor {
|
|
3
|
+
configurable?: boolean;
|
|
4
|
+
enumerable?: boolean;
|
|
5
|
+
value?: Function;
|
|
6
|
+
get?: () => Function;
|
|
7
|
+
initializer?: () => Function;
|
|
8
|
+
}
|
|
9
|
+
export default function makeClassMemberDecorator(decorate: DecoratorFn): (target: object, name: string, descriptor: MemberDescriptor) => MemberDescriptor;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=makeClassMemberDecorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeClassMemberDecorator.d.ts","sourceRoot":"","sources":["../src/makeClassMemberDecorator.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG,CAAC,WAAW,EAAE,QAAQ,KAAK,QAAQ,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,QAAQ,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,QAAQ,CAAC;CAChC;AAED,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,QAAQ,EAAE,WAAW,IAE9D,QAAQ,MAAM,EACd,MAAM,MAAM,EACZ,YAAY,gBAAgB,KAC7B,gBAAgB,CA4CtB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TrackingData } from './types';
|
|
2
|
+
type TrackEventDataInput = TrackingData | ((props: Record<string, unknown>, state: unknown, args: unknown[], promiseArgs: unknown[]) => TrackingData | null);
|
|
3
|
+
export default function trackEventMethodDecorator(trackingData?: TrackEventDataInput): (target: object, name: string, descriptor: import('./makeClassMemberDecorator').MemberDescriptor) => import('./makeClassMemberDecorator').MemberDescriptor;
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=trackEventMethodDecorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackEventMethodDecorator.d.ts","sourceRoot":"","sources":["../src/trackEventMethodDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,SAAS,CAAC;AAG1D,KAAK,mBAAmB,GAClB,YAAY,GACZ,CAAC,CACG,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,OAAO,EAAE,EACf,WAAW,EAAE,OAAO,EAAE,KACrB,YAAY,GAAG,IAAI,CAAC,CAAC;AAOhC,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC7C,YAAY,GAAE,mBAAwB,8JAwCzC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TrackingDataInput, TrackingOptions } from './types';
|
|
2
|
+
export default function track(trackingData?: TrackingDataInput, options?: TrackingOptions): (DecoratedComponent: React.ComponentType<any>) => {
|
|
3
|
+
(props: Record<string, unknown>, ref?: React.Ref<unknown>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
} | import('react').ForwardRefExoticComponent<Omit<Record<string, unknown>, "ref"> & import('react').RefAttributes<unknown>>;
|
|
6
|
+
//# sourceMappingURL=trackingHoC.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackingHoC.d.ts","sourceRoot":"","sources":["../src/trackingHoC.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAElE,MAAM,CAAC,OAAO,UAAU,KAAK,CACzB,YAAY,CAAC,EAAE,iBAAiB,EAChC,OAAO,CAAC,EAAE,eAAe;;;6HAG5B"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Options as DeepmergeOptions } from 'deepmerge';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
export type TrackingData = Record<string, unknown>;
|
|
4
|
+
export type TrackingDataFn = (props: any) => TrackingData;
|
|
5
|
+
export type TrackingDataInput = TrackingData | TrackingDataFn;
|
|
6
|
+
export interface TrackingOptions {
|
|
7
|
+
dispatch?: (data: TrackingData) => void;
|
|
8
|
+
dispatchOnMount?: boolean | ((contextData: TrackingData) => TrackingData | null);
|
|
9
|
+
process?: (data: TrackingData) => TrackingData | null;
|
|
10
|
+
forwardRef?: boolean;
|
|
11
|
+
mergeOptions?: DeepmergeOptions;
|
|
12
|
+
}
|
|
13
|
+
export interface TrackingProp {
|
|
14
|
+
trackEvent: (data?: TrackingData) => void;
|
|
15
|
+
getTrackingData: () => TrackingData;
|
|
16
|
+
}
|
|
17
|
+
export interface TrackingContextValue {
|
|
18
|
+
tracking: {
|
|
19
|
+
dispatch: (data?: TrackingData) => void;
|
|
20
|
+
getTrackingData: () => TrackingData;
|
|
21
|
+
process?: ((data: TrackingData) => TrackingData | null) | null;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export type WithTrackingProps<P = Record<string, unknown>> = P & {
|
|
25
|
+
tracking: TrackingProp;
|
|
26
|
+
};
|
|
27
|
+
export type TrackingDecorator = <P extends Record<string, unknown>, C extends ComponentType<P>>(component: C) => C;
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MA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
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TrackingData, TrackingDataInput, TrackingOptions } from './types';
|
|
2
|
+
interface UseTrackingResult {
|
|
3
|
+
Track: React.FC<{
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
getTrackingData: () => TrackingData;
|
|
7
|
+
trackEvent: (data?: TrackingData) => void;
|
|
8
|
+
}
|
|
9
|
+
export default function useTracking(trackingData?: TrackingDataInput, options?: Omit<TrackingOptions, 'forwardRef'>): UseTrackingResult;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=useTracking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTracking.d.ts","sourceRoot":"","sources":["../src/useTracking.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEhF,UAAU,iBAAiB;IACvB,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;IAC/C,eAAe,EAAE,MAAM,YAAY,CAAC;IACpC,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;CAC7C;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAC/B,YAAY,GAAE,iBAAsB,EACpC,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,GAC9C,iBAAiB,CAwBnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Options as DeepmergeOptions } from 'deepmerge';
|
|
2
|
+
import { TrackingData, TrackingContextValue } from './types';
|
|
3
|
+
interface UseTrackingImplOptions {
|
|
4
|
+
dispatch?: (data: TrackingData) => void;
|
|
5
|
+
dispatchOnMount?: boolean | ((contextData: TrackingData) => TrackingData | null);
|
|
6
|
+
process?: (data: TrackingData) => TrackingData | null;
|
|
7
|
+
mergeOptions?: DeepmergeOptions;
|
|
8
|
+
}
|
|
9
|
+
export default function useTrackingImpl(trackingData: TrackingData | ((...args: unknown[]) => TrackingData), options?: UseTrackingImplOptions): TrackingContextValue;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=useTrackingImpl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTrackingImpl.d.ts","sourceRoot":"","sources":["../src/useTrackingImpl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAI7D,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAElE,UAAU,sBAAsB;IAC5B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,eAAe,CAAC,EACV,OAAO,GACP,CAAC,CAAC,WAAW,EAAE,YAAY,KAAK,YAAY,GAAG,IAAI,CAAC,CAAC;IAC3D,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,YAAY,GAAG,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACnC;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CACnC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,YAAY,CAAC,EACnE,OAAO,CAAC,EAAE,sBAAsB,GACjC,oBAAoB,CAiHtB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TrackingDataInput, TrackingOptions } from './types';
|
|
3
|
+
export default function withTrackingComponentDecorator(trackingData?: TrackingDataInput, { forwardRef: shouldForwardRef, ...options }?: TrackingOptions): (DecoratedComponent: React.ComponentType<any>) => {
|
|
4
|
+
(props: Record<string, unknown>, ref?: React.Ref<unknown>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
displayName: string;
|
|
6
|
+
} | React.ForwardRefExoticComponent<Omit<Record<string, unknown>, "ref"> & React.RefAttributes<unknown>>;
|
|
7
|
+
//# sourceMappingURL=withTrackingComponentDecorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withTrackingComponentDecorator.d.ts","sourceRoot":"","sources":["../src/withTrackingComponentDecorator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAElE,MAAM,CAAC,OAAO,UAAU,8BAA8B,CAClD,YAAY,GAAE,iBAAsB,EACpC,EAAE,UAAU,EAAE,gBAAwB,EAAE,GAAG,OAAO,EAAE,GAAE,eAAoB,IAElE,oBAAoB,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC;YAOrC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QACxB,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;;yGAgDnC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cbnsndwch/react-tracking",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Declarative tracking for React apps. Based on nytimes/react-tracking",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"declarative",
|
|
7
|
+
"layer",
|
|
8
|
+
"metrics",
|
|
9
|
+
"react",
|
|
10
|
+
"tracking"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/cbnsndwch/react-tracking",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": {
|
|
15
|
+
"name": "Sergio Leon",
|
|
16
|
+
"url": "https://cbnsndwch.io"
|
|
17
|
+
},
|
|
18
|
+
"contributors": [
|
|
19
|
+
{
|
|
20
|
+
"name": "Nicole Baram",
|
|
21
|
+
"email": "nicole.baram@nytimes.com",
|
|
22
|
+
"url": "https://github.com/nicolehollyNYT"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "Oleh Ziniak",
|
|
26
|
+
"email": "oleh.ziniak@nytimes.com",
|
|
27
|
+
"url": "https://github.com/oziniak"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "Ivan Kravchenko",
|
|
31
|
+
"email": "ivan@kravchenko.rocks",
|
|
32
|
+
"url": "https://github.com/ivankravchenko"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "Jeremy Gayed",
|
|
36
|
+
"email": "jeremy.gayed@gmail.com",
|
|
37
|
+
"url": "https://github.com/tizmagik"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "Lukasz Szmit",
|
|
41
|
+
"email": "lukasz.szmit@workday.com",
|
|
42
|
+
"url": "https://github.com/lszm"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "Bryan Gergen",
|
|
46
|
+
"email": "bryangergen@gmail.com",
|
|
47
|
+
"url": "https://github.com/bgergen"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/cbnsndwch/react-tracking"
|
|
53
|
+
},
|
|
54
|
+
"files": [
|
|
55
|
+
"dist"
|
|
56
|
+
],
|
|
57
|
+
"type": "module",
|
|
58
|
+
"sideEffects": false,
|
|
59
|
+
"exports": {
|
|
60
|
+
".": {
|
|
61
|
+
"import": "./dist/index.js",
|
|
62
|
+
"types": "./dist/index.d.ts"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public"
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"deepmerge": "^4.3.1",
|
|
70
|
+
"hoist-non-react-statics": "^3.3.2"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@changesets/changelog-github": "^0.6.0",
|
|
74
|
+
"@changesets/cli": "^2.30.0",
|
|
75
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
76
|
+
"@testing-library/react": "^16.3.2",
|
|
77
|
+
"@types/hoist-non-react-statics": "^3.3.7",
|
|
78
|
+
"@types/react": "^19.0.0",
|
|
79
|
+
"@types/react-dom": "^19.0.0",
|
|
80
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
81
|
+
"husky": "^9.1.7",
|
|
82
|
+
"jsdom": "^29.0.1",
|
|
83
|
+
"lint-staged": "^16.4.0",
|
|
84
|
+
"npm-check-updates": "^19.6.6",
|
|
85
|
+
"oxc": "^1.0.1",
|
|
86
|
+
"oxfmt": "^0.42.0",
|
|
87
|
+
"oxlint": "^1.57.0",
|
|
88
|
+
"react": "^19.2.0",
|
|
89
|
+
"react-dom": "^19.2.0",
|
|
90
|
+
"typescript": "~5.9.3",
|
|
91
|
+
"vite": "^8.0.3",
|
|
92
|
+
"vite-plugin-dts": "^4.5.4",
|
|
93
|
+
"vitest": "^4.1.2"
|
|
94
|
+
},
|
|
95
|
+
"peerDependencies": {
|
|
96
|
+
"react": "^18.2.0 || ^19.0.0"
|
|
97
|
+
},
|
|
98
|
+
"lint-staged": {
|
|
99
|
+
"*.{ts,tsx,json}": [
|
|
100
|
+
"oxfmt"
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
"engines": {
|
|
104
|
+
"node": ">=22"
|
|
105
|
+
},
|
|
106
|
+
"scripts": {
|
|
107
|
+
"build": "vite build",
|
|
108
|
+
"dev": "vite build --watch",
|
|
109
|
+
"lint": "oxlint ./src",
|
|
110
|
+
"format": "oxfmt .",
|
|
111
|
+
"format:check": "oxfmt --check .",
|
|
112
|
+
"test": "vitest run",
|
|
113
|
+
"test:watch": "vitest",
|
|
114
|
+
"test:coverage": "vitest run --coverage",
|
|
115
|
+
"changeset": "changeset",
|
|
116
|
+
"version-packages": "changeset version",
|
|
117
|
+
"release": "pnpm run build && changeset publish"
|
|
118
|
+
}
|
|
119
|
+
}
|