;; The social side: presence to friends, live invite toasts. Its own shadow
;; module (loaded via shadow.lazy after boot — the CLJS equivalent of TS's
;; `void import("ardegazu-social-kit")`) and the ONLY namespace referencing
;; the kit's main entry, so the initial chunk stays lean. Must never break
;; the app.
;;
;; Leaderboard games additionally construct soc/GameLb here and route its
;; lbq/lbs/lbr frames FIRST in main's onMessage — game1's social.cljs is the
;; worked example.
(ns __NAME__.social
(:require ["ardegazu-social-kit" :as soc]
[__NAME__.config :as config]
[__NAME__.i18n :as i18n]))
(defn setup!
"cfg: js obj (ident net myName). Attaches the social agent to the node's
pubsub."
[^js cfg]
(let [ident ^js (unchecked-get cfg "ident")
net ^js (unchecked-get cfg "net")
boot ^js (unchecked-get ident "boot")
lp ^js (unchecked-get net "libp2p")
bridge ^js (unchecked-get ident "bridge")
rec (.lastRecord bridge)]
(soc/attachSocial
(js-obj "ns" (unchecked-get ident "ns")
"app" (aget (.split config/APP-SALT "/") 0)
"identity" (unchecked-get boot "identity")
"seed" (unchecked-get boot "seed")
"myName" (unchecked-get cfg "myName")
"pubsub" (unchecked-get (.-services lp) "pubsub")
"soc" (when (some? rec) (unchecked-get rec "soc"))
"roomLink" (fn [] (.-href js/location))
"t" i18n/t-kit))))