Improvements (#379)

* Improvements

- Fix button visibility in reports on light theme
- Unify logic for provider syncs
- Add default option is to skip accounts linking ( no op default )

* Stability fixes and UX improvements

* FIX add unlinking when deleting lunch flow connection as well

* Wrap updates in transaction

* Some more improvements

* FIX proper provider setup check

* Make provider section collapsible

* Fix balance calculation

* Restore focus ring

* Use browser default focus

* Fix lunch flow balance for credit cards
This commit is contained in:
soky srm
2025-11-25 20:21:29 +01:00
committed by GitHub
parent 97a8cb9407
commit 91a91c3834
28 changed files with 732 additions and 89 deletions

View File

@@ -113,6 +113,7 @@ module Provider::Configurable
@provider_key = provider_key
@fields = []
@provider_description = nil
@configured_check = nil
end
# Set the provider-level description (markdown supported)
@@ -121,6 +122,14 @@ module Provider::Configurable
@provider_description = text
end
# Define a custom check for whether this provider is configured
# @param block [Proc] A block that returns true if the provider is configured
# Example:
# configured_check { get_value(:client_id).present? && get_value(:secret).present? }
def configured_check(&block)
@configured_check = block
end
# Define a configuration field
# @param name [Symbol] The field name
# @param label [String] Human-readable label
@@ -150,9 +159,21 @@ module Provider::Configurable
field.value
end
# Check if all required fields are present
# Check if provider is properly configured
# Uses custom configured_check if defined, otherwise checks required fields
def configured?
fields.select(&:required).all? { |f| f.value.present? }
if @configured_check
instance_eval(&@configured_check)
else
required_fields = fields.select(&:required)
if required_fields.any?
required_fields.all? { |f| f.value.present? }
else
# If no required fields, provider is not considered configured
# unless it defines a custom configured_check
false
end
end
end
# Get all field values as a hash

View File

@@ -106,6 +106,9 @@ class Provider::PlaidAdapter < Provider::Base
env_key: "PLAID_ENV",
default: "sandbox",
description: "Plaid environment: sandbox, development, or production"
# Plaid requires both client_id and secret to be configured
configured_check { get_value(:client_id).present? && get_value(:secret).present? }
end
def provider_name

View File

@@ -45,6 +45,9 @@ class Provider::PlaidEuAdapter
env_key: "PLAID_EU_ENV",
default: "sandbox",
description: "Plaid environment: sandbox, development, or production"
# Plaid EU requires both client_id and secret to be configured
configured_check { get_value(:client_id).present? && get_value(:secret).present? }
end
# Thread-safe lazy loading of Plaid EU configuration