@syntrologie/runtime-sdk 2.8.0-canary.69 → 2.8.0-canary.70

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.
@@ -3456,7 +3456,7 @@ function getAntiFlickerSnippet(config = {}) {
3456
3456
  }
3457
3457
 
3458
3458
  // src/version.ts
3459
- var SDK_VERSION = "2.8.0-canary.69";
3459
+ var SDK_VERSION = "2.8.0-canary.70";
3460
3460
 
3461
3461
  // src/types.ts
3462
3462
  var SDK_SCHEMA_VERSION = "2.0";
@@ -3932,6 +3932,36 @@ function getEventName(phEvent) {
3932
3932
  return eventName.replace("$", "posthog.");
3933
3933
  }
3934
3934
  var INTERACTIVE_TAGS = /* @__PURE__ */ new Set(["a", "button", "input", "select", "textarea"]);
3935
+ function parseElementsChain(chain) {
3936
+ if (!chain)
3937
+ return void 0;
3938
+ return chain.split(";").map((segment) => {
3939
+ const el = {};
3940
+ const colonIdx = segment.indexOf(":");
3941
+ const tagPart = colonIdx >= 0 ? segment.slice(0, colonIdx) : segment;
3942
+ const attrPart = colonIdx >= 0 ? segment.slice(colonIdx + 1) : "";
3943
+ const dotIdx = tagPart.indexOf(".");
3944
+ if (dotIdx >= 0) {
3945
+ el.tag_name = tagPart.slice(0, dotIdx);
3946
+ el.attr__class = tagPart.slice(dotIdx + 1).replace(/\./g, " ");
3947
+ } else {
3948
+ el.tag_name = tagPart;
3949
+ }
3950
+ const attrRegex = /([\w$]+)="([^"]*)"/g;
3951
+ let match;
3952
+ while ((match = attrRegex.exec(attrPart)) !== null) {
3953
+ const [, key, value] = match;
3954
+ if (key === "nth-child" || key === "nth-of-type")
3955
+ continue;
3956
+ el[key] = value;
3957
+ }
3958
+ if (el.text) {
3959
+ el.$el_text = el.text;
3960
+ delete el.text;
3961
+ }
3962
+ return el;
3963
+ });
3964
+ }
3935
3965
  function resolveInteractiveTag(elements, directTag) {
3936
3966
  if (directTag && INTERACTIVE_TAGS.has(directTag))
3937
3967
  return directTag;
@@ -3945,17 +3975,20 @@ function resolveInteractiveTag(elements, directTag) {
3945
3975
  return directTag;
3946
3976
  }
3947
3977
  function extractProps(phEvent) {
3948
- var _a2, _b;
3978
+ var _a2, _b, _c;
3949
3979
  const props = {};
3950
3980
  const phProps = phEvent.properties || {};
3951
- const elements = phProps.$elements;
3952
- const directTag = (_b = phProps.$tag_name) != null ? _b : (_a2 = elements == null ? void 0 : elements[0]) == null ? void 0 : _a2.tag_name;
3981
+ const elements = (_a2 = phProps.$elements) != null ? _a2 : typeof phProps.$elements_chain === "string" ? parseElementsChain(phProps.$elements_chain) : void 0;
3982
+ const directTag = (_c = phProps.$tag_name) != null ? _c : (_b = elements == null ? void 0 : elements[0]) == null ? void 0 : _b.tag_name;
3953
3983
  const isClickEvent = phEvent.event === "$autocapture" || phEvent.event === "$click";
3954
3984
  props.tagName = isClickEvent ? resolveInteractiveTag(elements, directTag) : directTag;
3955
3985
  if (phProps.$el_text)
3956
3986
  props.elementText = phProps.$el_text;
3957
3987
  if (elements)
3958
3988
  props.elements = elements;
3989
+ if (isClickEvent && !elements) {
3990
+ console.warn(`[PostHogNormalizer] $autocapture click has no element chain. PostHog may have changed wire format. Properties: $elements=${!!phProps.$elements}, $elements_chain=${typeof phProps.$elements_chain}`);
3991
+ }
3959
3992
  if (phProps.$current_url)
3960
3993
  props.url = phProps.$current_url;
3961
3994
  if (phProps.$pathname)
@@ -12370,4 +12403,4 @@ export {
12370
12403
  encodeToken,
12371
12404
  Syntro
12372
12405
  };
12373
- //# sourceMappingURL=chunk-L5D2RNBG.js.map
12406
+ //# sourceMappingURL=chunk-N5OR6Q2I.js.map