@refraction-ui/react 0.7.0 → 0.9.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/dist/applicationinsights-web-62HUCH3W.js +23262 -0
- package/dist/applicationinsights-web-62HUCH3W.js.map +1 -0
- package/dist/index.cjs +36187 -5602
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +887 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/analytics-sink-app-insights/index.d.cts +165 -0
- package/dist/internal/analytics-sink-app-insights/index.d.ts +165 -0
- package/dist/internal/analytics-sink-ga4/index.d.cts +219 -0
- package/dist/internal/analytics-sink-ga4/index.d.ts +219 -0
- package/dist/internal/analytics-sink-posthog/index.d.cts +155 -0
- package/dist/internal/analytics-sink-posthog/index.d.ts +155 -0
- package/dist/internal/analytics-sink-posthog/replay.d.cts +78 -0
- package/dist/internal/analytics-sink-posthog/replay.d.ts +78 -0
- package/dist/internal/react-analytics/index.d.cts +4 -0
- package/dist/internal/react-analytics/index.d.ts +4 -0
- package/dist/internal/react-logger/index.d.cts +6 -2
- package/dist/internal/react-logger/index.d.ts +6 -2
- package/dist/module-XHEQRMQB.js +5320 -0
- package/dist/module-XHEQRMQB.js.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cn, devWarn, cva, createKeyboardHandler, Keys, createMachine, generateId } from './chunk-O4453CBF.js';
|
|
2
|
-
|
|
2
|
+
export { createFaroSink } from './chunk-XWP763SH.js';
|
|
3
3
|
import * as React11 from 'react';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import * as ReactDOM from 'react-dom';
|
|
@@ -13736,6 +13736,10 @@ function createTelemetry(config) {
|
|
|
13736
13736
|
}
|
|
13737
13737
|
|
|
13738
13738
|
// ../react-logger/dist/index.js
|
|
13739
|
+
var noopTelemetry = null;
|
|
13740
|
+
function getNoopTelemetry() {
|
|
13741
|
+
return noopTelemetry ??= createNoopTelemetry();
|
|
13742
|
+
}
|
|
13739
13743
|
var TelemetryContext = React11.createContext(null);
|
|
13740
13744
|
function TelemetryProvider({ children, ...config }) {
|
|
13741
13745
|
const telemetryRef = React11.useRef(null);
|
|
@@ -13753,9 +13757,9 @@ function useTelemetry() {
|
|
|
13753
13757
|
if (!ctx) {
|
|
13754
13758
|
devWarn(
|
|
13755
13759
|
"react-logger/use-telemetry-outside-provider",
|
|
13756
|
-
"useTelemetry() (or useSpan(), which
|
|
13760
|
+
"useTelemetry() (or useLogger()/useSpan(), which depend on it) was called outside a <TelemetryProvider>. Telemetry is a no-op here; wrap your app (or the consuming subtree) in <TelemetryProvider> to enable it."
|
|
13757
13761
|
);
|
|
13758
|
-
|
|
13762
|
+
return getNoopTelemetry();
|
|
13759
13763
|
}
|
|
13760
13764
|
return ctx.telemetry;
|
|
13761
13765
|
}
|
|
@@ -14213,7 +14217,7 @@ function createHttpSink(options) {
|
|
|
14213
14217
|
const base = endpoint.replace(/\/+$/, "");
|
|
14214
14218
|
const url = `${base}/v${SCHEMA_VERSION}/batch`;
|
|
14215
14219
|
const authHeader = `Basic ${base64(`${writeKey}:`)}`;
|
|
14216
|
-
const
|
|
14220
|
+
const resolveFetch2 = () => {
|
|
14217
14221
|
if (options.fetchImpl) return options.fetchImpl;
|
|
14218
14222
|
const f = globalThis.fetch;
|
|
14219
14223
|
if (!f) throw new Error("No fetch implementation available");
|
|
@@ -14241,7 +14245,7 @@ function createHttpSink(options) {
|
|
|
14241
14245
|
return beacon(beaconUrl, JSON.stringify(envelope(batch)));
|
|
14242
14246
|
}
|
|
14243
14247
|
async function sendViaFetch(batch) {
|
|
14244
|
-
const doFetch =
|
|
14248
|
+
const doFetch = resolveFetch2();
|
|
14245
14249
|
const body = JSON.stringify(envelope(batch));
|
|
14246
14250
|
for (let attempt = 0; ; attempt++) {
|
|
14247
14251
|
let status;
|
|
@@ -14593,6 +14597,883 @@ function createAnalytics(config) {
|
|
|
14593
14597
|
return makeApi();
|
|
14594
14598
|
}
|
|
14595
14599
|
|
|
14600
|
+
// ../analytics-sink-ga4/dist/index.js
|
|
14601
|
+
var GA4_RESERVED_PREFIXES = ["google_", "ga_", "firebase_"];
|
|
14602
|
+
function toGa4Name(name) {
|
|
14603
|
+
const snake = name.trim().replace(/['"]/g, "").replace(/[^a-zA-Z0-9]+/g, "_").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toLowerCase();
|
|
14604
|
+
const safe = /^[a-z]/.test(snake) ? snake : `e_${snake}`;
|
|
14605
|
+
return GA4_RESERVED_PREFIXES.some((p) => safe.startsWith(p)) ? `x_${safe}` : safe;
|
|
14606
|
+
}
|
|
14607
|
+
function ga4EventName(ev) {
|
|
14608
|
+
switch (ev.type) {
|
|
14609
|
+
case "identify":
|
|
14610
|
+
return void 0;
|
|
14611
|
+
case "page":
|
|
14612
|
+
return "page_view";
|
|
14613
|
+
case "screen":
|
|
14614
|
+
return "screen_view";
|
|
14615
|
+
case "group":
|
|
14616
|
+
return "group";
|
|
14617
|
+
case "alias":
|
|
14618
|
+
return "alias";
|
|
14619
|
+
case "track":
|
|
14620
|
+
return ev.event ? toGa4Name(ev.event) : "track";
|
|
14621
|
+
default:
|
|
14622
|
+
return void 0;
|
|
14623
|
+
}
|
|
14624
|
+
}
|
|
14625
|
+
function toUserProperties(traits) {
|
|
14626
|
+
if (!traits) return void 0;
|
|
14627
|
+
const out = {};
|
|
14628
|
+
let any = false;
|
|
14629
|
+
for (const [k, v] of Object.entries(traits)) {
|
|
14630
|
+
if (v === void 0) continue;
|
|
14631
|
+
out[toGa4Name(k)] = { value: v };
|
|
14632
|
+
any = true;
|
|
14633
|
+
}
|
|
14634
|
+
return any ? out : void 0;
|
|
14635
|
+
}
|
|
14636
|
+
function toParams(ev) {
|
|
14637
|
+
const params = {};
|
|
14638
|
+
for (const [k, v] of Object.entries(ev.properties ?? {})) {
|
|
14639
|
+
if (v === void 0) continue;
|
|
14640
|
+
params[toGa4Name(k)] = v;
|
|
14641
|
+
}
|
|
14642
|
+
params.session_id = ev.sessionId;
|
|
14643
|
+
params.engagement_time_msec = params.engagement_time_msec ?? 1;
|
|
14644
|
+
const page = ev.context.page;
|
|
14645
|
+
if (ev.type === "page" || ev.type === "screen") {
|
|
14646
|
+
if (ev.event) {
|
|
14647
|
+
if (ev.type === "screen") params.screen_name = ev.event;
|
|
14648
|
+
else params.page_title = params.page_title ?? ev.event;
|
|
14649
|
+
}
|
|
14650
|
+
if (page?.url && params.page_location === void 0) {
|
|
14651
|
+
params.page_location = page.url;
|
|
14652
|
+
}
|
|
14653
|
+
if (page?.path && params.page_path === void 0) {
|
|
14654
|
+
params.page_path = page.path;
|
|
14655
|
+
}
|
|
14656
|
+
if (page?.referrer && params.page_referrer === void 0) {
|
|
14657
|
+
params.page_referrer = page.referrer;
|
|
14658
|
+
}
|
|
14659
|
+
if (page?.title && params.page_title === void 0) {
|
|
14660
|
+
params.page_title = page.title;
|
|
14661
|
+
}
|
|
14662
|
+
}
|
|
14663
|
+
if (ev.type === "group" && ev.groupId) {
|
|
14664
|
+
params.group_id = ev.groupId;
|
|
14665
|
+
}
|
|
14666
|
+
if (ev.type === "alias") {
|
|
14667
|
+
if (ev.userId) params.user_id = ev.userId;
|
|
14668
|
+
if (ev.previousId) params.previous_id = ev.previousId;
|
|
14669
|
+
}
|
|
14670
|
+
return params;
|
|
14671
|
+
}
|
|
14672
|
+
function mapEvent(ev) {
|
|
14673
|
+
const name = ga4EventName(ev);
|
|
14674
|
+
const mapped = {
|
|
14675
|
+
clientId: ev.anonymousId
|
|
14676
|
+
};
|
|
14677
|
+
if (ev.userId) mapped.userId = ev.userId;
|
|
14678
|
+
if (ev.type === "identify" || ev.type === "group") {
|
|
14679
|
+
const up = toUserProperties(ev.traits);
|
|
14680
|
+
if (up) mapped.userProperties = up;
|
|
14681
|
+
}
|
|
14682
|
+
if (name) {
|
|
14683
|
+
mapped.event = { name, params: toParams(ev) };
|
|
14684
|
+
}
|
|
14685
|
+
return mapped;
|
|
14686
|
+
}
|
|
14687
|
+
var DEFAULT_ENDPOINT = "https://www.google-analytics.com";
|
|
14688
|
+
var MAX_EVENTS_PER_REQUEST = 25;
|
|
14689
|
+
function resolveFetch(opts) {
|
|
14690
|
+
if (opts.fetchImpl) return opts.fetchImpl;
|
|
14691
|
+
const f = globalThis.fetch;
|
|
14692
|
+
if (!f) throw new Error("GA4 http sink: no fetch implementation available");
|
|
14693
|
+
return f;
|
|
14694
|
+
}
|
|
14695
|
+
function buildPayloads(batch) {
|
|
14696
|
+
const payloads = [];
|
|
14697
|
+
for (const ev of batch) {
|
|
14698
|
+
const m = mapEvent(ev);
|
|
14699
|
+
const last = payloads[payloads.length - 1];
|
|
14700
|
+
const sameIdentity = last && last.client_id === m.clientId && last.user_id === m.userId && last.events.length < MAX_EVENTS_PER_REQUEST && // user_properties must not silently differ within one request
|
|
14701
|
+
JSON.stringify(last.user_properties) === JSON.stringify(m.userProperties);
|
|
14702
|
+
const target = sameIdentity ? last : (() => {
|
|
14703
|
+
const p = { client_id: m.clientId, events: [] };
|
|
14704
|
+
if (m.userId) p.user_id = m.userId;
|
|
14705
|
+
if (m.userProperties) p.user_properties = m.userProperties;
|
|
14706
|
+
payloads.push(p);
|
|
14707
|
+
return p;
|
|
14708
|
+
})();
|
|
14709
|
+
if (m.event) {
|
|
14710
|
+
target.events.push(m.event);
|
|
14711
|
+
}
|
|
14712
|
+
}
|
|
14713
|
+
return payloads.filter(
|
|
14714
|
+
(p) => p.events.length > 0 || p.user_id !== void 0 || p.user_properties !== void 0
|
|
14715
|
+
);
|
|
14716
|
+
}
|
|
14717
|
+
function createGA4HttpSink(options) {
|
|
14718
|
+
const {
|
|
14719
|
+
measurementId,
|
|
14720
|
+
apiSecret,
|
|
14721
|
+
consentCategories = ["analytics"],
|
|
14722
|
+
name = "ga4",
|
|
14723
|
+
debug = false
|
|
14724
|
+
} = options;
|
|
14725
|
+
const base = (options.endpoint ?? DEFAULT_ENDPOINT).replace(/\/+$/, "");
|
|
14726
|
+
const path = debug ? "/debug/mp/collect" : "/mp/collect";
|
|
14727
|
+
const url = `${base}${path}?measurement_id=${encodeURIComponent(measurementId)}&api_secret=${encodeURIComponent(apiSecret)}`;
|
|
14728
|
+
return {
|
|
14729
|
+
name,
|
|
14730
|
+
consentCategories,
|
|
14731
|
+
init(_ctx) {
|
|
14732
|
+
},
|
|
14733
|
+
async deliver(batch) {
|
|
14734
|
+
if (batch.length === 0) return;
|
|
14735
|
+
const payloads = buildPayloads(batch);
|
|
14736
|
+
if (payloads.length === 0) return;
|
|
14737
|
+
const doFetch = resolveFetch(options);
|
|
14738
|
+
for (const payload of payloads) {
|
|
14739
|
+
try {
|
|
14740
|
+
await doFetch(url, {
|
|
14741
|
+
method: "POST",
|
|
14742
|
+
headers: { "Content-Type": "application/json" },
|
|
14743
|
+
body: JSON.stringify(payload),
|
|
14744
|
+
keepalive: true
|
|
14745
|
+
});
|
|
14746
|
+
} catch {
|
|
14747
|
+
}
|
|
14748
|
+
}
|
|
14749
|
+
}
|
|
14750
|
+
};
|
|
14751
|
+
}
|
|
14752
|
+
var DEFAULT_SRC_BASE = "https://www.googletagmanager.com/gtag/js";
|
|
14753
|
+
function defaultScriptLoader(src) {
|
|
14754
|
+
const g = globalThis;
|
|
14755
|
+
const doc = g.document;
|
|
14756
|
+
if (!doc || typeof doc.createElement !== "function") {
|
|
14757
|
+
return Promise.reject(
|
|
14758
|
+
new Error("GA4 client-sdk sink: no DOM to inject gtag.js")
|
|
14759
|
+
);
|
|
14760
|
+
}
|
|
14761
|
+
return new Promise((resolve, reject) => {
|
|
14762
|
+
const el = doc.createElement("script");
|
|
14763
|
+
el.async = true;
|
|
14764
|
+
el.src = src;
|
|
14765
|
+
el.onload = () => resolve();
|
|
14766
|
+
el.onerror = () => reject(new Error("GA4 client-sdk: gtag.js failed"));
|
|
14767
|
+
if (doc.head?.appendChild) {
|
|
14768
|
+
doc.head.appendChild(el);
|
|
14769
|
+
} else {
|
|
14770
|
+
const first = doc.getElementsByTagName("script")[0];
|
|
14771
|
+
first?.parentNode?.insertBefore(el, first);
|
|
14772
|
+
}
|
|
14773
|
+
});
|
|
14774
|
+
}
|
|
14775
|
+
function createGA4ClientSdkSink(options) {
|
|
14776
|
+
const {
|
|
14777
|
+
measurementId,
|
|
14778
|
+
consentCategories = ["analytics"],
|
|
14779
|
+
name = "ga4",
|
|
14780
|
+
consentMode
|
|
14781
|
+
} = options;
|
|
14782
|
+
const g = globalThis;
|
|
14783
|
+
let gtag = options.gtag;
|
|
14784
|
+
let loaded = false;
|
|
14785
|
+
let loadPromise;
|
|
14786
|
+
function ensureGtagStub() {
|
|
14787
|
+
if (gtag) return gtag;
|
|
14788
|
+
g.dataLayer = g.dataLayer ?? [];
|
|
14789
|
+
const dl = g.dataLayer;
|
|
14790
|
+
const fn = (...args) => {
|
|
14791
|
+
dl.push(args);
|
|
14792
|
+
};
|
|
14793
|
+
g.gtag = g.gtag ?? fn;
|
|
14794
|
+
gtag = g.gtag;
|
|
14795
|
+
return gtag;
|
|
14796
|
+
}
|
|
14797
|
+
function pushConsentDefault() {
|
|
14798
|
+
if (!consentMode?.default || !gtag) return;
|
|
14799
|
+
gtag("consent", "default", { ...consentMode.default });
|
|
14800
|
+
}
|
|
14801
|
+
function pushConsentUpdate() {
|
|
14802
|
+
if (!consentMode?.map || !gtag) return;
|
|
14803
|
+
const update = {};
|
|
14804
|
+
for (const cat of consentCategories) {
|
|
14805
|
+
for (const ga4Type of consentMode.map[cat] ?? []) {
|
|
14806
|
+
update[ga4Type] = "granted";
|
|
14807
|
+
}
|
|
14808
|
+
}
|
|
14809
|
+
if (Object.keys(update).length > 0) {
|
|
14810
|
+
gtag("consent", "update", update);
|
|
14811
|
+
}
|
|
14812
|
+
}
|
|
14813
|
+
function ensureLoaded() {
|
|
14814
|
+
if (loaded) return Promise.resolve();
|
|
14815
|
+
if (loadPromise) return loadPromise;
|
|
14816
|
+
ensureGtagStub();
|
|
14817
|
+
pushConsentDefault();
|
|
14818
|
+
if (options.gtag) {
|
|
14819
|
+
gtag("js", /* @__PURE__ */ new Date());
|
|
14820
|
+
gtag("config", measurementId, { send_page_view: false });
|
|
14821
|
+
loaded = true;
|
|
14822
|
+
return Promise.resolve();
|
|
14823
|
+
}
|
|
14824
|
+
const base = options.gtagSrcBase ?? DEFAULT_SRC_BASE;
|
|
14825
|
+
const src = `${base}?id=${encodeURIComponent(measurementId)}`;
|
|
14826
|
+
const load = options.scriptLoader ?? defaultScriptLoader;
|
|
14827
|
+
loadPromise = load(src).then(() => {
|
|
14828
|
+
gtag("js", /* @__PURE__ */ new Date());
|
|
14829
|
+
gtag("config", measurementId, { send_page_view: false });
|
|
14830
|
+
loaded = true;
|
|
14831
|
+
});
|
|
14832
|
+
return loadPromise;
|
|
14833
|
+
}
|
|
14834
|
+
return {
|
|
14835
|
+
name,
|
|
14836
|
+
consentCategories,
|
|
14837
|
+
init(_ctx) {
|
|
14838
|
+
ensureGtagStub();
|
|
14839
|
+
pushConsentDefault();
|
|
14840
|
+
},
|
|
14841
|
+
async deliver(batch) {
|
|
14842
|
+
if (batch.length === 0) return;
|
|
14843
|
+
await ensureLoaded();
|
|
14844
|
+
const send = gtag;
|
|
14845
|
+
pushConsentUpdate();
|
|
14846
|
+
for (const ev of batch) {
|
|
14847
|
+
const m = mapEvent(ev);
|
|
14848
|
+
if (m.userId) {
|
|
14849
|
+
send("set", { user_id: m.userId });
|
|
14850
|
+
}
|
|
14851
|
+
if (m.userProperties) {
|
|
14852
|
+
const flat = {};
|
|
14853
|
+
for (const [k, v] of Object.entries(m.userProperties)) {
|
|
14854
|
+
flat[k] = v.value;
|
|
14855
|
+
}
|
|
14856
|
+
send("set", "user_properties", flat);
|
|
14857
|
+
}
|
|
14858
|
+
if (m.event) {
|
|
14859
|
+
send("event", m.event.name, m.event.params);
|
|
14860
|
+
}
|
|
14861
|
+
}
|
|
14862
|
+
}
|
|
14863
|
+
};
|
|
14864
|
+
}
|
|
14865
|
+
function createGA4Sink(options) {
|
|
14866
|
+
if (options.mode === "client-sdk") {
|
|
14867
|
+
return createGA4ClientSdkSink(options);
|
|
14868
|
+
}
|
|
14869
|
+
return createGA4HttpSink(options);
|
|
14870
|
+
}
|
|
14871
|
+
|
|
14872
|
+
// ../analytics-sink-app-insights/dist/index.js
|
|
14873
|
+
var FALLBACK_TRACK_NAME = "track";
|
|
14874
|
+
function eventName(ev) {
|
|
14875
|
+
switch (ev.type) {
|
|
14876
|
+
case "page":
|
|
14877
|
+
return `Page View: ${ev.event ?? ev.context.page?.path ?? "(unknown)"}`;
|
|
14878
|
+
case "screen":
|
|
14879
|
+
return `Screen: ${ev.event ?? "(unknown)"}`;
|
|
14880
|
+
case "identify":
|
|
14881
|
+
return "Identify";
|
|
14882
|
+
case "group":
|
|
14883
|
+
return "Group";
|
|
14884
|
+
case "alias":
|
|
14885
|
+
return "Alias";
|
|
14886
|
+
case "track":
|
|
14887
|
+
default:
|
|
14888
|
+
return ev.event ?? FALLBACK_TRACK_NAME;
|
|
14889
|
+
}
|
|
14890
|
+
}
|
|
14891
|
+
function isMeasurement(value) {
|
|
14892
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
14893
|
+
}
|
|
14894
|
+
function stringify(value) {
|
|
14895
|
+
if (typeof value === "string") return value;
|
|
14896
|
+
if (typeof value === "boolean" || typeof value === "bigint") {
|
|
14897
|
+
return String(value);
|
|
14898
|
+
}
|
|
14899
|
+
if (typeof value === "number") return String(value);
|
|
14900
|
+
try {
|
|
14901
|
+
return JSON.stringify(value) ?? String(value);
|
|
14902
|
+
} catch {
|
|
14903
|
+
return String(value);
|
|
14904
|
+
}
|
|
14905
|
+
}
|
|
14906
|
+
function splitBag(bag, prefix, properties, measurements) {
|
|
14907
|
+
if (!bag) return;
|
|
14908
|
+
for (const [key, value] of Object.entries(bag)) {
|
|
14909
|
+
if (value === void 0 || value === null) continue;
|
|
14910
|
+
const flatKey = prefix ? `${prefix}.${key}` : key;
|
|
14911
|
+
if (isMeasurement(value)) {
|
|
14912
|
+
measurements[flatKey] = value;
|
|
14913
|
+
continue;
|
|
14914
|
+
}
|
|
14915
|
+
if (typeof value === "object" && !Array.isArray(value) && value.constructor === Object) {
|
|
14916
|
+
splitBag(
|
|
14917
|
+
value,
|
|
14918
|
+
flatKey,
|
|
14919
|
+
properties,
|
|
14920
|
+
measurements
|
|
14921
|
+
);
|
|
14922
|
+
continue;
|
|
14923
|
+
}
|
|
14924
|
+
properties[flatKey] = stringify(value);
|
|
14925
|
+
}
|
|
14926
|
+
}
|
|
14927
|
+
function mapEvent2(ev) {
|
|
14928
|
+
const properties = {};
|
|
14929
|
+
const measurements = {};
|
|
14930
|
+
if (ev.userId !== void 0) {
|
|
14931
|
+
properties.authenticatedUserId = ev.userId;
|
|
14932
|
+
properties.anonymous = "false";
|
|
14933
|
+
} else {
|
|
14934
|
+
properties.anonymous = "true";
|
|
14935
|
+
}
|
|
14936
|
+
properties.messageId = ev.messageId;
|
|
14937
|
+
properties.anonymousId = ev.anonymousId;
|
|
14938
|
+
properties.sessionId = ev.sessionId;
|
|
14939
|
+
properties.eventType = ev.type;
|
|
14940
|
+
properties.timestamp = ev.timestamp;
|
|
14941
|
+
measurements.schemaVersion = ev.schemaVersion;
|
|
14942
|
+
if (ev.groupId !== void 0) properties.groupId = ev.groupId;
|
|
14943
|
+
if (ev.previousId !== void 0) properties.previousId = ev.previousId;
|
|
14944
|
+
if (ev.event !== void 0) properties.eventName = ev.event;
|
|
14945
|
+
properties.app = ev.context.app;
|
|
14946
|
+
properties.env = ev.context.env;
|
|
14947
|
+
properties.libraryName = ev.context.library.name;
|
|
14948
|
+
properties.libraryVersion = ev.context.library.version;
|
|
14949
|
+
if (ev.context.page) {
|
|
14950
|
+
splitBag(
|
|
14951
|
+
ev.context.page,
|
|
14952
|
+
"page",
|
|
14953
|
+
properties,
|
|
14954
|
+
measurements
|
|
14955
|
+
);
|
|
14956
|
+
}
|
|
14957
|
+
splitBag(ev.properties, "", properties, measurements);
|
|
14958
|
+
splitBag(ev.traits, "", properties, measurements);
|
|
14959
|
+
return { name: eventName(ev), properties, measurements };
|
|
14960
|
+
}
|
|
14961
|
+
var DEFAULT_INGEST_ENDPOINT = "https://dc.services.visualstudio.com";
|
|
14962
|
+
var NO_RETRY2 = /* @__PURE__ */ new Set([400, 401, 403, 413]);
|
|
14963
|
+
var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
14964
|
+
function createClientSdkSink(opts) {
|
|
14965
|
+
const name = opts.name ?? "app-insights";
|
|
14966
|
+
let instance = opts.appInsights;
|
|
14967
|
+
let loading;
|
|
14968
|
+
async function resolveSdk() {
|
|
14969
|
+
if (instance) return instance;
|
|
14970
|
+
if (loading) return loading;
|
|
14971
|
+
loading = (async () => {
|
|
14972
|
+
if (opts.loadSdk) {
|
|
14973
|
+
instance = await opts.loadSdk({
|
|
14974
|
+
connectionString: opts.connectionString,
|
|
14975
|
+
instrumentationKey: opts.instrumentationKey
|
|
14976
|
+
});
|
|
14977
|
+
return instance;
|
|
14978
|
+
}
|
|
14979
|
+
const mod = await import(
|
|
14980
|
+
/* @vite-ignore */
|
|
14981
|
+
'./applicationinsights-web-62HUCH3W.js'
|
|
14982
|
+
);
|
|
14983
|
+
const ai = new mod.ApplicationInsights({
|
|
14984
|
+
config: {
|
|
14985
|
+
connectionString: opts.connectionString,
|
|
14986
|
+
instrumentationKey: opts.instrumentationKey
|
|
14987
|
+
}
|
|
14988
|
+
});
|
|
14989
|
+
ai.loadAppInsights?.();
|
|
14990
|
+
instance = ai;
|
|
14991
|
+
return ai;
|
|
14992
|
+
})();
|
|
14993
|
+
return loading;
|
|
14994
|
+
}
|
|
14995
|
+
let lastAuthUserId;
|
|
14996
|
+
return {
|
|
14997
|
+
name,
|
|
14998
|
+
consentCategories: opts.consentCategories ?? ["analytics"],
|
|
14999
|
+
async deliver(batch) {
|
|
15000
|
+
if (batch.length === 0) return;
|
|
15001
|
+
const ai = await resolveSdk();
|
|
15002
|
+
for (const ev of batch) {
|
|
15003
|
+
if (ev.userId !== void 0 && ev.userId !== lastAuthUserId) {
|
|
15004
|
+
ai.setAuthenticatedUserContext?.(ev.userId);
|
|
15005
|
+
lastAuthUserId = ev.userId;
|
|
15006
|
+
}
|
|
15007
|
+
if (ev.type === "identify" && ev.userId === void 0 && lastAuthUserId !== void 0) {
|
|
15008
|
+
ai.clearAuthenticatedUserContext?.();
|
|
15009
|
+
lastAuthUserId = void 0;
|
|
15010
|
+
}
|
|
15011
|
+
const mapped = mapEvent2(ev);
|
|
15012
|
+
const merged = {
|
|
15013
|
+
...mapped.properties,
|
|
15014
|
+
...mapped.measurements
|
|
15015
|
+
};
|
|
15016
|
+
if (ev.type === "page") {
|
|
15017
|
+
ai.trackPageView({
|
|
15018
|
+
name: ev.event ?? ev.context.page?.path,
|
|
15019
|
+
uri: ev.context.page?.url,
|
|
15020
|
+
properties: mapped.properties,
|
|
15021
|
+
measurements: mapped.measurements
|
|
15022
|
+
});
|
|
15023
|
+
} else {
|
|
15024
|
+
ai.trackEvent({ name: mapped.name }, merged);
|
|
15025
|
+
}
|
|
15026
|
+
}
|
|
15027
|
+
},
|
|
15028
|
+
async flush() {
|
|
15029
|
+
if (instance?.flush) instance.flush(false);
|
|
15030
|
+
},
|
|
15031
|
+
shutdown() {
|
|
15032
|
+
instance = void 0;
|
|
15033
|
+
loading = void 0;
|
|
15034
|
+
lastAuthUserId = void 0;
|
|
15035
|
+
}
|
|
15036
|
+
};
|
|
15037
|
+
}
|
|
15038
|
+
function buildIngestEnvelope(ev, iKey) {
|
|
15039
|
+
const mapped = mapEvent2(ev);
|
|
15040
|
+
const isPage = ev.type === "page";
|
|
15041
|
+
const tags = {
|
|
15042
|
+
"ai.session.id": ev.sessionId,
|
|
15043
|
+
"ai.user.id": ev.anonymousId,
|
|
15044
|
+
"ai.operation.id": ev.messageId,
|
|
15045
|
+
"ai.internal.sdkVersion": `refraction-ui-analytics-app-insights:0.1.0`,
|
|
15046
|
+
"ai.application.ver": ev.context.library.version,
|
|
15047
|
+
"ai.cloud.role": ev.context.app,
|
|
15048
|
+
"ai.cloud.roleInstance": ev.context.env
|
|
15049
|
+
};
|
|
15050
|
+
if (ev.userId !== void 0) tags["ai.user.authUserId"] = ev.userId;
|
|
15051
|
+
return {
|
|
15052
|
+
name: isPage ? "Microsoft.ApplicationInsights.PageView" : "Microsoft.ApplicationInsights.Event",
|
|
15053
|
+
time: ev.timestamp,
|
|
15054
|
+
iKey,
|
|
15055
|
+
tags,
|
|
15056
|
+
data: {
|
|
15057
|
+
baseType: isPage ? "PageViewData" : "EventData",
|
|
15058
|
+
baseData: {
|
|
15059
|
+
ver: 2,
|
|
15060
|
+
name: isPage ? eventName(ev) : mapped.name,
|
|
15061
|
+
properties: mapped.properties,
|
|
15062
|
+
measurements: mapped.measurements
|
|
15063
|
+
}
|
|
15064
|
+
}
|
|
15065
|
+
};
|
|
15066
|
+
}
|
|
15067
|
+
function createHttpSink2(opts) {
|
|
15068
|
+
const name = opts.name ?? "app-insights";
|
|
15069
|
+
const {
|
|
15070
|
+
instrumentationKey,
|
|
15071
|
+
maxRetries = 3,
|
|
15072
|
+
backoffBaseMs = 500
|
|
15073
|
+
} = opts;
|
|
15074
|
+
const base = (opts.endpoint ?? DEFAULT_INGEST_ENDPOINT).replace(/\/+$/, "");
|
|
15075
|
+
const url = `${base}/v2/track`;
|
|
15076
|
+
const resolveFetch2 = () => {
|
|
15077
|
+
if (opts.fetchImpl) return opts.fetchImpl;
|
|
15078
|
+
const f = globalThis.fetch;
|
|
15079
|
+
if (!f) throw new Error("No fetch implementation available");
|
|
15080
|
+
return f;
|
|
15081
|
+
};
|
|
15082
|
+
async function send(body) {
|
|
15083
|
+
const doFetch = resolveFetch2();
|
|
15084
|
+
for (let attempt = 0; ; attempt++) {
|
|
15085
|
+
let status;
|
|
15086
|
+
try {
|
|
15087
|
+
const res = await doFetch(url, {
|
|
15088
|
+
method: "POST",
|
|
15089
|
+
headers: { "Content-Type": "application/json" },
|
|
15090
|
+
body,
|
|
15091
|
+
keepalive: true
|
|
15092
|
+
});
|
|
15093
|
+
status = res.status;
|
|
15094
|
+
} catch {
|
|
15095
|
+
status = 0;
|
|
15096
|
+
}
|
|
15097
|
+
if (status >= 200 && status < 300) return;
|
|
15098
|
+
if (NO_RETRY2.has(status)) return;
|
|
15099
|
+
if (attempt >= maxRetries) return;
|
|
15100
|
+
await sleep2(backoffBaseMs * 2 ** attempt);
|
|
15101
|
+
}
|
|
15102
|
+
}
|
|
15103
|
+
return {
|
|
15104
|
+
name,
|
|
15105
|
+
consentCategories: opts.consentCategories ?? ["analytics"],
|
|
15106
|
+
async deliver(batch, _ctx) {
|
|
15107
|
+
if (batch.length === 0) return;
|
|
15108
|
+
const envelopes = batch.map(
|
|
15109
|
+
(ev) => buildIngestEnvelope(ev, instrumentationKey)
|
|
15110
|
+
);
|
|
15111
|
+
await send(JSON.stringify(envelopes));
|
|
15112
|
+
}
|
|
15113
|
+
};
|
|
15114
|
+
}
|
|
15115
|
+
function createAppInsightsSink(options) {
|
|
15116
|
+
return options.mode === "http" ? createHttpSink2(options) : createClientSdkSink(options);
|
|
15117
|
+
}
|
|
15118
|
+
|
|
15119
|
+
// ../analytics-sink-posthog/dist/index.js
|
|
15120
|
+
function distinctId(ev) {
|
|
15121
|
+
return ev.userId ?? ev.anonymousId;
|
|
15122
|
+
}
|
|
15123
|
+
function contextProperties(ev) {
|
|
15124
|
+
const ctx = ev.context;
|
|
15125
|
+
const props = {
|
|
15126
|
+
$lib: ctx.library?.name,
|
|
15127
|
+
$lib_version: ctx.library?.version,
|
|
15128
|
+
app: ctx.app,
|
|
15129
|
+
env: ctx.env,
|
|
15130
|
+
$session_id: ev.sessionId,
|
|
15131
|
+
// Keep the canonical anonymous id addressable in PostHog too.
|
|
15132
|
+
anonymousId: ev.anonymousId
|
|
15133
|
+
};
|
|
15134
|
+
const page = ctx.page;
|
|
15135
|
+
if (page) {
|
|
15136
|
+
if (page.url !== void 0) props.$current_url = page.url;
|
|
15137
|
+
if (page.path !== void 0) props.$pathname = page.path;
|
|
15138
|
+
if (page.referrer !== void 0) props.$referrer = page.referrer;
|
|
15139
|
+
if (page.title !== void 0) props.title = page.title;
|
|
15140
|
+
if (page.search !== void 0) props.$search = page.search;
|
|
15141
|
+
}
|
|
15142
|
+
return props;
|
|
15143
|
+
}
|
|
15144
|
+
function toPostHogEvent(ev) {
|
|
15145
|
+
const base = {
|
|
15146
|
+
distinct_id: distinctId(ev),
|
|
15147
|
+
timestamp: ev.timestamp,
|
|
15148
|
+
uuid: ev.messageId
|
|
15149
|
+
};
|
|
15150
|
+
const props = contextProperties(ev);
|
|
15151
|
+
switch (ev.type) {
|
|
15152
|
+
case "identify": {
|
|
15153
|
+
return {
|
|
15154
|
+
...base,
|
|
15155
|
+
event: "$identify",
|
|
15156
|
+
properties: {
|
|
15157
|
+
...props,
|
|
15158
|
+
$set: { ...ev.traits ?? {} },
|
|
15159
|
+
// Stitch the pre-identify anonymous history onto this person.
|
|
15160
|
+
$anon_distinct_id: ev.anonymousId
|
|
15161
|
+
}
|
|
15162
|
+
};
|
|
15163
|
+
}
|
|
15164
|
+
case "group": {
|
|
15165
|
+
const groupType = ev.properties?.groupType ?? "company";
|
|
15166
|
+
return {
|
|
15167
|
+
...base,
|
|
15168
|
+
event: "$groupidentify",
|
|
15169
|
+
properties: {
|
|
15170
|
+
...props,
|
|
15171
|
+
$group_type: groupType,
|
|
15172
|
+
$group_key: ev.groupId,
|
|
15173
|
+
$group_set: { ...ev.traits ?? {} }
|
|
15174
|
+
}
|
|
15175
|
+
};
|
|
15176
|
+
}
|
|
15177
|
+
case "alias": {
|
|
15178
|
+
return {
|
|
15179
|
+
...base,
|
|
15180
|
+
event: "$create_alias",
|
|
15181
|
+
properties: {
|
|
15182
|
+
...props,
|
|
15183
|
+
// PostHog links `alias` to the current `distinct_id`.
|
|
15184
|
+
alias: ev.previousId
|
|
15185
|
+
}
|
|
15186
|
+
};
|
|
15187
|
+
}
|
|
15188
|
+
case "page": {
|
|
15189
|
+
return {
|
|
15190
|
+
...base,
|
|
15191
|
+
event: "$pageview",
|
|
15192
|
+
properties: { ...props, ...ev.properties ?? {} }
|
|
15193
|
+
};
|
|
15194
|
+
}
|
|
15195
|
+
case "screen": {
|
|
15196
|
+
return {
|
|
15197
|
+
...base,
|
|
15198
|
+
event: "$screen",
|
|
15199
|
+
properties: {
|
|
15200
|
+
...props,
|
|
15201
|
+
$screen_name: ev.event,
|
|
15202
|
+
...ev.properties ?? {}
|
|
15203
|
+
}
|
|
15204
|
+
};
|
|
15205
|
+
}
|
|
15206
|
+
case "track":
|
|
15207
|
+
default: {
|
|
15208
|
+
return {
|
|
15209
|
+
...base,
|
|
15210
|
+
event: ev.event ?? "track",
|
|
15211
|
+
properties: { ...props, ...ev.properties ?? {} }
|
|
15212
|
+
};
|
|
15213
|
+
}
|
|
15214
|
+
}
|
|
15215
|
+
}
|
|
15216
|
+
function toPostHogBatch(batch) {
|
|
15217
|
+
return batch.map(toPostHogEvent);
|
|
15218
|
+
}
|
|
15219
|
+
var NO_RETRY3 = /* @__PURE__ */ new Set([400, 401, 403, 413]);
|
|
15220
|
+
var sleep3 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
15221
|
+
function byteLength2(s) {
|
|
15222
|
+
const g = globalThis;
|
|
15223
|
+
if (g.TextEncoder) return new g.TextEncoder().encode(s).length;
|
|
15224
|
+
return unescape(encodeURIComponent(s)).length;
|
|
15225
|
+
}
|
|
15226
|
+
function splitBatch2(items, maxBatchBytes, maxEventBytes) {
|
|
15227
|
+
const batches = [];
|
|
15228
|
+
let current = [];
|
|
15229
|
+
let currentBytes = 2;
|
|
15230
|
+
for (const item of items) {
|
|
15231
|
+
const itemBytes = byteLength2(JSON.stringify(item));
|
|
15232
|
+
if (itemBytes > maxEventBytes) continue;
|
|
15233
|
+
if (current.length && currentBytes + itemBytes + 1 > maxBatchBytes) {
|
|
15234
|
+
batches.push(current);
|
|
15235
|
+
current = [];
|
|
15236
|
+
currentBytes = 2;
|
|
15237
|
+
}
|
|
15238
|
+
current.push(item);
|
|
15239
|
+
currentBytes += itemBytes + 1;
|
|
15240
|
+
}
|
|
15241
|
+
if (current.length) batches.push(current);
|
|
15242
|
+
return batches;
|
|
15243
|
+
}
|
|
15244
|
+
function createPostHogHttpSink(options) {
|
|
15245
|
+
const {
|
|
15246
|
+
apiKey,
|
|
15247
|
+
host = "https://us.i.posthog.com",
|
|
15248
|
+
name = "posthog",
|
|
15249
|
+
consentCategories = ["analytics"],
|
|
15250
|
+
maxRetries = 3,
|
|
15251
|
+
backoffBaseMs = 500,
|
|
15252
|
+
maxBatchBytes = 1e6,
|
|
15253
|
+
maxEventBytes = 32e3
|
|
15254
|
+
} = options;
|
|
15255
|
+
const base = host.replace(/\/+$/, "");
|
|
15256
|
+
const captureUrl = `${base}/capture/`;
|
|
15257
|
+
const batchUrl = `${base}/batch/`;
|
|
15258
|
+
const resolveFetch2 = () => {
|
|
15259
|
+
if (options.fetchImpl) return options.fetchImpl;
|
|
15260
|
+
const f = globalThis.fetch;
|
|
15261
|
+
if (!f) throw new Error("No fetch implementation available");
|
|
15262
|
+
return f;
|
|
15263
|
+
};
|
|
15264
|
+
const resolveBeacon = () => {
|
|
15265
|
+
if (options.beaconImpl) return options.beaconImpl;
|
|
15266
|
+
const nav = globalThis.navigator;
|
|
15267
|
+
if (nav && typeof nav.sendBeacon === "function") {
|
|
15268
|
+
return (u, body) => nav.sendBeacon(u, body);
|
|
15269
|
+
}
|
|
15270
|
+
return void 0;
|
|
15271
|
+
};
|
|
15272
|
+
function payload(part) {
|
|
15273
|
+
if (part.length === 1) {
|
|
15274
|
+
return {
|
|
15275
|
+
url: captureUrl,
|
|
15276
|
+
body: JSON.stringify({ api_key: apiKey, ...part[0] })
|
|
15277
|
+
};
|
|
15278
|
+
}
|
|
15279
|
+
return {
|
|
15280
|
+
url: batchUrl,
|
|
15281
|
+
body: JSON.stringify({ api_key: apiKey, batch: part })
|
|
15282
|
+
};
|
|
15283
|
+
}
|
|
15284
|
+
async function sendViaFetch(part) {
|
|
15285
|
+
const doFetch = resolveFetch2();
|
|
15286
|
+
const { url, body } = payload(part);
|
|
15287
|
+
for (let attempt = 0; ; attempt++) {
|
|
15288
|
+
let status;
|
|
15289
|
+
try {
|
|
15290
|
+
const res = await doFetch(url, {
|
|
15291
|
+
method: "POST",
|
|
15292
|
+
headers: { "Content-Type": "application/json" },
|
|
15293
|
+
body,
|
|
15294
|
+
keepalive: true
|
|
15295
|
+
});
|
|
15296
|
+
status = res.status;
|
|
15297
|
+
} catch {
|
|
15298
|
+
status = 0;
|
|
15299
|
+
}
|
|
15300
|
+
if (status >= 200 && status < 300) return;
|
|
15301
|
+
if (NO_RETRY3.has(status)) return;
|
|
15302
|
+
if (attempt >= maxRetries) return;
|
|
15303
|
+
await sleep3(backoffBaseMs * 2 ** attempt);
|
|
15304
|
+
}
|
|
15305
|
+
}
|
|
15306
|
+
function sendViaBeacon(part) {
|
|
15307
|
+
const beacon = resolveBeacon();
|
|
15308
|
+
if (!beacon) return false;
|
|
15309
|
+
const { url, body } = payload(part);
|
|
15310
|
+
return beacon(url, body);
|
|
15311
|
+
}
|
|
15312
|
+
return {
|
|
15313
|
+
name,
|
|
15314
|
+
consentCategories,
|
|
15315
|
+
async deliver(batch, ctx) {
|
|
15316
|
+
if (batch.length === 0) return;
|
|
15317
|
+
const items = toPostHogBatch(batch);
|
|
15318
|
+
const parts = splitBatch2(items, maxBatchBytes, maxEventBytes);
|
|
15319
|
+
for (const part of parts) {
|
|
15320
|
+
if (part.length === 0) continue;
|
|
15321
|
+
if (ctx.unload) {
|
|
15322
|
+
if (sendViaBeacon(part)) continue;
|
|
15323
|
+
void sendViaFetch(part);
|
|
15324
|
+
} else {
|
|
15325
|
+
await sendViaFetch(part);
|
|
15326
|
+
}
|
|
15327
|
+
}
|
|
15328
|
+
}
|
|
15329
|
+
};
|
|
15330
|
+
}
|
|
15331
|
+
async function defaultLoad() {
|
|
15332
|
+
const mod = await import('./module-XHEQRMQB.js');
|
|
15333
|
+
return "default" in mod ? mod.default : mod;
|
|
15334
|
+
}
|
|
15335
|
+
function createPostHogClientSdkSink(options) {
|
|
15336
|
+
const {
|
|
15337
|
+
apiKey,
|
|
15338
|
+
host = "https://us.i.posthog.com",
|
|
15339
|
+
name = "posthog",
|
|
15340
|
+
consentCategories = ["analytics"],
|
|
15341
|
+
posthogOptions = {}
|
|
15342
|
+
} = options;
|
|
15343
|
+
let ph;
|
|
15344
|
+
let loading;
|
|
15345
|
+
async function ensure() {
|
|
15346
|
+
if (ph) return ph;
|
|
15347
|
+
if (!loading) {
|
|
15348
|
+
const load = options.loadPostHog ? async () => {
|
|
15349
|
+
const m = await options.loadPostHog();
|
|
15350
|
+
return "default" in m ? m.default : m;
|
|
15351
|
+
} : defaultLoad;
|
|
15352
|
+
loading = load().then((instance) => {
|
|
15353
|
+
instance.init(apiKey, {
|
|
15354
|
+
api_host: host,
|
|
15355
|
+
// The canonical router owns the event path — disable PostHog's
|
|
15356
|
+
// own auto-capture and pageview, and never start replay here.
|
|
15357
|
+
autocapture: false,
|
|
15358
|
+
capture_pageview: false,
|
|
15359
|
+
disable_session_recording: true,
|
|
15360
|
+
...posthogOptions
|
|
15361
|
+
});
|
|
15362
|
+
ph = instance;
|
|
15363
|
+
return instance;
|
|
15364
|
+
});
|
|
15365
|
+
}
|
|
15366
|
+
return loading;
|
|
15367
|
+
}
|
|
15368
|
+
return {
|
|
15369
|
+
name,
|
|
15370
|
+
consentCategories,
|
|
15371
|
+
async init(_ctx) {
|
|
15372
|
+
await ensure();
|
|
15373
|
+
},
|
|
15374
|
+
async deliver(batch) {
|
|
15375
|
+
if (batch.length === 0) return;
|
|
15376
|
+
const client = await ensure();
|
|
15377
|
+
for (const ev of batch) {
|
|
15378
|
+
const did = distinctId(ev);
|
|
15379
|
+
switch (ev.type) {
|
|
15380
|
+
case "identify":
|
|
15381
|
+
client.identify(did, { ...ev.traits ?? {} });
|
|
15382
|
+
break;
|
|
15383
|
+
case "alias":
|
|
15384
|
+
if (ev.previousId) client.alias(ev.previousId, did);
|
|
15385
|
+
break;
|
|
15386
|
+
case "group":
|
|
15387
|
+
client.group(
|
|
15388
|
+
ev.properties?.groupType ?? "company",
|
|
15389
|
+
ev.groupId ?? "",
|
|
15390
|
+
{ ...ev.traits ?? {} }
|
|
15391
|
+
);
|
|
15392
|
+
break;
|
|
15393
|
+
case "page":
|
|
15394
|
+
client.capture("$pageview", { ...ev.properties ?? {} });
|
|
15395
|
+
break;
|
|
15396
|
+
case "screen":
|
|
15397
|
+
client.capture("$screen", {
|
|
15398
|
+
$screen_name: ev.event,
|
|
15399
|
+
...ev.properties ?? {}
|
|
15400
|
+
});
|
|
15401
|
+
break;
|
|
15402
|
+
case "track":
|
|
15403
|
+
default:
|
|
15404
|
+
client.capture(ev.event ?? "track", { ...ev.properties ?? {} });
|
|
15405
|
+
break;
|
|
15406
|
+
}
|
|
15407
|
+
}
|
|
15408
|
+
},
|
|
15409
|
+
shutdown() {
|
|
15410
|
+
ph?.reset();
|
|
15411
|
+
}
|
|
15412
|
+
};
|
|
15413
|
+
}
|
|
15414
|
+
function createPostHogSink(options) {
|
|
15415
|
+
if (options.mode === "client-sdk") {
|
|
15416
|
+
return createPostHogClientSdkSink(options);
|
|
15417
|
+
}
|
|
15418
|
+
return createPostHogHttpSink(options);
|
|
15419
|
+
}
|
|
15420
|
+
|
|
15421
|
+
// ../analytics-sink-posthog/dist/replay.js
|
|
15422
|
+
async function defaultLoad2() {
|
|
15423
|
+
const mod = await import('./module-XHEQRMQB.js');
|
|
15424
|
+
return "default" in mod ? mod.default : mod;
|
|
15425
|
+
}
|
|
15426
|
+
async function startSessionReplay(options) {
|
|
15427
|
+
const {
|
|
15428
|
+
apiKey,
|
|
15429
|
+
host = "https://us.i.posthog.com",
|
|
15430
|
+
hasConsent,
|
|
15431
|
+
maskAllText = true,
|
|
15432
|
+
maskAllInputs = true,
|
|
15433
|
+
recordingOptions = {}
|
|
15434
|
+
} = options;
|
|
15435
|
+
const consented = () => typeof hasConsent === "function" ? hasConsent() === true : false;
|
|
15436
|
+
const slot = {};
|
|
15437
|
+
let recording = false;
|
|
15438
|
+
const stop = () => {
|
|
15439
|
+
if (slot.ph && recording) {
|
|
15440
|
+
slot.ph.stopSessionRecording();
|
|
15441
|
+
}
|
|
15442
|
+
recording = false;
|
|
15443
|
+
};
|
|
15444
|
+
const handle = {
|
|
15445
|
+
get recording() {
|
|
15446
|
+
return recording;
|
|
15447
|
+
},
|
|
15448
|
+
enforceConsent() {
|
|
15449
|
+
if (!consented()) stop();
|
|
15450
|
+
},
|
|
15451
|
+
stop
|
|
15452
|
+
};
|
|
15453
|
+
if (!consented()) return handle;
|
|
15454
|
+
const load = options.loadPostHog ? async () => {
|
|
15455
|
+
const m = await options.loadPostHog();
|
|
15456
|
+
return "default" in m ? m.default : m;
|
|
15457
|
+
} : defaultLoad2;
|
|
15458
|
+
slot.ph = await load();
|
|
15459
|
+
slot.ph.init(apiKey, {
|
|
15460
|
+
api_host: host,
|
|
15461
|
+
autocapture: false,
|
|
15462
|
+
capture_pageview: false,
|
|
15463
|
+
// Start with replay disabled, then opt in explicitly below.
|
|
15464
|
+
disable_session_recording: true,
|
|
15465
|
+
session_recording: {
|
|
15466
|
+
maskAllInputs,
|
|
15467
|
+
maskTextSelector: maskAllText ? "*" : void 0,
|
|
15468
|
+
...recordingOptions
|
|
15469
|
+
}
|
|
15470
|
+
});
|
|
15471
|
+
if (!consented()) return handle;
|
|
15472
|
+
slot.ph.startSessionRecording();
|
|
15473
|
+
recording = slot.ph.sessionRecordingStarted?.() ?? true;
|
|
15474
|
+
return handle;
|
|
15475
|
+
}
|
|
15476
|
+
|
|
14596
15477
|
// ../react-analytics/dist/index.js
|
|
14597
15478
|
var AnalyticsContext = React11.createContext(null);
|
|
14598
15479
|
function AnalyticsProvider({ children, value }) {
|
|
@@ -14629,6 +15510,6 @@ function useTrackEvent(options) {
|
|
|
14629
15510
|
);
|
|
14630
15511
|
}
|
|
14631
15512
|
|
|
14632
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AltHintState, AnalyticsProvider, AnimatedText, AppShell, AuthGuard, AuthProvider, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, BadgeDisplay, BottomNav, Breadcrumbs, Button, CATEGORY_LABELS, Calendar, CalendarHeader, Callout, CalloutContent, CalloutDescription, CalloutIcon, CalloutTitle, Card, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselTrigger, Checkbox, CodeBlock, CodeBlockContent, CodeBlockHeader, CodeEditor, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, ContentProtection, DEFAULT_VOICE_PILL_POSITION, DEFAULT_VOICE_PILL_SPEAKER, DEFAULT_WAVEFORM_BAR_COUNT, DEFAULT_WAVEFORM_COLOR, DEFAULT_WAVEFORM_HEIGHT, DEFAULT_WAVEFORM_INTENSITY, DEFAULT_WAVEFORM_SMOOTHING, DataTable, DatePicker, DeviceFrame, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EMOJI_CATEGORIES, EMOJI_DATA, EmojiPicker, FeedbackButton, FeedbackDialog, FileTree, FileUpload, Footer, IconSystem, InlineEditor, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InstallPrompt, KeyboardShortcut, LanguageSelector, LinkCard, MarkdownRenderer, MobileNav, MobileNavContent, MobileNavLink, MobileNavTrigger, Navbar, OtpInput, STATUS_COLORS as PRESENCE_STATUS_COLORS, STATUS_LABELS as PRESENCE_STATUS_LABELS, Pagination, Payment, Popover, PopoverClose, PopoverContent, PopoverTrigger, PresenceIndicator, ProgressBar, RadioGroup, RadioItem, ReactionBar, ResizableDivider, ResizableLayout, ResizablePane, SANE_DEFAULTS, STATUS_INDICATOR_COLORS as STATUS_COLORS, STATUS_INDICATOR_LABELS as STATUS_LABELS, SearchBar, SearchResultItem, SearchResults, Select, SelectContent, SelectItem, SelectTrigger, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetTitle, SheetTrigger, ShortcutBadge, ShortcutContext, ShortcutHint, ShortcutProvider, ShortcutRegistry, Sidebar, Skeleton, SkeletonText, SkipToContent, SlideViewer, StatsGrid, StatusIndicator, Step, StepContent, StepDescription, StepIndicator, StepTitle, Steps, Switch, TableOfContents, Tabs, TabsContent, TabsList, TabsTrigger, TelemetryErrorBoundary, TelemetryProvider, Textarea, ThreadView, Toast, ToastProvider, Toaster, Tooltip, TooltipContent, TooltipTrigger, TypewriterText, VersionSelector, VideoPlayer, VoicePill, Waveform, altHintState, animatedTextVariants, avatarFallbackVariants, avatarImageVariants, avatarTokens, avatarVariants, badgeGridVariants, badgeItemVariants, badgeVariants, bottomNavTabVariants, bottomNavVariants, breadcrumbItemVariants, breadcrumbSeparatorStyles, breadcrumbsVariants, buttonTokens, buttonVariants, calendarVariants, canAccessAdmin, canAccessReviewer, cardContentVariants, cardDescriptionVariants, cardFooterVariants, cardHeaderVariants, cardTitleVariants, cardTokens, cardVariants, cellVariants, checkIconPath, checkboxTokens, checkboxVariants, clampVoicePillIntensity, codeEditorTokens, codeEditorVariants, collapsibleContentVariants, comboboxContentVariants, comboboxEmptyVariants, comboboxInputVariants, comboboxItemVariants, comboboxListVariants, comboboxTriggerVariants, commandGroupVariants, commandInputVariants, commandItemVariants, commandVariants, contentProtectionVariants, controlsVariants, createAnalytics, createIntensitySamples, createSilentSamples, createVoicePill, createWaveform, dayVariants, deviceFrameVariants, dialogContentVariants, drawWaveform, editorVariants, emojiPickerContainerStyles, emojiPickerEmojiButtonStyles, emojiPickerGridStyles, feedbackDialogVariants, fileUploadDropZoneVariants, fileUploadFileItemStyles, fileUploadFileListStyles, footerVariants, formatFileSize, formatRelativeTime, formatShortcut, formatTimestamp, getAssignableRoles, getDefaultPortal, getInitials, getVoicePillAriaLabel, getVoicePillInitials, getVoicePillPosition, getVoicePillPulseStyle, getVoicePillSpeakerKey, getVoicePillSpeakerLabel, getWaveformPeak, globalShortcutRegistry, hasAllRoles, hasAnyRole, hasRole, headerVariants, indeterminateIconPath, inputGroupAddonVariants, inputGroupButtonVariants, inputGroupTokens, inputGroupVariants, inputVariants, installPromptVariants, isWaveformSampleInput, latestBadgeVariants, markdownRendererTokens, menuContentVariants, menuItemVariants, mobileNavContentVariants, mobileNavLinkVariants, mobileNavTokens, mobileNavTriggerVariants, mobileNavVariants, navLinkVariants, navbarVariants, normalizeBarCount, normalizeIntensity, normalizeSmoothing, normalizeWaveformConfig, normalizeWaveformSamples, optionVariants, otpInputContainerVariants, otpInputSlotVariants, otpInputTokens, overlayStyles, overlayVariants, playerVariants, popoverContentVariants, prepareWaveformCanvas, previewVariants, progressBarVariants, proseVariants, radioCircleVariants, radioGroupVariants, radioItemVariants, reactionAddButtonStyles, reactionBarStyles, reactionCountStyles, reactionEmojiStyles, reactionPillVariants, resampleWaveformSamples, resizableDividerVariants, resizableLayoutTokens, resizableLayoutVariants, resizablePaneVariants, rowVariants, scaleWaveformSamples, searchBarVariants, searchResultVariants, selectContentVariants, selectItemVariants, selectTokens, selectTriggerVariants, selectorVariants, sheetContentVariants, sheetOverlayStyles, shortcutBadgeStyles, shortcutKeyStyles, shortcutSeparatorStyles, sidebarItemVariants, sidebarVariants, skeletonVariants, slideTypeBadgeVariants, slideViewerProgressBarVariants, slideViewerTokens, slideViewerVariants, smoothWaveformSamples, statCardVariants, statsGridVariants, statusContainerStyles, statusDotVariants, statusLabelStyles, statusPulseVariants, switchThumbVariants, switchTokens, switchVariants, tableVariants, tabsListVariants, tabsTriggerVariants, textareaVariants, threadAuthorStyles, threadAvatarStyles, threadBodyStyles, threadContainerStyles, threadContentStyles, threadMessageStyles, threadReactionsStyles, threadTimestampStyles, toCssDimension, toastVariants, toolbarVariants, tooltipContentVariants, typewriterVariants, useAnalytics, useAuth, useLogger, useShortcut, useSpan, useTelemetry, useToast, useTrackEvent, versionSelectorOptionVariants, versionSelectorVariants, voicePillAvatarStyles, voicePillAvatarWrapStyles, voicePillLabelStyles, voicePillMuteButtonStyles, voicePillPositionVariants, voicePillPulseRingStyles, voicePillRootStyles, voicePillSpeakerStyles, voicePillSubStyles, voicePillTextStyles, voicePillTokens, watermarkVariants, waveformCanvasVariants, waveformVariants };
|
|
15513
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AltHintState, AnalyticsProvider, AnimatedText, AppShell, AuthGuard, AuthProvider, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, BadgeDisplay, BottomNav, Breadcrumbs, Button, CATEGORY_LABELS, Calendar, CalendarHeader, Callout, CalloutContent, CalloutDescription, CalloutIcon, CalloutTitle, Card, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselTrigger, Checkbox, CodeBlock, CodeBlockContent, CodeBlockHeader, CodeEditor, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, ContentProtection, DEFAULT_VOICE_PILL_POSITION, DEFAULT_VOICE_PILL_SPEAKER, DEFAULT_WAVEFORM_BAR_COUNT, DEFAULT_WAVEFORM_COLOR, DEFAULT_WAVEFORM_HEIGHT, DEFAULT_WAVEFORM_INTENSITY, DEFAULT_WAVEFORM_SMOOTHING, DataTable, DatePicker, DeviceFrame, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EMOJI_CATEGORIES, EMOJI_DATA, EmojiPicker, FeedbackButton, FeedbackDialog, FileTree, FileUpload, Footer, IconSystem, InlineEditor, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InstallPrompt, KeyboardShortcut, LanguageSelector, LinkCard, MarkdownRenderer, MobileNav, MobileNavContent, MobileNavLink, MobileNavTrigger, Navbar, OtpInput, STATUS_COLORS as PRESENCE_STATUS_COLORS, STATUS_LABELS as PRESENCE_STATUS_LABELS, Pagination, Payment, Popover, PopoverClose, PopoverContent, PopoverTrigger, PresenceIndicator, ProgressBar, RadioGroup, RadioItem, ReactionBar, ResizableDivider, ResizableLayout, ResizablePane, SANE_DEFAULTS, STATUS_INDICATOR_COLORS as STATUS_COLORS, STATUS_INDICATOR_LABELS as STATUS_LABELS, SearchBar, SearchResultItem, SearchResults, Select, SelectContent, SelectItem, SelectTrigger, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetTitle, SheetTrigger, ShortcutBadge, ShortcutContext, ShortcutHint, ShortcutProvider, ShortcutRegistry, Sidebar, Skeleton, SkeletonText, SkipToContent, SlideViewer, StatsGrid, StatusIndicator, Step, StepContent, StepDescription, StepIndicator, StepTitle, Steps, Switch, TableOfContents, Tabs, TabsContent, TabsList, TabsTrigger, TelemetryErrorBoundary, TelemetryProvider, Textarea, ThreadView, Toast, ToastProvider, Toaster, Tooltip, TooltipContent, TooltipTrigger, TypewriterText, VersionSelector, VideoPlayer, VoicePill, Waveform, altHintState, animatedTextVariants, avatarFallbackVariants, avatarImageVariants, avatarTokens, avatarVariants, badgeGridVariants, badgeItemVariants, badgeVariants, bottomNavTabVariants, bottomNavVariants, breadcrumbItemVariants, breadcrumbSeparatorStyles, breadcrumbsVariants, buttonTokens, buttonVariants, calendarVariants, canAccessAdmin, canAccessReviewer, cardContentVariants, cardDescriptionVariants, cardFooterVariants, cardHeaderVariants, cardTitleVariants, cardTokens, cardVariants, cellVariants, checkIconPath, checkboxTokens, checkboxVariants, clampVoicePillIntensity, codeEditorTokens, codeEditorVariants, collapsibleContentVariants, comboboxContentVariants, comboboxEmptyVariants, comboboxInputVariants, comboboxItemVariants, comboboxListVariants, comboboxTriggerVariants, commandGroupVariants, commandInputVariants, commandItemVariants, commandVariants, contentProtectionVariants, controlsVariants, createAnalytics, createAppInsightsSink, createConsoleSink, createGA4ClientSdkSink, createGA4HttpSink, createGA4Sink, createIntensitySamples, createPostHogClientSdkSink, createPostHogHttpSink, createPostHogSink, createSilentSamples, createTelemetry, createVoicePill, createWaveform, dayVariants, deviceFrameVariants, dialogContentVariants, drawWaveform, editorVariants, emojiPickerContainerStyles, emojiPickerEmojiButtonStyles, emojiPickerGridStyles, feedbackDialogVariants, fileUploadDropZoneVariants, fileUploadFileItemStyles, fileUploadFileListStyles, footerVariants, formatFileSize, formatRelativeTime, formatShortcut, formatTimestamp, getAssignableRoles, getDefaultPortal, getInitials, getVoicePillAriaLabel, getVoicePillInitials, getVoicePillPosition, getVoicePillPulseStyle, getVoicePillSpeakerKey, getVoicePillSpeakerLabel, getWaveformPeak, globalShortcutRegistry, hasAllRoles, hasAnyRole, hasRole, headerVariants, indeterminateIconPath, inputGroupAddonVariants, inputGroupButtonVariants, inputGroupTokens, inputGroupVariants, inputVariants, installPromptVariants, isWaveformSampleInput, latestBadgeVariants, markdownRendererTokens, menuContentVariants, menuItemVariants, mobileNavContentVariants, mobileNavLinkVariants, mobileNavTokens, mobileNavTriggerVariants, mobileNavVariants, navLinkVariants, navbarVariants, normalizeBarCount, normalizeIntensity, normalizeSmoothing, normalizeWaveformConfig, normalizeWaveformSamples, optionVariants, otpInputContainerVariants, otpInputSlotVariants, otpInputTokens, overlayStyles, overlayVariants, playerVariants, popoverContentVariants, prepareWaveformCanvas, previewVariants, progressBarVariants, proseVariants, radioCircleVariants, radioGroupVariants, radioItemVariants, reactionAddButtonStyles, reactionBarStyles, reactionCountStyles, reactionEmojiStyles, reactionPillVariants, resampleWaveformSamples, resizableDividerVariants, resizableLayoutTokens, resizableLayoutVariants, resizablePaneVariants, rowVariants, scaleWaveformSamples, searchBarVariants, searchResultVariants, selectContentVariants, selectItemVariants, selectTokens, selectTriggerVariants, selectorVariants, sheetContentVariants, sheetOverlayStyles, shortcutBadgeStyles, shortcutKeyStyles, shortcutSeparatorStyles, sidebarItemVariants, sidebarVariants, skeletonVariants, slideTypeBadgeVariants, slideViewerProgressBarVariants, slideViewerTokens, slideViewerVariants, smoothWaveformSamples, startSessionReplay, statCardVariants, statsGridVariants, statusContainerStyles, statusDotVariants, statusLabelStyles, statusPulseVariants, switchThumbVariants, switchTokens, switchVariants, tableVariants, tabsListVariants, tabsTriggerVariants, textareaVariants, threadAuthorStyles, threadAvatarStyles, threadBodyStyles, threadContainerStyles, threadContentStyles, threadMessageStyles, threadReactionsStyles, threadTimestampStyles, toCssDimension, toastVariants, toolbarVariants, tooltipContentVariants, typewriterVariants, useAnalytics, useAuth, useLogger, useShortcut, useSpan, useTelemetry, useToast, useTrackEvent, versionSelectorOptionVariants, versionSelectorVariants, voicePillAvatarStyles, voicePillAvatarWrapStyles, voicePillLabelStyles, voicePillMuteButtonStyles, voicePillPositionVariants, voicePillPulseRingStyles, voicePillRootStyles, voicePillSpeakerStyles, voicePillSubStyles, voicePillTextStyles, voicePillTokens, watermarkVariants, waveformCanvasVariants, waveformVariants };
|
|
14633
15514
|
//# sourceMappingURL=index.js.map
|
|
14634
15515
|
//# sourceMappingURL=index.js.map
|