Compare commits

...
15 changed files with 1686 additions and 50 deletions
+2
View File
@@ -65,6 +65,8 @@ gem 'dotenv-rails', '>= 3.0.0'
gem 'foreman' gem 'foreman'
gem 'puma' gem 'puma'
gem 'vite_rails' gem 'vite_rails'
# for legacy no cors support
gem 'vite_plugin_legacy'
# metrics on heroku # metrics on heroku
gem 'barnes' gem 'barnes'
+3
View File
@@ -798,6 +798,8 @@ GEM
activemodel (>= 3.2) activemodel (>= 3.2)
mail (~> 2.5) mail (~> 2.5)
version_gem (1.1.4) version_gem (1.1.4)
vite_plugin_legacy (3.0.2)
vite_ruby (~> 3.0, >= 3.0.4)
vite_rails (3.0.17) vite_rails (3.0.17)
railties (>= 5.1, < 8) railties (>= 5.1, < 8)
vite_ruby (~> 3.0, >= 3.2.2) vite_ruby (~> 3.0, >= 3.2.2)
@@ -959,6 +961,7 @@ DEPENDENCIES
tzinfo-data tzinfo-data
uglifier uglifier
valid_email2 valid_email2
vite_plugin_legacy
vite_rails vite_rails
web-console (>= 4.2.1) web-console (>= 4.2.1)
web-push (>= 3.0.1) web-push (>= 3.0.1)
@@ -23,11 +23,11 @@ export default {
// Once loaded, the loading state is hidden // Once loaded, the loading state is hidden
this.isLoading = false; this.isLoading = false;
}, },
handleIframeError() { // handleIframeError() {
// Hide the loading state and show the empty state when an error occurs // // Hide the loading state and show the empty state when an error occurs
this.isLoading = false; // this.isLoading = false;
this.showEmptyState = true; // this.showEmptyState = true;
}, // },
}, },
}; };
</script> </script>
@@ -39,7 +39,6 @@ export default {
:src="url" :src="url"
class="absolute w-full h-full top-0 left-0" class="absolute w-full h-full top-0 left-0"
@load="handleIframeLoad" @load="handleIframeLoad"
@error="handleIframeError"
/> />
<ArticleSkeletonLoader <ArticleSkeletonLoader
v-if="isLoading" v-if="isLoading"
@@ -3,7 +3,7 @@
<head> <head>
<title>SuperAdmin | Chatwoot</title> <title>SuperAdmin | Chatwoot</title>
<%= vite_client_tag %> <%= vite_client_tag %>
<%= vite_javascript_tag 'superadmin' %> <%= vite_javascript_tag 'superadmin', crossorigin: nil %>
</head> </head>
<body> <body>
<div class="h-full w-full antialiased"> <div class="h-full w-full antialiased">
@@ -73,5 +73,6 @@
<% end %> <% end %>
</main> </main>
</div> </div>
<%= vite_legacy_javascript_tag 'superadmin' %>
</body> </body>
</html> </html>
+2 -1
View File
@@ -22,7 +22,7 @@ By default, it renders:
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<%= vite_client_tag %> <%= vite_client_tag %>
<%= vite_javascript_tag 'portal' %> <%= vite_javascript_tag 'portal', crossorigin: nil %>
<style> <style>
#appearance-dropdown[data-current-theme="system"] .check-mark-icon.light-theme, #appearance-dropdown[data-current-theme="system"] .check-mark-icon.light-theme,
#appearance-dropdown[data-current-theme="system"] .check-mark-icon.dark-theme, #appearance-dropdown[data-current-theme="system"] .check-mark-icon.dark-theme,
@@ -132,4 +132,5 @@ By default, it renders:
<% if @portal.channel_web_widget.present? && !@is_plain_layout_enabled %> <% if @portal.channel_web_widget.present? && !@is_plain_layout_enabled %>
<%= @portal.channel_web_widget.web_widget_script.html_safe %> <%= @portal.channel_web_widget.web_widget_script.html_safe %>
<% end %> <% end %>
<%= vite_legacy_javascript_tag 'portal'%>
</html> </html>
@@ -23,7 +23,7 @@ By default, it renders:
</title> </title>
<%= render "stylesheet" %> <%= render "stylesheet" %>
<%= vite_client_tag %> <%= vite_client_tag %>
<%= vite_javascript_tag 'superadmin' %> <%= vite_javascript_tag 'superadmin', crossorigin: nil %>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
</head> </head>
<body class="antialiased w-full h-full"> <body class="antialiased w-full h-full">
@@ -36,5 +36,6 @@ By default, it renders:
</main> </main>
</div> </div>
<%= render "javascript" %> <%= render "javascript" %>
<%= vite_legacy_javascript_tag 'superadmin'%>
</body> </body>
</html> </html>
+2 -1
View File
@@ -64,7 +64,7 @@
</script> </script>
<% end %> <% end %>
<%= vite_client_tag %> <%= vite_client_tag %>
<%= vite_javascript_tag @application_pack %> <%= vite_javascript_tag @application_pack, crossorigin: nil %>
</head> </head>
<body class="text-slate-600"> <body class="text-slate-600">
<div id="app"></div> <div id="app"></div>
@@ -73,5 +73,6 @@
<% if @dashboard_scripts.present? %> <% if @dashboard_scripts.present? %>
<%= @dashboard_scripts.html_safe %> <%= @dashboard_scripts.html_safe %>
<% end %> <% end %>
<%= vite_legacy_javascript_tag @application_pack %>
</body> </body>
</html> </html>
@@ -8,8 +8,7 @@ as defined by the routes in the `admin/` namespace
%> %>
<%= vite_client_tag %> <%= vite_client_tag %>
<%= vite_javascript_tag 'superadmin_pages' %> <%= vite_javascript_tag 'superadmin_pages', crossorigin: nil %>
<% <%
sidebar_icons = { sidebar_icons = {
accounts: 'icon-building-4-line', accounts: 'icon-building-4-line',
@@ -59,4 +58,5 @@ as defined by the routes in the `admin/` namespace
<%= render partial: "nav_item", locals: { icon: 'icon-logout-circle-r-line', url: super_admin_logout_url, label: 'Logout' } %> <%= render partial: "nav_item", locals: { icon: 'icon-logout-circle-r-line', url: super_admin_logout_url, label: 'Logout' } %>
</ul> </ul>
</div> </div>
<%= vite_legacy_javascript_tag 'superadmin_pages'%>
</div> </div>
@@ -3,7 +3,7 @@
<head> <head>
<title>SuperAdmin | Chatwoot</title> <title>SuperAdmin | Chatwoot</title>
<%= vite_client_tag %> <%= vite_client_tag %>
<%= vite_javascript_tag 'superadmin' %> <%= vite_javascript_tag 'superadmin', crossorigin: nil %>
</head> </head>
<body> <body>
<div class="h-full w-full antialiased"> <div class="h-full w-full antialiased">
@@ -45,5 +45,6 @@
</section> </section>
</main> </main>
</div> </div>
<%= vite_legacy_javascript_tag 'superadmin'%>
</body> </body>
</html> </html>
+2 -1
View File
@@ -8,10 +8,11 @@
window.globalConfig = <%= raw @global_config.to_json %> window.globalConfig = <%= raw @global_config.to_json %>
</script> </script>
<%= vite_client_tag %> <%= vite_client_tag %>
<%= vite_javascript_tag 'survey' %> <%= vite_javascript_tag 'survey', crossorigin: nil %>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<%= yield %> <%= yield %>
<%= vite_legacy_javascript_tag 'survey'%>
</body> </body>
</html> </html>
+2 -1
View File
@@ -34,10 +34,11 @@
window.globalConfig = <%= raw @global_config.to_json %> window.globalConfig = <%= raw @global_config.to_json %>
</script> </script>
<%= vite_client_tag %> <%= vite_client_tag %>
<%= vite_javascript_tag 'widget' %> <%= vite_javascript_tag 'widget', crossorigin: nil %>
</head> </head>
<body> <body>
<div id="app" class="h-full"></div> <div id="app" class="h-full"></div>
<%= yield %> <%= yield %>
<%= vite_legacy_javascript_tag 'widget'%>
</body> </body>
</html> </html>
+1 -1
View File
@@ -34,7 +34,7 @@ Rails.application.configure do
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server. # Enable serving of images, stylesheets, and JavaScripts from an asset server.
config.action_controller.asset_host = ENV.fetch('ASSET_CDN_HOST') if ENV['ASSET_CDN_HOST'].present? # config.action_controller.asset_host = ENV.fetch('ASSET_CDN_HOST') if ENV['ASSET_CDN_HOST'].present?
# Specifies the header that your server uses for sending files. # Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
+2
View File
@@ -100,6 +100,7 @@
"@iconify-json/logos": "^1.2.0", "@iconify-json/logos": "^1.2.0",
"@iconify-json/lucide": "^1.2.5", "@iconify-json/lucide": "^1.2.5",
"@size-limit/file": "^8.2.4", "@size-limit/file": "^8.2.4",
"@vitejs/plugin-legacy": "^5.4.2",
"@vitest/coverage-v8": "^2.1.1", "@vitest/coverage-v8": "^2.1.1",
"@vue/test-utils": "^2.4.6", "@vue/test-utils": "^2.4.6",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
@@ -120,6 +121,7 @@
"prettier": "^3.3.3", "prettier": "^3.3.3",
"size-limit": "^8.2.4", "size-limit": "^8.2.4",
"tailwindcss": "^3.4.13", "tailwindcss": "^3.4.13",
"terser": "^5.34.1",
"vite": "^5.4.8", "vite": "^5.4.8",
"vite-plugin-ruby": "^5.0.0", "vite-plugin-ruby": "^5.0.0",
"vitest": "^2.1.1" "vitest": "^2.1.1"
+1648 -33
View File
File diff suppressed because it is too large Load Diff
+9 -1
View File
@@ -18,6 +18,7 @@ and build it separately using Vite itself, toggled by an ENV variable.
We need to edit the `asset:precompile` rake task to include the SDK in the precompile list. We need to edit the `asset:precompile` rake task to include the SDK in the precompile list.
*/ */
import legacy from '@vitejs/plugin-legacy';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import ruby from 'vite-plugin-ruby'; import ruby from 'vite-plugin-ruby';
import path from 'path'; import path from 'path';
@@ -34,7 +35,13 @@ const vueOptions = {
}, },
}; };
let plugins = [ruby(), vue(vueOptions)]; let plugins = [
legacy({
targets: ['defaults', 'not IE 11'],
}),
ruby(),
vue(vueOptions),
];
if (isLibraryMode) { if (isLibraryMode) {
plugins = []; plugins = [];
@@ -45,6 +52,7 @@ if (isLibraryMode) {
export default defineConfig({ export default defineConfig({
plugins: plugins, plugins: plugins,
build: { build: {
modulePreload: false,
rollupOptions: { rollupOptions: {
output: { output: {
// [NOTE] when not in library mode, no new keys will be addedd or overwritten // [NOTE] when not in library mode, no new keys will be addedd or overwritten