Add SandwichReminder-AutoOrder feature for automated sandwich ordering and enhance SandwichReminder logic

This commit is contained in:
Arne Moerman
2026-05-08 16:00:22 +02:00
parent c26898d4d2
commit 2592c0145f
5 changed files with 372 additions and 57 deletions
@@ -0,0 +1,149 @@
$FeatureMeta = @{
Name = 'SandwichReminder-AutoOrder'
Description = 'Personal automation settings for sandwich auto-order browser flow'
Settings = @(
@{
Key = 'baseUrl'
Label = 'Base URL'
Type = 'string'
Default = 'https://ylos-kitchen.unipage.eu'
Description = 'Base URL of the ordering website'
},
@{
Key = 'itemId'
Label = 'Item ID'
Type = 'string'
Default = 'dmwmo3'
Description = 'Item ID for direct item modal URL (default = Smoske)'
},
@{
Key = 'windowTitleHint'
Label = 'Browser Window Title Hint'
Type = 'string'
Default = "YLO'S Kitchen"
Description = 'Used to bring browser window to foreground before sending keys'
},
@{
Key = 'defaultItemRemark'
Label = 'Default Item Remark'
Type = 'string'
Default = 'zonder tomaat aub'
Description = 'For next step (checkout automation)'
},
@{
Key = 'defaultOrderRemark'
Label = 'Default Order Remark'
Type = 'string'
Default = 'levering in Sioen Bistro'
Description = 'For next step (checkout automation)'
},
@{
Key = 'initialDelayMs'
Label = 'Initial Delay (ms)'
Type = 'int'
Default = 2500
Description = 'Wait time after opening browser before key automation starts'
},
@{
Key = 'activationTimeoutMs'
Label = 'Activation Timeout (ms)'
Type = 'int'
Default = 10000
Description = 'How long to retry foregrounding the browser window'
},
@{
Key = 'stepDelayMs'
Label = 'Key Step Delay (ms)'
Type = 'int'
Default = 120
Description = 'Delay between keyboard steps'
},
@{
Key = 'optionToggleKey'
Label = 'Option Toggle Key'
Type = 'string'
Default = 'SPACE'
Description = 'Key used to toggle option checkbox: SPACE or ENTER'
},
@{
Key = 'calibrationOnly'
Label = 'Calibration Only'
Type = 'bool'
Default = $false
Description = 'If enabled, only tabs through the modal and stops (no clicks/add)'
},
@{
Key = 'calibrationTabs'
Label = 'Calibration Tabs'
Type = 'int'
Default = 0
Description = 'Number of tabs to send in calibration mode before stopping'
},
@{
Key = 'tabsToOption1'
Label = 'Tabs To Option 1'
Type = 'int'
Default = 7
Description = 'Tab count from modal start to first option checkbox'
},
@{
Key = 'tabsBetweenOptions'
Label = 'Tabs Between Options'
Type = 'int'
Default = 2
Description = 'Tab count from first checkbox to second checkbox'
},
@{
Key = 'tabsToAddButton'
Label = 'Tabs To Add Button'
Type = 'int'
Default = 6
Description = 'Tab count from second checkbox to add-to-cart button'
},
@{
Key = 'openCartPopupAfterAdd'
Label = 'Open Cart Popup After Add'
Type = 'bool'
Default = $true
Description = 'Open mini-cart after adding item'
},
@{
Key = 'refreshBeforeCart'
Label = 'Refresh Before Cart'
Type = 'bool'
Default = $true
Description = 'Refresh the page after add-to-cart to reset focus to page start before tabbing to mini-cart'
},
@{
Key = 'postRefreshDelayMs'
Label = 'Post-Refresh Delay (ms)'
Type = 'int'
Default = 2500
Description = 'Wait time after F5 refresh before tabbing to mini-cart'
},
@{
Key = 'tabsToCartButton'
Label = 'Tabs To Cart Button'
Type = 'int'
Default = 5
Description = 'Tab count from page start (after refresh) to mini-cart button'
},
@{
Key = 'tabsToConfirmButton'
Label = 'Tabs To Confirm Button'
Type = 'int'
Default = 3
Description = 'Tab count from mini-cart button to confirm order button (opens delivery popup)'
}
)
}
function Invoke-Feature {
param(
[hashtable]$Config,
[hashtable]$State
)
if (-not $State) { $State = @{} }
return $State
}