@syntrologie/adapt-content 2.8.0-canary.95 → 2.8.0-canary.97

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.
@@ -29,9 +29,5 @@ export interface BuildActionStepOptions {
29
29
  /** If true, infer $pageview for <a> elements with internal href */
30
30
  inferPageview?: boolean;
31
31
  }
32
- /**
33
- * Build a PostHog action step from a selected element in the chain.
34
- * Does NOT include `selector` — it's not supported in Athena.
35
- */
36
32
  export declare function buildActionStepFromElement(element: PostHogElement, pageUrl: string, options?: BuildActionStepOptions): ActionStep;
37
33
  //# sourceMappingURL=elementChainRecommender.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"elementChainRecommender.d.ts","sourceRoot":"","sources":["../../src/utils/elementChainRecommender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAKD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,CAYvE;AAED,MAAM,WAAW,sBAAsB;IACrC,mEAAmE;IACnE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,sBAA2B,GACnC,UAAU,CAmBZ"}
1
+ {"version":3,"file":"elementChainRecommender.d.ts","sourceRoot":"","sources":["../../src/utils/elementChainRecommender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAKD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,CAYvE;AAED,MAAM,WAAW,sBAAsB;IACrC,mEAAmE;IACnE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAsBD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,sBAA2B,GACnC,UAAU,CAmBZ"}
@@ -34,7 +34,23 @@ export function findRecommendedIndex(elements) {
34
34
  /**
35
35
  * Build a PostHog action step from a selected element in the chain.
36
36
  * Does NOT include `selector` — it's not supported in Athena.
37
+ *
38
+ * The `url` field stores the PATHNAME of the page where the user clicked,
39
+ * not the full URL. This matches how the backend generates SQL:
40
+ * step.url → `pathname LIKE '%<url>%'`
41
+ * Storing the full URL (including the editor token / query string) makes
42
+ * the stored KPI data ugly, leaks editor tokens into saved configs, and
43
+ * forces the backend to re-parse on every query. Strip at the boundary.
37
44
  */
45
+ function pageUrlToPathname(pageUrl) {
46
+ try {
47
+ const u = new URL(pageUrl);
48
+ return u.pathname || pageUrl;
49
+ }
50
+ catch {
51
+ return pageUrl;
52
+ }
53
+ }
38
54
  export function buildActionStepFromElement(element, pageUrl, options = {}) {
39
55
  const { inferPageview = false } = options;
40
56
  const href = element.attr__href;
@@ -42,7 +58,7 @@ export function buildActionStepFromElement(element, pageUrl, options = {}) {
42
58
  const step = {
43
59
  event: inferPageview && isInternalLink ? '$pageview' : '$autocapture',
44
60
  tag_name: element.tag_name,
45
- url: pageUrl,
61
+ url: pageUrlToPathname(pageUrl),
46
62
  };
47
63
  const text = (element.$el_text || '').trim();
48
64
  if (text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syntrologie/adapt-content",
3
- "version": "2.8.0-canary.95",
3
+ "version": "2.8.0-canary.97",
4
4
  "description": "Adaptive Content app - DOM manipulation actions for text, attributes, and styles",
5
5
  "license": "Proprietary",
6
6
  "private": false,