use serde::{Deserialize, Serialize}; pub mod extension; use crate::{config::Config, webhooks::WebhookManifest}; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum AppPermission { ManageUsers, ManageStaff, ImpersonateUser, ManageObservability, ManageCheckouts, HandleCheckouts, HandleTaxes, ManageTaxes, ManageChannels, ManageDiscounts, ManageGiftCard, ManageMenus, ManageOrders, ManageOrdersImport, ManagePages, ManagePageTypesAndAttributes, HandlePayments, ManagePlugins, ManageProducts, ManageProductTypesAndAttributes, ManageShipping, ManageSettings, ManageTranslations, ManageApps, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum AppExtensionMount { ProductDetailsMoreActions, ProductOverviewCreate, ProductOverviewMoreActions, NavigationCatalog, NavigationOrders, NavigationCustomers, NavigationDiscounts, NavigationTranslations, NavigationPages, OrderDetailsMoreActions, OrderOverviewCreate, OrderOverviewMoreActions, } impl Default for AppExtensionMount { fn default() -> Self { Self::ProductOverviewMoreActions } } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum AppExtensionTarget { Popup, AppPage, } impl Default for AppExtensionTarget { fn default() -> Self { Self::Popup } } #[derive(Debug, Clone, Serialize, Deserialize, Default)] #[serde(rename_all = "camelCase")] pub struct AppExtension { /** Name which will be displayed in the dashboard */ pub label: String, /** the place where the extension will be mounted */ pub mount: AppExtensionMount, /** Method of presenting the interface `POPUP` will present the interface in a modal overlay `APP_PAGE` will navigate to the application page @default `POPUP` */ pub target: AppExtensionTarget, pub permissions: Vec, /** URL of the view to display, you can skip the domain and protocol when target is set to `APP_PAGE`, or when your manifest defines an `appUrl`. When target is set to `POPUP`, the url will be used to render an `