opnform-host-nginx/client/components/open/forms/OpenForm.vue

874 lines
27 KiB
Vue
Raw Normal View History

2023-12-09 15:47:03 +01:00
<template>
<div v-if="isAutoSubmit">
<p class="text-center p-4">
2023-12-11 11:56:21 +01:00
<Loader class="h-6 w-6 text-nt-blue mx-auto" />
2023-12-09 15:47:03 +01:00
</p>
</div>
<form
v-else-if="dataForm"
2024-08-08 12:00:36 +02:00
:style="computedStyle"
@submit.prevent=""
>
<FormTimer
ref="form-timer"
:form="form"
/>
<FormProgressbar
:form="form"
:fields="fields"
:form-data="dataFormValue"
/>
<transition
name="fade"
mode="out-in"
>
<div
:key="formPageIndex"
class="form-group flex flex-wrap w-full"
>
<draggable
:list="currentFields"
group="form-elements"
item-key="id"
2024-05-14 17:17:28 +02:00
class="grid grid-cols-12 relative transition-all w-full"
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
:class="[
draggingNewBlock ? 'rounded-md bg-blue-50 dark:bg-gray-800' : '',
]"
ghost-class="ghost-item"
filter=".not-draggable"
:animation="200"
Decouple title from title block (#696) * Decouple title from title block * fix lint * remove dry run for FormTitleMigration * Skip form title migration for forms with hidden titles * Refactor AI Form Generation with Dedicated Prompt Services - Extract AI form generation logic from GenerateTemplate command into dedicated prompt service classes - Update GenerateAiForm job to use new prompt generation services - Improve GptCompleter with more robust error handling and token tracking - Add error field to AiFormCompletion model for better error logging - Simplify command signature from 'ai:make-form-template' to 'form:generate' * Consolidate Template Metadata Generation with Unified Prompt Service - Create GenerateTemplateMetadataPrompt to centralize template metadata generation - Update GenerateTemplate command to use new consolidated metadata generation approach - Enhance GptCompleter to support strict JSON schema validation - Increase form prompt max length to support more complex form descriptions - Refactor form generation to simplify metadata extraction and processing * Implement Form Mode Strategy for Flexible Form Rendering - Introduce FormModeStrategy to centralize form rendering logic - Add support for different form modes: LIVE, PREVIEW, TEST, EDIT, PREFILL - Refactor components to use mode-based rendering strategy - Remove legacy boolean props like adminPreview and creating - Enhance form component flexibility and reusability * Refine Form Mode Strategy Display Behavior - Update FormModeStrategy to hide hidden fields in PREVIEW mode - Add FormMode getter in UrlFormPrefill component for mode-specific rendering - Clarify mode-specific validation and display logic in form strategies * Enhance Form Template Generation with Advanced Field Options - Update GenerateTemplate command to use front_url for template URL output - Expand GenerateFormPrompt with comprehensive field configuration options - Add support for advanced field types: date with time, toggle switches, radio/checkbox selections - Introduce field width configuration and HTML formatting for text elements - Re-enable select, multi-select, and matrix field type definitions with enhanced configurations * Remove Deprecated Template Metadata Generation Services - Delete multiple AI prompt services related to template metadata generation - Simplify GenerateTemplate command to use default values instead of complex metadata generation - Remove GenerateTemplateMetadataPrompt and related classes like GenerateTemplateDescriptionPrompt, GenerateTemplateImageKeywordsPrompt, etc. - Update form template generation to use basic fallback metadata generation approach * Restore GenerateTemplateMetadataPrompt for Comprehensive Template Generation - Reintroduce GenerateTemplateMetadataPrompt to replace default metadata generation - Update GenerateTemplate command to use consolidated metadata generation approach - Extract detailed metadata components including title, description, industries, and image search query - Improve template generation with more dynamic and AI-generated metadata * Refactor Template Preview Section Layout - Remove unnecessary nested div in template preview section - Simplify HTML structure for the template preview component - Maintain existing styling and functionality while improving code readability * Refactor Constructor and Code Formatting in AI Form Generation and Prompt Classes - Updated the constructor in GenerateAiForm.php to use a block structure for improved readability and consistency. - Added a blank line in the Prompt.php file to enhance code formatting and maintain consistency with PHP coding standards. - Modified the migration file to use a more concise class declaration syntax, improving clarity. These changes aim to enhance code readability and maintainability across the affected files. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-21 16:59:18 +01:00
:disabled="!formModeStrategy.admin.allowDragging"
@change="handleDragDropped"
2023-12-09 15:47:03 +01:00
>
<template #item="{element}">
<open-form-field
:field="element"
:show-hidden="showHidden"
:form="form"
:data-form="dataForm"
:data-form-value="dataFormValue"
:theme="theme"
:dark-mode="darkMode"
Decouple title from title block (#696) * Decouple title from title block * fix lint * remove dry run for FormTitleMigration * Skip form title migration for forms with hidden titles * Refactor AI Form Generation with Dedicated Prompt Services - Extract AI form generation logic from GenerateTemplate command into dedicated prompt service classes - Update GenerateAiForm job to use new prompt generation services - Improve GptCompleter with more robust error handling and token tracking - Add error field to AiFormCompletion model for better error logging - Simplify command signature from 'ai:make-form-template' to 'form:generate' * Consolidate Template Metadata Generation with Unified Prompt Service - Create GenerateTemplateMetadataPrompt to centralize template metadata generation - Update GenerateTemplate command to use new consolidated metadata generation approach - Enhance GptCompleter to support strict JSON schema validation - Increase form prompt max length to support more complex form descriptions - Refactor form generation to simplify metadata extraction and processing * Implement Form Mode Strategy for Flexible Form Rendering - Introduce FormModeStrategy to centralize form rendering logic - Add support for different form modes: LIVE, PREVIEW, TEST, EDIT, PREFILL - Refactor components to use mode-based rendering strategy - Remove legacy boolean props like adminPreview and creating - Enhance form component flexibility and reusability * Refine Form Mode Strategy Display Behavior - Update FormModeStrategy to hide hidden fields in PREVIEW mode - Add FormMode getter in UrlFormPrefill component for mode-specific rendering - Clarify mode-specific validation and display logic in form strategies * Enhance Form Template Generation with Advanced Field Options - Update GenerateTemplate command to use front_url for template URL output - Expand GenerateFormPrompt with comprehensive field configuration options - Add support for advanced field types: date with time, toggle switches, radio/checkbox selections - Introduce field width configuration and HTML formatting for text elements - Re-enable select, multi-select, and matrix field type definitions with enhanced configurations * Remove Deprecated Template Metadata Generation Services - Delete multiple AI prompt services related to template metadata generation - Simplify GenerateTemplate command to use default values instead of complex metadata generation - Remove GenerateTemplateMetadataPrompt and related classes like GenerateTemplateDescriptionPrompt, GenerateTemplateImageKeywordsPrompt, etc. - Update form template generation to use basic fallback metadata generation approach * Restore GenerateTemplateMetadataPrompt for Comprehensive Template Generation - Reintroduce GenerateTemplateMetadataPrompt to replace default metadata generation - Update GenerateTemplate command to use consolidated metadata generation approach - Extract detailed metadata components including title, description, industries, and image search query - Improve template generation with more dynamic and AI-generated metadata * Refactor Template Preview Section Layout - Remove unnecessary nested div in template preview section - Simplify HTML structure for the template preview component - Maintain existing styling and functionality while improving code readability * Refactor Constructor and Code Formatting in AI Form Generation and Prompt Classes - Updated the constructor in GenerateAiForm.php to use a block structure for improved readability and consistency. - Added a blank line in the Prompt.php file to enhance code formatting and maintain consistency with PHP coding standards. - Modified the migration file to use a more concise class declaration syntax, improving clarity. These changes aim to enhance code readability and maintainability across the affected files. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-21 16:59:18 +01:00
:mode="mode"
2023-12-09 15:47:03 +01:00
/>
</template>
</draggable>
</div>
</transition>
<!-- Captcha -->
<ClientOnly>
<div v-if="form.use_captcha && isLastPage && hasCaptchaProviders && isCaptchaProviderAvailable" class="mb-3 px-2 mt-4 mx-auto w-max">
<CaptchaInput
ref="captcha"
:provider="form.captcha_provider"
:form="dataForm"
:language="form.language"
:dark-mode="darkMode"
/>
</div>
<template #fallback>
<USkeleton class="h-[78px] w-[304px]" />
</template>
</ClientOnly>
2023-12-09 15:47:03 +01:00
<!-- Submit, Next and previous buttons -->
<div class="flex flex-wrap justify-center w-full">
<open-form-button
v-if="formPageIndex>0 && previousFieldsPageBreak && !loading"
native-type="button"
:color="form.color"
:theme="theme"
class="mt-2 px-8 mx-1"
@click="previousPage"
2023-12-09 15:47:03 +01:00
>
{{ previousFieldsPageBreak.previous_btn_text }}
</open-form-button>
<slot
v-if="isLastPage"
name="submit-btn"
:submit-form="submitForm"
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
:loading="dataForm.busy"
/>
<open-form-button
v-else-if="currentFieldsPageBreak"
native-type="button"
:color="form.color"
:theme="theme"
class="mt-2 px-8 mx-1"
:loading="dataForm.busy"
@click.stop="nextPage"
2023-12-09 15:47:03 +01:00
>
{{ currentFieldsPageBreak.next_btn_text }}
</open-form-button>
<div v-if="!currentFieldsPageBreak && !isLastPage">
{{ $t('forms.wrong_form_structure') }}
2023-12-09 15:47:03 +01:00
</div>
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
<div
v-if="paymentBlock"
class="mt-6 flex justify-center w-full"
>
<p class="text-xs text-gray-400 dark:text-gray-500 flex text-center max-w-md">
{{ $t('forms.payment.payment_disclaimer') }}
</p>
</div>
2023-12-09 15:47:03 +01:00
</div>
</form>
</template>
<script>
import draggable from 'vuedraggable'
import OpenFormButton from './OpenFormButton.vue'
Add reCAPTCHA support and update captcha provider handling (#647) * Add reCAPTCHA support and update captcha provider handling - Introduced reCAPTCHA as an additional captcha provider alongside hCaptcha. - Updated form request validation to handle different captcha providers based on user selection. - Added a new validation rule for reCAPTCHA. - Modified the forms model to include a 'captcha_provider' field. - Created a migration to add the 'captcha_provider' column to the forms table. - Updated frontend components to support dynamic rendering of captcha based on the selected provider. - Enhanced tests to cover scenarios for both hCaptcha and reCAPTCHA. These changes improve the flexibility of captcha options available to users, enhancing form security and user experience. * fix pint * change comment text * Refactor captcha implementation and integrate new captcha components - Removed the old RecaptchaV2 component and replaced it with a new implementation that supports both reCAPTCHA and hCaptcha through a unified CaptchaInput component. - Updated the OpenForm component to utilize the new CaptchaInput for dynamic captcha rendering based on user-selected provider. - Cleaned up the package.json by removing the deprecated @hcaptcha/vue3-hcaptcha dependency. - Enhanced form initialization to set a default captcha provider. - Improved error handling and cleanup for both reCAPTCHA and hCaptcha scripts. These changes streamline captcha integration, improve maintainability, and enhance user experience by providing a more flexible captcha solution. * Refactor captcha error messages and localization support * Refactor registration process to integrate reCAPTCHA - Replaced hCaptcha implementation with reCAPTCHA in RegisterController and related test cases. - Updated validation rules to utilize g-recaptcha-response instead of h-captcha-response. - Modified RegisterForm component to support reCAPTCHA, including changes to the form data structure and component references. - Enhanced test cases to reflect the new reCAPTCHA integration, ensuring proper validation and response handling. These changes improve security and user experience during the registration process by adopting a more widely used captcha solution. * Fix reCAPTCHA configuration and update RegisterForm styling - Corrected the configuration key for reCAPTCHA in RegisterController from 'services.recaptcha.secret_key' to 'services.re_captcha.secret_key'. - Updated the styling of the Captcha input section in RegisterForm.vue to improve layout consistency. These changes ensure proper reCAPTCHA functionality and enhance the user interface during the registration process. * Fix reCAPTCHA configuration in RegisterTest to use the correct key format - Updated the configuration key for reCAPTCHA in RegisterTest from 'services.recaptcha.secret_key' to 'services.re_captcha.secret_key' to ensure proper functionality during tests. This change aligns the test setup with the recent updates in the reCAPTCHA integration, improving the accuracy of the registration process tests. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2024-12-18 16:35:09 +01:00
import CaptchaInput from '~/components/forms/components/CaptchaInput.vue'
import OpenFormField from './OpenFormField.vue'
2024-01-16 15:00:22 +01:00
import {pendingSubmission} from "~/composables/forms/pendingSubmission.js"
import FormLogicPropertyResolver from "~/lib/forms/FormLogicPropertyResolver.js"
import CachedDefaultTheme from "~/lib/forms/themes/CachedDefaultTheme.js"
import FormTimer from './FormTimer.vue'
import FormProgressbar from './FormProgressbar.vue'
import { storeToRefs } from 'pinia'
Decouple title from title block (#696) * Decouple title from title block * fix lint * remove dry run for FormTitleMigration * Skip form title migration for forms with hidden titles * Refactor AI Form Generation with Dedicated Prompt Services - Extract AI form generation logic from GenerateTemplate command into dedicated prompt service classes - Update GenerateAiForm job to use new prompt generation services - Improve GptCompleter with more robust error handling and token tracking - Add error field to AiFormCompletion model for better error logging - Simplify command signature from 'ai:make-form-template' to 'form:generate' * Consolidate Template Metadata Generation with Unified Prompt Service - Create GenerateTemplateMetadataPrompt to centralize template metadata generation - Update GenerateTemplate command to use new consolidated metadata generation approach - Enhance GptCompleter to support strict JSON schema validation - Increase form prompt max length to support more complex form descriptions - Refactor form generation to simplify metadata extraction and processing * Implement Form Mode Strategy for Flexible Form Rendering - Introduce FormModeStrategy to centralize form rendering logic - Add support for different form modes: LIVE, PREVIEW, TEST, EDIT, PREFILL - Refactor components to use mode-based rendering strategy - Remove legacy boolean props like adminPreview and creating - Enhance form component flexibility and reusability * Refine Form Mode Strategy Display Behavior - Update FormModeStrategy to hide hidden fields in PREVIEW mode - Add FormMode getter in UrlFormPrefill component for mode-specific rendering - Clarify mode-specific validation and display logic in form strategies * Enhance Form Template Generation with Advanced Field Options - Update GenerateTemplate command to use front_url for template URL output - Expand GenerateFormPrompt with comprehensive field configuration options - Add support for advanced field types: date with time, toggle switches, radio/checkbox selections - Introduce field width configuration and HTML formatting for text elements - Re-enable select, multi-select, and matrix field type definitions with enhanced configurations * Remove Deprecated Template Metadata Generation Services - Delete multiple AI prompt services related to template metadata generation - Simplify GenerateTemplate command to use default values instead of complex metadata generation - Remove GenerateTemplateMetadataPrompt and related classes like GenerateTemplateDescriptionPrompt, GenerateTemplateImageKeywordsPrompt, etc. - Update form template generation to use basic fallback metadata generation approach * Restore GenerateTemplateMetadataPrompt for Comprehensive Template Generation - Reintroduce GenerateTemplateMetadataPrompt to replace default metadata generation - Update GenerateTemplate command to use consolidated metadata generation approach - Extract detailed metadata components including title, description, industries, and image search query - Improve template generation with more dynamic and AI-generated metadata * Refactor Template Preview Section Layout - Remove unnecessary nested div in template preview section - Simplify HTML structure for the template preview component - Maintain existing styling and functionality while improving code readability * Refactor Constructor and Code Formatting in AI Form Generation and Prompt Classes - Updated the constructor in GenerateAiForm.php to use a block structure for improved readability and consistency. - Added a blank line in the Prompt.php file to enhance code formatting and maintain consistency with PHP coding standards. - Modified the migration file to use a more concise class declaration syntax, improving clarity. These changes aim to enhance code readability and maintainability across the affected files. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-21 16:59:18 +01:00
import { FormMode, createFormModeStrategy } from "~/lib/forms/FormModeStrategy.js"
import clonedeep from 'clone-deep'
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
import { provideStripeElements } from '~/composables/useStripeElements'
2023-12-09 15:47:03 +01:00
export default {
name: 'OpenForm',
components: {draggable, OpenFormField, OpenFormButton, CaptchaInput, FormTimer, FormProgressbar},
2023-12-09 15:47:03 +01:00
props: {
form: {
type: Object,
required: true
},
theme: {
type: Object, default: () => {
const theme = inject("theme", null)
if (theme) {
return theme.value
}
return CachedDefaultTheme.getInstance()
}
},
2023-12-09 15:47:03 +01:00
loading: {
type: Boolean,
required: true
},
fields: {
type: Array,
required: true
},
defaultDataForm: { type: [Object, null] },
Decouple title from title block (#696) * Decouple title from title block * fix lint * remove dry run for FormTitleMigration * Skip form title migration for forms with hidden titles * Refactor AI Form Generation with Dedicated Prompt Services - Extract AI form generation logic from GenerateTemplate command into dedicated prompt service classes - Update GenerateAiForm job to use new prompt generation services - Improve GptCompleter with more robust error handling and token tracking - Add error field to AiFormCompletion model for better error logging - Simplify command signature from 'ai:make-form-template' to 'form:generate' * Consolidate Template Metadata Generation with Unified Prompt Service - Create GenerateTemplateMetadataPrompt to centralize template metadata generation - Update GenerateTemplate command to use new consolidated metadata generation approach - Enhance GptCompleter to support strict JSON schema validation - Increase form prompt max length to support more complex form descriptions - Refactor form generation to simplify metadata extraction and processing * Implement Form Mode Strategy for Flexible Form Rendering - Introduce FormModeStrategy to centralize form rendering logic - Add support for different form modes: LIVE, PREVIEW, TEST, EDIT, PREFILL - Refactor components to use mode-based rendering strategy - Remove legacy boolean props like adminPreview and creating - Enhance form component flexibility and reusability * Refine Form Mode Strategy Display Behavior - Update FormModeStrategy to hide hidden fields in PREVIEW mode - Add FormMode getter in UrlFormPrefill component for mode-specific rendering - Clarify mode-specific validation and display logic in form strategies * Enhance Form Template Generation with Advanced Field Options - Update GenerateTemplate command to use front_url for template URL output - Expand GenerateFormPrompt with comprehensive field configuration options - Add support for advanced field types: date with time, toggle switches, radio/checkbox selections - Introduce field width configuration and HTML formatting for text elements - Re-enable select, multi-select, and matrix field type definitions with enhanced configurations * Remove Deprecated Template Metadata Generation Services - Delete multiple AI prompt services related to template metadata generation - Simplify GenerateTemplate command to use default values instead of complex metadata generation - Remove GenerateTemplateMetadataPrompt and related classes like GenerateTemplateDescriptionPrompt, GenerateTemplateImageKeywordsPrompt, etc. - Update form template generation to use basic fallback metadata generation approach * Restore GenerateTemplateMetadataPrompt for Comprehensive Template Generation - Reintroduce GenerateTemplateMetadataPrompt to replace default metadata generation - Update GenerateTemplate command to use consolidated metadata generation approach - Extract detailed metadata components including title, description, industries, and image search query - Improve template generation with more dynamic and AI-generated metadata * Refactor Template Preview Section Layout - Remove unnecessary nested div in template preview section - Simplify HTML structure for the template preview component - Maintain existing styling and functionality while improving code readability * Refactor Constructor and Code Formatting in AI Form Generation and Prompt Classes - Updated the constructor in GenerateAiForm.php to use a block structure for improved readability and consistency. - Added a blank line in the Prompt.php file to enhance code formatting and maintain consistency with PHP coding standards. - Modified the migration file to use a more concise class declaration syntax, improving clarity. These changes aim to enhance code readability and maintainability across the affected files. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-21 16:59:18 +01:00
mode: {
type: String,
default: FormMode.LIVE,
validator: (value) => Object.values(FormMode).includes(value)
},
darkMode: {
type: Boolean,
default: false
}
2023-12-09 15:47:03 +01:00
},
emits: ['submit'],
setup(props) {
2023-12-09 15:47:03 +01:00
const recordsStore = useRecordsStore()
const workingFormStore = useWorkingFormStore()
const dataForm = ref(useForm())
const config = useRuntimeConfig()
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
// Provide Stripe elements to be used by child components
const stripeElements = provideStripeElements()
const hasCaptchaProviders = computed(() => {
return config.public.hCaptchaSiteKey || config.public.recaptchaSiteKey
})
2023-12-09 15:47:03 +01:00
return {
dataForm,
2023-12-09 15:47:03 +01:00
recordsStore,
workingFormStore,
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
stripeElements,
2024-08-08 12:00:36 +02:00
isIframe: useIsIframe(),
draggingNewBlock: computed(() => workingFormStore.draggingNewBlock),
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
pendingSubmission: import.meta.client ? pendingSubmission(props.form) : { get: () => ({}), set: () => {} },
formPageIndex: storeToRefs(workingFormStore).formPageIndex,
// Used for admin previews
selectedFieldIndex: computed(() => workingFormStore.selectedFieldIndex),
showEditFieldSidebar: computed(() => workingFormStore.showEditFieldSidebar),
hasCaptchaProviders
2023-12-09 15:47:03 +01:00
}
},
data() {
2023-12-09 15:47:03 +01:00
return {
isAutoSubmit: false,
isInitialLoad: true,
// Flag to prevent recursion in field group updates
isUpdatingFieldGroups: false,
2023-12-09 15:47:03 +01:00
}
},
computed: {
/**
* Create field groups (or Page) using page breaks if any
*/
fieldGroups() {
2023-12-09 15:47:03 +01:00
if (!this.fields) return []
const groups = []
let currentGroup = []
this.fields.forEach((field) => {
if (field.type === 'nf-page-break' && this.isFieldHidden(field)) return
currentGroup.push(field)
if (field.type === 'nf-page-break') {
groups.push(currentGroup)
currentGroup = []
}
})
groups.push(currentGroup)
return groups
},
Decouple title from title block (#696) * Decouple title from title block * fix lint * remove dry run for FormTitleMigration * Skip form title migration for forms with hidden titles * Refactor AI Form Generation with Dedicated Prompt Services - Extract AI form generation logic from GenerateTemplate command into dedicated prompt service classes - Update GenerateAiForm job to use new prompt generation services - Improve GptCompleter with more robust error handling and token tracking - Add error field to AiFormCompletion model for better error logging - Simplify command signature from 'ai:make-form-template' to 'form:generate' * Consolidate Template Metadata Generation with Unified Prompt Service - Create GenerateTemplateMetadataPrompt to centralize template metadata generation - Update GenerateTemplate command to use new consolidated metadata generation approach - Enhance GptCompleter to support strict JSON schema validation - Increase form prompt max length to support more complex form descriptions - Refactor form generation to simplify metadata extraction and processing * Implement Form Mode Strategy for Flexible Form Rendering - Introduce FormModeStrategy to centralize form rendering logic - Add support for different form modes: LIVE, PREVIEW, TEST, EDIT, PREFILL - Refactor components to use mode-based rendering strategy - Remove legacy boolean props like adminPreview and creating - Enhance form component flexibility and reusability * Refine Form Mode Strategy Display Behavior - Update FormModeStrategy to hide hidden fields in PREVIEW mode - Add FormMode getter in UrlFormPrefill component for mode-specific rendering - Clarify mode-specific validation and display logic in form strategies * Enhance Form Template Generation with Advanced Field Options - Update GenerateTemplate command to use front_url for template URL output - Expand GenerateFormPrompt with comprehensive field configuration options - Add support for advanced field types: date with time, toggle switches, radio/checkbox selections - Introduce field width configuration and HTML formatting for text elements - Re-enable select, multi-select, and matrix field type definitions with enhanced configurations * Remove Deprecated Template Metadata Generation Services - Delete multiple AI prompt services related to template metadata generation - Simplify GenerateTemplate command to use default values instead of complex metadata generation - Remove GenerateTemplateMetadataPrompt and related classes like GenerateTemplateDescriptionPrompt, GenerateTemplateImageKeywordsPrompt, etc. - Update form template generation to use basic fallback metadata generation approach * Restore GenerateTemplateMetadataPrompt for Comprehensive Template Generation - Reintroduce GenerateTemplateMetadataPrompt to replace default metadata generation - Update GenerateTemplate command to use consolidated metadata generation approach - Extract detailed metadata components including title, description, industries, and image search query - Improve template generation with more dynamic and AI-generated metadata * Refactor Template Preview Section Layout - Remove unnecessary nested div in template preview section - Simplify HTML structure for the template preview component - Maintain existing styling and functionality while improving code readability * Refactor Constructor and Code Formatting in AI Form Generation and Prompt Classes - Updated the constructor in GenerateAiForm.php to use a block structure for improved readability and consistency. - Added a blank line in the Prompt.php file to enhance code formatting and maintain consistency with PHP coding standards. - Modified the migration file to use a more concise class declaration syntax, improving clarity. These changes aim to enhance code readability and maintainability across the affected files. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-21 16:59:18 +01:00
/**
* Gets the comprehensive strategy based on the form mode
*/
formModeStrategy() {
return createFormModeStrategy(this.mode)
},
/**
* Determines if hidden fields should be shown based on the mode
*/
showHidden() {
return this.formModeStrategy.display.showHiddenFields
},
/**
* Determines if the form is in admin preview mode
*/
isAdminPreview() {
return this.formModeStrategy.admin.showAdminControls
},
2023-12-09 15:47:03 +01:00
currentFields: {
get() {
return this.fieldGroups[this.formPageIndex]
2023-12-09 15:47:03 +01:00
},
set(val) {
2023-12-09 15:47:03 +01:00
// On re-order from the form, set the new order
// Add the previous groups and next to val, and set the properties on working form
const newFields = []
this.fieldGroups.forEach((group, index) => {
if (index < this.formPageIndex) {
2023-12-09 15:47:03 +01:00
newFields.push(...group)
} else if (index === this.formPageIndex) {
2023-12-09 15:47:03 +01:00
newFields.push(...val)
} else {
newFields.push(...group)
}
})
// set the properties on working_form store
this.workingFormStore.setProperties(newFields)
}
},
/**
* Returns the page break block for the current group of fields
*/
currentFieldsPageBreak() {
2024-01-17 12:43:52 +01:00
// Last block from current group
2024-02-10 12:20:45 +01:00
if (!this.currentFields?.length) return null
2023-12-09 15:47:03 +01:00
const block = this.currentFields[this.currentFields.length - 1]
if (block && block.type === 'nf-page-break') return block
return null
},
previousFieldsPageBreak() {
if (this.formPageIndex === 0) return null
const previousFields = this.fieldGroups[this.formPageIndex - 1]
2023-12-09 15:47:03 +01:00
const block = previousFields[previousFields.length - 1]
if (block && block.type === 'nf-page-break') return block
return null
},
/**
* Returns true if we're on the last page
* @returns {boolean}xs
*/
isLastPage() {
return this.formPageIndex === (this.fieldGroups.length - 1)
2023-12-09 15:47:03 +01:00
},
isPublicFormPage() {
return this.$route.name === 'forms-slug'
2023-12-09 15:47:03 +01:00
},
dataFormValue() {
2023-12-09 15:47:03 +01:00
// For get values instead of Id for select/multi select options
const data = this.dataForm.data()
const selectionFields = this.fields.filter((field) => {
return ['select', 'multi_select'].includes(field.type)
})
selectionFields.forEach((field) => {
if (data[field.id] !== undefined && data[field.id] !== null && Array.isArray(data[field.id])) {
data[field.id] = data[field.id].map(option_nfid => {
const tmpop = field[field.type].options.find((op) => {
return (op.id === option_nfid)
})
return (tmpop) ? tmpop.name : option_nfid
})
}
})
return data
2024-08-08 12:00:36 +02:00
},
computedStyle() {
return {
'--form-color': this.form.color
2024-08-08 12:00:36 +02:00
}
},
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
paymentBlock() {
return (this.currentFields) ? this.currentFields.find(field => field.type === 'payment') : null
},
isCaptchaProviderAvailable() {
const config = useRuntimeConfig()
if (this.form.captcha_provider === 'recaptcha') {
return !!config.public.recaptchaSiteKey
} else if (this.form.captcha_provider === 'hcaptcha') {
return !!config.public.hCaptchaSiteKey
}
return false
2023-12-09 15:47:03 +01:00
}
},
watch: {
// Monitor only critical changes that require full reinitialization
'form.database_id': function() {
// Only reinitialize when database changes
this.initForm()
2023-12-09 15:47:03 +01:00
},
'fields.length': function() {
// Only reinitialize when fields are added or removed
this.updateFieldGroupsSafely()
},
// Watch for changes to individual field properties
'fields': {
2023-12-09 15:47:03 +01:00
deep: true,
handler() {
// Skip update if only triggered by internal fieldGroups changes
if (this.isUpdatingFieldGroups) return
// Safely update field groups without causing recursive updates
this.updateFieldGroupsSafely()
2023-12-09 15:47:03 +01:00
}
},
dataFormValue: {
2023-12-09 15:47:03 +01:00
deep: true,
handler() {
if (this.isPublicFormPage && this.form && this.form.auto_save) {
this.pendingSubmission.set(this.dataFormValue)
2023-12-09 15:47:03 +01:00
}
}
},
// These watchers ensure the form shows the correct page for the field being edited in admin preview
selectedFieldIndex: {
handler(newIndex) {
Decouple title from title block (#696) * Decouple title from title block * fix lint * remove dry run for FormTitleMigration * Skip form title migration for forms with hidden titles * Refactor AI Form Generation with Dedicated Prompt Services - Extract AI form generation logic from GenerateTemplate command into dedicated prompt service classes - Update GenerateAiForm job to use new prompt generation services - Improve GptCompleter with more robust error handling and token tracking - Add error field to AiFormCompletion model for better error logging - Simplify command signature from 'ai:make-form-template' to 'form:generate' * Consolidate Template Metadata Generation with Unified Prompt Service - Create GenerateTemplateMetadataPrompt to centralize template metadata generation - Update GenerateTemplate command to use new consolidated metadata generation approach - Enhance GptCompleter to support strict JSON schema validation - Increase form prompt max length to support more complex form descriptions - Refactor form generation to simplify metadata extraction and processing * Implement Form Mode Strategy for Flexible Form Rendering - Introduce FormModeStrategy to centralize form rendering logic - Add support for different form modes: LIVE, PREVIEW, TEST, EDIT, PREFILL - Refactor components to use mode-based rendering strategy - Remove legacy boolean props like adminPreview and creating - Enhance form component flexibility and reusability * Refine Form Mode Strategy Display Behavior - Update FormModeStrategy to hide hidden fields in PREVIEW mode - Add FormMode getter in UrlFormPrefill component for mode-specific rendering - Clarify mode-specific validation and display logic in form strategies * Enhance Form Template Generation with Advanced Field Options - Update GenerateTemplate command to use front_url for template URL output - Expand GenerateFormPrompt with comprehensive field configuration options - Add support for advanced field types: date with time, toggle switches, radio/checkbox selections - Introduce field width configuration and HTML formatting for text elements - Re-enable select, multi-select, and matrix field type definitions with enhanced configurations * Remove Deprecated Template Metadata Generation Services - Delete multiple AI prompt services related to template metadata generation - Simplify GenerateTemplate command to use default values instead of complex metadata generation - Remove GenerateTemplateMetadataPrompt and related classes like GenerateTemplateDescriptionPrompt, GenerateTemplateImageKeywordsPrompt, etc. - Update form template generation to use basic fallback metadata generation approach * Restore GenerateTemplateMetadataPrompt for Comprehensive Template Generation - Reintroduce GenerateTemplateMetadataPrompt to replace default metadata generation - Update GenerateTemplate command to use consolidated metadata generation approach - Extract detailed metadata components including title, description, industries, and image search query - Improve template generation with more dynamic and AI-generated metadata * Refactor Template Preview Section Layout - Remove unnecessary nested div in template preview section - Simplify HTML structure for the template preview component - Maintain existing styling and functionality while improving code readability * Refactor Constructor and Code Formatting in AI Form Generation and Prompt Classes - Updated the constructor in GenerateAiForm.php to use a block structure for improved readability and consistency. - Added a blank line in the Prompt.php file to enhance code formatting and maintain consistency with PHP coding standards. - Modified the migration file to use a more concise class declaration syntax, improving clarity. These changes aim to enhance code readability and maintainability across the affected files. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-21 16:59:18 +01:00
if (this.isAdminPreview && this.showEditFieldSidebar) {
this.setPageForField(newIndex)
}
}
},
showEditFieldSidebar: {
handler(newValue) {
Decouple title from title block (#696) * Decouple title from title block * fix lint * remove dry run for FormTitleMigration * Skip form title migration for forms with hidden titles * Refactor AI Form Generation with Dedicated Prompt Services - Extract AI form generation logic from GenerateTemplate command into dedicated prompt service classes - Update GenerateAiForm job to use new prompt generation services - Improve GptCompleter with more robust error handling and token tracking - Add error field to AiFormCompletion model for better error logging - Simplify command signature from 'ai:make-form-template' to 'form:generate' * Consolidate Template Metadata Generation with Unified Prompt Service - Create GenerateTemplateMetadataPrompt to centralize template metadata generation - Update GenerateTemplate command to use new consolidated metadata generation approach - Enhance GptCompleter to support strict JSON schema validation - Increase form prompt max length to support more complex form descriptions - Refactor form generation to simplify metadata extraction and processing * Implement Form Mode Strategy for Flexible Form Rendering - Introduce FormModeStrategy to centralize form rendering logic - Add support for different form modes: LIVE, PREVIEW, TEST, EDIT, PREFILL - Refactor components to use mode-based rendering strategy - Remove legacy boolean props like adminPreview and creating - Enhance form component flexibility and reusability * Refine Form Mode Strategy Display Behavior - Update FormModeStrategy to hide hidden fields in PREVIEW mode - Add FormMode getter in UrlFormPrefill component for mode-specific rendering - Clarify mode-specific validation and display logic in form strategies * Enhance Form Template Generation with Advanced Field Options - Update GenerateTemplate command to use front_url for template URL output - Expand GenerateFormPrompt with comprehensive field configuration options - Add support for advanced field types: date with time, toggle switches, radio/checkbox selections - Introduce field width configuration and HTML formatting for text elements - Re-enable select, multi-select, and matrix field type definitions with enhanced configurations * Remove Deprecated Template Metadata Generation Services - Delete multiple AI prompt services related to template metadata generation - Simplify GenerateTemplate command to use default values instead of complex metadata generation - Remove GenerateTemplateMetadataPrompt and related classes like GenerateTemplateDescriptionPrompt, GenerateTemplateImageKeywordsPrompt, etc. - Update form template generation to use basic fallback metadata generation approach * Restore GenerateTemplateMetadataPrompt for Comprehensive Template Generation - Reintroduce GenerateTemplateMetadataPrompt to replace default metadata generation - Update GenerateTemplate command to use consolidated metadata generation approach - Extract detailed metadata components including title, description, industries, and image search query - Improve template generation with more dynamic and AI-generated metadata * Refactor Template Preview Section Layout - Remove unnecessary nested div in template preview section - Simplify HTML structure for the template preview component - Maintain existing styling and functionality while improving code readability * Refactor Constructor and Code Formatting in AI Form Generation and Prompt Classes - Updated the constructor in GenerateAiForm.php to use a block structure for improved readability and consistency. - Added a blank line in the Prompt.php file to enhance code formatting and maintain consistency with PHP coding standards. - Modified the migration file to use a more concise class declaration syntax, improving clarity. These changes aim to enhance code readability and maintainability across the affected files. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-21 16:59:18 +01:00
if (this.isAdminPreview && newValue) {
this.setPageForField(this.selectedFieldIndex)
}
}
2023-12-09 15:47:03 +01:00
}
},
beforeMount() {
2023-12-09 15:47:03 +01:00
this.initForm()
},
mounted() {
2025-01-28 09:23:11 +01:00
nextTick(() => {
if (this.$refs['form-timer']) {
this.$refs['form-timer'].startTimer()
}
})
if (import.meta.client && window.location.href.includes('auto_submit=true')) {
2023-12-09 15:47:03 +01:00
this.isAutoSubmit = true
this.submitForm()
}
},
methods: {
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
async submitForm() {
this.dataForm.busy = true
try {
if (!await this.nextPage()) {
this.dataForm.busy = false
return
}
2023-12-09 15:47:03 +01:00
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
if (!this.isAutoSubmit && this.formPageIndex !== this.fieldGroups.length - 1) {
this.dataForm.busy = false
return
}
2023-12-09 15:47:03 +01:00
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
if (this.form.use_captcha && import.meta.client) {
this.$refs.captcha?.reset()
}
if (this.form.editable_submissions && this.form.submission_id) {
this.dataForm.submission_id = this.form.submission_id
}
2023-12-09 15:47:03 +01:00
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
this.$refs['form-timer'].stopTimer()
this.dataForm.completion_time = this.$refs['form-timer'].completionTime
// Add validation strategy check
if (!this.formModeStrategy.validation.validateOnSubmit) {
this.$emit('submit', this.dataForm, this.onSubmissionFailure)
return
}
Decouple title from title block (#696) * Decouple title from title block * fix lint * remove dry run for FormTitleMigration * Skip form title migration for forms with hidden titles * Refactor AI Form Generation with Dedicated Prompt Services - Extract AI form generation logic from GenerateTemplate command into dedicated prompt service classes - Update GenerateAiForm job to use new prompt generation services - Improve GptCompleter with more robust error handling and token tracking - Add error field to AiFormCompletion model for better error logging - Simplify command signature from 'ai:make-form-template' to 'form:generate' * Consolidate Template Metadata Generation with Unified Prompt Service - Create GenerateTemplateMetadataPrompt to centralize template metadata generation - Update GenerateTemplate command to use new consolidated metadata generation approach - Enhance GptCompleter to support strict JSON schema validation - Increase form prompt max length to support more complex form descriptions - Refactor form generation to simplify metadata extraction and processing * Implement Form Mode Strategy for Flexible Form Rendering - Introduce FormModeStrategy to centralize form rendering logic - Add support for different form modes: LIVE, PREVIEW, TEST, EDIT, PREFILL - Refactor components to use mode-based rendering strategy - Remove legacy boolean props like adminPreview and creating - Enhance form component flexibility and reusability * Refine Form Mode Strategy Display Behavior - Update FormModeStrategy to hide hidden fields in PREVIEW mode - Add FormMode getter in UrlFormPrefill component for mode-specific rendering - Clarify mode-specific validation and display logic in form strategies * Enhance Form Template Generation with Advanced Field Options - Update GenerateTemplate command to use front_url for template URL output - Expand GenerateFormPrompt with comprehensive field configuration options - Add support for advanced field types: date with time, toggle switches, radio/checkbox selections - Introduce field width configuration and HTML formatting for text elements - Re-enable select, multi-select, and matrix field type definitions with enhanced configurations * Remove Deprecated Template Metadata Generation Services - Delete multiple AI prompt services related to template metadata generation - Simplify GenerateTemplate command to use default values instead of complex metadata generation - Remove GenerateTemplateMetadataPrompt and related classes like GenerateTemplateDescriptionPrompt, GenerateTemplateImageKeywordsPrompt, etc. - Update form template generation to use basic fallback metadata generation approach * Restore GenerateTemplateMetadataPrompt for Comprehensive Template Generation - Reintroduce GenerateTemplateMetadataPrompt to replace default metadata generation - Update GenerateTemplate command to use consolidated metadata generation approach - Extract detailed metadata components including title, description, industries, and image search query - Improve template generation with more dynamic and AI-generated metadata * Refactor Template Preview Section Layout - Remove unnecessary nested div in template preview section - Simplify HTML structure for the template preview component - Maintain existing styling and functionality while improving code readability * Refactor Constructor and Code Formatting in AI Form Generation and Prompt Classes - Updated the constructor in GenerateAiForm.php to use a block structure for improved readability and consistency. - Added a blank line in the Prompt.php file to enhance code formatting and maintain consistency with PHP coding standards. - Modified the migration file to use a more concise class declaration syntax, improving clarity. These changes aim to enhance code readability and maintainability across the affected files. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-21 16:59:18 +01:00
this.$emit('submit', this.dataForm, this.onSubmissionFailure)
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
} catch (error) {
this.handleValidationError(error)
this.dataForm.busy = false
Decouple title from title block (#696) * Decouple title from title block * fix lint * remove dry run for FormTitleMigration * Skip form title migration for forms with hidden titles * Refactor AI Form Generation with Dedicated Prompt Services - Extract AI form generation logic from GenerateTemplate command into dedicated prompt service classes - Update GenerateAiForm job to use new prompt generation services - Improve GptCompleter with more robust error handling and token tracking - Add error field to AiFormCompletion model for better error logging - Simplify command signature from 'ai:make-form-template' to 'form:generate' * Consolidate Template Metadata Generation with Unified Prompt Service - Create GenerateTemplateMetadataPrompt to centralize template metadata generation - Update GenerateTemplate command to use new consolidated metadata generation approach - Enhance GptCompleter to support strict JSON schema validation - Increase form prompt max length to support more complex form descriptions - Refactor form generation to simplify metadata extraction and processing * Implement Form Mode Strategy for Flexible Form Rendering - Introduce FormModeStrategy to centralize form rendering logic - Add support for different form modes: LIVE, PREVIEW, TEST, EDIT, PREFILL - Refactor components to use mode-based rendering strategy - Remove legacy boolean props like adminPreview and creating - Enhance form component flexibility and reusability * Refine Form Mode Strategy Display Behavior - Update FormModeStrategy to hide hidden fields in PREVIEW mode - Add FormMode getter in UrlFormPrefill component for mode-specific rendering - Clarify mode-specific validation and display logic in form strategies * Enhance Form Template Generation with Advanced Field Options - Update GenerateTemplate command to use front_url for template URL output - Expand GenerateFormPrompt with comprehensive field configuration options - Add support for advanced field types: date with time, toggle switches, radio/checkbox selections - Introduce field width configuration and HTML formatting for text elements - Re-enable select, multi-select, and matrix field type definitions with enhanced configurations * Remove Deprecated Template Metadata Generation Services - Delete multiple AI prompt services related to template metadata generation - Simplify GenerateTemplate command to use default values instead of complex metadata generation - Remove GenerateTemplateMetadataPrompt and related classes like GenerateTemplateDescriptionPrompt, GenerateTemplateImageKeywordsPrompt, etc. - Update form template generation to use basic fallback metadata generation approach * Restore GenerateTemplateMetadataPrompt for Comprehensive Template Generation - Reintroduce GenerateTemplateMetadataPrompt to replace default metadata generation - Update GenerateTemplate command to use consolidated metadata generation approach - Extract detailed metadata components including title, description, industries, and image search query - Improve template generation with more dynamic and AI-generated metadata * Refactor Template Preview Section Layout - Remove unnecessary nested div in template preview section - Simplify HTML structure for the template preview component - Maintain existing styling and functionality while improving code readability * Refactor Constructor and Code Formatting in AI Form Generation and Prompt Classes - Updated the constructor in GenerateAiForm.php to use a block structure for improved readability and consistency. - Added a blank line in the Prompt.php file to enhance code formatting and maintain consistency with PHP coding standards. - Modified the migration file to use a more concise class declaration syntax, improving clarity. These changes aim to enhance code readability and maintainability across the affected files. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-21 16:59:18 +01:00
}
2023-12-09 15:47:03 +01:00
},
/**
* Handle form submission failure
2023-12-09 15:47:03 +01:00
*/
onSubmissionFailure() {
this.$refs['form-timer'].startTimer()
2023-12-09 15:47:03 +01:00
this.isAutoSubmit = false
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
this.dataForm.busy = false
2023-12-09 15:47:03 +01:00
if (this.fieldGroups.length > 1) {
this.showFirstPageWithError()
2023-12-09 15:47:03 +01:00
}
this.scrollToFirstError()
},
showFirstPageWithError() {
for (let i = 0; i < this.fieldGroups.length; i++) {
if (this.fieldGroups[i].some(field => this.dataForm.errors.has(field.id))) {
this.formPageIndex = i
break
}
}
},
scrollToFirstError() {
if (import.meta.server) return
const firstErrorElement = document.querySelector('.has-error')
if (firstErrorElement) {
2023-12-09 15:47:03 +01:00
window.scroll({
top: window.scrollY + firstErrorElement.getBoundingClientRect().top - 60,
2023-12-09 15:47:03 +01:00
behavior: 'smooth'
})
}
},
async getSubmissionData() {
2023-12-09 15:47:03 +01:00
if (!this.form || !this.form.editable_submissions || !this.form.submission_id) {
return null
}
await this.recordsStore.loadRecord(
opnFetch('/forms/' + this.form.slug + '/submissions/' + this.form.submission_id).then((data) => {
return {submission_id: this.form.submission_id, id: this.form.submission_id, ...data.data}
}).catch((error) => {
if (error?.data?.errors) {
useAlert().formValidationError(error.data)
} else {
useAlert().error(error?.data?.message || 'Something went wrong')
}
return null
2023-12-09 15:47:03 +01:00
})
)
return this.recordsStore.getByKey(this.form.submission_id)
2023-12-09 15:47:03 +01:00
},
/**
* Form initialization
*/
async initForm() {
// Only do a full initialization when necessary
// Store current page index and form data to avoid overwriting existing values
const currentFormData = this.dataForm ? clonedeep(this.dataForm.data()) : {}
// Handle special cases first
if (this.defaultDataForm) {
// If we have default data form, initialize with that
await nextTick(() => {
this.dataForm.resetAndFill(this.defaultDataForm)
})
this.updateFieldGroupsSafely()
return
}
// Initialize the field groups without resetting form data
this.updateFieldGroupsSafely()
// Check if we need to handle form submission states
if (await this.checkForEditableSubmission()) {
return
}
if (this.checkForPendingSubmission()) {
return
}
// Standard initialization with default values
this.initFormWithDefaultValues(currentFormData)
},
checkForEditableSubmission() {
return this.tryInitFormFromEditableSubmission()
},
checkForPendingSubmission() {
if (this.tryInitFormFromPendingSubmission()) {
this.updateFieldGroupsSafely()
return true
}
return false
},
async tryInitFormFromEditableSubmission() {
2023-12-09 15:47:03 +01:00
if (this.isPublicFormPage && this.form.editable_submissions) {
const submissionId = useRoute().query?.submission_id
if (submissionId) {
this.form.submission_id = submissionId
2023-12-09 15:47:03 +01:00
const data = await this.getSubmissionData()
if (data) {
this.dataForm.resetAndFill(data)
return true
2023-12-09 15:47:03 +01:00
}
}
}
return false
},
tryInitFormFromPendingSubmission() {
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
if (!this.pendingSubmission || !this.isPublicFormPage || !this.form.auto_save) {
return false
2023-12-09 15:47:03 +01:00
}
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
const pendingData = this.pendingSubmission.get()
if (pendingData && Object.keys(pendingData).length !== 0) {
this.updatePendingDataFields(pendingData)
this.dataForm.resetAndFill(pendingData)
return true
}
return false
},
updatePendingDataFields(pendingData) {
this.fields.forEach(field => {
if (field.type === 'date' && field.prefill_today) {
pendingData[field.id] = new Date().toISOString()
2023-12-09 15:47:03 +01:00
}
})
},
initFormWithDefaultValues(currentFormData = {}) {
// Only set page 0 on first load, otherwise maintain current position
if (this.formPageIndex === undefined || this.isInitialLoad) {
this.formPageIndex = 0
this.isInitialLoad = false
}
// Initialize form data with default values
const formData = { ...currentFormData }
const urlPrefill = this.isPublicFormPage ? new URLSearchParams(window.location.search) : null
2023-12-09 15:47:03 +01:00
this.fields.forEach(field => {
if (field.type.startsWith('nf-') && !['nf-page-body-input', 'nf-page-logo', 'nf-page-cover'].includes(field.type)) return
this.handleUrlPrefill(field, formData, urlPrefill)
this.handleDefaultPrefill(field, formData)
2023-12-09 15:47:03 +01:00
})
// Reset form with new data
this.dataForm.resetAndFill(formData)
2023-12-09 15:47:03 +01:00
},
handleUrlPrefill(field, formData, urlPrefill) {
if (!urlPrefill) return
const prefillValue = (() => {
const val = urlPrefill.get(field.id)
try {
return typeof val === 'string' && val.startsWith('{') ? JSON.parse(val) : val
} catch (e) {
return val
}
})()
const arrayPrefillValue = urlPrefill.getAll(field.id + '[]')
if (typeof prefillValue === 'object' && prefillValue !== null) {
formData[field.id] = { ...prefillValue }
} else if (prefillValue !== null) {
formData[field.id] = field.type === 'checkbox' ? this.parseBooleanValue(prefillValue) : prefillValue
} else if (arrayPrefillValue.length > 0) {
formData[field.id] = arrayPrefillValue
}
},
parseBooleanValue(value) {
return value === 'true' || value === '1'
},
handleDefaultPrefill(field, formData) {
if (field.type === 'date' && field.prefill_today) {
formData[field.id] = new Date().toISOString()
} else if (field.type === 'matrix' && !formData[field.id]) {
formData[field.id] = {...field.prefill}
} else if (!(field.id in formData)) {
formData[field.id] = field.prefill
}
},
/**
* Page Navigation
*/
previousPage() {
this.formPageIndex--
this.scrollToTop()
2023-12-09 15:47:03 +01:00
},
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
async nextPage() {
Decouple title from title block (#696) * Decouple title from title block * fix lint * remove dry run for FormTitleMigration * Skip form title migration for forms with hidden titles * Refactor AI Form Generation with Dedicated Prompt Services - Extract AI form generation logic from GenerateTemplate command into dedicated prompt service classes - Update GenerateAiForm job to use new prompt generation services - Improve GptCompleter with more robust error handling and token tracking - Add error field to AiFormCompletion model for better error logging - Simplify command signature from 'ai:make-form-template' to 'form:generate' * Consolidate Template Metadata Generation with Unified Prompt Service - Create GenerateTemplateMetadataPrompt to centralize template metadata generation - Update GenerateTemplate command to use new consolidated metadata generation approach - Enhance GptCompleter to support strict JSON schema validation - Increase form prompt max length to support more complex form descriptions - Refactor form generation to simplify metadata extraction and processing * Implement Form Mode Strategy for Flexible Form Rendering - Introduce FormModeStrategy to centralize form rendering logic - Add support for different form modes: LIVE, PREVIEW, TEST, EDIT, PREFILL - Refactor components to use mode-based rendering strategy - Remove legacy boolean props like adminPreview and creating - Enhance form component flexibility and reusability * Refine Form Mode Strategy Display Behavior - Update FormModeStrategy to hide hidden fields in PREVIEW mode - Add FormMode getter in UrlFormPrefill component for mode-specific rendering - Clarify mode-specific validation and display logic in form strategies * Enhance Form Template Generation with Advanced Field Options - Update GenerateTemplate command to use front_url for template URL output - Expand GenerateFormPrompt with comprehensive field configuration options - Add support for advanced field types: date with time, toggle switches, radio/checkbox selections - Introduce field width configuration and HTML formatting for text elements - Re-enable select, multi-select, and matrix field type definitions with enhanced configurations * Remove Deprecated Template Metadata Generation Services - Delete multiple AI prompt services related to template metadata generation - Simplify GenerateTemplate command to use default values instead of complex metadata generation - Remove GenerateTemplateMetadataPrompt and related classes like GenerateTemplateDescriptionPrompt, GenerateTemplateImageKeywordsPrompt, etc. - Update form template generation to use basic fallback metadata generation approach * Restore GenerateTemplateMetadataPrompt for Comprehensive Template Generation - Reintroduce GenerateTemplateMetadataPrompt to replace default metadata generation - Update GenerateTemplate command to use consolidated metadata generation approach - Extract detailed metadata components including title, description, industries, and image search query - Improve template generation with more dynamic and AI-generated metadata * Refactor Template Preview Section Layout - Remove unnecessary nested div in template preview section - Simplify HTML structure for the template preview component - Maintain existing styling and functionality while improving code readability * Refactor Constructor and Code Formatting in AI Form Generation and Prompt Classes - Updated the constructor in GenerateAiForm.php to use a block structure for improved readability and consistency. - Added a blank line in the Prompt.php file to enhance code formatting and maintain consistency with PHP coding standards. - Modified the migration file to use a more concise class declaration syntax, improving clarity. These changes aim to enhance code readability and maintainability across the affected files. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-21 16:59:18 +01:00
if (!this.formModeStrategy.validation.validateOnNextPage) {
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
if (!this.isLastPage) {
this.formPageIndex++
}
this.scrollToTop()
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
return true
}
try {
this.dataForm.busy = true
const fieldsToValidate = this.currentFields
.filter(f => f.type !== 'payment')
.map(f => f.id)
// Validate non-payment fields first
if (fieldsToValidate.length > 0) {
await this.dataForm.validate('POST', `/forms/${this.form.slug}/answer`, {}, fieldsToValidate)
}
// Process payment if needed
if (!await this.doPayment()) {
return false // Payment failed or was required but not completed
}
// If validation and payment are successful, proceed
if (!this.isLastPage) {
this.formPageIndex++
this.scrollToTop()
}
return true
} catch (error) {
this.handleValidationError(error)
return false
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
} finally {
this.dataForm.busy = false
}
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
},
async doPayment() {
// Use the stripeElements from setup instead of calling useStripeElements
const { state: stripeState, processPayment, isCardPopulated, isReadyForPayment } = this.stripeElements
Decouple title from title block (#696) * Decouple title from title block * fix lint * remove dry run for FormTitleMigration * Skip form title migration for forms with hidden titles * Refactor AI Form Generation with Dedicated Prompt Services - Extract AI form generation logic from GenerateTemplate command into dedicated prompt service classes - Update GenerateAiForm job to use new prompt generation services - Improve GptCompleter with more robust error handling and token tracking - Add error field to AiFormCompletion model for better error logging - Simplify command signature from 'ai:make-form-template' to 'form:generate' * Consolidate Template Metadata Generation with Unified Prompt Service - Create GenerateTemplateMetadataPrompt to centralize template metadata generation - Update GenerateTemplate command to use new consolidated metadata generation approach - Enhance GptCompleter to support strict JSON schema validation - Increase form prompt max length to support more complex form descriptions - Refactor form generation to simplify metadata extraction and processing * Implement Form Mode Strategy for Flexible Form Rendering - Introduce FormModeStrategy to centralize form rendering logic - Add support for different form modes: LIVE, PREVIEW, TEST, EDIT, PREFILL - Refactor components to use mode-based rendering strategy - Remove legacy boolean props like adminPreview and creating - Enhance form component flexibility and reusability * Refine Form Mode Strategy Display Behavior - Update FormModeStrategy to hide hidden fields in PREVIEW mode - Add FormMode getter in UrlFormPrefill component for mode-specific rendering - Clarify mode-specific validation and display logic in form strategies * Enhance Form Template Generation with Advanced Field Options - Update GenerateTemplate command to use front_url for template URL output - Expand GenerateFormPrompt with comprehensive field configuration options - Add support for advanced field types: date with time, toggle switches, radio/checkbox selections - Introduce field width configuration and HTML formatting for text elements - Re-enable select, multi-select, and matrix field type definitions with enhanced configurations * Remove Deprecated Template Metadata Generation Services - Delete multiple AI prompt services related to template metadata generation - Simplify GenerateTemplate command to use default values instead of complex metadata generation - Remove GenerateTemplateMetadataPrompt and related classes like GenerateTemplateDescriptionPrompt, GenerateTemplateImageKeywordsPrompt, etc. - Update form template generation to use basic fallback metadata generation approach * Restore GenerateTemplateMetadataPrompt for Comprehensive Template Generation - Reintroduce GenerateTemplateMetadataPrompt to replace default metadata generation - Update GenerateTemplate command to use consolidated metadata generation approach - Extract detailed metadata components including title, description, industries, and image search query - Improve template generation with more dynamic and AI-generated metadata * Refactor Template Preview Section Layout - Remove unnecessary nested div in template preview section - Simplify HTML structure for the template preview component - Maintain existing styling and functionality while improving code readability * Refactor Constructor and Code Formatting in AI Form Generation and Prompt Classes - Updated the constructor in GenerateAiForm.php to use a block structure for improved readability and consistency. - Added a blank line in the Prompt.php file to enhance code formatting and maintain consistency with PHP coding standards. - Modified the migration file to use a more concise class declaration syntax, improving clarity. These changes aim to enhance code readability and maintainability across the affected files. --------- Co-authored-by: Julien Nahum <julien@nahum.net>
2025-03-21 16:59:18 +01:00
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
// Check if there's a payment block in the current step
if (!this.paymentBlock) {
return true // No payment needed for this step
}
// Skip if payment is already processed in the stripe state
if (stripeState.intentId) {
return true
}
// Skip if payment ID already exists in the form data
const paymentFieldValue = this.dataFormValue[this.paymentBlock.id]
if (paymentFieldValue && typeof paymentFieldValue === 'string' && paymentFieldValue.startsWith('pi_')) {
// If we have a valid payment intent ID in the form data, sync it to the stripe state
stripeState.intentId = paymentFieldValue
return true
}
// Check for the stripe object itself, not just the ready flag
if (stripeState.isStripeInstanceReady && !stripeState.stripe) {
stripeState.isStripeInstanceReady = false
}
// Only process payment if required or card has data
const shouldProcessPayment = this.paymentBlock.required || isCardPopulated.value
if (shouldProcessPayment) {
// If not ready yet, try a brief wait
if (!isReadyForPayment.value) {
try {
this.dataForm.busy = true
// Just wait a second to see if state updates (it should be reactive now)
await new Promise(resolve => setTimeout(resolve, 1000))
// Check if we're ready now
if (!isReadyForPayment.value) {
// Provide detailed diagnostics
let errorMsg = 'Payment system not ready. '
const details = []
if (!stripeState.stripeAccountId) {
details.push('No Stripe account connected')
}
if (!stripeState.isStripeInstanceReady) {
details.push('Stripe.js not initialized')
}
if (!stripeState.isCardElementReady) {
details.push('Card element not initialized')
}
errorMsg += details.join(', ') + '. Please refresh and try again.'
useAlert().error(errorMsg)
return false
}
} catch (error) {
return false
} finally {
this.dataForm.busy = false
}
}
try {
this.dataForm.busy = true
const result = await processPayment(this.form.slug, this.paymentBlock.required)
if (!result.success) {
// Handle payment error
if (result.error?.message) {
this.dataForm.errors.set(this.paymentBlock.id, result.error.message)
useAlert().error(result.error.message)
} else {
useAlert().error('Payment processing failed. Please try again.')
}
return false
}
// Payment successful
if (result.paymentIntent?.status === 'succeeded') {
useAlert().success('Thank you! Your payment is successful.')
return true
}
// Fallback error
useAlert().error('Something went wrong with the payment. Please try again.')
return false
} catch (error) {
useAlert().error(error?.message || 'Payment failed')
return false
} finally {
this.dataForm.busy = false
Stripe Payment (#679) * oAuth for Stripe * Stripe Payment Frontend - WIP * Payment block backend validation and new package for stripe * change stripe scopes * update PaymentBlockConfigurationRule * Set loader on provider modal * stripe oauth * PaymentFieldOptions as seprate component * validate Stripe account * Payment intent * Stripe Payment as composable * confirmCardPayment working * Set payment errors on form.errors * Validate card other fields * Store payment id to database and on submission add link for view payment on stripe * FormPaymentController no need auth middleware * paymentinput error display on field * Make payment block as input change 'nf-payment' to 'payment' * Refactor payment processing and error handling * Multi lang & direction support on payment * reset card on change direction or local * use connected account for loadstripe * validate OAuthProvider before delete it * payment improvements * display payment by stripe * use stripe_currencies.json * Form Payment testcase * Enhance form auto-save behavior for payment forms * Restrict payment block in self-hosted environments * validate form before process payment * Refactor Nuxt Configuration for Improved Development Server Settings - Removed the existing Vite server configuration for hot module replacement (HMR) as it was no longer necessary. - Introduced a new `devServer` configuration to specify the host and port for the development server, allowing for more flexible environment setup based on environment variables. These changes aim to streamline the development process by enhancing server configuration and ensuring better adaptability to different environments. * Enhance Payment Handling and User Experience in Forms - Refactored `FormPaymentController` to improve handling of Stripe account retrieval, including better error messages for both editor preview and public forms. - Updated `OAuthProviderController` to utilize caching for OAuth connection context, enhancing performance and user experience during account connections. - Improved `PaymentInput.client.vue` to display a loading state and a preview message for users, guiding them to save the form for payment activation. - Modified various components to standardize payment-related messages and improve localization support across multiple languages. - Removed the deprecated `connections.vue` page to streamline the codebase. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of the payment-related components. * Refactor Payment Handling and Enhance User Experience in Forms - Updated `FormPaymentController` to utilize a new method for checking if the Stripe provider belongs to any workspace user, improving security and error logging. - Modified `OAuthProviderController` to streamline the OAuth provider creation process by directly using the service object. - Enhanced `Workspace` model with a new method to verify provider ownership, improving code clarity and maintainability. - Improved `PaymentInput.client.vue` to handle loading states and error messages more effectively, enhancing user feedback during payment processing. - Refactored `useFormInput.js` to include an `isAdminPreview` prop for better context handling in form components. These changes aim to improve the overall user experience when handling payments and enhance the maintainability of the payment-related components. * Enhance Payment Validation and User Experience in Forms - Updated `UserFormRequest` to improve workspace handling during form submissions, allowing for better context in validation rules. - Modified `PaymentBlockConfigurationRule` to include workspace validation, ensuring that payment providers are associated with the correct workspace, enhancing security and error logging. - Improved `PaymentInput.client.vue` to dynamically determine the success state of payment processing, providing clearer user feedback. - Updated various localization files to include a payment disclaimer, ensuring users are informed about credit card charges during payment processing. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Features and User Experience in Forms - Added checks in `FormPaymentController` to disable payment features for self-hosted instances, improving clarity for users regarding feature availability. - Updated `PaymentBlockConfigurationRule` to change the minimum amount validation from 0.5 to 1, ensuring stricter payment requirements. - Enhanced `PaymentInput.client.vue` with dark mode support for various UI elements, improving accessibility and user experience in different themes. - Modified `useFormInput.js` to include an `isDark` prop, allowing for better theme handling in form components. - Updated error messages in `useStripeElements.js` to include periods for consistency and improved user feedback. These changes aim to enhance the overall user experience when handling payments and improve the maintainability of payment-related components. * Enhance Payment Input Component with Focus Handling and Theme Support - Updated `PaymentInput.client.vue` to include focus and blur event handlers, improving user interaction by visually indicating when the card input is focused. - Enhanced theme support by adding new properties in `form-themes.js` for `PaymentInput`, allowing for better styling and transitions based on focus state. - Introduced a new `isCardFocused` reactive reference to manage the focus state of the card input, enhancing the overall user experience. These changes aim to improve the usability and visual feedback of the payment input component, aligning with recent enhancements to user experience in payment forms. * Refactor Payment Handling and Improve Code Consistency - Updated various files to enhance code consistency by adding spaces in arrow function definitions, improving readability and adhering to coding standards. - Modified `PaymentBlockConfigurationRule.php`, `FormPaymentController.php`, and `Workspace.php` to ensure uniformity in the use of arrow functions. - Enhanced `PaymentInput.client.vue` and other components by improving the formatting of template elements for better visual structure. - Updated `useStripeElements.js` to streamline state management and improve clarity in the handling of Stripe elements. These changes aim to improve code maintainability and readability across the payment handling components, ensuring a more consistent coding style throughout the codebase. * Enhance Form Model and Logging Configuration - Added a new 'auto_save' boolean property to the Form model, allowing for automatic saving of form data. - Updated the logging configuration to include a 'combined' channel that stacks multiple log channels, improving logging flexibility and error tracking. - Modified the FormFactory to set a default value for 'auto_save' to false, ensuring consistent behavior across form instances. - Improved error message structure in FormPaymentTest to provide clearer feedback when a payment block is missing. These changes aim to enhance the functionality of forms and improve logging capabilities, contributing to better maintainability and user experience. * Update api/config/logging.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor Payment Error Handling and Localization Updates - Updated `FormPaymentTest.php` to improve code consistency by adding spaces in arrow function definitions, enhancing readability. - Modified `useStripeElements.js` to replace hardcoded error messages with localized strings, improving user experience and maintainability. - Enhanced various localization files (e.g., `en.json`, `fr.json`, `de.json`, etc.) to include new error messages related to payment processing, ensuring users receive clear and consistent feedback across different languages. These changes aim to enhance the clarity of error handling in payment processes and improve the overall user experience through better localization support. * Enhance AddFormBlock and FieldOptions with Authentication Checks - Added an icon to indicate authentication requirements for blocks in `AddFormBlock.vue`, improving user awareness of access restrictions. - Implemented alert notifications using `useAlert()` for unauthorized block additions and input cloning, enhancing user feedback. - Updated `FieldOptions.vue` to conditionally render payment field options, ensuring relevant options are displayed based on the field type. - Modified `blocks_types.json` to include an `auth_required` property for specific block types, facilitating authentication checks. These changes aim to improve user experience by providing clear indications of authentication requirements and enhancing form functionality. * Enhance Authentication Checks in AddFormBlock Component - Updated `AddFormBlock.vue` to conditionally render authentication-required icons based on user authentication status, improving user awareness of access restrictions. - Implemented additional authentication checks in the `addBlock` and `handleInputClone` functions, utilizing `useAlert()` for notifying users when login is required to add blocks or clone inputs. - Introduced a computed property to manage the authenticated state, streamlining the authentication logic within the component. These changes aim to enhance user experience by providing clear indications of authentication requirements and improving the functionality of the form component. * Enhance PaymentInput Component with Disabled State Support - Updated `PaymentInput.client.vue` to include a `disabled` prop for the card holder name and email inputs, improving form accessibility and user experience by preventing interaction when necessary. - Modified the card options to respect the `disabled` state, ensuring consistent behavior across the payment input fields. These changes aim to enhance the usability of the payment input component by providing better control over user interactions. * Add Payment Condition Logic and Update Filters - Introduced a new payment condition in `FormLogicConditionChecker.php` to handle 'paid' and 'not_paid' states, enhancing form logic capabilities. - Added corresponding payment comparators in `open_filters.json` for both API and client, ensuring consistent validation and expected types for payment conditions. - Updated the JavaScript logic in `FormLogicConditionChecker.js` to include the new payment condition checks, improving the overall functionality of form conditions. These changes aim to enhance the form logic related to payment states, providing better validation and user experience in payment-related forms. * Refactor Authentication Checks in AddFormBlock and Working Form Store - Removed redundant authentication checks from `AddFormBlock.vue` for adding blocks and cloning inputs, streamlining the logic. - Centralized authentication validation in `working_form.js` to ensure consistent user feedback when authentication is required for specific block types. - Enhanced user experience by utilizing `useAlert()` for notifying users about login requirements, improving clarity and interaction. These changes aim to simplify the authentication logic and improve user notifications regarding access restrictions in form components. * Refactor Feature Flags and Update Payment Input Logic - Updated `FeatureFlagsController.php` to utilize the `Cache` facade directly, improving code clarity and consistency. - Modified `PaymentInput.client.vue` to enhance the display logic for payment previews, ensuring a better user experience by conditionally showing messages based on the state of the Stripe account. - Removed the `STRIPE_PUBLISHABLE_KEY` from `runtimeConfig.js` to streamline the configuration and replaced it with a computed property that retrieves the key from feature flags, improving maintainability. - Adjusted the `.env.example` file to maintain consistency in environment variable definitions. These changes aim to enhance the clarity of feature flag management and improve the user experience in payment interactions by refining the logic and configuration handling. * Update Stripe Configuration in Services - Modified the `services.php` configuration file to enhance the Stripe integration by providing default values for `client_secret` and `redirect` URI. This change ensures that the application can fallback to a predefined secret and a specific callback URL, improving the robustness of the payment service setup. These changes aim to streamline the configuration process for Stripe, ensuring that necessary values are always available for the application to function correctly. --------- Co-authored-by: Chirag Chhatrala <chirag.chhatrala@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-04-10 12:04:25 +02:00
}
}
return true // Payment not required or no card data
2023-12-09 15:47:03 +01:00
},
scrollToTop() {
window.scrollTo({ top: 0, behavior: 'smooth' })
},
handleValidationError(error) {
console.error(error)
if (error?.data) {
useAlert().formValidationError(error.data)
}
this.dataForm.busy = false
},
isFieldHidden(field) {
2023-12-09 15:47:03 +01:00
return (new FormLogicPropertyResolver(field, this.dataFormValue)).isHidden()
},
2024-08-08 12:00:36 +02:00
getTargetFieldIndex(currentFieldPageIndex) {
return this.formPageIndex > 0
? this.fieldGroups.slice(0, this.formPageIndex).reduce((sum, group) => sum + group.length, 0) + currentFieldPageIndex
: currentFieldPageIndex
2023-12-09 15:47:03 +01:00
},
handleDragDropped(data) {
if (data.added) {
const targetIndex = this.getTargetFieldIndex(data.added.newIndex)
this.workingFormStore.addBlock(data.added.element, targetIndex, false)
}
if (data.moved) {
const oldTargetIndex = this.getTargetFieldIndex(data.moved.oldIndex)
const newTargetIndex = this.getTargetFieldIndex(data.moved.newIndex)
this.workingFormStore.moveField(oldTargetIndex, newTargetIndex)
}
2024-08-08 12:00:36 +02:00
},
setPageForField(fieldIndex) {
if (fieldIndex === -1) return
let currentIndex = 0
for (let i = 0; i < this.fieldGroups.length; i++) {
currentIndex += this.fieldGroups[i].length
if (currentIndex > fieldIndex) {
this.formPageIndex = i
return
}
2024-08-08 12:00:36 +02:00
}
this.formPageIndex = this.fieldGroups.length - 1
},
// New method for updating field groups
updateFieldGroups() {
if (!this.fields || this.fields.length === 0) return
// Preserve the current page index if possible
const currentPageIndex = this.formPageIndex
// Use a local variable instead of directly modifying computed property
// We'll use this to determine totalPages and currentPageIndex
const calculatedGroups = this.fields.reduce((groups, field, index) => {
// If the field is a page break, start a new group
if (field.type === 'nf-page-break' && index !== 0) {
groups.push([])
}
// Add the field to the current group
if (groups.length === 0) groups.push([])
groups[groups.length - 1].push(field)
return groups
}, [])
// If we don't have any groups (shouldn't happen), create a default group
if (calculatedGroups.length === 0) {
calculatedGroups.push([])
}
// Update page navigation
const totalPages = calculatedGroups.length
// Try to maintain the current page index if valid
if (currentPageIndex !== undefined && currentPageIndex < totalPages) {
this.formPageIndex = currentPageIndex
} else {
this.formPageIndex = 0
}
// Force a re-render of the component, which will update fieldGroups computed property
this.$forceUpdate()
},
// Helper method to prevent recursive updates
updateFieldGroupsSafely() {
// Set flag to prevent recursive updates
this.isUpdatingFieldGroups = true
// Call the actual update method
this.updateFieldGroups()
// Clear the flag after a short delay to allow Vue to process the update
this.$nextTick(() => {
this.isUpdatingFieldGroups = false
})
}
2023-12-09 15:47:03 +01:00
}
}
</script>
<style lang='scss' scoped>
.ghost-item {
@apply bg-blue-100 dark:bg-blue-900 rounded-md;
}
</style>