-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: select delivery date for small package type INT-752
- Loading branch information
Clerise Swart
committed
Dec 10, 2024
1 parent
65a50ea
commit 5bb691d
Showing
2 changed files
with
15 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
import {computed} from 'vue'; | ||
import {useMemoize} from '@vueuse/core'; | ||
import {ConfigSetting, PACKAGE_TYPE_DEFAULT} from '@myparcel-do/shared'; | ||
import {ConfigSetting, LimitedPackageTypeName} from '@myparcel-do/shared'; | ||
import {useConfigStore} from '../stores'; | ||
import {SHOWN_SHIPMENT_OPTIONS} from '../data'; | ||
|
||
const PACKAGE_TYPE_DEFAULT = [LimitedPackageTypeName.Package, LimitedPackageTypeName.PackageSmall]; | ||
|
||
export const useFeatures = useMemoize(() => { | ||
const config = useConfigStore(); | ||
|
||
return { | ||
availableShipmentOptions: computed(() => { | ||
return PACKAGE_TYPE_DEFAULT === config.packageType ? SHOWN_SHIPMENT_OPTIONS : []; | ||
return PACKAGE_TYPE_DEFAULT.includes(config.packageType as unknown as LimitedPackageTypeName) | ||
? SHOWN_SHIPMENT_OPTIONS | ||
: []; | ||
}), | ||
|
||
showDeliveryDate: computed(() => { | ||
return PACKAGE_TYPE_DEFAULT === config.packageType && config[ConfigSetting.ShowDeliveryDate]; | ||
return ( | ||
PACKAGE_TYPE_DEFAULT.includes(config.packageType as unknown as LimitedPackageTypeName) && | ||
config[ConfigSetting.ShowDeliveryDate] | ||
); | ||
}), | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters