sitepong 0.2.12 → 0.2.14

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.
@@ -749,7 +749,7 @@ declare function startWatchtower(config: WatchtowerConfig): void;
749
749
  * Set user identity — stamped as distinct_id on every subsequent event. Call
750
750
  * this wherever you call the SDK's identify(), with the same id.
751
751
  */
752
- declare function setWatchtowerUser(distinctId: string | null): void;
752
+ declare function setWatchtowerUser(distinctId: string | null, email?: string | null, name?: string | null): void;
753
753
  /**
754
754
  * The engine's current capture session id (null when not running). Attach it
755
755
  * to error reports/analytics — it is the key that joins an error to its
@@ -2625,7 +2625,7 @@ var SitePongClient = class {
2625
2625
  }
2626
2626
  for (const hook of this.identifyHooks) {
2627
2627
  try {
2628
- hook(userId);
2628
+ hook(userId, traits);
2629
2629
  } catch (err) {
2630
2630
  this.log("identify hook failed:", err);
2631
2631
  }
@@ -3149,7 +3149,7 @@ sitepong.flushProfiles.bind(sitepong);
3149
3149
  var getRemoteConfig = sitepong.getRemoteConfig.bind(sitepong);
3150
3150
  var isRemoteConfigFeatureEnabled = sitepong.isRemoteConfigFeatureEnabled.bind(sitepong);
3151
3151
  var onRemoteConfigChange = sitepong.onRemoteConfigChange.bind(sitepong);
3152
- sitepong.registerIdentifyHook.bind(sitepong);
3152
+ var registerIdentifyHook = sitepong.registerIdentifyHook.bind(sitepong);
3153
3153
 
3154
3154
  // src/react-native/storage.ts
3155
3155
  function createAsyncStorageAdapter(asyncStorage) {
@@ -3865,6 +3865,12 @@ function extractAttrs(tag, props, componentName2) {
3865
3865
  if (uri) attrs.src = String(uri);
3866
3866
  }
3867
3867
  if (componentName2) attrs.rnComponent = componentName2;
3868
+ if (props.activityState !== void 0 && props.activityState !== null) {
3869
+ attrs.activityState = String(props.activityState);
3870
+ }
3871
+ if (props.isFocused !== void 0 && props.isFocused !== null) {
3872
+ attrs.isFocused = String(props.isFocused);
3873
+ }
3868
3874
  if (props.wtOverlay || props.accessibilityViewIsModal) attrs.wtOverlay = "true";
3869
3875
  if (props.wtSensitive || props.secureTextEntry) attrs.wtSensitive = "true";
3870
3876
  return attrs;
@@ -4719,6 +4725,7 @@ function loadBridge() {
4719
4725
  return getScreenRecorderModule();
4720
4726
  }
4721
4727
  var started = false;
4728
+ var identifyHookUnsub = null;
4722
4729
  function startWatchtower(config) {
4723
4730
  if (started) return;
4724
4731
  const bridge = loadBridge();
@@ -4741,10 +4748,15 @@ function startWatchtower(config) {
4741
4748
  });
4742
4749
  started = true;
4743
4750
  if (config.distinctId) setWatchtowerUser(config.distinctId);
4751
+ if (!identifyHookUnsub) {
4752
+ identifyHookUnsub = registerIdentifyHook(
4753
+ (userId, traits) => setWatchtowerUser(userId, traits?.email ?? null, traits?.name ?? null)
4754
+ );
4755
+ }
4744
4756
  }
4745
- function setWatchtowerUser(distinctId) {
4757
+ function setWatchtowerUser(distinctId, email = null, name = null) {
4746
4758
  try {
4747
- loadBridge()?.watchtowerSetUser(distinctId);
4759
+ loadBridge()?.watchtowerSetUser(distinctId, email, name);
4748
4760
  } catch {
4749
4761
  }
4750
4762
  }
@@ -4759,6 +4771,8 @@ function stopWatchtower() {
4759
4771
  if (!started) return;
4760
4772
  loadBridge()?.watchtowerStop();
4761
4773
  started = false;
4774
+ identifyHookUnsub?.();
4775
+ identifyHookUnsub = null;
4762
4776
  }
4763
4777
  function subscribeNavigationToWatchtower(navigationRef) {
4764
4778
  const unsubscribe = createNavigationTracker(navigationRef, {