moonshot-rails 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b79ae4d63426bbf4426c0bf67cbbe387ac14905b2408b4afe9c21c187ab60b8
|
4
|
+
data.tar.gz: 4bf8dafd670e98755453f729f97b6e55b29c044fbfe477e3828c58a3441c5e7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feff6be2fadc8959b0e15ea713e8db3c1cce6a58d56a31808890d84f5171573a3b302dc5c4e915686614ef76c7b11680acb0e15d2743659fd50936562699c8c7
|
7
|
+
data.tar.gz: ce23061913f7dfbda0630d7e8b700aa8bc3f0a993301f3be701546270502532d6d4913872d207e606fce62e4f833240f74ba612c95dcb073050c524b19650340
|
data/README.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
import
|
1
|
+
import PostHogController from './post_hog_controller'
|
2
|
+
import ShepherdController from './shepherd_controller'
|
2
3
|
|
3
|
-
export {
|
4
|
+
export {
|
5
|
+
PostHogController, ShepherdController
|
6
|
+
}
|
4
7
|
|
5
8
|
export function registerControllers(application) {
|
6
|
-
application.register('
|
9
|
+
application.register('shepherd', ShepherdController)
|
10
|
+
application.register('post-hog', PostHogController)
|
7
11
|
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import posthog from 'posthog-js'
|
2
|
+
import { Controller } from "@hotwired/stimulus"
|
3
|
+
|
4
|
+
// Connects to data-controller="post-hog"
|
5
|
+
export default class extends Controller {
|
6
|
+
static values = {
|
7
|
+
apiKey: String,
|
8
|
+
identification: Object
|
9
|
+
}
|
10
|
+
|
11
|
+
connect() {
|
12
|
+
posthog.init(this.apiKeyValue, {
|
13
|
+
api_host: 'https://eu.posthog.com',
|
14
|
+
custom_campaign_params: ["ref"],
|
15
|
+
session_recording: {
|
16
|
+
maskAllInputs: false,
|
17
|
+
maskInputOptions: {
|
18
|
+
password: true
|
19
|
+
}
|
20
|
+
}
|
21
|
+
})
|
22
|
+
|
23
|
+
if (Object.keys(this.identificationValue).length) {
|
24
|
+
const { id, email, name } = this.identificationValue
|
25
|
+
posthog.identify(id, { email, name })
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
@@ -2,5 +2,36 @@
|
|
2
2
|
|
3
3
|
module Moonshot
|
4
4
|
module MoonshotHelper
|
5
|
+
def shepherd_tour tour:, context: {}
|
6
|
+
tag.div nil, data: {
|
7
|
+
controller: 'shepherd',
|
8
|
+
'shepherd-tour-name-value' => tour,
|
9
|
+
'shepherd-endpoint-value' => shepherd_rails.tour_statuses_path,
|
10
|
+
'shepherd-config-value' => I18n.t(tour, scope: 'shepherd_rails'),
|
11
|
+
'shepherd-context-value' => context
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
def post_hog_tracker user: nil, enabled: true, api_key:
|
16
|
+
return unless enabled
|
17
|
+
|
18
|
+
options = {
|
19
|
+
controller: 'post-hog',
|
20
|
+
post_hog_api_key_value: api_key
|
21
|
+
}
|
22
|
+
|
23
|
+
if user
|
24
|
+
id_options = {
|
25
|
+
id: user.id,
|
26
|
+
name: user.tracker_name,
|
27
|
+
email: user.tracker_email
|
28
|
+
}
|
29
|
+
options.merge!({
|
30
|
+
post_hog_identification_value: id_options
|
31
|
+
})
|
32
|
+
end
|
33
|
+
|
34
|
+
tag.div(data: options)
|
35
|
+
end
|
5
36
|
end
|
6
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moonshot-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Catalin Ionescu
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- README.md
|
64
64
|
- app/assets/javascripts/moonshot.js
|
65
65
|
- app/assets/javascripts/moonshot/index.js
|
66
|
+
- app/assets/javascripts/moonshot/post_hog_controller.js
|
66
67
|
- app/assets/javascripts/moonshot/shepherd_controller.js
|
67
68
|
- app/helpers/moonshot/moonshot_helper.rb
|
68
69
|
- lib/moonshot-rails.rb
|