def get_context_menu(menu_type=None): import menu_utils menu = context_variables["ACTIVE_MENU"] if menu_type is not None: if menu is None: raise menu_utils.InvalidMenuOption( f"Expecting {menu_type}, got None") if menu["menuType"] != menu_type: raise menu_utils.InvalidMenuOption( f"Expecting {menu_type}, got {menu['menuType']}") return menu
async def get_shipping_menu(): menu = await menu_utils.get_active_menu(menu_type='itemsToGrabMenu') if not menu['shippingBin']: raise menu_utils.InvalidMenuOption() return menu
def get_title_menu(menu): menu_utils.validate_menu_type(TITLE_MENU, menu) if menu['subMenu']: raise menu_utils.InvalidMenuOption() return menu
def get_page_by_name(menu, page_type): current_page = menu['currentPage'] is_active = page_type == current_page['menuType'] if not is_active: raise menu_utils.InvalidMenuOption() return current_page