@funnelsgrove/analytics 0.1.6 → 0.1.7

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.
@@ -15,6 +15,7 @@ export type PurchaseAnalyticsAttributesInput = {
15
15
  projectId?: unknown;
16
16
  providerPlanId?: unknown;
17
17
  transactionId?: unknown;
18
+ timezone?: unknown;
18
19
  url?: unknown;
19
20
  userAgent?: unknown;
20
21
  userId?: unknown;
@@ -71,10 +71,11 @@ export const buildPurchaseAnalyticsAttributes = (input = {}, options = {}) => {
71
71
  const document = asRecord(input.funnelUserDocument);
72
72
  const attribution = asRecord((_a = input.attribution) !== null && _a !== void 0 ? _a : document.attribution);
73
73
  const attributionContext = asRecord(attribution.context);
74
+ const progressAttributes = asRecord(asRecord(document.progress).attributes);
74
75
  const transactionInfo = asRecord(document.transactionInfo);
75
76
  const amountCents = toNumber(input.amountCents);
76
77
  const value = (_b = toNumber(input.value)) !== null && _b !== void 0 ? _b : (amountCents === undefined ? undefined : amountCents / 100);
77
- return buildDefinedRecord(Object.assign(Object.assign({}, normalizeAttributionTouch(attribution.firstTouch)), { currency: toCurrency(input.currency), value, plan_id: firstString(input.planId, input.plan_id), provider_plan_id: firstString(input.providerPlanId, input.provider_plan_id), coupon_id: firstString(input.couponId, input.coupon_id), environment: firstString(input.environment), user_id: firstString(input.userId, input.user_id), project_id: firstString(input.projectId, input.project_id), funnel_id: firstString(input.funnelId, input.funnel_id), funnel_version: firstString(input.funnelVersion, input.funnelVersionId, input.funnel_version), ip_address: firstString(input.ipAddress, input.ip_address, transactionInfo.ipAddress, transactionInfo.ip_address), user_agent: firstString(input.userAgent, input.user_agent, attributionContext.userAgent), geo_city: firstString(input.geoCity, input.geo_city, document.geo_city, document.geoCity, asRecord(document.geo).city, attributionContext.geo_city, attributionContext.geoCity, attributionContext.cityName, attributionContext.city), geo_country: firstString(input.geoCountry, input.geo_country, document.geo_country, document.geoCountry, asRecord(document.geo).country, attributionContext.geo_country, attributionContext.geoCountry, attributionContext.countryName, attributionContext.countryCode, attributionContext.country), transaction_id: firstString(input.transactionId, input.transaction_id), url: options.includeUrl ? firstString(input.url, currentBrowserUrl()) : undefined }));
78
+ return buildDefinedRecord(Object.assign(Object.assign({}, normalizeAttributionTouch(attribution.firstTouch)), { currency: toCurrency(input.currency), value, plan_id: firstString(input.planId, input.plan_id), provider_plan_id: firstString(input.providerPlanId, input.provider_plan_id), coupon_id: firstString(input.couponId, input.coupon_id), environment: firstString(input.environment), user_id: firstString(input.userId, input.user_id), project_id: firstString(input.projectId, input.project_id), funnel_id: firstString(input.funnelId, input.funnel_id), funnel_version: firstString(input.funnelVersion, input.funnelVersionId, input.funnel_version), ip_address: firstString(input.ipAddress, input.ip_address, transactionInfo.ipAddress, transactionInfo.ip_address), user_agent: firstString(input.userAgent, input.user_agent, attributionContext.userAgent), timezone: firstString(input.timezone, input.time_zone, progressAttributes.timezone, progressAttributes.time_zone, document.timezone, document.time_zone, attributionContext.timezone, attributionContext.time_zone), geo_city: firstString(input.geoCity, input.geo_city, progressAttributes.geo_city, progressAttributes.geoCity, document.geo_city, document.geoCity, asRecord(document.geo).city, attributionContext.geo_city, attributionContext.geoCity, attributionContext.cityName, attributionContext.city), geo_country: firstString(input.geoCountry, input.geo_country, progressAttributes.geo_country, progressAttributes.geoCountry, document.geo_country, document.geoCountry, asRecord(document.geo).country, attributionContext.geo_country, attributionContext.geoCountry, attributionContext.countryName, attributionContext.countryCode, attributionContext.country), transaction_id: firstString(input.transactionId, input.transaction_id), url: options.includeUrl ? firstString(input.url, currentBrowserUrl()) : undefined }));
78
79
  };
79
80
  export const buildBrowserPurchaseAnalyticsAttributes = (input = {}) => {
80
81
  return buildPurchaseAnalyticsAttributes(input, { includeUrl: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/analytics",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "test:run": "vitest run --passWithNoTests"
27
27
  },
28
28
  "dependencies": {
29
- "@funnelsgrove/runtime": "0.1.14"
29
+ "@funnelsgrove/runtime": "0.1.16"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^20",