defaults.ts 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. import { registerAlert } from '@/vdb/framework/alert/alert-extensions.js';
  2. import { searchIndexBufferAlert } from '@/vdb/framework/alert/search-index-buffer-alert/search-index-buffer-alert.js';
  3. import { setNavMenuConfig } from '@/vdb/framework/nav-menu/nav-menu-extensions.js';
  4. import { ChartLine, Percent, Settings2, ShoppingBag, Tags, Terminal, Users } from 'lucide-react';
  5. import { LatestOrdersWidget } from './dashboard-widget/latest-orders-widget/index.js';
  6. import { MetricsWidget } from './dashboard-widget/metrics-widget/index.js';
  7. import { OrdersSummaryWidget } from './dashboard-widget/orders-summary/index.js';
  8. import { registerDashboardWidget } from './dashboard-widget/widget-extensions.js';
  9. export function registerDefaults() {
  10. setNavMenuConfig({
  11. sections: [
  12. {
  13. id: 'insights',
  14. title: /* i18n*/ 'Insights',
  15. placement: 'top',
  16. icon: ChartLine,
  17. url: '/',
  18. order: 100,
  19. },
  20. {
  21. id: 'catalog',
  22. title: /* i18n*/ 'Catalog',
  23. icon: Tags,
  24. placement: 'top',
  25. order: 200,
  26. items: [
  27. {
  28. id: 'products',
  29. title: /* i18n*/ 'Products',
  30. url: '/products',
  31. order: 100,
  32. requiresPermission: ['ReadProduct', 'ReadCatalog'],
  33. },
  34. {
  35. id: 'product-variants',
  36. title: /* i18n*/ 'Product Variants',
  37. url: '/product-variants',
  38. order: 200,
  39. requiresPermission: ['ReadProduct', 'ReadCatalog'],
  40. },
  41. {
  42. id: 'facets',
  43. title: /* i18n*/ 'Facets',
  44. url: '/facets',
  45. order: 300,
  46. requiresPermission: ['ReadProduct', 'ReadCatalog'],
  47. },
  48. {
  49. id: 'collections',
  50. title: /* i18n*/ 'Collections',
  51. url: '/collections',
  52. order: 400,
  53. requiresPermission: ['ReadCollection', 'ReadCatalog'],
  54. },
  55. {
  56. id: 'assets',
  57. title: /* i18n*/ 'Assets',
  58. url: '/assets',
  59. order: 500,
  60. requiresPermission: ['ReadAsset', 'ReadCatalog'],
  61. },
  62. ],
  63. },
  64. {
  65. id: 'sales',
  66. title: /* i18n*/ 'Sales',
  67. icon: ShoppingBag,
  68. placement: 'top',
  69. order: 300,
  70. items: [
  71. {
  72. id: 'orders',
  73. title: /* i18n*/ 'Orders',
  74. url: '/orders',
  75. order: 100,
  76. requiresPermission: ['ReadOrder'],
  77. },
  78. ],
  79. },
  80. {
  81. id: 'customers',
  82. title: /* i18n*/ 'Customers',
  83. icon: Users,
  84. placement: 'top',
  85. order: 400,
  86. items: [
  87. {
  88. id: 'customers',
  89. title: /* i18n*/ 'Customers',
  90. url: '/customers',
  91. order: 100,
  92. requiresPermission: ['ReadCustomer'],
  93. },
  94. {
  95. id: 'customer-groups',
  96. title: /* i18n*/ 'Customer Groups',
  97. url: '/customer-groups',
  98. order: 200,
  99. requiresPermission: ['ReadCustomerGroup'],
  100. },
  101. ],
  102. },
  103. {
  104. id: 'marketing',
  105. title: /* i18n*/ 'Marketing',
  106. icon: Percent,
  107. placement: 'top',
  108. order: 500,
  109. items: [
  110. {
  111. id: 'promotions',
  112. title: /* i18n*/ 'Promotions',
  113. url: '/promotions',
  114. order: 100,
  115. requiresPermission: ['ReadPromotion'],
  116. },
  117. ],
  118. },
  119. {
  120. id: 'system',
  121. title: /* i18n*/ 'System',
  122. icon: Terminal,
  123. placement: 'bottom',
  124. order: 200,
  125. items: [
  126. {
  127. id: 'job-queue',
  128. title: /* i18n*/ 'Job Queue',
  129. url: '/job-queue',
  130. order: 100,
  131. requiresPermission: ['ReadSystem'],
  132. },
  133. {
  134. id: 'healthchecks',
  135. title: /* i18n*/ 'Healthchecks',
  136. url: '/healthchecks',
  137. order: 200,
  138. requiresPermission: ['ReadSystem'],
  139. },
  140. {
  141. id: 'scheduled-tasks',
  142. title: /* i18n*/ 'Scheduled Tasks',
  143. url: '/scheduled-tasks',
  144. order: 300,
  145. requiresPermission: ['ReadSystem'],
  146. },
  147. ],
  148. },
  149. {
  150. id: 'settings',
  151. title: /* i18n*/ 'Settings',
  152. icon: Settings2,
  153. placement: 'bottom',
  154. order: 100,
  155. items: [
  156. {
  157. id: 'sellers',
  158. title: /* i18n*/ 'Sellers',
  159. url: '/sellers',
  160. order: 100,
  161. requiresPermission: ['ReadSeller'],
  162. },
  163. {
  164. id: 'channels',
  165. title: /* i18n*/ 'Channels',
  166. url: '/channels',
  167. order: 200,
  168. requiresPermission: ['ReadChannel'],
  169. },
  170. {
  171. id: 'stock-locations',
  172. title: /* i18n*/ 'Stock Locations',
  173. url: '/stock-locations',
  174. order: 300,
  175. requiresPermission: ['ReadStockLocation'],
  176. },
  177. {
  178. id: 'administrators',
  179. title: /* i18n*/ 'Administrators',
  180. url: '/administrators',
  181. order: 400,
  182. requiresPermission: ['ReadAdministrator'],
  183. },
  184. {
  185. id: 'roles',
  186. title: /* i18n*/ 'Roles',
  187. url: '/roles',
  188. order: 500,
  189. requiresPermission: ['ReadAdministrator'],
  190. },
  191. {
  192. id: 'shipping-methods',
  193. title: /* i18n*/ 'Shipping Methods',
  194. url: '/shipping-methods',
  195. order: 600,
  196. requiresPermission: ['ReadShippingMethod'],
  197. },
  198. {
  199. id: 'payment-methods',
  200. title: /* i18n*/ 'Payment Methods',
  201. url: '/payment-methods',
  202. order: 700,
  203. requiresPermission: ['ReadPaymentMethod'],
  204. },
  205. {
  206. id: 'tax-categories',
  207. title: /* i18n*/ 'Tax Categories',
  208. url: '/tax-categories',
  209. order: 800,
  210. requiresPermission: ['ReadTaxCategory'],
  211. },
  212. {
  213. id: 'tax-rates',
  214. title: /* i18n*/ 'Tax Rates',
  215. url: '/tax-rates',
  216. order: 900,
  217. requiresPermission: ['ReadTaxRate'],
  218. },
  219. {
  220. id: 'countries',
  221. title: /* i18n*/ 'Countries',
  222. url: '/countries',
  223. order: 1000,
  224. requiresPermission: ['ReadCountry'],
  225. },
  226. {
  227. id: 'zones',
  228. title: /* i18n*/ 'Zones',
  229. url: '/zones',
  230. order: 1100,
  231. requiresPermission: ['ReadZone'],
  232. },
  233. {
  234. id: 'global-settings',
  235. title: /* i18n*/ 'Global Settings',
  236. url: '/global-settings',
  237. order: 1200,
  238. requiresPermission: ['UpdateGlobalSettings'],
  239. },
  240. ],
  241. },
  242. ],
  243. });
  244. registerDashboardWidget({
  245. id: 'metrics-widget',
  246. name: /* i18n*/ 'Metrics Widget',
  247. component: MetricsWidget,
  248. defaultSize: { w: 12, h: 6, x: 0, y: 0 },
  249. minSize: { w: 6, h: 4 },
  250. });
  251. registerDashboardWidget({
  252. id: 'latest-orders-widget',
  253. name: /* i18n*/ 'Latest Orders Widget',
  254. component: LatestOrdersWidget,
  255. defaultSize: { w: 6, h: 7, x: 0, y: 0 },
  256. });
  257. registerDashboardWidget({
  258. id: 'orders-summary-widget',
  259. name: /* i18n*/ 'Orders Summary Widget',
  260. component: OrdersSummaryWidget,
  261. defaultSize: { w: 6, h: 3, x: 6, y: 0 },
  262. });
  263. registerAlert(searchIndexBufferAlert);
  264. }