@vendure/dashboard 3.5.0-minor-202509261210 → 3.5.0-minor-202510031341

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/README.md +4 -0
  2. package/dist/plugin/dashboard.plugin.d.ts +25 -6
  3. package/dist/plugin/dashboard.plugin.js +184 -27
  4. package/dist/plugin/default-page.html +188 -0
  5. package/dist/vite/vite-plugin-config.js +13 -9
  6. package/dist/vite/vite-plugin-translations.d.ts +22 -0
  7. package/dist/vite/vite-plugin-translations.js +66 -0
  8. package/dist/vite/vite-plugin-vendure-dashboard.js +8 -6
  9. package/lingui.config.js +25 -2
  10. package/package.json +159 -156
  11. package/src/app/app-providers.tsx +0 -4
  12. package/src/app/common/delete-bulk-action.tsx +6 -5
  13. package/src/app/common/duplicate-bulk-action.tsx +4 -5
  14. package/src/app/common/duplicate-entity-dialog.tsx +1 -1
  15. package/src/app/common/set-document-direction.ts +7 -0
  16. package/src/app/main.tsx +50 -17
  17. package/src/app/routes/_authenticated/_administrators/administrators.tsx +8 -6
  18. package/src/app/routes/_authenticated/_administrators/administrators_.$id.tsx +17 -6
  19. package/src/app/routes/_authenticated/_administrators/components/role-permissions-display.tsx +2 -2
  20. package/src/app/routes/_authenticated/_assets/assets.tsx +1 -1
  21. package/src/app/routes/_authenticated/_assets/assets_.$id.tsx +4 -4
  22. package/src/app/routes/_authenticated/_assets/components/asset-bulk-actions.tsx +8 -6
  23. package/src/app/routes/_authenticated/_assets/components/asset-tag-filter.tsx +1 -1
  24. package/src/app/routes/_authenticated/_assets/components/asset-tags-editor.tsx +1 -1
  25. package/src/app/routes/_authenticated/_assets/components/manage-tags-dialog.tsx +3 -8
  26. package/src/app/routes/_authenticated/_channels/channels.tsx +3 -6
  27. package/src/app/routes/_authenticated/_channels/channels_.$id.tsx +5 -5
  28. package/src/app/routes/_authenticated/_collections/collections.tsx +3 -4
  29. package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +4 -6
  30. package/src/app/routes/_authenticated/_collections/components/collection-bulk-actions.tsx +1 -1
  31. package/src/app/routes/_authenticated/_collections/components/collection-contents-sheet.tsx +1 -1
  32. package/src/app/routes/_authenticated/_collections/components/move-collections-dialog.tsx +6 -6
  33. package/src/app/routes/_authenticated/_countries/countries.graphql.ts +2 -0
  34. package/src/app/routes/_authenticated/_countries/countries.tsx +2 -3
  35. package/src/app/routes/_authenticated/_countries/countries_.$id.tsx +4 -4
  36. package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-sheet.tsx +1 -1
  37. package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-table.tsx +4 -4
  38. package/src/app/routes/_authenticated/_customer-groups/customer-groups.tsx +2 -4
  39. package/src/app/routes/_authenticated/_customer-groups/customer-groups_.$id.tsx +13 -6
  40. package/src/app/routes/_authenticated/_customers/components/customer-address-card.tsx +8 -8
  41. package/src/app/routes/_authenticated/_customers/components/customer-address-form.tsx +3 -3
  42. package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-container.tsx +1 -1
  43. package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-utils.tsx +1 -1
  44. package/src/app/routes/_authenticated/_customers/components/customer-history/default-customer-history-components.tsx +1 -1
  45. package/src/app/routes/_authenticated/_customers/components/customer-history/use-customer-history.ts +1 -1
  46. package/src/app/routes/_authenticated/_customers/components/customer-status-badge.tsx +1 -1
  47. package/src/app/routes/_authenticated/_customers/customers.graphql.ts +4 -0
  48. package/src/app/routes/_authenticated/_customers/customers.tsx +23 -11
  49. package/src/app/routes/_authenticated/_customers/customers_.$id.tsx +10 -8
  50. package/src/app/routes/_authenticated/_facets/components/edit-facet-value.tsx +1 -1
  51. package/src/app/routes/_authenticated/_facets/components/facet-bulk-actions.tsx +6 -5
  52. package/src/app/routes/_authenticated/_facets/components/facet-values-sheet.tsx +1 -1
  53. package/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx +1 -1
  54. package/src/app/routes/_authenticated/_facets/facets.tsx +5 -5
  55. package/src/app/routes/_authenticated/_facets/facets_.$facetId.values_.$id.tsx +7 -5
  56. package/src/app/routes/_authenticated/_facets/facets_.$id.tsx +4 -4
  57. package/src/app/routes/_authenticated/_global-settings/global-settings.tsx +5 -5
  58. package/src/app/routes/_authenticated/_orders/components/add-manual-payment-dialog.tsx +19 -21
  59. package/src/app/routes/_authenticated/_orders/components/customer-address-selector.tsx +1 -1
  60. package/src/app/routes/_authenticated/_orders/components/edit-order-table.tsx +22 -22
  61. package/src/app/routes/_authenticated/_orders/components/fulfill-order-dialog.tsx +6 -6
  62. package/src/app/routes/_authenticated/_orders/components/fulfillment-details.tsx +15 -9
  63. package/src/app/routes/_authenticated/_orders/components/order-address.tsx +1 -1
  64. package/src/app/routes/_authenticated/_orders/components/order-detail-shared.tsx +11 -9
  65. package/src/app/routes/_authenticated/_orders/components/order-history/default-order-history-components.tsx +1 -1
  66. package/src/app/routes/_authenticated/_orders/components/order-history/order-history-container.tsx +1 -1
  67. package/src/app/routes/_authenticated/_orders/components/order-history/order-history-utils.tsx +1 -1
  68. package/src/app/routes/_authenticated/_orders/components/order-history/use-order-history.ts +1 -1
  69. package/src/app/routes/_authenticated/_orders/components/order-line-custom-fields-form.tsx +1 -1
  70. package/src/app/routes/_authenticated/_orders/components/order-modification-preview-dialog.tsx +4 -4
  71. package/src/app/routes/_authenticated/_orders/components/order-modification-summary.tsx +1 -1
  72. package/src/app/routes/_authenticated/_orders/components/order-table-totals.tsx +27 -27
  73. package/src/app/routes/_authenticated/_orders/components/order-table.tsx +2 -2
  74. package/src/app/routes/_authenticated/_orders/components/order-tax-summary.tsx +1 -1
  75. package/src/app/routes/_authenticated/_orders/components/payment-details.tsx +26 -20
  76. package/src/app/routes/_authenticated/_orders/components/seller-orders-card.tsx +3 -1
  77. package/src/app/routes/_authenticated/_orders/components/settle-refund-dialog.tsx +6 -6
  78. package/src/app/routes/_authenticated/_orders/components/shipping-method-selector.tsx +1 -1
  79. package/src/app/routes/_authenticated/_orders/components/state-transition-control.tsx +1 -1
  80. package/src/app/routes/_authenticated/_orders/components/use-transition-order-to-state.tsx +3 -2
  81. package/src/app/routes/_authenticated/_orders/orders.tsx +5 -9
  82. package/src/app/routes/_authenticated/_orders/orders_.$aggregateOrderId_.seller-orders.$sellerOrderId.tsx +1 -1
  83. package/src/app/routes/_authenticated/_orders/orders_.$id.tsx +1 -1
  84. package/src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx +4 -4
  85. package/src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx +17 -17
  86. package/src/app/routes/_authenticated/_orders/utils/order-detail-loaders.tsx +1 -1
  87. package/src/app/routes/_authenticated/_payment-methods/payment-methods.tsx +5 -6
  88. package/src/app/routes/_authenticated/_payment-methods/payment-methods_.$id.tsx +13 -6
  89. package/src/app/routes/_authenticated/_product-variants/components/product-variant-bulk-actions.tsx +1 -1
  90. package/src/app/routes/_authenticated/_product-variants/components/variant-price-detail.tsx +1 -1
  91. package/src/app/routes/_authenticated/_product-variants/product-variants.tsx +9 -2
  92. package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +13 -6
  93. package/src/app/routes/_authenticated/_products/components/add-option-group-dialog.tsx +5 -5
  94. package/src/app/routes/_authenticated/_products/components/add-product-variant-dialog.tsx +5 -5
  95. package/src/app/routes/_authenticated/_products/components/assign-facet-values-dialog.tsx +5 -4
  96. package/src/app/routes/_authenticated/_products/components/create-product-options-dialog.tsx +9 -12
  97. package/src/app/routes/_authenticated/_products/components/create-product-variants-dialog.tsx +1 -1
  98. package/src/app/routes/_authenticated/_products/components/create-product-variants.tsx +4 -4
  99. package/src/app/routes/_authenticated/_products/components/option-groups-editor.tsx +1 -1
  100. package/src/app/routes/_authenticated/_products/components/product-bulk-actions.tsx +1 -1
  101. package/src/app/routes/_authenticated/_products/components/product-option-select.tsx +3 -3
  102. package/src/app/routes/_authenticated/_products/components/product-options-table.tsx +9 -6
  103. package/src/app/routes/_authenticated/_products/products.graphql.ts +31 -31
  104. package/src/app/routes/_authenticated/_products/products.tsx +11 -6
  105. package/src/app/routes/_authenticated/_products/products_.$id.tsx +4 -4
  106. package/src/app/routes/_authenticated/_products/products_.$id_.variants.tsx +11 -11
  107. package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$id.tsx +8 -12
  108. package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$productOptionGroupId.options_.$id.tsx +2 -2
  109. package/src/app/routes/_authenticated/_profile/profile.tsx +4 -4
  110. package/src/app/routes/_authenticated/_promotions/promotions.tsx +2 -4
  111. package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +16 -9
  112. package/src/app/routes/_authenticated/_roles/components/permissions-table-grid.tsx +1 -1
  113. package/src/app/routes/_authenticated/_roles/roles.tsx +3 -6
  114. package/src/app/routes/_authenticated/_roles/roles_.$id.tsx +4 -6
  115. package/src/app/routes/_authenticated/_sellers/sellers.tsx +3 -4
  116. package/src/app/routes/_authenticated/_sellers/sellers_.$id.tsx +4 -4
  117. package/src/app/routes/_authenticated/_shipping-methods/components/price-display.tsx +5 -5
  118. package/src/app/routes/_authenticated/_shipping-methods/components/shipping-method-test-result-wrapper.tsx +1 -1
  119. package/src/app/routes/_authenticated/_shipping-methods/components/test-address-form.tsx +4 -3
  120. package/src/app/routes/_authenticated/_shipping-methods/components/test-order-builder.tsx +4 -3
  121. package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-methods-result.tsx +8 -8
  122. package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-methods-sheet.tsx +1 -1
  123. package/src/app/routes/_authenticated/_shipping-methods/components/test-single-method-result.tsx +8 -8
  124. package/src/app/routes/_authenticated/_shipping-methods/components/test-single-shipping-method-sheet.tsx +4 -4
  125. package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.tsx +2 -3
  126. package/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx +2 -2
  127. package/src/app/routes/_authenticated/_stock-locations/stock-locations.tsx +3 -4
  128. package/src/app/routes/_authenticated/_stock-locations/stock-locations_.$id.tsx +13 -6
  129. package/src/app/routes/_authenticated/_system/healthchecks.tsx +10 -4
  130. package/src/app/routes/_authenticated/_system/job-queue.tsx +10 -13
  131. package/src/app/routes/_authenticated/_system/scheduled-tasks.tsx +18 -16
  132. package/src/app/routes/_authenticated/_tax-categories/tax-categories.tsx +2 -4
  133. package/src/app/routes/_authenticated/_tax-categories/tax-categories_.$id.tsx +13 -6
  134. package/src/app/routes/_authenticated/_tax-rates/tax-rates.tsx +8 -12
  135. package/src/app/routes/_authenticated/_tax-rates/tax-rates_.$id.tsx +6 -4
  136. package/src/app/routes/_authenticated/_zones/zones.tsx +4 -4
  137. package/src/app/routes/_authenticated/_zones/zones_.$id.tsx +8 -5
  138. package/src/app/routes/_authenticated/index.tsx +6 -2
  139. package/src/app/styles.css +4 -0
  140. package/src/i18n/common-strings.ts +111 -0
  141. package/src/i18n/locales/ar.po +4777 -0
  142. package/src/i18n/locales/cs.po +4777 -0
  143. package/src/i18n/locales/de.po +4299 -1101
  144. package/src/i18n/locales/en.po +3857 -659
  145. package/src/i18n/locales/es.po +4777 -0
  146. package/src/i18n/locales/fa.po +4777 -0
  147. package/src/i18n/locales/fr.po +4777 -0
  148. package/src/i18n/locales/he.po +4777 -0
  149. package/src/i18n/locales/hr.po +4777 -0
  150. package/src/i18n/locales/it.po +4777 -0
  151. package/src/i18n/locales/ja.po +4777 -0
  152. package/src/i18n/locales/ko.po +4628 -0
  153. package/src/i18n/locales/nb.po +4777 -0
  154. package/src/i18n/locales/ne.po +4777 -0
  155. package/src/i18n/locales/nl.po +4628 -0
  156. package/src/i18n/locales/pl.po +4777 -0
  157. package/src/i18n/locales/pt_BR.po +4777 -0
  158. package/src/i18n/locales/pt_PT.po +4777 -0
  159. package/src/i18n/locales/ru.po +4777 -0
  160. package/src/i18n/locales/sv.po +4777 -0
  161. package/src/i18n/locales/tr.po +4777 -0
  162. package/src/i18n/locales/uk.po +4777 -0
  163. package/src/i18n/locales/zh_Hans.po +4777 -0
  164. package/src/i18n/locales/zh_Hant.po +4777 -0
  165. package/src/lib/components/data-input/combination-mode-input.tsx +1 -1
  166. package/src/lib/components/data-input/custom-field-list-input.tsx +11 -7
  167. package/src/lib/components/data-input/customer-group-input.tsx +27 -33
  168. package/src/lib/components/data-input/datetime-input.tsx +40 -1
  169. package/src/lib/components/data-input/default-relation-input.tsx +5 -4
  170. package/src/lib/components/data-input/product-multi-selector-input.tsx +14 -14
  171. package/src/lib/components/data-input/relation-selector.tsx +1 -1
  172. package/src/lib/components/data-input/select-with-options.tsx +1 -1
  173. package/src/lib/components/data-input/slug-input.tsx +9 -15
  174. package/src/lib/components/data-table/add-filter-menu.tsx +4 -4
  175. package/src/lib/components/data-table/data-table-bulk-action-item.tsx +8 -8
  176. package/src/lib/components/data-table/data-table-bulk-actions.tsx +4 -4
  177. package/src/lib/components/data-table/data-table-column-header.tsx +13 -8
  178. package/src/lib/components/data-table/data-table-faceted-filter.tsx +2 -1
  179. package/src/lib/components/data-table/data-table-filter-dialog.tsx +1 -1
  180. package/src/lib/components/data-table/data-table-utils.ts +21 -4
  181. package/src/lib/components/data-table/data-table-view-options.tsx +4 -2
  182. package/src/lib/components/data-table/data-table.tsx +3 -3
  183. package/src/lib/components/data-table/filters/data-table-boolean-filter.tsx +4 -4
  184. package/src/lib/components/data-table/global-views-bar.tsx +1 -1
  185. package/src/lib/components/data-table/human-readable-operator.tsx +1 -1
  186. package/src/lib/components/data-table/manage-global-views-button.tsx +1 -1
  187. package/src/lib/components/data-table/my-views-button.tsx +13 -13
  188. package/src/lib/components/data-table/refresh-button.tsx +1 -1
  189. package/src/lib/components/data-table/save-view-button.tsx +11 -11
  190. package/src/lib/components/data-table/use-generated-columns.tsx +10 -7
  191. package/src/lib/components/data-table/views-sheet.tsx +79 -71
  192. package/src/lib/components/date-range-picker.tsx +36 -34
  193. package/src/lib/components/layout/app-sidebar.tsx +3 -1
  194. package/src/lib/components/layout/channel-switcher.tsx +8 -10
  195. package/src/lib/components/layout/dev-mode-indicator.tsx +1 -1
  196. package/src/lib/components/layout/generated-breadcrumbs.tsx +10 -8
  197. package/src/lib/components/layout/language-dialog.tsx +34 -13
  198. package/src/lib/components/layout/manage-languages-dialog.tsx +1 -1
  199. package/src/lib/components/layout/nav-main.tsx +23 -13
  200. package/src/lib/components/layout/nav-user.tsx +19 -23
  201. package/src/lib/components/login/login-form.tsx +1 -1
  202. package/src/lib/components/shared/asset/asset-bulk-actions.tsx +4 -4
  203. package/src/lib/components/shared/asset/asset-focal-point-editor.tsx +1 -1
  204. package/src/lib/components/shared/asset/asset-gallery.tsx +15 -14
  205. package/src/lib/components/shared/assign-to-channel-bulk-action.tsx +11 -11
  206. package/src/lib/components/shared/assign-to-channel-dialog.tsx +6 -5
  207. package/src/lib/components/shared/channel-code-label.tsx +1 -1
  208. package/src/lib/components/shared/channel-selector.tsx +4 -4
  209. package/src/lib/components/shared/configurable-operation-multi-selector.tsx +16 -14
  210. package/src/lib/components/shared/configurable-operation-selector.tsx +1 -1
  211. package/src/lib/components/shared/confirmation-dialog.tsx +8 -8
  212. package/src/lib/components/shared/country-selector.tsx +1 -1
  213. package/src/lib/components/shared/currency-selector.tsx +4 -4
  214. package/src/lib/components/shared/custom-fields-form.tsx +8 -24
  215. package/src/lib/components/shared/customer-address-form.tsx +3 -3
  216. package/src/lib/components/shared/customer-group-selector.tsx +1 -1
  217. package/src/lib/components/shared/customer-selector.tsx +1 -1
  218. package/src/lib/components/shared/error-page.tsx +1 -1
  219. package/src/lib/components/shared/facet-value-selector.tsx +10 -10
  220. package/src/lib/components/shared/history-timeline/history-note-checkbox.tsx +1 -1
  221. package/src/lib/components/shared/history-timeline/history-note-editor.tsx +1 -1
  222. package/src/lib/components/shared/history-timeline/history-note-entry.tsx +1 -1
  223. package/src/lib/components/shared/language-selector.tsx +4 -4
  224. package/src/lib/components/shared/navigation-confirmation.tsx +1 -1
  225. package/src/lib/components/shared/paginated-list-data-table.tsx +21 -18
  226. package/src/lib/components/shared/remove-from-channel-bulk-action.tsx +6 -5
  227. package/src/lib/components/shared/rich-text-editor/image-dialog.tsx +1 -1
  228. package/src/lib/components/shared/rich-text-editor/link-dialog.tsx +1 -1
  229. package/src/lib/components/shared/rich-text-editor/responsive-toolbar.tsx +1 -1
  230. package/src/lib/components/shared/rich-text-editor/table-edit-icons.tsx +1 -1
  231. package/src/lib/components/shared/role-code-label.tsx +1 -1
  232. package/src/lib/components/shared/role-selector.tsx +4 -4
  233. package/src/lib/components/shared/seller-selector.tsx +1 -1
  234. package/src/lib/components/shared/stock-level-label.tsx +3 -5
  235. package/src/lib/components/shared/table-cell/order-table-cell-components.tsx +3 -1
  236. package/src/lib/components/shared/tax-category-selector.tsx +1 -1
  237. package/src/lib/components/shared/translatable-form-field.tsx +15 -15
  238. package/src/lib/components/shared/zone-selector.tsx +1 -1
  239. package/src/lib/constants.ts +10 -0
  240. package/src/lib/framework/dashboard-widget/base-widget.tsx +11 -9
  241. package/src/lib/framework/dashboard-widget/latest-orders-widget/index.tsx +6 -4
  242. package/src/lib/framework/dashboard-widget/metrics-widget/index.tsx +8 -5
  243. package/src/lib/framework/dashboard-widget/orders-summary/index.tsx +7 -4
  244. package/src/lib/framework/dashboard-widget/widget-filters-context.tsx +3 -1
  245. package/src/lib/framework/defaults.ts +34 -63
  246. package/src/lib/framework/layout-engine/page-layout.tsx +36 -36
  247. package/src/lib/framework/page/detail-page.tsx +10 -10
  248. package/src/lib/framework/page/use-extended-router.tsx +48 -23
  249. package/src/lib/graphql/api.ts +22 -7
  250. package/src/lib/graphql/graphql-env.d.ts +13 -25
  251. package/src/lib/hooks/use-display-locale.ts +40 -0
  252. package/src/lib/hooks/use-dynamic-translations.ts +46 -0
  253. package/src/lib/hooks/use-extended-detail-query.ts +1 -1
  254. package/src/lib/hooks/use-extended-list-query.ts +1 -1
  255. package/src/lib/hooks/use-local-format.ts +15 -1
  256. package/src/lib/hooks/use-saved-views.ts +7 -0
  257. package/src/lib/hooks/use-ui-language-loader.ts +30 -0
  258. package/src/lib/lib/load-i18n-messages.ts +17 -0
  259. package/src/lib/lib/trans.tsx +15 -11
  260. package/src/lib/providers/auth.tsx +2 -2
  261. package/src/lib/providers/channel-provider.tsx +3 -2
  262. package/src/lib/providers/i18n-provider.tsx +7 -14
  263. package/src/lib/providers/user-settings.tsx +46 -5
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
 
3
+ import { useLingui } from '@lingui/react/macro';
3
4
  import { createContext, useContext, PropsWithChildren } from 'react';
4
5
 
5
6
  export interface DefinedDateRange {
@@ -25,9 +26,10 @@ export function WidgetFiltersProvider({
25
26
  }
26
27
 
27
28
  export function useWidgetFilters() {
29
+ const { t } = useLingui();
28
30
  const context = useContext(WidgetFiltersContext);
29
31
  if (context === undefined) {
30
- throw new Error('useWidgetFilters must be used within a WidgetFiltersProvider');
32
+ throw new Error(t`useWidgetFilters must be used within a WidgetFiltersProvider`);
31
33
  }
32
34
  return context;
33
35
  }
@@ -19,7 +19,7 @@ export function registerDefaults() {
19
19
  sections: [
20
20
  {
21
21
  id: 'insights',
22
- title: 'Insights',
22
+ title: /* i18n*/ 'Insights',
23
23
  placement: 'top',
24
24
  icon: LayoutDashboardIcon,
25
25
  url: '/',
@@ -27,42 +27,42 @@ export function registerDefaults() {
27
27
  },
28
28
  {
29
29
  id: 'catalog',
30
- title: 'Catalog',
30
+ title: /* i18n*/ 'Catalog',
31
31
  icon: SquareTerminal,
32
32
  placement: 'top',
33
33
  order: 200,
34
34
  items: [
35
35
  {
36
36
  id: 'products',
37
- title: 'Products',
37
+ title: /* i18n*/ 'Products',
38
38
  url: '/products',
39
39
  order: 100,
40
40
  requiresPermission: ['ReadProduct', 'ReadCatalog'],
41
41
  },
42
42
  {
43
43
  id: 'product-variants',
44
- title: 'Product Variants',
44
+ title: /* i18n*/ 'Product Variants',
45
45
  url: '/product-variants',
46
46
  order: 200,
47
47
  requiresPermission: ['ReadProduct', 'ReadCatalog'],
48
48
  },
49
49
  {
50
50
  id: 'facets',
51
- title: 'Facets',
51
+ title: /* i18n*/ 'Facets',
52
52
  url: '/facets',
53
53
  order: 300,
54
54
  requiresPermission: ['ReadProduct', 'ReadCatalog'],
55
55
  },
56
56
  {
57
57
  id: 'collections',
58
- title: 'Collections',
58
+ title: /* i18n*/ 'Collections',
59
59
  url: '/collections',
60
60
  order: 400,
61
61
  requiresPermission: ['ReadCollection', 'ReadCatalog'],
62
62
  },
63
63
  {
64
64
  id: 'assets',
65
- title: 'Assets',
65
+ title: /* i18n*/ 'Assets',
66
66
  url: '/assets',
67
67
  order: 500,
68
68
  requiresPermission: ['ReadAsset', 'ReadCatalog'],
@@ -71,14 +71,14 @@ export function registerDefaults() {
71
71
  },
72
72
  {
73
73
  id: 'sales',
74
- title: 'Sales',
74
+ title: /* i18n*/ 'Sales',
75
75
  icon: ShoppingCart,
76
76
  placement: 'top',
77
77
  order: 300,
78
78
  items: [
79
79
  {
80
80
  id: 'orders',
81
- title: 'Orders',
81
+ title: /* i18n*/ 'Orders',
82
82
  url: '/orders',
83
83
  order: 100,
84
84
  requiresPermission: ['ReadOrder'],
@@ -87,21 +87,21 @@ export function registerDefaults() {
87
87
  },
88
88
  {
89
89
  id: 'customers',
90
- title: 'Customers',
90
+ title: /* i18n*/ 'Customers',
91
91
  icon: Users,
92
92
  placement: 'top',
93
93
  order: 400,
94
94
  items: [
95
95
  {
96
96
  id: 'customers',
97
- title: 'Customers',
97
+ title: /* i18n*/ 'Customers',
98
98
  url: '/customers',
99
99
  order: 100,
100
100
  requiresPermission: ['ReadCustomer'],
101
101
  },
102
102
  {
103
103
  id: 'customer-groups',
104
- title: 'Customer Groups',
104
+ title: /* i18n*/ 'Customer Groups',
105
105
  url: '/customer-groups',
106
106
  order: 200,
107
107
  requiresPermission: ['ReadCustomerGroup'],
@@ -110,14 +110,14 @@ export function registerDefaults() {
110
110
  },
111
111
  {
112
112
  id: 'marketing',
113
- title: 'Marketing',
113
+ title: /* i18n*/ 'Marketing',
114
114
  icon: Mail,
115
115
  placement: 'top',
116
116
  order: 500,
117
117
  items: [
118
118
  {
119
119
  id: 'promotions',
120
- title: 'Promotions',
120
+ title: /* i18n*/ 'Promotions',
121
121
  url: '/promotions',
122
122
  order: 100,
123
123
  requiresPermission: ['ReadPromotion'],
@@ -126,28 +126,28 @@ export function registerDefaults() {
126
126
  },
127
127
  {
128
128
  id: 'system',
129
- title: 'System',
129
+ title: /* i18n*/ 'System',
130
130
  icon: Terminal,
131
131
  placement: 'bottom',
132
132
  order: 200,
133
133
  items: [
134
134
  {
135
135
  id: 'job-queue',
136
- title: 'Job Queue',
136
+ title: /* i18n*/ 'Job Queue',
137
137
  url: '/job-queue',
138
138
  order: 100,
139
139
  requiresPermission: ['ReadSystem'],
140
140
  },
141
141
  {
142
142
  id: 'healthchecks',
143
- title: 'Healthchecks',
143
+ title: /* i18n*/ 'Healthchecks',
144
144
  url: '/healthchecks',
145
145
  order: 200,
146
146
  requiresPermission: ['ReadSystem'],
147
147
  },
148
148
  {
149
149
  id: 'scheduled-tasks',
150
- title: 'Scheduled Tasks',
150
+ title: /* i18n*/ 'Scheduled Tasks',
151
151
  url: '/scheduled-tasks',
152
152
  order: 300,
153
153
  requiresPermission: ['ReadSystem'],
@@ -156,91 +156,91 @@ export function registerDefaults() {
156
156
  },
157
157
  {
158
158
  id: 'settings',
159
- title: 'Settings',
159
+ title: /* i18n*/ 'Settings',
160
160
  icon: Settings2,
161
161
  placement: 'bottom',
162
162
  order: 100,
163
163
  items: [
164
164
  {
165
165
  id: 'sellers',
166
- title: 'Sellers',
166
+ title: /* i18n*/ 'Sellers',
167
167
  url: '/sellers',
168
168
  order: 100,
169
169
  requiresPermission: ['ReadSeller'],
170
170
  },
171
171
  {
172
172
  id: 'channels',
173
- title: 'Channels',
173
+ title: /* i18n*/ 'Channels',
174
174
  url: '/channels',
175
175
  order: 200,
176
176
  requiresPermission: ['ReadChannel'],
177
177
  },
178
178
  {
179
179
  id: 'stock-locations',
180
- title: 'Stock Locations',
180
+ title: /* i18n*/ 'Stock Locations',
181
181
  url: '/stock-locations',
182
182
  order: 300,
183
183
  requiresPermission: ['ReadStockLocation'],
184
184
  },
185
185
  {
186
186
  id: 'administrators',
187
- title: 'Administrators',
187
+ title: /* i18n*/ 'Administrators',
188
188
  url: '/administrators',
189
189
  order: 400,
190
190
  requiresPermission: ['ReadAdministrator'],
191
191
  },
192
192
  {
193
193
  id: 'roles',
194
- title: 'Roles',
194
+ title: /* i18n*/ 'Roles',
195
195
  url: '/roles',
196
196
  order: 500,
197
197
  requiresPermission: ['ReadAdministrator'],
198
198
  },
199
199
  {
200
200
  id: 'shipping-methods',
201
- title: 'Shipping Methods',
201
+ title: /* i18n*/ 'Shipping Methods',
202
202
  url: '/shipping-methods',
203
203
  order: 600,
204
204
  requiresPermission: ['ReadShippingMethod'],
205
205
  },
206
206
  {
207
207
  id: 'payment-methods',
208
- title: 'Payment Methods',
208
+ title: /* i18n*/ 'Payment Methods',
209
209
  url: '/payment-methods',
210
210
  order: 700,
211
211
  requiresPermission: ['ReadPaymentMethod'],
212
212
  },
213
213
  {
214
214
  id: 'tax-categories',
215
- title: 'Tax Categories',
215
+ title: /* i18n*/ 'Tax Categories',
216
216
  url: '/tax-categories',
217
217
  order: 800,
218
218
  requiresPermission: ['ReadTaxCategory'],
219
219
  },
220
220
  {
221
221
  id: 'tax-rates',
222
- title: 'Tax Rates',
222
+ title: /* i18n*/ 'Tax Rates',
223
223
  url: '/tax-rates',
224
224
  order: 900,
225
225
  requiresPermission: ['ReadTaxRate'],
226
226
  },
227
227
  {
228
228
  id: 'countries',
229
- title: 'Countries',
229
+ title: /* i18n*/ 'Countries',
230
230
  url: '/countries',
231
231
  order: 1000,
232
232
  requiresPermission: ['ReadCountry'],
233
233
  },
234
234
  {
235
235
  id: 'zones',
236
- title: 'Zones',
236
+ title: /* i18n*/ 'Zones',
237
237
  url: '/zones',
238
238
  order: 1100,
239
239
  requiresPermission: ['ReadZone'],
240
240
  },
241
241
  {
242
242
  id: 'global-settings',
243
- title: 'Global Settings',
243
+ title: /* i18n*/ 'Global Settings',
244
244
  url: '/global-settings',
245
245
  order: 1200,
246
246
  requiresPermission: ['UpdateGlobalSettings'],
@@ -252,7 +252,7 @@ export function registerDefaults() {
252
252
 
253
253
  registerDashboardWidget({
254
254
  id: 'metrics-widget',
255
- name: 'Metrics Widget',
255
+ name: /* i18n*/ 'Metrics Widget',
256
256
  component: MetricsWidget,
257
257
  defaultSize: { w: 12, h: 6, x: 0, y: 0 },
258
258
  minSize: { w: 6, h: 4 },
@@ -260,44 +260,15 @@ export function registerDefaults() {
260
260
 
261
261
  registerDashboardWidget({
262
262
  id: 'latest-orders-widget',
263
- name: 'Latest Orders Widget',
263
+ name: /* i18n*/ 'Latest Orders Widget',
264
264
  component: LatestOrdersWidget,
265
265
  defaultSize: { w: 6, h: 7, x: 0, y: 0 },
266
266
  });
267
267
 
268
268
  registerDashboardWidget({
269
269
  id: 'orders-summary-widget',
270
- name: 'Orders Summary Widget',
270
+ name: /* i18n*/ 'Orders Summary Widget',
271
271
  component: OrdersSummaryWidget,
272
272
  defaultSize: { w: 6, h: 3, x: 6, y: 0 },
273
273
  });
274
-
275
- // registerAlert<boolean>({
276
- // id: 'test-alert',
277
- // title: data => `Test Alert ${String(data)}`,
278
- // description: 'This is a test alert',
279
- // severity: 'info',
280
- // check: () => Promise.resolve(true),
281
- // actions: [
282
- // {
283
- // label: 'Test Action',
284
- // onClick: () => console.log('Test Action'),
285
- // },
286
- // ],
287
- // });
288
-
289
- // registerAlert<boolean>({
290
- // id: 'test-alert-2',
291
- // title: 'Test Alert 2',
292
- // description: 'This is a test alert 2',
293
- // severity: 'info',
294
- // check: () => Promise.resolve(true),
295
- // shouldShow: data => data === true,
296
- // actions: [
297
- // {
298
- // label: 'Test Action',
299
- // onClick: () => console.log('Test Action'),
300
- // },
301
- // ],
302
- // });
303
274
  }
@@ -23,7 +23,7 @@ import {
23
23
  } from '@/vdb/components/ui/dropdown-menu.js';
24
24
  import { PageBlockContext } from '@/vdb/framework/layout-engine/page-block-provider.js';
25
25
  import { PageContext, PageContextValue } from '@/vdb/framework/layout-engine/page-provider.js';
26
- import { Trans } from '@/vdb/lib/trans.js';
26
+ import { Trans } from '@lingui/react/macro';
27
27
  import { getDashboardActionBarItems, getDashboardPageBlocks } from './layout-extensions.js';
28
28
  import { LocationWrapper } from './location-wrapper.js';
29
29
 
@@ -119,12 +119,12 @@ export function Page({ children, pageId, entity, form, submitHandler, ...props }
119
119
  }
120
120
 
121
121
  function PageContent({
122
- pageHeader,
123
- pageContent,
124
- form,
125
- submitHandler,
126
- ...props
127
- }: {
122
+ pageHeader,
123
+ pageContent,
124
+ form,
125
+ submitHandler,
126
+ ...props
127
+ }: {
128
128
  pageHeader: React.ReactNode;
129
129
  pageContent: React.ReactNode;
130
130
  form?: UseFormReturn<any>;
@@ -146,11 +146,11 @@ function PageContent({
146
146
  }
147
147
 
148
148
  export function PageContentWithOptionalForm({
149
- form,
150
- pageHeader,
151
- pageContent,
152
- submitHandler,
153
- }: {
149
+ form,
150
+ pageHeader,
151
+ pageContent,
152
+ submitHandler,
153
+ }: {
154
154
  form?: UseFormReturn<any>;
155
155
  pageHeader: React.ReactNode;
156
156
  pageContent: React.ReactNode;
@@ -425,9 +425,9 @@ function EntityInfoDropdown({ entity }: Readonly<{ entity: any }>) {
425
425
  * @since 3.3.0
426
426
  */
427
427
  export function PageActionBarRight({
428
- children,
429
- dropdownMenuItems,
430
- }: Readonly<{
428
+ children,
429
+ dropdownMenuItems,
430
+ }: Readonly<{
431
431
  children: React.ReactNode;
432
432
  dropdownMenuItems?: InlineDropdownItem[];
433
433
  }>) {
@@ -458,9 +458,9 @@ export function PageActionBarRight({
458
458
  }
459
459
 
460
460
  function PageActionBarItem({
461
- item,
462
- page,
463
- }: Readonly<{ item: DashboardActionBarItem; page: PageContextValue }>) {
461
+ item,
462
+ page,
463
+ }: Readonly<{ item: DashboardActionBarItem; page: PageContextValue }>) {
464
464
  return (
465
465
  <PermissionGuard requires={item.requiresPermission ?? []}>
466
466
  <item.component context={page} />
@@ -469,9 +469,9 @@ function PageActionBarItem({
469
469
  }
470
470
 
471
471
  function PageActionBarDropdown({
472
- items,
473
- page,
474
- }: Readonly<{ items: DashboardActionBarItem[]; page: PageContextValue }>) {
472
+ items,
473
+ page,
474
+ }: Readonly<{ items: DashboardActionBarItem[]; page: PageContextValue }>) {
475
475
  return (
476
476
  <DropdownMenu>
477
477
  <DropdownMenuTrigger asChild>
@@ -550,13 +550,13 @@ export type PageBlockProps = {
550
550
  * @since 3.3.0
551
551
  */
552
552
  export function PageBlock({
553
- children,
554
- title,
555
- description,
556
- className,
557
- blockId,
558
- column,
559
- }: Readonly<PageBlockProps>) {
553
+ children,
554
+ title,
555
+ description,
556
+ className,
557
+ blockId,
558
+ column,
559
+ }: Readonly<PageBlockProps>) {
560
560
  const contextValue = useMemo(
561
561
  () => ({
562
562
  blockId,
@@ -595,10 +595,10 @@ export function PageBlock({
595
595
  * @since 3.3.0
596
596
  */
597
597
  export function FullWidthPageBlock({
598
- children,
599
- className,
600
- blockId,
601
- }: Readonly<Pick<PageBlockProps, 'children' | 'className' | 'blockId'>>) {
598
+ children,
599
+ className,
600
+ blockId,
601
+ }: Readonly<Pick<PageBlockProps, 'children' | 'className' | 'blockId'>>) {
602
602
  const contextValue = useMemo(() => ({ blockId, column: 'main' as const }), [blockId]);
603
603
  return (
604
604
  <PageBlockContext.Provider value={contextValue}>
@@ -625,10 +625,10 @@ export function FullWidthPageBlock({
625
625
  * @since 3.3.0
626
626
  */
627
627
  export function CustomFieldsPageBlock({
628
- column,
629
- entityType,
630
- control,
631
- }: Readonly<{
628
+ column,
629
+ entityType,
630
+ control,
631
+ }: Readonly<{
632
632
  column: 'main' | 'side';
633
633
  entityType: string;
634
634
  control: Control<any, any>;
@@ -5,7 +5,7 @@ import { Checkbox } from '@/vdb/components/ui/checkbox.js';
5
5
  import { Input } from '@/vdb/components/ui/input.js';
6
6
  import { NEW_ENTITY_PATH } from '@/vdb/constants.js';
7
7
  import { useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
8
- import { Trans } from '@/vdb/lib/trans.js';
8
+ import { Trans } from '@lingui/react/macro';
9
9
  import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
10
10
  import { AnyRoute, useNavigate } from '@tanstack/react-router';
11
11
  import { ResultOf, VariablesOf } from 'gql.tada';
@@ -152,15 +152,15 @@ export function DetailPage<
152
152
  C extends TypedDocumentNode<any, any>,
153
153
  U extends TypedDocumentNode<any, any>,
154
154
  >({
155
- pageId,
156
- route,
157
- entityName: passedEntityName,
158
- queryDocument,
159
- createDocument,
160
- updateDocument,
161
- setValuesForUpdate,
162
- title,
163
- }: DetailPageProps<T, C, U>) {
155
+ pageId,
156
+ route,
157
+ entityName: passedEntityName,
158
+ queryDocument,
159
+ createDocument,
160
+ updateDocument,
161
+ setValuesForUpdate,
162
+ title,
163
+ }: DetailPageProps<T, C, U>) {
164
164
  const params = route.useParams();
165
165
  const creatingNewEntity = params.id === NEW_ENTITY_PATH;
166
166
  const navigate = useNavigate();
@@ -1,4 +1,4 @@
1
- import { AnyRoute, createRoute, Router } from '@tanstack/react-router';
1
+ import { AnyRoute, createRoute, createRouter, RouterOptions } from '@tanstack/react-router';
2
2
  import { useMemo } from 'react';
3
3
  import { ErrorPage } from '../../components/shared/error-page.js';
4
4
  import { AUTHENTICATED_ROUTE_PREFIX } from '../../constants.js';
@@ -6,26 +6,40 @@ import { useDashboardExtensions } from '../extension-api/use-dashboard-extension
6
6
  import { extensionRoutes } from './page-api.js';
7
7
 
8
8
  /**
9
- * Extends the TanStack Router with additional routes for each dashboard
10
- * extension.
9
+ * Creates a TanStack Router with the base route tree extended with additional
10
+ * routes from dashboard extensions.
11
11
  */
12
- export const useExtendedRouter = (router: Router<AnyRoute, any, any>) => {
12
+ export const useExtendedRouter = (
13
+ baseRouteTree: AnyRoute,
14
+ routerOptions: Omit<RouterOptions<AnyRoute, any>, 'routeTree'>,
15
+ ) => {
13
16
  const { extensionsLoaded } = useDashboardExtensions();
14
17
 
15
18
  return useMemo(() => {
19
+ // Start with the base route tree
20
+ let routeTree = baseRouteTree;
21
+
22
+ // Only extend if extensions are loaded
16
23
  if (!extensionsLoaded) {
17
- return router;
24
+ return createRouter({
25
+ ...routerOptions,
26
+ routeTree,
27
+ });
18
28
  }
19
29
 
20
- const authenticatedRouteIndex = router.routeTree.children.findIndex(
30
+ const authenticatedRouteIndex = routeTree.children.findIndex(
21
31
  (r: AnyRoute) => r.id === AUTHENTICATED_ROUTE_PREFIX,
22
32
  );
23
33
 
24
34
  if (authenticatedRouteIndex === -1) {
25
- return router;
35
+ // No authenticated route found, return router with base tree
36
+ return createRouter({
37
+ ...routerOptions,
38
+ routeTree,
39
+ });
26
40
  }
27
41
 
28
- let authenticatedRoute: AnyRoute = router.routeTree.children[authenticatedRouteIndex];
42
+ let authenticatedRoute: AnyRoute = routeTree.children[authenticatedRouteIndex];
29
43
 
30
44
  const newAuthenticatedRoutes: AnyRoute[] = [];
31
45
  const newRootRoutes: AnyRoute[] = [];
@@ -61,7 +75,7 @@ export const useExtendedRouter = (router: Router<AnyRoute, any, any>) => {
61
75
  // Check if the route already exists at the root level
62
76
  // Check both by path and by id (which includes the leading slash)
63
77
  const routeExists =
64
- router.routeTree.children.some(
78
+ routeTree.children.some(
65
79
  (r: AnyRoute) =>
66
80
  r.path === `/${pathWithoutLeadingSlash}` ||
67
81
  r.path === pathWithoutLeadingSlash ||
@@ -80,7 +94,7 @@ export const useExtendedRouter = (router: Router<AnyRoute, any, any>) => {
80
94
 
81
95
  const newRoute: AnyRoute = createRoute({
82
96
  path: `/${pathWithoutLeadingSlash}`,
83
- getParentRoute: () => router.routeTree,
97
+ getParentRoute: () => routeTree,
84
98
  loader: config.loader,
85
99
  validateSearch: config.validateSearch,
86
100
  component: () => config.component(newRoute),
@@ -90,21 +104,32 @@ export const useExtendedRouter = (router: Router<AnyRoute, any, any>) => {
90
104
  }
91
105
  }
92
106
 
93
- const childrenWithoutAuthenticated = router.routeTree.children.filter(
107
+ // Only extend the tree if we have new routes to add
108
+ if (newAuthenticatedRoutes.length === 0 && newRootRoutes.length === 0) {
109
+ return createRouter({
110
+ ...routerOptions,
111
+ routeTree,
112
+ });
113
+ }
114
+
115
+ const childrenWithoutAuthenticated = routeTree.children.filter(
94
116
  (r: AnyRoute) => r.id !== AUTHENTICATED_ROUTE_PREFIX,
95
117
  );
96
118
 
97
- // Create a new router with the modified route tree
98
- const newRouter = new Router({
99
- routeTree: router.routeTree.addChildren([
100
- ...childrenWithoutAuthenticated,
101
- authenticatedRoute.addChildren([...authenticatedRoute.children, ...newAuthenticatedRoutes]),
102
- ...newRootRoutes,
103
- ]),
104
- basepath: router.basepath,
105
- defaultPreload: router.options.defaultPreload,
106
- defaultPreloadDelay: router.options.defaultPreloadDelay,
119
+ const updatedAuthenticatedRoute = authenticatedRoute.addChildren([
120
+ ...authenticatedRoute.children,
121
+ ...newAuthenticatedRoutes,
122
+ ]);
123
+
124
+ const extendedRouteTree: AnyRoute = routeTree.addChildren([
125
+ ...childrenWithoutAuthenticated,
126
+ updatedAuthenticatedRoute,
127
+ ...newRootRoutes,
128
+ ]);
129
+
130
+ return createRouter({
131
+ ...routerOptions,
132
+ routeTree: extendedRouteTree,
107
133
  });
108
- return newRouter;
109
- }, [router, extensionsLoaded]);
134
+ }, [baseRouteTree, routerOptions, extensionsLoaded]);
110
135
  };