import { pluginPageLink } from './landing/pluginPage' /** * The settings that can be opened straight from a link, so other pages can * send the merchant to the right setting. */ export type SettingsModal = 'returns' | 'printing' const SETTINGS_MODALS: Array = ['returns', 'printing'] export const settingsModalToOpen = ( search: string ): SettingsModal | undefined => { const requested = new URLSearchParams(search).get('open') return SETTINGS_MODALS.find(modal => modal === requested) } export const settingsLink = (modal: SettingsModal): string => `${pluginPageLink('settings')}&open=${modal}`