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 'puma'
gem 'vite_rails'
# for legacy no cors support
gem 'vite_plugin_legacy'
# metrics on heroku
gem 'barnes'
+3
View File
@@ -798,6 +798,8 @@ GEM
activemodel (>= 3.2)
mail (~> 2.5)
version_gem (1.1.4)
vite_plugin_legacy (3.0.2)
vite_ruby (~> 3.0, >= 3.0.4)
vite_rails (3.0.17)
railties (>= 5.1, < 8)
vite_ruby (~> 3.0, >= 3.2.2)
@@ -959,6 +961,7 @@ DEPENDENCIES
tzinfo-data
uglifier
valid_email2
vite_plugin_legacy
vite_rails
web-console (>= 4.2.1)
web-push (>= 3.0.1)
@@ -23,11 +23,11 @@ export default {
// Once loaded, the loading state is hidden
this.isLoading = false;
},
handleIframeError() {
// Hide the loading state and show the empty state when an error occurs
this.isLoading = false;
this.showEmptyState = true;
},
// handleIframeError() {
// // Hide the loading state and show the empty state when an error occurs
// this.isLoading = false;
// this.showEmptyState = true;
// },
},
};
</script>
@@ -39,7 +39,6 @@ export default {
:src="url"
class="absolute w-full h-full top-0 left-0"
@load="handleIframeLoad"
@error="handleIframeError"
/>
<ArticleSkeletonLoader
v-if="isLoading"
@@ -3,7 +3,7 @@
<head>
<title>SuperAdmin | Chatwoot</title>
<%= vite_client_tag %>
<%= vite_javascript_tag 'superadmin' %>
<%= vite_javascript_tag 'superadmin', crossorigin: nil %>
</head>
<body>
<div class="h-full w-full antialiased">
@@ -73,5 +73,6 @@
<% end %>
</main>
</div>
<%= vite_legacy_javascript_tag 'superadmin' %>
</body>
</html>
+2 -1
View File
@@ -22,7 +22,7 @@ By default, it renders:
<meta name="viewport" content="width=device-width, initial-scale=1" />
<%= vite_client_tag %>
<%= vite_javascript_tag 'portal' %>
<%= vite_javascript_tag 'portal', crossorigin: nil %>
<style>
#appearance-dropdown[data-current-theme="system"] .check-mark-icon.light-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 %>
<%= @portal.channel_web_widget.web_widget_script.html_safe %>
<% end %>
<%= vite_legacy_javascript_tag 'portal'%>
</html>
@@ -23,7 +23,7 @@ By default, it renders:
</title>
<%= render "stylesheet" %>
<%= vite_client_tag %>
<%= vite_javascript_tag 'superadmin' %>
<%= vite_javascript_tag 'superadmin', crossorigin: nil %>
<%= csrf_meta_tags %>
</head>
<body class="antialiased w-full h-full">
@@ -36,5 +36,6 @@ By default, it renders:
</main>
</div>
<%= render "javascript" %>
<%= vite_legacy_javascript_tag 'superadmin'%>
</body>
</html>
+2 -1
View File
@@ -64,7 +64,7 @@
</script>
<% end %>
<%= vite_client_tag %>
<%= vite_javascript_tag @application_pack %>
<%= vite_javascript_tag @application_pack, crossorigin: nil %>
</head>
<body class="text-slate-600">
<div id="app"></div>
@@ -73,5 +73,6 @@
<% if @dashboard_scripts.present? %>
<%= @dashboard_scripts.html_safe %>
<% end %>
<%= vite_legacy_javascript_tag @application_pack %>
</body>
</html>
@@ -8,8 +8,7 @@ as defined by the routes in the `admin/` namespace
%>
<%= vite_client_tag %>
<%= vite_javascript_tag 'superadmin_pages' %>
<%= vite_javascript_tag 'superadmin_pages', crossorigin: nil %>
<%
sidebar_icons = {
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' } %>
</ul>
</div>
<%= vite_legacy_javascript_tag 'superadmin_pages'%>
</div>
@@ -3,7 +3,7 @@
<head>
<title>SuperAdmin | Chatwoot</title>
<%= vite_client_tag %>
<%= vite_javascript_tag 'superadmin' %>
<%= vite_javascript_tag 'superadmin', crossorigin: nil %>
</head>
<body>
<div class="h-full w-full antialiased">
@@ -45,5 +45,6 @@
</section>
</main>
</div>
<%= vite_legacy_javascript_tag 'superadmin'%>
</body>
</html>
+2 -1
View File
@@ -8,10 +8,11 @@
window.globalConfig = <%= raw @global_config.to_json %>
</script>
<%= vite_client_tag %>
<%= vite_javascript_tag 'survey' %>
<%= vite_javascript_tag 'survey', crossorigin: nil %>
</head>
<body>
<div id="app"></div>
<%= yield %>
<%= vite_legacy_javascript_tag 'survey'%>
</body>
</html>
+2 -1
View File
@@ -34,10 +34,11 @@
window.globalConfig = <%= raw @global_config.to_json %>
</script>
<%= vite_client_tag %>
<%= vite_javascript_tag 'widget' %>
<%= vite_javascript_tag 'widget', crossorigin: nil %>
</head>
<body>
<div id="app" class="h-full"></div>
<%= yield %>
<%= vite_legacy_javascript_tag 'widget'%>
</body>
</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
# 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.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# 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/lucide": "^1.2.5",
"@size-limit/file": "^8.2.4",
"@vitejs/plugin-legacy": "^5.4.2",
"@vitest/coverage-v8": "^2.1.1",
"@vue/test-utils": "^2.4.6",
"autoprefixer": "^10.4.20",
@@ -120,6 +121,7 @@
"prettier": "^3.3.3",
"size-limit": "^8.2.4",
"tailwindcss": "^3.4.13",
"terser": "^5.34.1",
"vite": "^5.4.8",
"vite-plugin-ruby": "^5.0.0",
"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.
*/
import legacy from '@vitejs/plugin-legacy';
import { defineConfig } from 'vite';
import ruby from 'vite-plugin-ruby';
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) {
plugins = [];
@@ -45,6 +52,7 @@ if (isLibraryMode) {
export default defineConfig({
plugins: plugins,
build: {
modulePreload: false,
rollupOptions: {
output: {
// [NOTE] when not in library mode, no new keys will be addedd or overwritten