runtime/composables
Interfaces
CountryDetectionParams
Properties
UseCountryDetectionReturn
Properties
Property | Type | Description |
---|---|---|
detectedRegion | Readonly <Ref <... | ..., ... | ...>> | The detected region code (based on the user's location, e.g "US") |
hasPromptedUser | ComputedRef <boolean > | A computed reference indicating whether the user has already been prompted to switch shops (persisted in session storage). |
hasSwitchedShops | ComputedRef <boolean > | A computed reference indicating whether the user has already manually switched shops (persisted in session storage). |
markUserAsPrompted | () => void | A function to mark that the user has been prompted to switch shops. |
suggestedShops | ComputedRef <PublicShopConfig > | An array of shops matching the detected region or the fallback shop. |
suggestionActive | Readonly <Ref <boolean , boolean >> | A boolean indicating whether a suggestion for switching shops should be active. |
Functions
useCountryDetection()
function useCountryDetection(params): UseCountryDetectionReturn
A composable that provides logic for detecting the user's country and suggesting shops matching the detected country.
Parameters
Parameter | Type | Description |
---|---|---|
params | CountryDetectionParams | An object containing the parameters for the composable. |
Returns
An object containing reactive data, computed properties and functions for managing country detection: