@vendure/dashboard 3.4.3-master-202509260228 → 3.5.0-minor-202510012036

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 (295) hide show
  1. package/README.md +4 -0
  2. package/dist/plugin/api/api-extensions.js +11 -14
  3. package/dist/plugin/api/metrics.resolver.d.ts +2 -2
  4. package/dist/plugin/api/metrics.resolver.js +2 -2
  5. package/dist/plugin/config/metrics-strategies.d.ts +9 -9
  6. package/dist/plugin/config/metrics-strategies.js +6 -6
  7. package/dist/plugin/constants.d.ts +2 -0
  8. package/dist/plugin/constants.js +3 -1
  9. package/dist/plugin/dashboard.plugin.js +13 -0
  10. package/dist/plugin/service/metrics.service.d.ts +3 -3
  11. package/dist/plugin/service/metrics.service.js +37 -53
  12. package/dist/plugin/types.d.ts +9 -12
  13. package/dist/plugin/types.js +7 -11
  14. package/dist/vite/vite-plugin-config.js +13 -9
  15. package/dist/vite/vite-plugin-translations.d.ts +22 -0
  16. package/dist/vite/vite-plugin-translations.js +66 -0
  17. package/dist/vite/vite-plugin-vendure-dashboard.js +10 -8
  18. package/lingui.config.js +25 -2
  19. package/package.json +159 -156
  20. package/src/app/app-providers.tsx +0 -4
  21. package/src/app/common/delete-bulk-action.tsx +6 -5
  22. package/src/app/common/duplicate-bulk-action.tsx +4 -5
  23. package/src/app/common/duplicate-entity-dialog.tsx +1 -1
  24. package/src/app/common/set-document-direction.ts +7 -0
  25. package/src/app/main.tsx +50 -17
  26. package/src/app/routes/_authenticated/_administrators/administrators.tsx +8 -6
  27. package/src/app/routes/_authenticated/_administrators/administrators_.$id.tsx +17 -6
  28. package/src/app/routes/_authenticated/_administrators/components/role-permissions-display.tsx +2 -2
  29. package/src/app/routes/_authenticated/_assets/assets.tsx +1 -1
  30. package/src/app/routes/_authenticated/_assets/assets_.$id.tsx +4 -4
  31. package/src/app/routes/_authenticated/_assets/components/asset-bulk-actions.tsx +8 -6
  32. package/src/app/routes/_authenticated/_assets/components/asset-tag-filter.tsx +1 -1
  33. package/src/app/routes/_authenticated/_assets/components/asset-tags-editor.tsx +1 -1
  34. package/src/app/routes/_authenticated/_assets/components/manage-tags-dialog.tsx +3 -8
  35. package/src/app/routes/_authenticated/_channels/channels.tsx +3 -6
  36. package/src/app/routes/_authenticated/_channels/channels_.$id.tsx +5 -5
  37. package/src/app/routes/_authenticated/_collections/collections.tsx +10 -6
  38. package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +16 -5
  39. package/src/app/routes/_authenticated/_collections/components/collection-bulk-actions.tsx +1 -1
  40. package/src/app/routes/_authenticated/_collections/components/collection-contents-sheet.tsx +1 -1
  41. package/src/app/routes/_authenticated/_collections/components/move-collections-dialog.tsx +6 -6
  42. package/src/app/routes/_authenticated/_countries/countries.graphql.ts +2 -0
  43. package/src/app/routes/_authenticated/_countries/countries.tsx +2 -3
  44. package/src/app/routes/_authenticated/_countries/countries_.$id.tsx +4 -4
  45. package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-sheet.tsx +1 -1
  46. package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-table.tsx +4 -4
  47. package/src/app/routes/_authenticated/_customer-groups/customer-groups.tsx +2 -4
  48. package/src/app/routes/_authenticated/_customer-groups/customer-groups_.$id.tsx +13 -6
  49. package/src/app/routes/_authenticated/_customers/components/customer-address-card.tsx +8 -8
  50. package/src/app/routes/_authenticated/_customers/components/customer-address-form.tsx +3 -3
  51. package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-container.tsx +1 -1
  52. package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-utils.tsx +1 -1
  53. package/src/app/routes/_authenticated/_customers/components/customer-history/default-customer-history-components.tsx +1 -1
  54. package/src/app/routes/_authenticated/_customers/components/customer-history/use-customer-history.ts +1 -1
  55. package/src/app/routes/_authenticated/_customers/components/customer-status-badge.tsx +1 -1
  56. package/src/app/routes/_authenticated/_customers/customers.graphql.ts +4 -0
  57. package/src/app/routes/_authenticated/_customers/customers.tsx +23 -11
  58. package/src/app/routes/_authenticated/_customers/customers_.$id.tsx +10 -8
  59. package/src/app/routes/_authenticated/_facets/components/edit-facet-value.tsx +1 -1
  60. package/src/app/routes/_authenticated/_facets/components/facet-bulk-actions.tsx +6 -5
  61. package/src/app/routes/_authenticated/_facets/components/facet-values-sheet.tsx +1 -1
  62. package/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx +1 -1
  63. package/src/app/routes/_authenticated/_facets/facets.tsx +5 -5
  64. package/src/app/routes/_authenticated/_facets/facets_.$facetId.values_.$id.tsx +7 -5
  65. package/src/app/routes/_authenticated/_facets/facets_.$id.tsx +18 -6
  66. package/src/app/routes/_authenticated/_global-settings/global-settings.tsx +5 -5
  67. package/src/app/routes/_authenticated/_orders/components/add-manual-payment-dialog.tsx +19 -21
  68. package/src/app/routes/_authenticated/_orders/components/customer-address-selector.tsx +1 -1
  69. package/src/app/routes/_authenticated/_orders/components/edit-order-table.tsx +22 -22
  70. package/src/app/routes/_authenticated/_orders/components/fulfill-order-dialog.tsx +6 -6
  71. package/src/app/routes/_authenticated/_orders/components/fulfillment-details.tsx +15 -9
  72. package/src/app/routes/_authenticated/_orders/components/order-address.tsx +1 -1
  73. package/src/app/routes/_authenticated/_orders/components/order-detail-shared.tsx +11 -9
  74. package/src/app/routes/_authenticated/_orders/components/order-history/default-order-history-components.tsx +1 -1
  75. package/src/app/routes/_authenticated/_orders/components/order-history/order-history-container.tsx +1 -1
  76. package/src/app/routes/_authenticated/_orders/components/order-history/order-history-utils.tsx +1 -1
  77. package/src/app/routes/_authenticated/_orders/components/order-history/use-order-history.ts +1 -1
  78. package/src/app/routes/_authenticated/_orders/components/order-line-custom-fields-form.tsx +1 -1
  79. package/src/app/routes/_authenticated/_orders/components/order-modification-preview-dialog.tsx +4 -4
  80. package/src/app/routes/_authenticated/_orders/components/order-modification-summary.tsx +1 -1
  81. package/src/app/routes/_authenticated/_orders/components/order-table-totals.tsx +27 -27
  82. package/src/app/routes/_authenticated/_orders/components/order-table.tsx +2 -2
  83. package/src/app/routes/_authenticated/_orders/components/order-tax-summary.tsx +1 -1
  84. package/src/app/routes/_authenticated/_orders/components/payment-details.tsx +26 -20
  85. package/src/app/routes/_authenticated/_orders/components/seller-orders-card.tsx +3 -1
  86. package/src/app/routes/_authenticated/_orders/components/settle-refund-dialog.tsx +6 -6
  87. package/src/app/routes/_authenticated/_orders/components/shipping-method-selector.tsx +1 -1
  88. package/src/app/routes/_authenticated/_orders/components/state-transition-control.tsx +1 -1
  89. package/src/app/routes/_authenticated/_orders/components/use-transition-order-to-state.tsx +3 -2
  90. package/src/app/routes/_authenticated/_orders/orders.tsx +5 -9
  91. package/src/app/routes/_authenticated/_orders/orders_.$aggregateOrderId_.seller-orders.$sellerOrderId.tsx +1 -1
  92. package/src/app/routes/_authenticated/_orders/orders_.$id.tsx +1 -1
  93. package/src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx +4 -4
  94. package/src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx +17 -17
  95. package/src/app/routes/_authenticated/_orders/utils/order-detail-loaders.tsx +1 -1
  96. package/src/app/routes/_authenticated/_payment-methods/payment-methods.tsx +5 -6
  97. package/src/app/routes/_authenticated/_payment-methods/payment-methods_.$id.tsx +13 -6
  98. package/src/app/routes/_authenticated/_product-variants/components/product-variant-bulk-actions.tsx +1 -1
  99. package/src/app/routes/_authenticated/_product-variants/components/variant-price-detail.tsx +1 -1
  100. package/src/app/routes/_authenticated/_product-variants/product-variants.graphql.ts +10 -0
  101. package/src/app/routes/_authenticated/_product-variants/product-variants.tsx +9 -2
  102. package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +13 -6
  103. package/src/app/routes/_authenticated/_products/components/add-option-group-dialog.tsx +5 -5
  104. package/src/app/routes/_authenticated/_products/components/add-product-variant-dialog.tsx +5 -5
  105. package/src/app/routes/_authenticated/_products/components/assign-facet-values-dialog.tsx +5 -4
  106. package/src/app/routes/_authenticated/_products/components/create-product-options-dialog.tsx +9 -12
  107. package/src/app/routes/_authenticated/_products/components/create-product-variants-dialog.tsx +1 -1
  108. package/src/app/routes/_authenticated/_products/components/create-product-variants.tsx +4 -4
  109. package/src/app/routes/_authenticated/_products/components/option-groups-editor.tsx +1 -1
  110. package/src/app/routes/_authenticated/_products/components/product-bulk-actions.tsx +1 -1
  111. package/src/app/routes/_authenticated/_products/components/product-option-group-badge.tsx +19 -0
  112. package/src/app/routes/_authenticated/_products/components/product-option-select.tsx +3 -3
  113. package/src/app/routes/_authenticated/_products/components/product-options-table.tsx +114 -0
  114. package/src/app/routes/_authenticated/_products/product-option-groups.graphql.ts +103 -0
  115. package/src/app/routes/_authenticated/_products/products.graphql.ts +44 -32
  116. package/src/app/routes/_authenticated/_products/products.tsx +34 -5
  117. package/src/app/routes/_authenticated/_products/products_.$id.tsx +29 -12
  118. package/src/app/routes/_authenticated/_products/products_.$id_.variants.tsx +11 -11
  119. package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$id.tsx +177 -0
  120. package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$productOptionGroupId.options_.$id.tsx +208 -0
  121. package/src/app/routes/_authenticated/_profile/profile.tsx +4 -4
  122. package/src/app/routes/_authenticated/_promotions/promotions.tsx +2 -4
  123. package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +16 -9
  124. package/src/app/routes/_authenticated/_roles/components/permissions-table-grid.tsx +1 -1
  125. package/src/app/routes/_authenticated/_roles/roles.tsx +3 -6
  126. package/src/app/routes/_authenticated/_roles/roles_.$id.tsx +4 -6
  127. package/src/app/routes/_authenticated/_sellers/sellers.tsx +3 -4
  128. package/src/app/routes/_authenticated/_sellers/sellers_.$id.tsx +4 -4
  129. package/src/app/routes/_authenticated/_shipping-methods/components/price-display.tsx +5 -5
  130. package/src/app/routes/_authenticated/_shipping-methods/components/shipping-method-test-result-wrapper.tsx +1 -1
  131. package/src/app/routes/_authenticated/_shipping-methods/components/test-address-form.tsx +11 -11
  132. package/src/app/routes/_authenticated/_shipping-methods/components/test-order-builder.tsx +1 -1
  133. package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-methods-result.tsx +8 -8
  134. package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-methods-sheet.tsx +1 -1
  135. package/src/app/routes/_authenticated/_shipping-methods/components/test-single-method-result.tsx +8 -8
  136. package/src/app/routes/_authenticated/_shipping-methods/components/test-single-shipping-method-sheet.tsx +4 -4
  137. package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.tsx +2 -3
  138. package/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx +2 -2
  139. package/src/app/routes/_authenticated/_stock-locations/stock-locations.tsx +3 -4
  140. package/src/app/routes/_authenticated/_stock-locations/stock-locations_.$id.tsx +13 -6
  141. package/src/app/routes/_authenticated/_system/healthchecks.tsx +10 -4
  142. package/src/app/routes/_authenticated/_system/job-queue.tsx +10 -13
  143. package/src/app/routes/_authenticated/_system/scheduled-tasks.tsx +18 -16
  144. package/src/app/routes/_authenticated/_tax-categories/tax-categories.tsx +2 -4
  145. package/src/app/routes/_authenticated/_tax-categories/tax-categories_.$id.tsx +13 -6
  146. package/src/app/routes/_authenticated/_tax-rates/tax-rates.tsx +8 -12
  147. package/src/app/routes/_authenticated/_tax-rates/tax-rates_.$id.tsx +6 -4
  148. package/src/app/routes/_authenticated/_zones/components/zone-countries-sheet.tsx +4 -1
  149. package/src/app/routes/_authenticated/_zones/zones.tsx +4 -4
  150. package/src/app/routes/_authenticated/_zones/zones_.$id.tsx +8 -5
  151. package/src/app/routes/_authenticated/index.tsx +46 -25
  152. package/src/app/styles.css +4 -0
  153. package/src/i18n/common-strings.ts +111 -0
  154. package/src/i18n/locales/ar.po +4777 -0
  155. package/src/i18n/locales/cs.po +4777 -0
  156. package/src/i18n/locales/de.po +4299 -1101
  157. package/src/i18n/locales/en.po +3857 -659
  158. package/src/i18n/locales/es.po +4777 -0
  159. package/src/i18n/locales/fa.po +4777 -0
  160. package/src/i18n/locales/fr.po +4777 -0
  161. package/src/i18n/locales/he.po +4777 -0
  162. package/src/i18n/locales/hr.po +4777 -0
  163. package/src/i18n/locales/it.po +4777 -0
  164. package/src/i18n/locales/ja.po +4777 -0
  165. package/src/i18n/locales/ko.po +4628 -0
  166. package/src/i18n/locales/nb.po +4777 -0
  167. package/src/i18n/locales/ne.po +4777 -0
  168. package/src/i18n/locales/nl.po +4628 -0
  169. package/src/i18n/locales/pl.po +4777 -0
  170. package/src/i18n/locales/pt_BR.po +4777 -0
  171. package/src/i18n/locales/pt_PT.po +4777 -0
  172. package/src/i18n/locales/ru.po +4777 -0
  173. package/src/i18n/locales/sv.po +4777 -0
  174. package/src/i18n/locales/tr.po +4777 -0
  175. package/src/i18n/locales/uk.po +4777 -0
  176. package/src/i18n/locales/zh_Hans.po +4777 -0
  177. package/src/i18n/locales/zh_Hant.po +4777 -0
  178. package/src/lib/components/data-display/json.tsx +16 -1
  179. package/src/lib/components/data-input/combination-mode-input.tsx +1 -1
  180. package/src/lib/components/data-input/custom-field-list-input.tsx +11 -7
  181. package/src/lib/components/data-input/customer-group-input.tsx +27 -33
  182. package/src/lib/components/data-input/datetime-input.tsx +40 -1
  183. package/src/lib/components/data-input/default-relation-input.tsx +5 -4
  184. package/src/lib/components/data-input/index.ts +3 -0
  185. package/src/lib/components/data-input/product-multi-selector-input.tsx +14 -14
  186. package/src/lib/components/data-input/relation-selector.tsx +1 -1
  187. package/src/lib/components/data-input/select-with-options.tsx +1 -1
  188. package/src/lib/components/data-input/slug-input.tsx +290 -0
  189. package/src/lib/components/data-table/add-filter-menu.tsx +17 -10
  190. package/src/lib/components/data-table/data-table-bulk-action-item.tsx +45 -8
  191. package/src/lib/components/data-table/data-table-bulk-actions.tsx +4 -4
  192. package/src/lib/components/data-table/data-table-column-header.tsx +13 -8
  193. package/src/lib/components/data-table/data-table-context.tsx +91 -0
  194. package/src/lib/components/data-table/data-table-faceted-filter.tsx +2 -1
  195. package/src/lib/components/data-table/data-table-filter-badge.tsx +9 -5
  196. package/src/lib/components/data-table/data-table-filter-dialog.tsx +1 -1
  197. package/src/lib/components/data-table/data-table-utils.ts +21 -4
  198. package/src/lib/components/data-table/data-table-view-options.tsx +21 -10
  199. package/src/lib/components/data-table/data-table.tsx +146 -94
  200. package/src/lib/components/data-table/filters/data-table-boolean-filter.tsx +4 -4
  201. package/src/lib/components/data-table/global-views-bar.tsx +97 -0
  202. package/src/lib/components/data-table/global-views-sheet.tsx +11 -0
  203. package/src/lib/components/data-table/human-readable-operator.tsx +1 -1
  204. package/src/lib/components/data-table/manage-global-views-button.tsx +26 -0
  205. package/src/lib/components/data-table/my-views-button.tsx +47 -0
  206. package/src/lib/components/data-table/refresh-button.tsx +12 -3
  207. package/src/lib/components/data-table/save-view-button.tsx +41 -0
  208. package/src/lib/components/data-table/save-view-dialog.tsx +113 -0
  209. package/src/lib/components/data-table/use-generated-columns.tsx +13 -8
  210. package/src/lib/components/data-table/user-views-sheet.tsx +11 -0
  211. package/src/lib/components/data-table/views-sheet.tsx +305 -0
  212. package/src/lib/components/date-range-picker.tsx +186 -0
  213. package/src/lib/components/layout/app-sidebar.tsx +3 -1
  214. package/src/lib/components/layout/channel-switcher.tsx +8 -10
  215. package/src/lib/components/layout/dev-mode-indicator.tsx +1 -1
  216. package/src/lib/components/layout/generated-breadcrumbs.tsx +10 -8
  217. package/src/lib/components/layout/language-dialog.tsx +34 -13
  218. package/src/lib/components/layout/manage-languages-dialog.tsx +1 -1
  219. package/src/lib/components/layout/nav-main.tsx +23 -13
  220. package/src/lib/components/layout/nav-user.tsx +19 -23
  221. package/src/lib/components/login/login-form.tsx +1 -1
  222. package/src/lib/components/shared/asset/asset-bulk-actions.tsx +4 -4
  223. package/src/lib/components/shared/asset/asset-focal-point-editor.tsx +1 -1
  224. package/src/lib/components/shared/asset/asset-gallery.tsx +15 -14
  225. package/src/lib/components/shared/assign-to-channel-bulk-action.tsx +11 -11
  226. package/src/lib/components/shared/assign-to-channel-dialog.tsx +6 -5
  227. package/src/lib/components/shared/channel-code-label.tsx +1 -1
  228. package/src/lib/components/shared/channel-selector.tsx +4 -4
  229. package/src/lib/components/shared/configurable-operation-multi-selector.tsx +16 -14
  230. package/src/lib/components/shared/configurable-operation-selector.tsx +1 -1
  231. package/src/lib/components/shared/confirmation-dialog.tsx +8 -8
  232. package/src/lib/components/shared/country-selector.tsx +1 -1
  233. package/src/lib/components/shared/currency-selector.tsx +4 -4
  234. package/src/lib/components/shared/custom-fields-form.tsx +8 -24
  235. package/src/lib/components/shared/customer-address-form.tsx +3 -3
  236. package/src/lib/components/shared/customer-group-selector.tsx +1 -1
  237. package/src/lib/components/shared/customer-selector.tsx +1 -1
  238. package/src/lib/components/shared/error-page.tsx +1 -1
  239. package/src/lib/components/shared/facet-value-selector.tsx +10 -10
  240. package/src/lib/components/shared/history-timeline/history-note-checkbox.tsx +1 -1
  241. package/src/lib/components/shared/history-timeline/history-note-editor.tsx +1 -1
  242. package/src/lib/components/shared/history-timeline/history-note-entry.tsx +1 -1
  243. package/src/lib/components/shared/language-selector.tsx +4 -4
  244. package/src/lib/components/shared/navigation-confirmation.tsx +1 -1
  245. package/src/lib/components/shared/paginated-list-data-table.tsx +64 -34
  246. package/src/lib/components/shared/remove-from-channel-bulk-action.tsx +6 -5
  247. package/src/lib/components/shared/rich-text-editor/image-dialog.tsx +1 -1
  248. package/src/lib/components/shared/rich-text-editor/link-dialog.tsx +1 -1
  249. package/src/lib/components/shared/rich-text-editor/responsive-toolbar.tsx +1 -1
  250. package/src/lib/components/shared/rich-text-editor/table-edit-icons.tsx +1 -1
  251. package/src/lib/components/shared/role-code-label.tsx +1 -1
  252. package/src/lib/components/shared/role-selector.tsx +4 -4
  253. package/src/lib/components/shared/seller-selector.tsx +1 -1
  254. package/src/lib/components/shared/stock-level-label.tsx +3 -5
  255. package/src/lib/components/shared/table-cell/order-table-cell-components.tsx +3 -1
  256. package/src/lib/components/shared/tax-category-selector.tsx +1 -1
  257. package/src/lib/components/shared/translatable-form-field.tsx +15 -15
  258. package/src/lib/components/shared/zone-selector.tsx +1 -1
  259. package/src/lib/components/ui/button.tsx +1 -1
  260. package/src/lib/framework/dashboard-widget/base-widget.tsx +11 -9
  261. package/src/lib/framework/dashboard-widget/latest-orders-widget/index.tsx +35 -6
  262. package/src/lib/framework/dashboard-widget/metrics-widget/index.tsx +18 -12
  263. package/src/lib/framework/dashboard-widget/metrics-widget/metrics-widget.graphql.ts +9 -3
  264. package/src/lib/framework/dashboard-widget/orders-summary/index.tsx +26 -79
  265. package/src/lib/framework/dashboard-widget/widget-filters-context.tsx +35 -0
  266. package/src/lib/framework/defaults.ts +34 -63
  267. package/src/lib/framework/document-introspection/add-custom-fields.spec.ts +319 -9
  268. package/src/lib/framework/document-introspection/add-custom-fields.ts +60 -31
  269. package/src/lib/framework/document-introspection/get-document-structure.spec.ts +1 -159
  270. package/src/lib/framework/document-introspection/include-only-selected-list-fields.spec.ts +1840 -0
  271. package/src/lib/framework/document-introspection/include-only-selected-list-fields.ts +940 -0
  272. package/src/lib/framework/document-introspection/testing-utils.ts +161 -0
  273. package/src/lib/framework/extension-api/display-component-extensions.tsx +2 -0
  274. package/src/lib/framework/extension-api/types/data-table.ts +62 -4
  275. package/src/lib/framework/extension-api/types/navigation.ts +16 -0
  276. package/src/lib/framework/form-engine/utils.ts +34 -0
  277. package/src/lib/framework/layout-engine/page-layout.tsx +36 -36
  278. package/src/lib/framework/page/detail-page.tsx +10 -10
  279. package/src/lib/framework/page/list-page.tsx +289 -4
  280. package/src/lib/framework/page/use-extended-router.tsx +101 -34
  281. package/src/lib/graphql/api.ts +6 -2
  282. package/src/lib/graphql/graphql-env.d.ts +38 -26
  283. package/src/lib/hooks/use-display-locale.ts +40 -0
  284. package/src/lib/hooks/use-dynamic-translations.ts +46 -0
  285. package/src/lib/hooks/use-extended-detail-query.ts +1 -1
  286. package/src/lib/hooks/use-extended-list-query.ts +6 -1
  287. package/src/lib/hooks/use-local-format.ts +15 -1
  288. package/src/lib/hooks/use-saved-views.ts +230 -0
  289. package/src/lib/hooks/use-ui-language-loader.ts +30 -0
  290. package/src/lib/index.ts +15 -0
  291. package/src/lib/lib/load-i18n-messages.ts +17 -0
  292. package/src/lib/lib/trans.tsx +15 -11
  293. package/src/lib/providers/i18n-provider.tsx +7 -14
  294. package/src/lib/types/saved-views.ts +39 -0
  295. package/src/lib/utils/saved-views-utils.ts +40 -0
@@ -0,0 +1,161 @@
1
+ export function getMockSchemaInfo() {
2
+ return {
3
+ schemaInfo: {
4
+ types: {
5
+ Query: {
6
+ products: ['ProductList', false, false, true],
7
+ product: ['Product', false, false, false],
8
+ collection: ['Collection', false, false, false],
9
+ order: ['Order', false, false, false],
10
+ },
11
+ Mutation: {
12
+ updateProduct: ['Product', false, false, false],
13
+ adjustDraftOrderLine: ['Order', false, false, false],
14
+ },
15
+
16
+ Collection: {
17
+ id: ['ID', false, false, false],
18
+ name: ['String', false, false, false],
19
+ productVariants: ['ProductVariantList', false, false, true],
20
+ },
21
+
22
+ ProductVariantList: {
23
+ items: ['ProductVariant', false, true, false],
24
+ totalItems: ['Int', false, false, false],
25
+ },
26
+
27
+ Product: {
28
+ channels: ['Channel', false, true, false],
29
+ id: ['ID', false, false, false],
30
+ createdAt: ['DateTime', false, false, false],
31
+ updatedAt: ['DateTime', false, false, false],
32
+ languageCode: ['LanguageCode', false, false, false],
33
+ name: ['String', false, false, false],
34
+ slug: ['String', false, false, false],
35
+ description: ['String', false, false, false],
36
+ enabled: ['Boolean', false, false, false],
37
+ featuredAsset: ['Asset', true, false, false],
38
+ assets: ['Asset', false, true, false],
39
+ variants: ['ProductVariant', false, true, false],
40
+ variantList: ['ProductVariantList', false, false, true],
41
+ optionGroups: ['ProductOptionGroup', false, true, false],
42
+ facetValues: ['FacetValue', false, true, false],
43
+ translations: ['ProductTranslation', false, true, false],
44
+ collections: ['Collection', false, true, false],
45
+ reviews: ['ProductReviewList', false, false, true],
46
+ reviewsHistogram: ['ProductReviewHistogramItem', false, true, false],
47
+ customFields: ['ProductCustomFields', true, false, false],
48
+ },
49
+ ProductVariantPrice: {
50
+ currencyCode: ['CurrencyCode', false, false, false],
51
+ price: ['Money', false, false, false],
52
+ customFields: ['JSON', true, false, false],
53
+ },
54
+ ProductVariant: {
55
+ enabled: ['Boolean', false, false, false],
56
+ trackInventory: ['GlobalFlag', false, false, false],
57
+ stockOnHand: ['Int', false, false, false],
58
+ stockAllocated: ['Int', false, false, false],
59
+ outOfStockThreshold: ['Int', false, false, false],
60
+ useGlobalOutOfStockThreshold: ['Boolean', false, false, false],
61
+ prices: ['ProductVariantPrice', false, true, false],
62
+ stockLevels: ['StockLevel', false, true, false],
63
+ stockMovements: ['StockMovementList', false, false, false],
64
+ channels: ['Channel', false, true, false],
65
+ id: ['ID', false, false, false],
66
+ product: ['Product', false, false, false],
67
+ productId: ['ID', false, false, false],
68
+ createdAt: ['DateTime', false, false, false],
69
+ updatedAt: ['DateTime', false, false, false],
70
+ languageCode: ['LanguageCode', false, false, false],
71
+ sku: ['String', false, false, false],
72
+ name: ['String', false, false, false],
73
+ featuredAsset: ['Asset', true, false, false],
74
+ assets: ['Asset', false, true, false],
75
+ price: ['Money', false, false, false],
76
+ currencyCode: ['CurrencyCode', false, false, false],
77
+ priceWithTax: ['Money', false, false, false],
78
+ stockLevel: ['String', false, false, false],
79
+ taxRateApplied: ['TaxRate', false, false, false],
80
+ taxCategory: ['TaxCategory', false, false, false],
81
+ options: ['ProductOption', false, true, false],
82
+ facetValues: ['FacetValue', false, true, false],
83
+ translations: ['ProductVariantTranslation', false, true, false],
84
+ customFields: ['JSON', true, false, false],
85
+ },
86
+ ProductCustomFields: {
87
+ custom1: ['String', false, false, false],
88
+ },
89
+
90
+ Asset: {
91
+ id: ['ID', false, false, false],
92
+ createdAt: ['DateTime', false, false, false],
93
+ updatedAt: ['DateTime', false, false, false],
94
+ name: ['String', false, false, false],
95
+ type: ['AssetType', false, false, false],
96
+ fileSize: ['Int', false, false, false],
97
+ mimeType: ['String', false, false, false],
98
+ width: ['Int', false, false, false],
99
+ height: ['Int', false, false, false],
100
+ source: ['String', false, false, false],
101
+ preview: ['String', false, false, false],
102
+ focalPoint: ['Coordinate', true, false, false],
103
+ tags: ['Tag', false, true, false],
104
+ customFields: ['JSON', true, false, false],
105
+ },
106
+ ProductTranslation: {
107
+ id: ['ID', false, false, false],
108
+ createdAt: ['DateTime', false, false, false],
109
+ updatedAt: ['DateTime', false, false, false],
110
+ languageCode: ['LanguageCode', false, false, false],
111
+ name: ['String', false, false, false],
112
+ slug: ['String', false, false, false],
113
+ description: ['String', false, false, false],
114
+ customFields: ['ProductTranslationCustomFields', true, false, false],
115
+ },
116
+ ProductList: {
117
+ items: ['Product', false, true, false],
118
+ totalItems: ['Int', false, false, false],
119
+ },
120
+
121
+ ProductVariantTranslation: {
122
+ id: ['ID', false, false, false],
123
+ createdAt: ['DateTime', false, false, false],
124
+ updatedAt: ['DateTime', false, false, false],
125
+ languageCode: ['LanguageCode', false, false, false],
126
+ name: ['String', false, false, false],
127
+ },
128
+ Order: {
129
+ id: ['ID', false, false, false],
130
+ lines: ['OrderLine', false, true, false],
131
+ },
132
+ OrderLine: {
133
+ id: ['ID', false, false, false],
134
+ quantity: ['Int', false, false, false],
135
+ },
136
+ },
137
+ inputs: {
138
+ UpdateProductInput: {
139
+ id: ['ID', false, false, false],
140
+ name: ['String', false, false, false],
141
+ },
142
+ AdjustDraftOrderLineInput: {
143
+ orderLineId: ['ID', false, false, false],
144
+ quantity: ['Int', false, false, false],
145
+ },
146
+ },
147
+ scalars: [
148
+ 'ID',
149
+ 'String',
150
+ 'Int',
151
+ 'Boolean',
152
+ 'Float',
153
+ 'JSON',
154
+ 'DateTime',
155
+ 'Upload',
156
+ 'CurrencyCode',
157
+ ],
158
+ enums: {},
159
+ },
160
+ };
161
+ }
@@ -1,5 +1,6 @@
1
1
  import { BooleanDisplayBadge, BooleanDisplayCheckbox } from '@/vdb/components/data-display/boolean.js';
2
2
  import { DateTime } from '@/vdb/components/data-display/date-time.js';
3
+ import { Json } from '@/vdb/components/data-display/json.js';
3
4
  import { Money } from '@/vdb/components/data-display/money.js';
4
5
  import { VendureImage } from '@/vdb/components/shared/vendure-image.js';
5
6
  import { DataDisplayComponent } from '../component-registry/component-registry.js';
@@ -17,6 +18,7 @@ displayComponents.set('vendure:booleanBadge', BooleanDisplayBadge);
17
18
  displayComponents.set('vendure:dateTime', DateTime);
18
19
  displayComponents.set('vendure:asset', AssetDisplay);
19
20
  displayComponents.set('vendure:money', Money);
21
+ displayComponents.set('vendure:json', Json);
20
22
 
21
23
  export function getDisplayComponent(id: string): DataDisplayComponent | undefined {
22
24
  return globalRegistry.get('displayComponents').get(id);
@@ -35,12 +35,70 @@ export type BulkActionComponent<Item extends { id: string } & Record<string, any
35
35
 
36
36
  /**
37
37
  * @description
38
- * **Status: Developer Preview**
39
- *
40
38
  * A bulk action is a component that will be rendered in the bulk actions dropdown.
41
39
  *
42
- * @docsCategory components
43
- * @docsPage DataTable
40
+ * The component receives the following props:
41
+ *
42
+ * - `selection`: The selected row or rows
43
+ * - `table`: A reference to the Tanstack table instance powering the list
44
+ *
45
+ * The `table` object has
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * import { BulkActionComponent, DataTableBulkActionItem, usePaginatedList } from '\@vendure/dashboard';
50
+ *
51
+ * // This is an example of a bulk action that shows some typical
52
+ * // uses of the provided props
53
+ * export const MyBulkAction: BulkActionComponent<any> = ({ selection, table }) => {
54
+ * const { refetchPaginatedList } = usePaginatedList();
55
+ *
56
+ * const doTheAction = async () => {
57
+ * // Actual logic of the action
58
+ * // goes here...
59
+ *
60
+ * // On success, we refresh the list
61
+ * refetchPaginatedList();
62
+ * // and un-select any selected rows in the table
63
+ * table.resetRowSelection();
64
+ * };
65
+ *
66
+ * return (
67
+ * <DataTableBulkActionItem
68
+ * onClick={doTheAction}
69
+ * label={<Trans>Delete</Trans>}
70
+ * confirmationText={<Trans>Are you sure?</Trans>}
71
+ * icon={Check}
72
+ * className="text-destructive"
73
+ * />
74
+ * );
75
+ * }
76
+ * ```
77
+ *
78
+ * For the common action of deletion, we provide a ready-made helper component:
79
+ *
80
+ * @example
81
+ * ```tsx
82
+ * import { BulkActionComponent, DeleteProductsBulkAction } from '\@vendure/dashboard';
83
+ *
84
+ * // Define the BulkAction component. This one uses
85
+ * // a built-in wrapper for "delete" actions, which includes
86
+ * // a confirmation dialog.
87
+ * export const DeleteProductsBulkAction: BulkActionComponent<any> = ({ selection, table }) => {
88
+ * return (
89
+ * <DeleteBulkAction
90
+ * mutationDocument={deleteProductsDocument}
91
+ * entityName="products"
92
+ * requiredPermissions={['DeleteCatalog', 'DeleteProduct']}
93
+ * selection={selection}
94
+ * table={table}
95
+ * />
96
+ * );
97
+ * };
98
+ * ```
99
+ *
100
+ * @docsCategory list-views
101
+ * @docsPage bulk-actions
44
102
  * @since 3.4.0
45
103
  */
46
104
  export type BulkAction = {
@@ -40,6 +40,22 @@ export interface DashboardRouteDefinition {
40
40
  * [loader function](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#route-loaders)
41
41
  */
42
42
  loader?: RouteOptions['loader'];
43
+
44
+ /**
45
+ * @description
46
+ * Optional search parameter validation function.
47
+ * The value is a Tanstack Router
48
+ * [validateSearch function](https://tanstack.com/router/latest/docs/framework/react/guide/search-params#search-param-validation)
49
+ */
50
+ validateSearch?: RouteOptions['validateSearch'];
51
+
52
+ /**
53
+ * @description
54
+ * Define if the route should be under the authentication context, i.e have the authenticated route
55
+ * as a parent.
56
+ * @default true
57
+ */
58
+ authenticated?: boolean;
43
59
  }
44
60
 
45
61
  /**
@@ -19,6 +19,8 @@ import {
19
19
  StructField,
20
20
  TextCustomFieldConfig,
21
21
  } from '@/vdb/framework/form-engine/form-engine-types.js';
22
+ import { FormEvent } from 'react';
23
+ import { UseFormReturn } from 'react-hook-form';
22
24
 
23
25
  import { FieldInfo } from '../document-introspection/get-document-structure.js';
24
26
 
@@ -320,3 +322,35 @@ export function hasPermissionRequirement(input: ConfigurableFieldDef): boolean {
320
322
  export function isNullableField(input: ConfigurableFieldDef): boolean {
321
323
  return isCustomFieldConfig(input) && Boolean(input.nullable);
322
324
  }
325
+
326
+ /**
327
+ * Handles nested form submission to prevent event bubbling in nested forms.
328
+ * This is useful when you have a form inside a dialog that's within another form.
329
+ *
330
+ * @param form - The react-hook-form instance
331
+ * @param onSubmit - The submit handler function
332
+ * @returns An event handler that prevents propagation and handles the form submission
333
+ *
334
+ * @example
335
+ * ```tsx
336
+ * const form = useForm<FormSchema>({ resolver: zodResolver(formSchema) });
337
+ *
338
+ * return (
339
+ * <form onSubmit={handleNestedFormSubmit(form, (data) => {
340
+ * // Handle form submission
341
+ * })}>
342
+ * ...
343
+ * </form>
344
+ * );
345
+ * ```
346
+ */
347
+ export function handleNestedFormSubmit<TFieldValues extends Record<string, any>>(
348
+ form: UseFormReturn<TFieldValues>,
349
+ onSubmit: (data: TFieldValues) => void | Promise<void>,
350
+ ) {
351
+ return (e: FormEvent<HTMLFormElement>) => {
352
+ e.preventDefault();
353
+ e.stopPropagation();
354
+ void form.handleSubmit(onSubmit)(e);
355
+ };
356
+ }
@@ -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();