0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-04 13:50:12 -05:00

Add feature flags info to posthog events

This commit is contained in:
Pablo Alba 2024-12-30 16:20:52 +01:00
parent 3eab9da74e
commit 3dc564d21f
2 changed files with 12 additions and 0 deletions

View file

@ -143,6 +143,11 @@
(let [f (obj/get global "externalSessionId")]
(when (fn? f) (f))))
(defn external-context-info
[]
(let [f (obj/get global "externalContextInfo")]
(when (fn? f) (f))))
;; --- Helper Functions
(defn ^boolean check-browser? [candidate]

View file

@ -93,6 +93,11 @@
data
data))
(defn add-external-context-info
[context]
(let [external-context-info (js->clj (cf/external-context-info) :keywordize-keys true)]
(merge context external-context-info)))
(defn- process-event-by-proto
[event]
(let [data (d/deep-merge (-data event) (meta event))
@ -102,6 +107,7 @@
(assoc :event-origin (::origin data))
(assoc :event-namespace (namespace type))
(assoc :event-symbol ev-name)
(add-external-context-info)
(d/without-nils))
props (-> data d/without-qualified simplify-props)]
@ -119,6 +125,7 @@
(let [type (::type data "action")
context (-> (::context data)
(assoc :event-origin (::origin data))
(add-external-context-info)
(d/without-nils))
props (-> data d/without-qualified simplify-props)]
{:type type