mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 02:57:57 +00:00 
			
		
		
		
	 b533980880
			
		
	
	b533980880
	
	
	
		
			
			### Summary - Converts conversation auto-resolution duration from days to minutes for more granular control - Updates validation to allow values from 10 minutes (minimum) to 999 days (maximum) - Implements smart messaging to show appropriate time units in activity messages ### Changes - Created migration to convert existing durations from days to minutes (x1440) - Updated conversation resolver to use minutes instead of days - Added dynamic translation key selection based on duration value - Updated related specs and documentation - Added support for displaying durations in days, hours, or minutes based on value ### Test plan - Verify account validation accepts new minute-based ranges - Confirm existing account settings are correctly migrated - Test auto-resolution works properly with minute values - Ensure proper time unit display in activity messages --------- Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
		
			
				
	
	
		
			65 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { computed } from 'vue';
 | |
| import { useRoute } from 'vue-router';
 | |
| import { useMapGetter, useStore } from './store';
 | |
| 
 | |
| /**
 | |
|  * Composable for account-related operations.
 | |
|  * @returns {Object} An object containing account-related properties and methods.
 | |
|  */
 | |
| export function useAccount() {
 | |
|   /**
 | |
|    * Computed property for the current account ID.
 | |
|    * @type {import('vue').ComputedRef<number>}
 | |
|    */
 | |
|   const route = useRoute();
 | |
|   const store = useStore();
 | |
|   const getAccountFn = useMapGetter('accounts/getAccount');
 | |
|   const isOnChatwootCloud = useMapGetter('globalConfig/isOnChatwootCloud');
 | |
|   const isFeatureEnabledonAccount = useMapGetter(
 | |
|     'accounts/isFeatureEnabledonAccount'
 | |
|   );
 | |
| 
 | |
|   const accountId = computed(() => {
 | |
|     return Number(route.params.accountId);
 | |
|   });
 | |
|   const currentAccount = computed(() => getAccountFn.value(accountId.value));
 | |
| 
 | |
|   /**
 | |
|    * Generates an account-scoped URL.
 | |
|    * @param {string} url - The URL to be scoped to the account.
 | |
|    * @returns {string} The account-scoped URL.
 | |
|    */
 | |
|   const accountScopedUrl = url => {
 | |
|     return `/app/accounts/${accountId.value}/${url}`;
 | |
|   };
 | |
| 
 | |
|   const isCloudFeatureEnabled = feature => {
 | |
|     return isFeatureEnabledonAccount.value(currentAccount.value.id, feature);
 | |
|   };
 | |
| 
 | |
|   const accountScopedRoute = (name, params, query) => {
 | |
|     return {
 | |
|       name,
 | |
|       params: { accountId: accountId.value, ...params },
 | |
|       query: { ...query },
 | |
|     };
 | |
|   };
 | |
| 
 | |
|   const updateAccount = async data => {
 | |
|     await store.dispatch('accounts/update', {
 | |
|       ...data,
 | |
|     });
 | |
|   };
 | |
| 
 | |
|   return {
 | |
|     accountId,
 | |
|     route,
 | |
|     currentAccount,
 | |
|     accountScopedUrl,
 | |
|     accountScopedRoute,
 | |
|     isCloudFeatureEnabled,
 | |
|     isOnChatwootCloud,
 | |
|     updateAccount,
 | |
|   };
 | |
| }
 |