@aranova/tracking-react 0.21.0 → 0.22.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/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +59 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{phone-utils-B2vHJkNz.d.mts → phone-utils-BhWfNuPS.d.mts} +8 -0
- package/dist/{phone-utils-B2vHJkNz.d.ts → phone-utils-BhWfNuPS.d.ts} +8 -0
- package/dist/phone.d.mts +1 -1
- package/dist/phone.d.ts +1 -1
- package/dist/sales.d.mts +1 -1
- package/dist/sales.d.ts +1 -1
- package/dist/sales.js +7 -0
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +7 -0
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/{sales-CBQJ2SBT.d.mts → sales-BhCYJqDy.d.mts} +4 -4
- package/dist/{sales-CBQJ2SBT.d.ts → sales-BhCYJqDy.d.ts} +4 -4
package/dist/index.mjs
CHANGED
|
@@ -250,6 +250,43 @@ function resetConsent() {
|
|
|
250
250
|
notifyConsentChanged(DEFAULT_CHOICE);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
// ../tracking-core/src/capabilities.ts
|
|
254
|
+
var TRACKING_CAPABILITIES = [
|
|
255
|
+
"ad_tags_google",
|
|
256
|
+
"ad_tags_meta",
|
|
257
|
+
"base_tracking",
|
|
258
|
+
"blog_rendering",
|
|
259
|
+
"calendar_read",
|
|
260
|
+
"calendar_write",
|
|
261
|
+
"consent_controls",
|
|
262
|
+
"conversion_goals_auto",
|
|
263
|
+
"conversion_goals_manual",
|
|
264
|
+
"cta_click_capture",
|
|
265
|
+
"form_capture",
|
|
266
|
+
"phone_click_capture",
|
|
267
|
+
"phone_fields"
|
|
268
|
+
];
|
|
269
|
+
var CAPABILITY_DOM_ATTRIBUTE = "data-aranova-capability";
|
|
270
|
+
var registered = /* @__PURE__ */ new Set();
|
|
271
|
+
function registerCapability(capability) {
|
|
272
|
+
registered.add(capability);
|
|
273
|
+
}
|
|
274
|
+
function getRegisteredCapabilities() {
|
|
275
|
+
const all = new Set(registered);
|
|
276
|
+
for (const marker of readDomMarkers()) all.add(marker);
|
|
277
|
+
return Array.from(all).sort();
|
|
278
|
+
}
|
|
279
|
+
function readDomMarkers() {
|
|
280
|
+
if (typeof document === "undefined") return [];
|
|
281
|
+
const known = new Set(TRACKING_CAPABILITIES);
|
|
282
|
+
const found = [];
|
|
283
|
+
for (const node of document.querySelectorAll(`[${CAPABILITY_DOM_ATTRIBUTE}]`)) {
|
|
284
|
+
const value = node.getAttribute(CAPABILITY_DOM_ATTRIBUTE);
|
|
285
|
+
if (value && known.has(value)) found.push(value);
|
|
286
|
+
}
|
|
287
|
+
return found;
|
|
288
|
+
}
|
|
289
|
+
|
|
253
290
|
// ../tracking-core/src/tracking.ts
|
|
254
291
|
var TRACKING_COOKIE_MAX_AGE_SECONDS = 7776e3;
|
|
255
292
|
var TRACKING_PARAM_KEYS = [
|
|
@@ -623,7 +660,8 @@ function createTrackingClientContext(surface, input = {}) {
|
|
|
623
660
|
page_title: input.pageTitle ?? (typeof document === "undefined" ? null : document.title || null),
|
|
624
661
|
referrer: input.referrer ?? (typeof document === "undefined" ? null : document.referrer || null),
|
|
625
662
|
environment: input.environment ?? "production",
|
|
626
|
-
active_gtag_ids: input.activeGtagIds ?? null
|
|
663
|
+
active_gtag_ids: input.activeGtagIds ?? null,
|
|
664
|
+
capabilities: getRegisteredCapabilities()
|
|
627
665
|
};
|
|
628
666
|
}
|
|
629
667
|
function createTrackingSessionUpsertPayload(trackingParams, input, context) {
|
|
@@ -1655,7 +1693,10 @@ function buildContext(surface, sdkVersion, packageName, environment, activeGtagI
|
|
|
1655
1693
|
page_title: typeof document === "undefined" ? null : document.title || null,
|
|
1656
1694
|
referrer: typeof document === "undefined" ? null : document.referrer || null,
|
|
1657
1695
|
environment,
|
|
1658
|
-
active_gtag_ids: activeGtagIds
|
|
1696
|
+
active_gtag_ids: activeGtagIds,
|
|
1697
|
+
// Rebuilt per flush (this runs inside the payload builder), so a client
|
|
1698
|
+
// constructed later on a deeper route still gets reported.
|
|
1699
|
+
capabilities: getRegisteredCapabilities()
|
|
1659
1700
|
};
|
|
1660
1701
|
}
|
|
1661
1702
|
function readTrackingParams() {
|
|
@@ -2248,8 +2289,9 @@ function getEventDefinition(name) {
|
|
|
2248
2289
|
}
|
|
2249
2290
|
|
|
2250
2291
|
// ../tracking-core/src/ingest-typed.ts
|
|
2251
|
-
function createTypedClient(raw,
|
|
2292
|
+
function createTypedClient(raw, registry, options = {}) {
|
|
2252
2293
|
const debug = options.debug ?? false;
|
|
2294
|
+
if (registry.manual?.form_submit) registerCapability("form_capture");
|
|
2253
2295
|
return {
|
|
2254
2296
|
trackEvent(eventType, metadata, opts) {
|
|
2255
2297
|
if (debug) {
|
|
@@ -2791,6 +2833,7 @@ function attachCtaClickCapture(client, config) {
|
|
|
2791
2833
|
return () => {
|
|
2792
2834
|
};
|
|
2793
2835
|
}
|
|
2836
|
+
registerCapability("cta_click_capture");
|
|
2794
2837
|
const selector = autoCapture.selector ?? DEFAULT_CTA_SELECTOR;
|
|
2795
2838
|
function onClick(event) {
|
|
2796
2839
|
const target = event.target;
|
|
@@ -2847,6 +2890,7 @@ function attachPhoneClickCapture(client, config) {
|
|
|
2847
2890
|
return () => {
|
|
2848
2891
|
};
|
|
2849
2892
|
}
|
|
2893
|
+
registerCapability("phone_click_capture");
|
|
2850
2894
|
const selector = autoCapture.selector ?? DEFAULT_TEL_SELECTOR;
|
|
2851
2895
|
function onClick(event) {
|
|
2852
2896
|
const target = event.target;
|
|
@@ -2963,6 +3007,7 @@ function fireRecordedConversions(firing, input, recorded, sale, currency) {
|
|
|
2963
3007
|
}
|
|
2964
3008
|
}
|
|
2965
3009
|
function createSalesClient(config) {
|
|
3010
|
+
if (config.firing) registerCapability("conversion_goals_manual");
|
|
2966
3011
|
async function record(input) {
|
|
2967
3012
|
const currency = input.currency ?? config.defaultCurrency;
|
|
2968
3013
|
if (!currency) {
|
|
@@ -3258,6 +3303,7 @@ var DEFAULT_CHOICE2 = {
|
|
|
3258
3303
|
expiresAt: null
|
|
3259
3304
|
};
|
|
3260
3305
|
function useCookiePreferences(options) {
|
|
3306
|
+
registerCapability("consent_controls");
|
|
3261
3307
|
const [choice, setChoice] = useState(DEFAULT_CHOICE2);
|
|
3262
3308
|
const ttlDays = options?.declineTtlDays;
|
|
3263
3309
|
useEffect(() => {
|
|
@@ -3520,6 +3566,12 @@ function AdPlatformTracking({
|
|
|
3520
3566
|
() => metaPixelIds ? JSON.stringify(metaPixelIds) : "",
|
|
3521
3567
|
[metaPixelIds]
|
|
3522
3568
|
);
|
|
3569
|
+
if (trackingConfig || gtagId || gtagIds && Object.keys(gtagIds).length > 0) {
|
|
3570
|
+
registerCapability("ad_tags_google");
|
|
3571
|
+
}
|
|
3572
|
+
if (metaPixelId || metaPixelIds && Object.keys(metaPixelIds).length > 0) {
|
|
3573
|
+
registerCapability("ad_tags_meta");
|
|
3574
|
+
}
|
|
3523
3575
|
useEffect3(() => {
|
|
3524
3576
|
if (trackingConfig) {
|
|
3525
3577
|
const runtime = getTrackingConfigRuntime(trackingConfig);
|
|
@@ -3560,7 +3612,7 @@ function GoogleAdsTracking(props) {
|
|
|
3560
3612
|
import { createContext as createContext2, useContext as useContext2, useEffect as useEffect5, useMemo as useMemo4 } from "react";
|
|
3561
3613
|
|
|
3562
3614
|
// package.json
|
|
3563
|
-
var version = "0.
|
|
3615
|
+
var version = "0.22.0";
|
|
3564
3616
|
|
|
3565
3617
|
// ../tracking-core/src/phone-react.tsx
|
|
3566
3618
|
import {
|
|
@@ -3591,6 +3643,7 @@ function usePhoneConfig() {
|
|
|
3591
3643
|
};
|
|
3592
3644
|
}
|
|
3593
3645
|
function usePhoneField(opts = {}) {
|
|
3646
|
+
registerCapability("phone_fields");
|
|
3594
3647
|
const cfg = usePhoneConfig();
|
|
3595
3648
|
const country = opts.country ?? cfg.defaultCountry;
|
|
3596
3649
|
const display = opts.display ?? cfg.display;
|
|
@@ -3676,6 +3729,8 @@ function createTracking(options) {
|
|
|
3676
3729
|
conversionConfig,
|
|
3677
3730
|
trackingConfig
|
|
3678
3731
|
} = options;
|
|
3732
|
+
registerCapability("base_tracking");
|
|
3733
|
+
if (trackingConfig) registerCapability("conversion_goals_auto");
|
|
3679
3734
|
if (!apiKey || !endpoint) {
|
|
3680
3735
|
if (apiKey || endpoint) {
|
|
3681
3736
|
console.warn(
|