shipeasy-sdk 3.5.1 → 3.6.0
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 +4 -4
- data/lib/shipeasy/engine.rb +24 -0
- data/lib/shipeasy/sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ad9abca98f87069daf53c2e2347e9f2975595b437576738aef381fbc2a4a9a10
|
|
4
|
+
data.tar.gz: 300a69f50db74da6279666d9d6d8698dbb22d08365e846f20403609e001ea638
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cfb4185054243325d9130de44d40fff6d28af91ee2100150a7f594c2a9925c8ab20f931a2d1ccb433b830521ac07b7ff2381ff2325cf3b1ada0591d674f30c0d
|
|
7
|
+
data.tar.gz: 5b89a4b38c9f6b9eebc9946e50ebd74bbfb5336c0354cee43321b7ea94652fff7da669deebf74317a7aee6492db6760e471ea29b0c375885474e5ab2e37fbdab
|
data/lib/shipeasy/engine.rb
CHANGED
|
@@ -485,6 +485,8 @@ module Shipeasy
|
|
|
485
485
|
attr("data-api-url", base),
|
|
486
486
|
]
|
|
487
487
|
attrs << attr("data-anon-id", anon_id) if anon_id && !anon_id.empty?
|
|
488
|
+
data_user = identity_attrs(user)
|
|
489
|
+
attrs << attr("data-user", data_user) if data_user
|
|
488
490
|
%(<script src="#{CGI.escapeHTML("#{base}/sdk/bootstrap.js")}" #{attrs.join(' ')}></script>)
|
|
489
491
|
end
|
|
490
492
|
|
|
@@ -745,6 +747,28 @@ module Shipeasy
|
|
|
745
747
|
%(#{name}="#{CGI.escapeHTML(value.to_s)}")
|
|
746
748
|
end
|
|
747
749
|
|
|
750
|
+
# Serialize the server-identified user's traits for the SSR bootstrap tag's
|
|
751
|
+
# data-user attribute: the request user minus `anonymous_id`, dropping
|
|
752
|
+
# nil values only (empty strings and other present values are kept, to
|
|
753
|
+
# match the cross-SDK contract). Returns a stable-keyed JSON object, or nil when nothing
|
|
754
|
+
# identified remains (a purely anonymous request) so data-user is omitted.
|
|
755
|
+
# The browser SDK adopts this identity on first paint, killing the
|
|
756
|
+
# anon->identified flip. See experiment-platform/18-identity-bucketing.md.
|
|
757
|
+
def identity_attrs(user)
|
|
758
|
+
return nil unless user.is_a?(Hash)
|
|
759
|
+
|
|
760
|
+
traits = {}
|
|
761
|
+
user.each do |k, v|
|
|
762
|
+
next if k.to_s == "anonymous_id"
|
|
763
|
+
next if v.nil?
|
|
764
|
+
|
|
765
|
+
traits[k.to_s] = v
|
|
766
|
+
end
|
|
767
|
+
return nil if traits.empty?
|
|
768
|
+
|
|
769
|
+
JSON.generate(traits.sort.to_h)
|
|
770
|
+
end
|
|
771
|
+
|
|
748
772
|
def start_poll
|
|
749
773
|
@timer = Thread.new do
|
|
750
774
|
loop do
|
data/lib/shipeasy/sdk/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shipeasy-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shipeasy, Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|