jekyll-deskcrew 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 90dc53c2da8abff1e6f73e79b6a3195a98984efc33ec2bba2e1846e7f77e68ae
4
+ data.tar.gz: 9cb03737d7a59ea4b8c511bc76b06ca3d961bd3462e02845b9b85166f557903a
5
+ SHA512:
6
+ metadata.gz: 43469596e4731d29814fc1858382222391c56c0bece9e1c0ad845f4b9cd4471d729106dafa5e20ff386e4965f5a33868e74a10513d069cd43f15d1489d2f50bf
7
+ data.tar.gz: 1148a24b1bff013206597f137e80550b8ecd174b87dfad0a8384701f2dc8be117c4d600b915310ce1438fd61744ad738440630fa413ec9453609dbfe2be4eabc
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeskCrew
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # jekyll-deskcrew
2
+
3
+ ![DeskCrew widget on every Jekyll page](https://deskcrew.io/packages/deskcrew-jekyll.gif)
4
+
5
+ Add the [DeskCrew](https://deskcrew.io) support widget to a Jekyll site: live chat, AI answers grounded in your knowledge base, and a help center. One plugin, configured in `_config.yml`, and every page and post carries the widget. No layout changes.
6
+
7
+ You need a free DeskCrew account to get a widget key: https://deskcrew.io/signup
8
+
9
+ ## Install
10
+
11
+ ```ruby
12
+ # Gemfile
13
+ group :jekyll_plugins do
14
+ gem "jekyll-deskcrew"
15
+ end
16
+ ```
17
+
18
+ ```yaml
19
+ # _config.yml
20
+ plugins:
21
+ - jekyll-deskcrew
22
+
23
+ deskcrew:
24
+ key: pub_your_widget_key # from your DeskCrew dashboard, Install page
25
+ board: your-board # optional
26
+ # color: "#4f46e5" # optional, 6-digit hex
27
+ # position: right # optional, or left
28
+ # greeting: "Hi! How can we help?"
29
+ # enabled: false # keep the plugin installed but switch the widget off
30
+ ```
31
+
32
+ Build the site. The launcher appears on every generated HTML page. GitHub Pages does not run custom plugins; build with GitHub Actions or another host instead.
33
+
34
+ ## How it works
35
+
36
+ A `post_render` hook injects one `<script>` tag before `</body>` on every page and document with an `.html` output. Every value from `_config.yml` is validated and HTML-escaped first; a missing or malformed key means nothing is injected, and a page that already carries the tag is never given a second one.
37
+
38
+ ## What the plugin adds to your site
39
+
40
+ One script tag loading `https://deskcrew.io/desk.js` with your public widget key. The widget runs inside a Shadow DOM and does not touch your styles. Terms: https://deskcrew.io/terms. Privacy: https://deskcrew.io/privacy.
41
+
42
+ ## License
43
+
44
+ MIT
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "erb"
4
+
5
+ module JekyllDeskcrew
6
+ # Builds the widget <script> tag from the `deskcrew` block of _config.yml.
7
+ # Every value is validated, then HTML-escaped; a missing or malformed key gives an
8
+ # empty string, so a bad config never puts arbitrary markup on the page.
9
+ module Tag
10
+ KEY_FORMAT = /\Apub_[A-Za-z0-9]+\z/
11
+ BOARD_FORMAT = /\A[a-z0-9-]+\z/
12
+ COLOR_FORMAT = /\A#[0-9a-fA-F]{6}\z/
13
+ APP_URL = "https://deskcrew.io"
14
+
15
+ module_function
16
+
17
+ def build(config)
18
+ cfg = (config || {}).transform_keys(&:to_s)
19
+ key = cfg["key"].to_s.strip
20
+ return "" if cfg.key?("enabled") && !cfg["enabled"]
21
+ return "" unless KEY_FORMAT.match?(key)
22
+
23
+ attrs = { "src" => "#{APP_URL}/desk.js", "data-key" => key }
24
+ board = cfg["board"].to_s.strip
25
+ attrs["data-board"] = board if BOARD_FORMAT.match?(board) && !board.empty?
26
+ color = cfg["color"].to_s.strip
27
+ attrs["data-color"] = color if COLOR_FORMAT.match?(color)
28
+ attrs["data-position"] = cfg["position"].to_s if %w[left right].include?(cfg["position"].to_s)
29
+ greeting = cfg["greeting"].to_s.strip
30
+ attrs["data-greeting"] = greeting[0, 120] unless greeting.empty?
31
+
32
+ pairs = attrs.map { |k, v| %(#{k}="#{ERB::Util.html_escape(v)}") }
33
+ "<script #{pairs.join(' ')} defer></script>"
34
+ end
35
+
36
+ def inject(html, tag)
37
+ return html if tag.empty? || !html.is_a?(String)
38
+ return html if html.include?("#{APP_URL}/desk.js")
39
+ return html unless html =~ %r{</body>}i
40
+
41
+ html.sub(%r{</body>}i) { "#{tag}\n</body>" }
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module JekyllDeskcrew
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require "jekyll-deskcrew/version"
5
+ require "jekyll-deskcrew/tag"
6
+
7
+ # _config.yml:
8
+ # plugins: [jekyll-deskcrew]
9
+ # deskcrew:
10
+ # key: pub_your_widget_key # from your DeskCrew dashboard, Install page
11
+ # board: your-board # optional
12
+ # color: "#4f46e5" # optional
13
+ # position: right # optional, or left
14
+ # greeting: "Hi! How can we help?" # optional
15
+ #
16
+ # The widget tag is injected before </body> of every rendered page and document.
17
+ Jekyll::Hooks.register [:pages, :documents], :post_render do |item|
18
+ next unless item.output_ext == ".html" || item.output_ext.nil?
19
+
20
+ tag = JekyllDeskcrew::Tag.build(item.site.config["deskcrew"])
21
+ item.output = JekyllDeskcrew::Tag.inject(item.output, tag)
22
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-deskcrew
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - DeskCrew
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: jekyll
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '3.9'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '5'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '3.9'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '5'
32
+ description: DeskCrew is an AI-powered helpdesk. This plugin injects the DeskCrew
33
+ support widget (live chat, AI answers from your knowledge base, a help center) before
34
+ </body> on every generated HTML page. Configure it from _config.yml; no layout changes.
35
+ email:
36
+ - support@deskcrew.io
37
+ executables: []
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - LICENSE.txt
42
+ - README.md
43
+ - lib/jekyll-deskcrew.rb
44
+ - lib/jekyll-deskcrew/tag.rb
45
+ - lib/jekyll-deskcrew/version.rb
46
+ homepage: https://deskcrew.io/integrations/jekyll
47
+ licenses:
48
+ - MIT
49
+ metadata:
50
+ homepage_uri: https://deskcrew.io/integrations/jekyll
51
+ source_code_uri: https://github.com/webmilmind1/support-tickets/tree/main/jekyll-deskcrew
52
+ rubygems_mfa_required: 'true'
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '2.7'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.6.9
68
+ specification_version: 4
69
+ summary: Add the DeskCrew AI support widget to every page and post of a Jekyll site.
70
+ test_files: []