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: 5cff18680c071a47e756d4e2c374e225786f91c20fcf36cdff9874b6d3646fe3
4
- data.tar.gz: 5650ffebc7e361df9cbb0bc3ed9f46adbd9b05f9f559dbc2a1520f5719e09cc2
3
+ metadata.gz: 9b79ae4d63426bbf4426c0bf67cbbe387ac14905b2408b4afe9c21c187ab60b8
4
+ data.tar.gz: 4bf8dafd670e98755453f729f97b6e55b29c044fbfe477e3828c58a3441c5e7d
5
5
  SHA512:
6
- metadata.gz: d36236cd06717459b4d7865d6377d200a8bce9013942f91ed2f0c0c0dc12d74b03a06198e41453447f3384e0f6039c256dcf2c6efee9f846fb331a9c2553031f
7
- data.tar.gz: 99cf637fd557d987c3ea2336202ec867851839c3c1983e8ad46c555c142472e51d2b7cc5924453053b4e68b7ea3964022c3475d247614886d22c2bc7b5749c48
6
+ metadata.gz: feff6be2fadc8959b0e15ea713e8db3c1cce6a58d56a31808890d84f5171573a3b302dc5c4e915686614ef76c7b11680acb0e15d2743659fd50936562699c8c7
7
+ data.tar.gz: ce23061913f7dfbda0630d7e8b700aa8bc3f0a993301f3be701546270502532d6d4913872d207e606fce62e4f833240f74ba612c95dcb073050c524b19650340
data/README.md CHANGED
@@ -1 +1,15 @@
1
1
  # Moonshot Rails
2
+
3
+ ## Release
4
+
5
+ ### Ruby Gem
6
+
7
+ ```bash
8
+ rake release
9
+ ```
10
+
11
+ ### JavaScript Package
12
+
13
+ ```bash
14
+ npm run release
15
+ ```
@@ -1,7 +1,11 @@
1
- import Shepherd from './shepherd_controller'
1
+ import PostHogController from './post_hog_controller'
2
+ import ShepherdController from './shepherd_controller'
2
3
 
3
- export { Shepherd }
4
+ export {
5
+ PostHogController, ShepherdController
6
+ }
4
7
 
5
8
  export function registerControllers(application) {
6
- application.register('moonshot-shepherd', Shepherd)
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module MoonshotRails
2
- VERSION = "0.0.1"
4
+ VERSION = '0.0.2'
3
5
  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.1
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