@aranova/tracking-react 0.20.2 → 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 +81 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -21
- 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-DrH6dY5F.d.mts → sales-BhCYJqDy.d.mts} +25 -23
- package/dist/{sales-DrH6dY5F.d.ts → sales-BhCYJqDy.d.ts} +25 -23
- package/dist/sales.d.mts +1 -1
- package/dist/sales.d.ts +1 -1
- package/dist/sales.js +29 -17
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +29 -17
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent } from 'react';
|
|
3
|
-
import { T as TrackingParams, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload, F as FormSubmitConfig, f as FormSubmitMetadata, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, C as ConsentState, g as ConsentChoiceState, h as ConsentSource, P as PhoneConfig, i as ParsedPhone, j as PhoneDisplayFormat } from './phone-utils-
|
|
4
|
-
export { k as ConsentChoice, D as DEFAULT_DECLINE_TTL_DAYS, l as DEFAULT_PHONE_COUNTRY, J as JsonValue, S as SetConsentOptions, m as TrackedField, n as TrackingInitConfig, o as formSubmitConfigSchema, p as formSubmitMetadataSchema, q as formatPhone, r as formatPhoneAsTyped, s as getConsentChoice, t as getConsentState, u as jsonValueSchema, v as onConsentChange, w as optIn, x as optOut, y as parsePhone, z as phoneField, A as resetConsent, B as setConsentState, E as toE164 } from './phone-utils-
|
|
5
|
-
import { T as TrackingConfigReference, C as ConversionConfig } from './sales-
|
|
6
|
-
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as ConversionUserData, f as CurrencyRevenue, g as CustomerCurrencyDelta, h as CustomerCurrencyTotal, i as CustomerGetOptions, j as CustomerGetResult, k as CustomerKpis, l as CustomerKpisDeltas, m as CustomerKpisPrevious, n as CustomerListPage, o as CustomerListQuery, p as CustomerProfile, q as CustomerSegment, r as CustomerSegmentCount, s as CustomerSortField, t as CustomerSummary, u as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, v as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, w as Sale, x as SaleCursorPage, y as SaleFilters, z as SaleInput, E as SaleItem, F as SaleItemInput, H as SaleKeysetSortField, I as SaleListPage, J as SaleListQuery, K as SaleListQueryV2, L as SaleService, M as SaleServiceInput, O as SaleSortField, Q as SaleSortOrder, R as SaleSummary, U as SaleSummaryPrevious, V as SaleSummaryQuery, W as SaleSummaryQueryV2, X as SaleSummaryV2, Y as SaleUpdateInput, Z as SalesBusinessClient, _ as SalesCategoryBreakdown, $ as SalesClient, a0 as SalesClientConfig, a1 as SalesCustomersClient, a2 as SalesServiceBreakdown, a3 as SalesTransportConfig, a4 as SalesTrendPoint, a5 as SummaryCurrencyDelta, a6 as SummaryDeltas, a7 as SummaryWindow, a8 as SupportedCurrency, a9 as TRACKING_RANGES, aa as TrackingOverviewRange, ab as clearStashedUserData, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, ah as getTrackingConfigRuntime, ai as resolveConversionConfig, aj as saleCreateSchema, ak as saleItemSchema, al as saleServiceSchema, am as saleUpdateSchema, an as salesRequest, ao as stashUserData, ap as toMinor } from './sales-
|
|
3
|
+
import { T as TrackingParams, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload, F as FormSubmitConfig, f as FormSubmitMetadata, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, C as ConsentState, g as ConsentChoiceState, h as ConsentSource, P as PhoneConfig, i as ParsedPhone, j as PhoneDisplayFormat } from './phone-utils-BhWfNuPS.mjs';
|
|
4
|
+
export { k as ConsentChoice, D as DEFAULT_DECLINE_TTL_DAYS, l as DEFAULT_PHONE_COUNTRY, J as JsonValue, S as SetConsentOptions, m as TrackedField, n as TrackingInitConfig, o as formSubmitConfigSchema, p as formSubmitMetadataSchema, q as formatPhone, r as formatPhoneAsTyped, s as getConsentChoice, t as getConsentState, u as jsonValueSchema, v as onConsentChange, w as optIn, x as optOut, y as parsePhone, z as phoneField, A as resetConsent, B as setConsentState, E as toE164 } from './phone-utils-BhWfNuPS.mjs';
|
|
5
|
+
import { T as TrackingConfigReference, C as ConversionConfig } from './sales-BhCYJqDy.mjs';
|
|
6
|
+
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as ConversionUserData, f as CurrencyRevenue, g as CustomerCurrencyDelta, h as CustomerCurrencyTotal, i as CustomerGetOptions, j as CustomerGetResult, k as CustomerKpis, l as CustomerKpisDeltas, m as CustomerKpisPrevious, n as CustomerListPage, o as CustomerListQuery, p as CustomerProfile, q as CustomerSegment, r as CustomerSegmentCount, s as CustomerSortField, t as CustomerSummary, u as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, v as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, w as Sale, x as SaleCursorPage, y as SaleFilters, z as SaleInput, E as SaleItem, F as SaleItemInput, H as SaleKeysetSortField, I as SaleListPage, J as SaleListQuery, K as SaleListQueryV2, L as SaleService, M as SaleServiceInput, O as SaleSortField, Q as SaleSortOrder, R as SaleSummary, U as SaleSummaryPrevious, V as SaleSummaryQuery, W as SaleSummaryQueryV2, X as SaleSummaryV2, Y as SaleUpdateInput, Z as SalesBusinessClient, _ as SalesCategoryBreakdown, $ as SalesClient, a0 as SalesClientConfig, a1 as SalesCustomersClient, a2 as SalesServiceBreakdown, a3 as SalesTransportConfig, a4 as SalesTrendPoint, a5 as SummaryCurrencyDelta, a6 as SummaryDeltas, a7 as SummaryWindow, a8 as SupportedCurrency, a9 as TRACKING_RANGES, aa as TrackingOverviewRange, ab as clearStashedUserData, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, ah as getTrackingConfigRuntime, ai as resolveConversionConfig, aj as saleCreateSchema, ak as saleItemSchema, al as saleServiceSchema, am as saleUpdateSchema, an as salesRequest, ao as stashUserData, ap as toMinor } from './sales-BhCYJqDy.mjs';
|
|
7
7
|
import * as src from 'src';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { CountryCode } from 'libphonenumber-js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent } from 'react';
|
|
3
|
-
import { T as TrackingParams, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload, F as FormSubmitConfig, f as FormSubmitMetadata, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, C as ConsentState, g as ConsentChoiceState, h as ConsentSource, P as PhoneConfig, i as ParsedPhone, j as PhoneDisplayFormat } from './phone-utils-
|
|
4
|
-
export { k as ConsentChoice, D as DEFAULT_DECLINE_TTL_DAYS, l as DEFAULT_PHONE_COUNTRY, J as JsonValue, S as SetConsentOptions, m as TrackedField, n as TrackingInitConfig, o as formSubmitConfigSchema, p as formSubmitMetadataSchema, q as formatPhone, r as formatPhoneAsTyped, s as getConsentChoice, t as getConsentState, u as jsonValueSchema, v as onConsentChange, w as optIn, x as optOut, y as parsePhone, z as phoneField, A as resetConsent, B as setConsentState, E as toE164 } from './phone-utils-
|
|
5
|
-
import { T as TrackingConfigReference, C as ConversionConfig } from './sales-
|
|
6
|
-
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as ConversionUserData, f as CurrencyRevenue, g as CustomerCurrencyDelta, h as CustomerCurrencyTotal, i as CustomerGetOptions, j as CustomerGetResult, k as CustomerKpis, l as CustomerKpisDeltas, m as CustomerKpisPrevious, n as CustomerListPage, o as CustomerListQuery, p as CustomerProfile, q as CustomerSegment, r as CustomerSegmentCount, s as CustomerSortField, t as CustomerSummary, u as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, v as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, w as Sale, x as SaleCursorPage, y as SaleFilters, z as SaleInput, E as SaleItem, F as SaleItemInput, H as SaleKeysetSortField, I as SaleListPage, J as SaleListQuery, K as SaleListQueryV2, L as SaleService, M as SaleServiceInput, O as SaleSortField, Q as SaleSortOrder, R as SaleSummary, U as SaleSummaryPrevious, V as SaleSummaryQuery, W as SaleSummaryQueryV2, X as SaleSummaryV2, Y as SaleUpdateInput, Z as SalesBusinessClient, _ as SalesCategoryBreakdown, $ as SalesClient, a0 as SalesClientConfig, a1 as SalesCustomersClient, a2 as SalesServiceBreakdown, a3 as SalesTransportConfig, a4 as SalesTrendPoint, a5 as SummaryCurrencyDelta, a6 as SummaryDeltas, a7 as SummaryWindow, a8 as SupportedCurrency, a9 as TRACKING_RANGES, aa as TrackingOverviewRange, ab as clearStashedUserData, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, ah as getTrackingConfigRuntime, ai as resolveConversionConfig, aj as saleCreateSchema, ak as saleItemSchema, al as saleServiceSchema, am as saleUpdateSchema, an as salesRequest, ao as stashUserData, ap as toMinor } from './sales-
|
|
3
|
+
import { T as TrackingParams, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload, F as FormSubmitConfig, f as FormSubmitMetadata, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, C as ConsentState, g as ConsentChoiceState, h as ConsentSource, P as PhoneConfig, i as ParsedPhone, j as PhoneDisplayFormat } from './phone-utils-BhWfNuPS.js';
|
|
4
|
+
export { k as ConsentChoice, D as DEFAULT_DECLINE_TTL_DAYS, l as DEFAULT_PHONE_COUNTRY, J as JsonValue, S as SetConsentOptions, m as TrackedField, n as TrackingInitConfig, o as formSubmitConfigSchema, p as formSubmitMetadataSchema, q as formatPhone, r as formatPhoneAsTyped, s as getConsentChoice, t as getConsentState, u as jsonValueSchema, v as onConsentChange, w as optIn, x as optOut, y as parsePhone, z as phoneField, A as resetConsent, B as setConsentState, E as toE164 } from './phone-utils-BhWfNuPS.js';
|
|
5
|
+
import { T as TrackingConfigReference, C as ConversionConfig } from './sales-BhCYJqDy.js';
|
|
6
|
+
export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as ConversionUserData, f as CurrencyRevenue, g as CustomerCurrencyDelta, h as CustomerCurrencyTotal, i as CustomerGetOptions, j as CustomerGetResult, k as CustomerKpis, l as CustomerKpisDeltas, m as CustomerKpisPrevious, n as CustomerListPage, o as CustomerListQuery, p as CustomerProfile, q as CustomerSegment, r as CustomerSegmentCount, s as CustomerSortField, t as CustomerSummary, u as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, v as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, w as Sale, x as SaleCursorPage, y as SaleFilters, z as SaleInput, E as SaleItem, F as SaleItemInput, H as SaleKeysetSortField, I as SaleListPage, J as SaleListQuery, K as SaleListQueryV2, L as SaleService, M as SaleServiceInput, O as SaleSortField, Q as SaleSortOrder, R as SaleSummary, U as SaleSummaryPrevious, V as SaleSummaryQuery, W as SaleSummaryQueryV2, X as SaleSummaryV2, Y as SaleUpdateInput, Z as SalesBusinessClient, _ as SalesCategoryBreakdown, $ as SalesClient, a0 as SalesClientConfig, a1 as SalesCustomersClient, a2 as SalesServiceBreakdown, a3 as SalesTransportConfig, a4 as SalesTrendPoint, a5 as SummaryCurrencyDelta, a6 as SummaryDeltas, a7 as SummaryWindow, a8 as SupportedCurrency, a9 as TRACKING_RANGES, aa as TrackingOverviewRange, ab as clearStashedUserData, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, ah as getTrackingConfigRuntime, ai as resolveConversionConfig, aj as saleCreateSchema, ak as saleItemSchema, al as saleServiceSchema, am as saleUpdateSchema, an as salesRequest, ao as stashUserData, ap as toMinor } from './sales-BhCYJqDy.js';
|
|
7
7
|
import * as src from 'src';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { CountryCode } from 'libphonenumber-js';
|
package/dist/index.js
CHANGED
|
@@ -327,6 +327,43 @@ function resetConsent() {
|
|
|
327
327
|
notifyConsentChanged(DEFAULT_CHOICE);
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
// ../tracking-core/src/capabilities.ts
|
|
331
|
+
var TRACKING_CAPABILITIES = [
|
|
332
|
+
"ad_tags_google",
|
|
333
|
+
"ad_tags_meta",
|
|
334
|
+
"base_tracking",
|
|
335
|
+
"blog_rendering",
|
|
336
|
+
"calendar_read",
|
|
337
|
+
"calendar_write",
|
|
338
|
+
"consent_controls",
|
|
339
|
+
"conversion_goals_auto",
|
|
340
|
+
"conversion_goals_manual",
|
|
341
|
+
"cta_click_capture",
|
|
342
|
+
"form_capture",
|
|
343
|
+
"phone_click_capture",
|
|
344
|
+
"phone_fields"
|
|
345
|
+
];
|
|
346
|
+
var CAPABILITY_DOM_ATTRIBUTE = "data-aranova-capability";
|
|
347
|
+
var registered = /* @__PURE__ */ new Set();
|
|
348
|
+
function registerCapability(capability) {
|
|
349
|
+
registered.add(capability);
|
|
350
|
+
}
|
|
351
|
+
function getRegisteredCapabilities() {
|
|
352
|
+
const all = new Set(registered);
|
|
353
|
+
for (const marker of readDomMarkers()) all.add(marker);
|
|
354
|
+
return Array.from(all).sort();
|
|
355
|
+
}
|
|
356
|
+
function readDomMarkers() {
|
|
357
|
+
if (typeof document === "undefined") return [];
|
|
358
|
+
const known = new Set(TRACKING_CAPABILITIES);
|
|
359
|
+
const found = [];
|
|
360
|
+
for (const node of document.querySelectorAll(`[${CAPABILITY_DOM_ATTRIBUTE}]`)) {
|
|
361
|
+
const value = node.getAttribute(CAPABILITY_DOM_ATTRIBUTE);
|
|
362
|
+
if (value && known.has(value)) found.push(value);
|
|
363
|
+
}
|
|
364
|
+
return found;
|
|
365
|
+
}
|
|
366
|
+
|
|
330
367
|
// ../tracking-core/src/tracking.ts
|
|
331
368
|
var TRACKING_COOKIE_MAX_AGE_SECONDS = 7776e3;
|
|
332
369
|
var TRACKING_PARAM_KEYS = [
|
|
@@ -700,7 +737,8 @@ function createTrackingClientContext(surface, input = {}) {
|
|
|
700
737
|
page_title: input.pageTitle ?? (typeof document === "undefined" ? null : document.title || null),
|
|
701
738
|
referrer: input.referrer ?? (typeof document === "undefined" ? null : document.referrer || null),
|
|
702
739
|
environment: input.environment ?? "production",
|
|
703
|
-
active_gtag_ids: input.activeGtagIds ?? null
|
|
740
|
+
active_gtag_ids: input.activeGtagIds ?? null,
|
|
741
|
+
capabilities: getRegisteredCapabilities()
|
|
704
742
|
};
|
|
705
743
|
}
|
|
706
744
|
function createTrackingSessionUpsertPayload(trackingParams, input, context) {
|
|
@@ -1044,6 +1082,21 @@ function automaticThresholdMet(goal, eventType, metadata) {
|
|
|
1044
1082
|
}
|
|
1045
1083
|
}
|
|
1046
1084
|
|
|
1085
|
+
// ../tracking-core/src/resources/intl/date.ts
|
|
1086
|
+
function formatDateInTz(iso, timeZone, opts, locale) {
|
|
1087
|
+
const date = new Date(iso);
|
|
1088
|
+
if (Number.isNaN(date.getTime())) return iso;
|
|
1089
|
+
return new Intl.DateTimeFormat(locale, {
|
|
1090
|
+
year: "numeric",
|
|
1091
|
+
month: "short",
|
|
1092
|
+
day: "2-digit",
|
|
1093
|
+
hour: "2-digit",
|
|
1094
|
+
minute: "2-digit",
|
|
1095
|
+
...opts,
|
|
1096
|
+
timeZone
|
|
1097
|
+
}).format(date);
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1047
1100
|
// ../tracking-core/src/resources/sales/money.ts
|
|
1048
1101
|
var MINOR_UNIT_EXPONENT = {
|
|
1049
1102
|
USD: 2,
|
|
@@ -1063,19 +1116,6 @@ function formatMoney(cents, currency, locale) {
|
|
|
1063
1116
|
fromMinor(cents, currency)
|
|
1064
1117
|
);
|
|
1065
1118
|
}
|
|
1066
|
-
function formatDateInTz(iso, timeZone, opts, locale) {
|
|
1067
|
-
const date = new Date(iso);
|
|
1068
|
-
if (Number.isNaN(date.getTime())) return iso;
|
|
1069
|
-
return new Intl.DateTimeFormat(locale, {
|
|
1070
|
-
year: "numeric",
|
|
1071
|
-
month: "short",
|
|
1072
|
-
day: "2-digit",
|
|
1073
|
-
hour: "2-digit",
|
|
1074
|
-
minute: "2-digit",
|
|
1075
|
-
...opts,
|
|
1076
|
-
timeZone
|
|
1077
|
-
}).format(date);
|
|
1078
|
-
}
|
|
1079
1119
|
|
|
1080
1120
|
// ../tracking-core/src/resources/tracking-config-runtime.ts
|
|
1081
1121
|
var CACHE_PREFIX2 = "_aranova_cfg_runtime_";
|
|
@@ -1730,7 +1770,10 @@ function buildContext(surface, sdkVersion, packageName, environment, activeGtagI
|
|
|
1730
1770
|
page_title: typeof document === "undefined" ? null : document.title || null,
|
|
1731
1771
|
referrer: typeof document === "undefined" ? null : document.referrer || null,
|
|
1732
1772
|
environment,
|
|
1733
|
-
active_gtag_ids: activeGtagIds
|
|
1773
|
+
active_gtag_ids: activeGtagIds,
|
|
1774
|
+
// Rebuilt per flush (this runs inside the payload builder), so a client
|
|
1775
|
+
// constructed later on a deeper route still gets reported.
|
|
1776
|
+
capabilities: getRegisteredCapabilities()
|
|
1734
1777
|
};
|
|
1735
1778
|
}
|
|
1736
1779
|
function readTrackingParams() {
|
|
@@ -2323,8 +2366,9 @@ function getEventDefinition(name) {
|
|
|
2323
2366
|
}
|
|
2324
2367
|
|
|
2325
2368
|
// ../tracking-core/src/ingest-typed.ts
|
|
2326
|
-
function createTypedClient(raw,
|
|
2369
|
+
function createTypedClient(raw, registry, options = {}) {
|
|
2327
2370
|
const debug = options.debug ?? false;
|
|
2371
|
+
if (registry.manual?.form_submit) registerCapability("form_capture");
|
|
2328
2372
|
return {
|
|
2329
2373
|
trackEvent(eventType, metadata, opts) {
|
|
2330
2374
|
if (debug) {
|
|
@@ -2866,6 +2910,7 @@ function attachCtaClickCapture(client, config) {
|
|
|
2866
2910
|
return () => {
|
|
2867
2911
|
};
|
|
2868
2912
|
}
|
|
2913
|
+
registerCapability("cta_click_capture");
|
|
2869
2914
|
const selector = autoCapture.selector ?? DEFAULT_CTA_SELECTOR;
|
|
2870
2915
|
function onClick(event) {
|
|
2871
2916
|
const target = event.target;
|
|
@@ -2922,6 +2967,7 @@ function attachPhoneClickCapture(client, config) {
|
|
|
2922
2967
|
return () => {
|
|
2923
2968
|
};
|
|
2924
2969
|
}
|
|
2970
|
+
registerCapability("phone_click_capture");
|
|
2925
2971
|
const selector = autoCapture.selector ?? DEFAULT_TEL_SELECTOR;
|
|
2926
2972
|
function onClick(event) {
|
|
2927
2973
|
const target = event.target;
|
|
@@ -2951,7 +2997,7 @@ function attachPhoneClickCapture(client, config) {
|
|
|
2951
2997
|
};
|
|
2952
2998
|
}
|
|
2953
2999
|
|
|
2954
|
-
// ../tracking-core/src/resources/
|
|
3000
|
+
// ../tracking-core/src/resources/http/errors.ts
|
|
2955
3001
|
var AranovaApiError = class extends Error {
|
|
2956
3002
|
constructor(message, options) {
|
|
2957
3003
|
super(message);
|
|
@@ -2962,7 +3008,7 @@ var AranovaApiError = class extends Error {
|
|
|
2962
3008
|
}
|
|
2963
3009
|
};
|
|
2964
3010
|
|
|
2965
|
-
// ../tracking-core/src/resources/
|
|
3011
|
+
// ../tracking-core/src/resources/http/request.ts
|
|
2966
3012
|
function identityHeaders(config) {
|
|
2967
3013
|
const headers = { [API_KEY_HEADER]: config.apiKey };
|
|
2968
3014
|
if (config.sdkVersion) headers[SDK_VERSION_HEADER] = config.sdkVersion;
|
|
@@ -2974,8 +3020,8 @@ function identityHeaders(config) {
|
|
|
2974
3020
|
function joinUrl(endpoint, path) {
|
|
2975
3021
|
return `${endpoint.replace(/\/$/, "")}${path}`;
|
|
2976
3022
|
}
|
|
2977
|
-
async function
|
|
2978
|
-
const headers = identityHeaders(config);
|
|
3023
|
+
async function apiRequest(config, method, path, body, extraHeaders) {
|
|
3024
|
+
const headers = { ...identityHeaders(config), ...extraHeaders };
|
|
2979
3025
|
if (body !== void 0) headers["Content-Type"] = "application/json";
|
|
2980
3026
|
const response = await fetch(joinUrl(config.endpoint, path), {
|
|
2981
3027
|
method,
|
|
@@ -3004,6 +3050,9 @@ async function salesRequest(config, method, path, body) {
|
|
|
3004
3050
|
return await response.json();
|
|
3005
3051
|
}
|
|
3006
3052
|
|
|
3053
|
+
// ../tracking-core/src/resources/sales/transport.ts
|
|
3054
|
+
var salesRequest = apiRequest;
|
|
3055
|
+
|
|
3007
3056
|
// ../tracking-core/src/resources/sales/client.ts
|
|
3008
3057
|
function fireRecordedConversions(firing, input, recorded, sale, currency) {
|
|
3009
3058
|
if (!firing) return;
|
|
@@ -3035,6 +3084,7 @@ function fireRecordedConversions(firing, input, recorded, sale, currency) {
|
|
|
3035
3084
|
}
|
|
3036
3085
|
}
|
|
3037
3086
|
function createSalesClient(config) {
|
|
3087
|
+
if (config.firing) registerCapability("conversion_goals_manual");
|
|
3038
3088
|
async function record(input) {
|
|
3039
3089
|
const currency = input.currency ?? config.defaultCurrency;
|
|
3040
3090
|
if (!currency) {
|
|
@@ -3330,6 +3380,7 @@ var DEFAULT_CHOICE2 = {
|
|
|
3330
3380
|
expiresAt: null
|
|
3331
3381
|
};
|
|
3332
3382
|
function useCookiePreferences(options) {
|
|
3383
|
+
registerCapability("consent_controls");
|
|
3333
3384
|
const [choice, setChoice] = (0, import_react.useState)(DEFAULT_CHOICE2);
|
|
3334
3385
|
const ttlDays = options?.declineTtlDays;
|
|
3335
3386
|
(0, import_react.useEffect)(() => {
|
|
@@ -3592,6 +3643,12 @@ function AdPlatformTracking({
|
|
|
3592
3643
|
() => metaPixelIds ? JSON.stringify(metaPixelIds) : "",
|
|
3593
3644
|
[metaPixelIds]
|
|
3594
3645
|
);
|
|
3646
|
+
if (trackingConfig || gtagId || gtagIds && Object.keys(gtagIds).length > 0) {
|
|
3647
|
+
registerCapability("ad_tags_google");
|
|
3648
|
+
}
|
|
3649
|
+
if (metaPixelId || metaPixelIds && Object.keys(metaPixelIds).length > 0) {
|
|
3650
|
+
registerCapability("ad_tags_meta");
|
|
3651
|
+
}
|
|
3595
3652
|
(0, import_react3.useEffect)(() => {
|
|
3596
3653
|
if (trackingConfig) {
|
|
3597
3654
|
const runtime = getTrackingConfigRuntime(trackingConfig);
|
|
@@ -3632,7 +3689,7 @@ function GoogleAdsTracking(props) {
|
|
|
3632
3689
|
var import_react6 = require("react");
|
|
3633
3690
|
|
|
3634
3691
|
// package.json
|
|
3635
|
-
var version = "0.
|
|
3692
|
+
var version = "0.22.0";
|
|
3636
3693
|
|
|
3637
3694
|
// ../tracking-core/src/phone-react.tsx
|
|
3638
3695
|
var import_react5 = require("react");
|
|
@@ -3656,6 +3713,7 @@ function usePhoneConfig() {
|
|
|
3656
3713
|
};
|
|
3657
3714
|
}
|
|
3658
3715
|
function usePhoneField(opts = {}) {
|
|
3716
|
+
registerCapability("phone_fields");
|
|
3659
3717
|
const cfg = usePhoneConfig();
|
|
3660
3718
|
const country = opts.country ?? cfg.defaultCountry;
|
|
3661
3719
|
const display = opts.display ?? cfg.display;
|
|
@@ -3741,6 +3799,8 @@ function createTracking(options) {
|
|
|
3741
3799
|
conversionConfig,
|
|
3742
3800
|
trackingConfig
|
|
3743
3801
|
} = options;
|
|
3802
|
+
registerCapability("base_tracking");
|
|
3803
|
+
if (trackingConfig) registerCapability("conversion_goals_auto");
|
|
3744
3804
|
if (!apiKey || !endpoint) {
|
|
3745
3805
|
if (apiKey || endpoint) {
|
|
3746
3806
|
console.warn(
|