mbuzz 0.7.3 → 0.7.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 717fff0f77150fb5f0a2ddcd60e59aaccaacdddbe41acd88ec7b953b568ec448
4
- data.tar.gz: caedfee3a6e6ced3dcfadcfcce5b80a9f13679b73710f0933b6c2d8573c2accb
3
+ metadata.gz: 31940df7a70689cccec128ba1f99498c1fda911604ca48ad9c243584c71ba228
4
+ data.tar.gz: e1b98becc405f8043831645c9ce6ee3010716466e2cd5c960d1ca5ac4a3d875a
5
5
  SHA512:
6
- metadata.gz: ce5da1805916ac523dc3d9a40e8b3126ee8f7b1d95cc3fe042d6e800e796e38227f117edd9acb72e1ec4e357cd83d378fe87b3f87eb063c2857f267ae2508c56
7
- data.tar.gz: 190f2ddbf15dbc17cde637ee4f8ed4d00a8b06d47f0d16fce9b54e96e67e7e8191359f57cc3a5e218c9028ccac072e14e0035a1c1cc0f5c9a4e95b3c14b73c41
6
+ metadata.gz: 80ca2e08d316b5b06526dc2375ccede006ef8e369c6a796cec73182aacca047f5874eb76e1de7e3612298379e8ebd3cb7cdc75bb45f9f3f8f43b410d5ed4f11b
7
+ data.tar.gz: 0ce7d660c3b17d2fa26ab14acb79c8942cbc4caacc40690b4fe772a7b1fb92d45a4ae59a4dfee32e6836535d930b4b49d2fbb88d72c7f59884e1924347ee14c2
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.7.4] - 2026-02-17
9
+
10
+ ### Fixed
11
+
12
+ - **`conversion()` now resolves `user_id` from context** — the `user_id: nil` parameter was shadowing `self.user_id`, preventing the identify → convert flow from working. `event()` was not affected.
13
+ - **`identify()` now stores `user_id` in context** — after a successful API call, `user_id` is written to `Current.user_id` and `request.env` so that subsequent `conversion()` calls in the same request can resolve it.
14
+
8
15
  ## [0.7.3] - 2026-02-02
9
16
 
10
17
  ### Breaking Changes
data/lib/mbuzz/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mbuzz
4
- VERSION = "0.7.3"
4
+ VERSION = "0.7.4"
5
5
  end
data/lib/mbuzz.rb CHANGED
@@ -161,13 +161,14 @@ module Mbuzz
161
161
  #
162
162
  def self.conversion(conversion_type, visitor_id: nil, revenue: nil, user_id: nil, is_acquisition: false, inherit_acquisition: false, identifier: nil, **properties)
163
163
  resolved_visitor_id = visitor_id || self.visitor_id
164
+ resolved_user_id = user_id || self.user_id
164
165
 
165
166
  # Must have at least one identifier (visitor_id or user_id)
166
- return false unless resolved_visitor_id || user_id
167
+ return false unless resolved_visitor_id || resolved_user_id
167
168
 
168
169
  Client.conversion(
169
170
  visitor_id: resolved_visitor_id,
170
- user_id: user_id,
171
+ user_id: resolved_user_id,
171
172
  conversion_type: conversion_type,
172
173
  revenue: revenue,
173
174
  is_acquisition: is_acquisition,
@@ -193,17 +194,28 @@ module Mbuzz
193
194
  # Mbuzz.identify("user_123", visitor_id: "abc123...", traits: { email: "jane@example.com" })
194
195
  #
195
196
  def self.identify(user_id, traits: {}, visitor_id: nil)
196
- Client.identify(
197
+ result = Client.identify(
197
198
  user_id: user_id,
198
199
  visitor_id: visitor_id || self.visitor_id,
199
200
  traits: traits
200
201
  )
202
+
203
+ store_user_id_in_context(user_id) if result
204
+
205
+ result
201
206
  end
202
207
 
203
208
  # ============================================================================
204
209
  # Private Helpers
205
210
  # ============================================================================
206
211
 
212
+ def self.store_user_id_in_context(uid)
213
+ str_id = uid.to_s
214
+ Current.user_id = str_id if defined?(Current)
215
+ RequestContext.current&.request&.env&.[]=(ENV_USER_ID_KEY, str_id)
216
+ end
217
+ private_class_method :store_user_id_in_context
218
+
207
219
  def self.enriched_properties(custom_properties)
208
220
  return custom_properties unless RequestContext.current
209
221
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mbuzz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - mbuzz team