@shware/analytics 2.8.3 → 2.8.4
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/dist/schema/index.d.cts +3 -3
- package/dist/schema/index.d.ts +3 -3
- package/dist/third-parties/meta-pixel.cjs +1 -1
- package/dist/third-parties/meta-pixel.cjs.map +1 -1
- package/dist/third-parties/meta-pixel.mjs +1 -1
- package/dist/third-parties/meta-pixel.mjs.map +1 -1
- package/dist/third-parties/reddit-pixel.cjs +1 -1
- package/dist/third-parties/reddit-pixel.cjs.map +1 -1
- package/dist/third-parties/reddit-pixel.mjs +1 -1
- package/dist/third-parties/reddit-pixel.mjs.map +1 -1
- package/package.json +1 -1
package/dist/schema/index.d.cts
CHANGED
|
@@ -8,13 +8,13 @@ declare const tagsSchema: z.ZodMiniObject<{
|
|
|
8
8
|
browser_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
9
9
|
browser_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
10
10
|
platform: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
11
|
+
unknown: "unknown";
|
|
11
12
|
ios: "ios";
|
|
12
13
|
android: "android";
|
|
13
14
|
web: "web";
|
|
14
15
|
macos: "macos";
|
|
15
16
|
windows: "windows";
|
|
16
17
|
linux: "linux";
|
|
17
|
-
unknown: "unknown";
|
|
18
18
|
}>>;
|
|
19
19
|
device: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
20
20
|
device_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -89,13 +89,13 @@ declare const createTrackEventSchemaV1: z.ZodMiniArray<z.ZodMiniObject<{
|
|
|
89
89
|
browser_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
90
90
|
browser_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
91
91
|
platform: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
92
|
+
unknown: "unknown";
|
|
92
93
|
ios: "ios";
|
|
93
94
|
android: "android";
|
|
94
95
|
web: "web";
|
|
95
96
|
macos: "macos";
|
|
96
97
|
windows: "windows";
|
|
97
98
|
linux: "linux";
|
|
98
|
-
unknown: "unknown";
|
|
99
99
|
}>>;
|
|
100
100
|
device: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
101
101
|
device_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -170,13 +170,13 @@ declare const createTrackEventSchema: z.ZodMiniArray<z.ZodMiniObject<{
|
|
|
170
170
|
browser_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
171
171
|
browser_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
172
172
|
platform: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
173
|
+
unknown: "unknown";
|
|
173
174
|
ios: "ios";
|
|
174
175
|
android: "android";
|
|
175
176
|
web: "web";
|
|
176
177
|
macos: "macos";
|
|
177
178
|
windows: "windows";
|
|
178
179
|
linux: "linux";
|
|
179
|
-
unknown: "unknown";
|
|
180
180
|
}>>;
|
|
181
181
|
device: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
182
182
|
device_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ declare const tagsSchema: z.ZodMiniObject<{
|
|
|
8
8
|
browser_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
9
9
|
browser_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
10
10
|
platform: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
11
|
+
unknown: "unknown";
|
|
11
12
|
ios: "ios";
|
|
12
13
|
android: "android";
|
|
13
14
|
web: "web";
|
|
14
15
|
macos: "macos";
|
|
15
16
|
windows: "windows";
|
|
16
17
|
linux: "linux";
|
|
17
|
-
unknown: "unknown";
|
|
18
18
|
}>>;
|
|
19
19
|
device: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
20
20
|
device_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -89,13 +89,13 @@ declare const createTrackEventSchemaV1: z.ZodMiniArray<z.ZodMiniObject<{
|
|
|
89
89
|
browser_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
90
90
|
browser_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
91
91
|
platform: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
92
|
+
unknown: "unknown";
|
|
92
93
|
ios: "ios";
|
|
93
94
|
android: "android";
|
|
94
95
|
web: "web";
|
|
95
96
|
macos: "macos";
|
|
96
97
|
windows: "windows";
|
|
97
98
|
linux: "linux";
|
|
98
|
-
unknown: "unknown";
|
|
99
99
|
}>>;
|
|
100
100
|
device: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
101
101
|
device_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -170,13 +170,13 @@ declare const createTrackEventSchema: z.ZodMiniArray<z.ZodMiniObject<{
|
|
|
170
170
|
browser_name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
171
171
|
browser_version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
172
172
|
platform: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
173
|
+
unknown: "unknown";
|
|
173
174
|
ios: "ios";
|
|
174
175
|
android: "android";
|
|
175
176
|
web: "web";
|
|
176
177
|
macos: "macos";
|
|
177
178
|
windows: "windows";
|
|
178
179
|
linux: "linux";
|
|
179
|
-
unknown: "unknown";
|
|
180
180
|
}>>;
|
|
181
181
|
device: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
182
182
|
device_id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
@@ -26,7 +26,7 @@ __export(meta_pixel_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(meta_pixel_exports);
|
|
27
27
|
var import_fbq = require("../track/fbq.cjs");
|
|
28
28
|
var import_field = require("../utils/field.cjs");
|
|
29
|
-
var metrics = ["CLS", "FCP", "INP", "LCP", "TTFB"];
|
|
29
|
+
var metrics = ["CLS", "FCP", "FID", "INP", "LCP", "TTFB"];
|
|
30
30
|
function sendFBEvent(name, properties, event_id) {
|
|
31
31
|
if (typeof window === "undefined" || !window.fbq) {
|
|
32
32
|
console.warn("fbq has not been initialized");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/third-parties/meta-pixel.ts"],"sourcesContent":["import { PixelId, mapFBEvent } from '../track/fbq';\nimport { getFirst } from '../utils/field';\nimport type { FBQ } from '../track/fbq';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends FBQ {}\n}\n\nconst metrics = ['CLS', 'FCP', 'INP', 'LCP', 'TTFB'];\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n if (metrics.includes(name)) return;\n\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function setFBUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n\n const address = getFirst(data?.address);\n\n window.fbq('init', pixelId, {\n em: getFirst(data?.email),\n fn: address?.first_name,\n ln: address?.last_name,\n ph: getFirst(data?.phone_number),\n external_id: user_id,\n ct: address?.city,\n st: address?.street,\n zp: address?.postal_code,\n country: address?.country,\n });\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoC;AACpC,mBAAyB;AASzB,IAAM,UAAU,CAAC,OAAO,OAAO,OAAO,OAAO,MAAM;
|
|
1
|
+
{"version":3,"sources":["../../src/third-parties/meta-pixel.ts"],"sourcesContent":["import { PixelId, mapFBEvent } from '../track/fbq';\nimport { getFirst } from '../utils/field';\nimport type { FBQ } from '../track/fbq';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends FBQ {}\n}\n\nconst metrics = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'];\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n if (metrics.includes(name)) return;\n\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function setFBUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n\n const address = getFirst(data?.address);\n\n window.fbq('init', pixelId, {\n em: getFirst(data?.email),\n fn: address?.first_name,\n ln: address?.last_name,\n ph: getFirst(data?.phone_number),\n external_id: user_id,\n ct: address?.city,\n st: address?.street,\n zp: address?.postal_code,\n country: address?.country,\n });\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoC;AACpC,mBAAyB;AASzB,IAAM,UAAU,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,MAAM;AAEnD,SAAS,YACd,MACA,YACA,UACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,YAAQ,KAAK,8BAA8B;AAC3C;AAAA,EACF;AACA,MAAI,QAAQ,SAAS,IAAI,EAAG;AAE5B,QAAM,EAAE,IAAI,IAAI;AAChB,QAAM,UAAU,EAAE,SAAS,SAAS;AACpC,QAAM,CAAC,MAAM,aAAa,iBAAiB,QAAI,uBAAW,MAAM,UAAU;AAC1E,MAAI,SAAS,SAAS;AACpB,QAAI,MAAM,aAAa,mBAAmB,OAAO;AAAA,EACnD,OAAO;AACL,QAAI,MAAM,aAAa,mBAAmB,OAAO;AAAA,EACnD;AACF;AAEO,SAAS,UAAU,SAAkB;AAC1C,SAAO,CAAC,EAAE,SAAS,KAAK,MAAwB;AAC9C,QAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,cAAQ,KAAK,8BAA8B;AAC3C;AAAA,IACF;AAEA,UAAM,cAAU,uBAAS,6BAAM,OAAO;AAEtC,WAAO,IAAI,QAAQ,SAAS;AAAA,MAC1B,QAAI,uBAAS,6BAAM,KAAK;AAAA,MACxB,IAAI,mCAAS;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,QAAI,uBAAS,6BAAM,YAAY;AAAA,MAC/B,aAAa;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,SAAS,mCAAS;AAAA,IACpB,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/third-parties/meta-pixel.ts
|
|
2
2
|
import { mapFBEvent } from "../track/fbq.mjs";
|
|
3
3
|
import { getFirst } from "../utils/field.mjs";
|
|
4
|
-
var metrics = ["CLS", "FCP", "INP", "LCP", "TTFB"];
|
|
4
|
+
var metrics = ["CLS", "FCP", "FID", "INP", "LCP", "TTFB"];
|
|
5
5
|
function sendFBEvent(name, properties, event_id) {
|
|
6
6
|
if (typeof window === "undefined" || !window.fbq) {
|
|
7
7
|
console.warn("fbq has not been initialized");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/third-parties/meta-pixel.ts"],"sourcesContent":["import { PixelId, mapFBEvent } from '../track/fbq';\nimport { getFirst } from '../utils/field';\nimport type { FBQ } from '../track/fbq';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends FBQ {}\n}\n\nconst metrics = ['CLS', 'FCP', 'INP', 'LCP', 'TTFB'];\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n if (metrics.includes(name)) return;\n\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function setFBUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n\n const address = getFirst(data?.address);\n\n window.fbq('init', pixelId, {\n em: getFirst(data?.email),\n fn: address?.first_name,\n ln: address?.last_name,\n ph: getFirst(data?.phone_number),\n external_id: user_id,\n ct: address?.city,\n st: address?.street,\n zp: address?.postal_code,\n country: address?.country,\n });\n };\n}\n"],"mappings":";AAAA,SAAkB,kBAAkB;AACpC,SAAS,gBAAgB;AASzB,IAAM,UAAU,CAAC,OAAO,OAAO,OAAO,OAAO,MAAM;
|
|
1
|
+
{"version":3,"sources":["../../src/third-parties/meta-pixel.ts"],"sourcesContent":["import { PixelId, mapFBEvent } from '../track/fbq';\nimport { getFirst } from '../utils/field';\nimport type { FBQ } from '../track/fbq';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends FBQ {}\n}\n\nconst metrics = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'];\n\nexport function sendFBEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n event_id?: string\n) {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n if (metrics.includes(name)) return;\n\n const { fbq } = window;\n const options = { eventID: event_id };\n const [type, fbEventName, fbEventProperties] = mapFBEvent(name, properties);\n if (type === 'track') {\n fbq(type, fbEventName, fbEventProperties, options);\n } else {\n fbq(type, fbEventName, fbEventProperties, options);\n }\n}\n\nexport function setFBUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.fbq) {\n console.warn('fbq has not been initialized');\n return;\n }\n\n const address = getFirst(data?.address);\n\n window.fbq('init', pixelId, {\n em: getFirst(data?.email),\n fn: address?.first_name,\n ln: address?.last_name,\n ph: getFirst(data?.phone_number),\n external_id: user_id,\n ct: address?.city,\n st: address?.street,\n zp: address?.postal_code,\n country: address?.country,\n });\n };\n}\n"],"mappings":";AAAA,SAAkB,kBAAkB;AACpC,SAAS,gBAAgB;AASzB,IAAM,UAAU,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,MAAM;AAEnD,SAAS,YACd,MACA,YACA,UACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,YAAQ,KAAK,8BAA8B;AAC3C;AAAA,EACF;AACA,MAAI,QAAQ,SAAS,IAAI,EAAG;AAE5B,QAAM,EAAE,IAAI,IAAI;AAChB,QAAM,UAAU,EAAE,SAAS,SAAS;AACpC,QAAM,CAAC,MAAM,aAAa,iBAAiB,IAAI,WAAW,MAAM,UAAU;AAC1E,MAAI,SAAS,SAAS;AACpB,QAAI,MAAM,aAAa,mBAAmB,OAAO;AAAA,EACnD,OAAO;AACL,QAAI,MAAM,aAAa,mBAAmB,OAAO;AAAA,EACnD;AACF;AAEO,SAAS,UAAU,SAAkB;AAC1C,SAAO,CAAC,EAAE,SAAS,KAAK,MAAwB;AAC9C,QAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,cAAQ,KAAK,8BAA8B;AAC3C;AAAA,IACF;AAEA,UAAM,UAAU,SAAS,6BAAM,OAAO;AAEtC,WAAO,IAAI,QAAQ,SAAS;AAAA,MAC1B,IAAI,SAAS,6BAAM,KAAK;AAAA,MACxB,IAAI,mCAAS;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,IAAI,SAAS,6BAAM,YAAY;AAAA,MAC/B,aAAa;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,IAAI,mCAAS;AAAA,MACb,SAAS,mCAAS;AAAA,IACpB,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -26,7 +26,7 @@ __export(reddit_pixel_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(reddit_pixel_exports);
|
|
27
27
|
var import_rdt = require("../track/rdt.cjs");
|
|
28
28
|
var import_field = require("../utils/field.cjs");
|
|
29
|
-
var metrics = ["CLS", "FCP", "INP", "LCP", "TTFB"];
|
|
29
|
+
var metrics = ["CLS", "FCP", "FID", "INP", "LCP", "TTFB"];
|
|
30
30
|
function sendRDTEvent(name, properties, eventId) {
|
|
31
31
|
if (typeof window === "undefined" || !window.rdt) {
|
|
32
32
|
console.warn("rdt has not been initialized");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/third-parties/reddit-pixel.ts"],"sourcesContent":["import { mapRDTEvent } from '../track/rdt';\nimport { getFirst } from '../utils/field';\nimport type { PixelId, RDT } from '../track/rdt';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends RDT {}\n}\n\nconst metrics = ['CLS', 'FCP', 'INP', 'LCP', 'TTFB'];\n\nexport function sendRDTEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n if (metrics.includes(name)) return;\n\n const { rdt } = window;\n const [type, params] = mapRDTEvent(name, properties, eventId);\n if (type === 'Custom') {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n } else {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n }\n}\n\nexport function setRDTUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (!window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n\n window.rdt('init', pixelId, {\n email: getFirst(data?.email),\n phoneNumber: getFirst(data?.phone_number),\n externalId: user_id,\n });\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA4B;AAC5B,mBAAyB;AASzB,IAAM,UAAU,CAAC,OAAO,OAAO,OAAO,OAAO,MAAM;
|
|
1
|
+
{"version":3,"sources":["../../src/third-parties/reddit-pixel.ts"],"sourcesContent":["import { mapRDTEvent } from '../track/rdt';\nimport { getFirst } from '../utils/field';\nimport type { PixelId, RDT } from '../track/rdt';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends RDT {}\n}\n\nconst metrics = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'];\n\nexport function sendRDTEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n if (metrics.includes(name)) return;\n\n const { rdt } = window;\n const [type, params] = mapRDTEvent(name, properties, eventId);\n if (type === 'Custom') {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n } else {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n }\n}\n\nexport function setRDTUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (!window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n\n window.rdt('init', pixelId, {\n email: getFirst(data?.email),\n phoneNumber: getFirst(data?.phone_number),\n externalId: user_id,\n });\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA4B;AAC5B,mBAAyB;AASzB,IAAM,UAAU,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,MAAM;AAEnD,SAAS,aACd,MACA,YACA,SACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,YAAQ,KAAK,8BAA8B;AAC3C;AAAA,EACF;AACA,MAAI,QAAQ,SAAS,IAAI,EAAG;AAE5B,QAAM,EAAE,IAAI,IAAI;AAChB,QAAM,CAAC,MAAM,MAAM,QAAI,wBAAY,MAAM,YAAY,OAAO;AAC5D,MAAI,SAAS,UAAU;AACrB,QAAI,SAAS,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;AAAA,EACvD,OAAO;AACL,QAAI,SAAS,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;AAAA,EACvD;AACF;AAEO,SAAS,WAAW,SAAkB;AAC3C,SAAO,CAAC,EAAE,SAAS,KAAK,MAAwB;AAC9C,QAAI,CAAC,OAAO,KAAK;AACf,cAAQ,KAAK,8BAA8B;AAC3C;AAAA,IACF;AAEA,WAAO,IAAI,QAAQ,SAAS;AAAA,MAC1B,WAAO,uBAAS,6BAAM,KAAK;AAAA,MAC3B,iBAAa,uBAAS,6BAAM,YAAY;AAAA,MACxC,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/third-parties/reddit-pixel.ts
|
|
2
2
|
import { mapRDTEvent } from "../track/rdt.mjs";
|
|
3
3
|
import { getFirst } from "../utils/field.mjs";
|
|
4
|
-
var metrics = ["CLS", "FCP", "INP", "LCP", "TTFB"];
|
|
4
|
+
var metrics = ["CLS", "FCP", "FID", "INP", "LCP", "TTFB"];
|
|
5
5
|
function sendRDTEvent(name, properties, eventId) {
|
|
6
6
|
if (typeof window === "undefined" || !window.rdt) {
|
|
7
7
|
console.warn("rdt has not been initialized");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/third-parties/reddit-pixel.ts"],"sourcesContent":["import { mapRDTEvent } from '../track/rdt';\nimport { getFirst } from '../utils/field';\nimport type { PixelId, RDT } from '../track/rdt';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends RDT {}\n}\n\nconst metrics = ['CLS', 'FCP', 'INP', 'LCP', 'TTFB'];\n\nexport function sendRDTEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n if (metrics.includes(name)) return;\n\n const { rdt } = window;\n const [type, params] = mapRDTEvent(name, properties, eventId);\n if (type === 'Custom') {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n } else {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n }\n}\n\nexport function setRDTUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (!window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n\n window.rdt('init', pixelId, {\n email: getFirst(data?.email),\n phoneNumber: getFirst(data?.phone_number),\n externalId: user_id,\n });\n };\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AASzB,IAAM,UAAU,CAAC,OAAO,OAAO,OAAO,OAAO,MAAM;
|
|
1
|
+
{"version":3,"sources":["../../src/third-parties/reddit-pixel.ts"],"sourcesContent":["import { mapRDTEvent } from '../track/rdt';\nimport { getFirst } from '../utils/field';\nimport type { PixelId, RDT } from '../track/rdt';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n interface Window extends RDT {}\n}\n\nconst metrics = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'];\n\nexport function sendRDTEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n if (metrics.includes(name)) return;\n\n const { rdt } = window;\n const [type, params] = mapRDTEvent(name, properties, eventId);\n if (type === 'Custom') {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n } else {\n rdt('track', type, JSON.parse(JSON.stringify(params)));\n }\n}\n\nexport function setRDTUser(pixelId: PixelId) {\n return ({ user_id, data }: UpdateVisitorDTO) => {\n if (!window.rdt) {\n console.warn('rdt has not been initialized');\n return;\n }\n\n window.rdt('init', pixelId, {\n email: getFirst(data?.email),\n phoneNumber: getFirst(data?.phone_number),\n externalId: user_id,\n });\n };\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AASzB,IAAM,UAAU,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,MAAM;AAEnD,SAAS,aACd,MACA,YACA,SACA;AACA,MAAI,OAAO,WAAW,eAAe,CAAC,OAAO,KAAK;AAChD,YAAQ,KAAK,8BAA8B;AAC3C;AAAA,EACF;AACA,MAAI,QAAQ,SAAS,IAAI,EAAG;AAE5B,QAAM,EAAE,IAAI,IAAI;AAChB,QAAM,CAAC,MAAM,MAAM,IAAI,YAAY,MAAM,YAAY,OAAO;AAC5D,MAAI,SAAS,UAAU;AACrB,QAAI,SAAS,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;AAAA,EACvD,OAAO;AACL,QAAI,SAAS,MAAM,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC;AAAA,EACvD;AACF;AAEO,SAAS,WAAW,SAAkB;AAC3C,SAAO,CAAC,EAAE,SAAS,KAAK,MAAwB;AAC9C,QAAI,CAAC,OAAO,KAAK;AACf,cAAQ,KAAK,8BAA8B;AAC3C;AAAA,IACF;AAEA,WAAO,IAAI,QAAQ,SAAS;AAAA,MAC1B,OAAO,SAAS,6BAAM,KAAK;AAAA,MAC3B,aAAa,SAAS,6BAAM,YAAY;AAAA,MACxC,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACF;","names":[]}
|