@deenruv/admin-dashboard 1.0.17-dev.4 → 1.0.17-dev.41

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 (87) hide show
  1. package/dist/DeenruvAdminPanel.js +30 -41
  2. package/dist/access/access-context.js +10 -0
  3. package/dist/access/admin-router.js +60 -0
  4. package/dist/access/built-in-route-permissions.js +44 -0
  5. package/dist/access/built-in-routes.js +301 -0
  6. package/dist/access/channel-selection.js +11 -0
  7. package/dist/access/index.js +6 -0
  8. package/dist/access/navigation.js +33 -0
  9. package/dist/access/permission-access.js +9 -0
  10. package/dist/access/permission-routes.js +3 -0
  11. package/dist/access/types.js +1 -0
  12. package/dist/components/BrandLogo.js +5 -5
  13. package/dist/components/GlobalSearch.js +32 -57
  14. package/dist/components/Menu/AccountMenu.js +58 -0
  15. package/dist/components/Menu/Breadcrumbs.js +23 -0
  16. package/dist/components/Menu/ChannelSwitcher.js +8 -1
  17. package/dist/components/Menu/Navigation.js +79 -257
  18. package/dist/components/Menu/NavigationFooter.js +16 -7
  19. package/dist/components/Menu/SidebarContent.js +9 -0
  20. package/dist/components/Menu/SidebarState.js +93 -0
  21. package/dist/components/Menu/TopbarOverflow.js +11 -0
  22. package/dist/components/Menu/index.js +68 -56
  23. package/dist/components/storefrontAction/StorefrontAction.js +9 -0
  24. package/dist/components/storefrontAction/StorefrontAction.logic.js +27 -0
  25. package/dist/components/storefrontAction/index.js +2 -0
  26. package/dist/graphql/scalars.js +4 -0
  27. package/dist/index.css +65 -0
  28. package/dist/locales/en/admins.json +62 -0
  29. package/dist/locales/en/collections.json +14 -0
  30. package/dist/locales/en/common.json +55 -27
  31. package/dist/locales/en/orders.json +9 -1
  32. package/dist/locales/en/products.json +15 -0
  33. package/dist/locales/pl/admins.json +62 -0
  34. package/dist/locales/pl/collections.json +14 -0
  35. package/dist/locales/pl/common.json +56 -28
  36. package/dist/locales/pl/orders.json +9 -1
  37. package/dist/locales/pl/products.json +15 -0
  38. package/dist/pages/Root.js +76 -35
  39. package/dist/pages/admins/Detail.js +1 -1
  40. package/dist/pages/admins/List.js +8 -3
  41. package/dist/pages/admins/Provision.js +173 -0
  42. package/dist/pages/admins/Provision.logic.js +53 -0
  43. package/dist/pages/admins/index.js +1 -0
  44. package/dist/pages/assets/List.js +3 -3
  45. package/dist/pages/channels/Detail.js +1 -1
  46. package/dist/pages/collections/Detail.js +9 -1
  47. package/dist/pages/collections/List.js +87 -20
  48. package/dist/pages/collections/_components/ContentsCard.js +1 -1
  49. package/dist/pages/collections/_components/collectionStorefrontAction/CollectionStorefrontAction.js +41 -0
  50. package/dist/pages/collections/_components/collectionStorefrontAction/CollectionStorefrontAction.logic.js +44 -0
  51. package/dist/pages/collections/_components/collectionStorefrontAction/index.js +2 -0
  52. package/dist/pages/countries/Detail.js +6 -1
  53. package/dist/pages/countries/List.js +1 -1
  54. package/dist/pages/dashboard/Dashboard.js +2 -2
  55. package/dist/pages/facets/Detail.js +6 -1
  56. package/dist/pages/facets/List.js +1 -1
  57. package/dist/pages/facets/_components/FacetDetailView.js +3 -2
  58. package/dist/pages/orders/_components/CancelAndRefundDialog.js +80 -19
  59. package/dist/pages/orders/_components/OrderLineImage.logic.js +4 -0
  60. package/dist/pages/orders/_components/Payments.js +39 -23
  61. package/dist/pages/orders/_components/ProductsCard.js +2 -3
  62. package/dist/pages/orders/_components/ProductsTable.js +13 -25
  63. package/dist/pages/orders/_components/TopActions.js +14 -8
  64. package/dist/pages/payment-methods/Detail.js +6 -1
  65. package/dist/pages/payment-methods/List.js +1 -1
  66. package/dist/pages/product-variants/List.js +7 -6
  67. package/dist/pages/products/Detail.js +9 -17
  68. package/dist/pages/products/List.js +3 -2
  69. package/dist/pages/products/ProductInitialVariantFormConfig.js +17 -0
  70. package/dist/pages/products/_components/Variant.js +13 -7
  71. package/dist/pages/products/_components/productStorefrontAction/ProductStorefrontAction.js +42 -0
  72. package/dist/pages/products/_components/productStorefrontAction/ProductStorefrontAction.logic.js +39 -0
  73. package/dist/pages/products/_components/productStorefrontAction/index.js +2 -0
  74. package/dist/pages/roles/Detail.js +1 -1
  75. package/dist/pages/sellers/Detail.js +1 -1
  76. package/dist/pages/shipping-methods/Detail.js +6 -1
  77. package/dist/pages/shipping-methods/List.js +1 -1
  78. package/dist/pages/status/_components/Jobs.js +2 -2
  79. package/dist/pages/stock-locations/Detail.js +1 -1
  80. package/dist/pages/tax-categories/Detail.js +3 -3
  81. package/dist/pages/tax-categories/List.js +1 -1
  82. package/dist/pages/tax-rates/Detail.js +6 -1
  83. package/dist/pages/tax-rates/List.js +1 -1
  84. package/dist/pages/zones/Detail.js +6 -1
  85. package/dist/pages/zones/List.js +1 -1
  86. package/dist/version.js +1 -1
  87. package/package.json +5 -5
@@ -4,6 +4,8 @@ import { VariantsTab } from "./_components/VariantsTab";
4
4
  import { OptionsTab } from "./_components/OptionsTab";
5
5
  import { ProductDetailView } from './_components/ProductDetailView';
6
6
  import { ProductDetailSidebar } from './_components/ProductDetailSidebar';
7
+ import { ProductStorefrontAction } from './_components/productStorefrontAction';
8
+ import { getProductInitialVariantFormConfig } from './ProductInitialVariantFormConfig';
7
9
  import { DEFAULT_CHANNEL_CODE, useTranslation, createDeenruvForm, DetailView, useMutation, useSettings, } from '@deenruv/react-ui-devkit';
8
10
  import { $, Permission, scalars, typedGql } from '@deenruv/admin-types';
9
11
  import { useMemo } from 'react';
@@ -57,19 +59,7 @@ export const ProductsDetailPage = () => {
57
59
  return [t('validation.nameSlugRequired')];
58
60
  },
59
61
  },
60
- ...{
61
- initialVariantSku: {
62
- validate: (v) => {
63
- if (!id && (!v || typeof v !== 'string' || !v.trim())) {
64
- return [t('validation.initialVariantSkuRequired')];
65
- }
66
- },
67
- },
68
- initialVariantPrice: {
69
- initialValue: 0,
70
- },
71
- initialVariantName: {},
72
- },
62
+ ...getProductInitialVariantFormConfig(!id, t('validation.initialVariantSkuRequired')),
73
63
  },
74
64
  onSubmitted: async (data) => {
75
65
  if (!data.translations)
@@ -123,9 +113,11 @@ export const ProductsDetailPage = () => {
123
113
  throw new Error('No id');
124
114
  },
125
115
  }),
126
- }, defaultTabs: defaultTabs, permissions: {
127
- create: Permission.CreateProduct,
128
- edit: Permission.UpdateProduct,
129
- delete: Permission.DeleteProduct,
116
+ }, defaultTabs: defaultTabs, topActions: {
117
+ inline: [_jsx(ProductStorefrontAction, {}, "product-storefront-action")],
118
+ }, permissions: {
119
+ create: [Permission.CreateProduct, Permission.CreateCatalog],
120
+ edit: [Permission.UpdateProduct, Permission.UpdateCatalog],
121
+ delete: [Permission.DeleteProduct, Permission.DeleteCatalog],
130
122
  } }) }));
131
123
  };
@@ -4,7 +4,7 @@ import { apiClient, deepMerge, DetailList, ListBadge, ListLocations, Routes, Tab
4
4
  // import { FacetValueSelector } from '@deenruv/react-ui-devkit/FacetValueSelector.js';
5
5
  const tableId = 'products-list-view';
6
6
  const { selector } = ListLocations[tableId];
7
- const fetch = async ({ page, perPage, filter, filterOperator, sort }, customFieldsSelector, additionalSelector) => {
7
+ const fetch = async ({ page, perPage, filter, filterOperator, searchTerm, sort }, customFieldsSelector, additionalSelector) => {
8
8
  const response = await apiClient('query')({
9
9
  ['products']: [
10
10
  {
@@ -12,6 +12,7 @@ const fetch = async ({ page, perPage, filter, filterOperator, sort }, customFiel
12
12
  take: perPage,
13
13
  skip: (page - 1) * perPage,
14
14
  filterOperator: filterOperator,
15
+ ...(searchTerm && { searchTerm }),
15
16
  sort: sort ? { [sort.key]: sort.sortDir } : { createdAt: SortOrder.DESC },
16
17
  ...(filter && { filter }),
17
18
  },
@@ -52,7 +53,7 @@ export const ProductsListPage = () => {
52
53
  }, facetValuesIds: props.value.in }));
53
54
  },
54
55
  },
55
- ], additionalBulkActions: [...EntityChannelManagementBulkAction(tableId), EntityFacetManagementBulkAction(tableId)], detailLinkColumn: "id", searchFields: ['name', 'slug', 'sku'], hideColumns: ['customFields', 'translations', 'collections', 'variantList'], entityName: 'Product', route: Routes['products'], tableId: tableId, fetch: fetch, onRemove: onRemove, createPermissions: [Permission.CreateProduct], deletePermissions: [Permission.DeleteProduct], suggestedOrderColumns: {
56
+ ], additionalBulkActions: [...EntityChannelManagementBulkAction(tableId), EntityFacetManagementBulkAction(tableId)], detailLinkColumn: "id", searchFields: ['name', 'slug', 'sku'], searchTransport: "searchTerm", hideColumns: ['customFields', 'translations', 'collections', 'variantList'], entityName: 'Product', route: Routes['products'], tableId: tableId, fetch: fetch, onRemove: onRemove, createPermissions: [Permission.CreateProduct, Permission.CreateCatalog], deletePermissions: [Permission.DeleteProduct, Permission.DeleteCatalog], suggestedOrderColumns: {
56
57
  featuredAsset: 4,
57
58
  variants: 99,
58
59
  }, additionalColumns: [
@@ -0,0 +1,17 @@
1
+ export const getProductInitialVariantFormConfig = (isCreating, initialVariantSkuRequiredError) => {
2
+ if (!isCreating)
3
+ return {};
4
+ return {
5
+ initialVariantSku: {
6
+ validate: (value) => {
7
+ if (!value || typeof value !== 'string' || !value.trim()) {
8
+ return [initialVariantSkuRequiredError];
9
+ }
10
+ },
11
+ },
12
+ initialVariantPrice: {
13
+ initialValue: 0,
14
+ },
15
+ initialVariantName: {},
16
+ };
17
+ };
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Button, CardIcons, ConfirmationDialog, CustomCard, Input, apiClient, setInArrayBy, useDeenruvForm, z, EntityCustomFields, useTranslation, useSettings, EntityChannelManager, DEFAULT_CHANNEL_CODE, } from '@deenruv/react-ui-devkit';
3
- import { CurrencyCode } from '@deenruv/admin-types';
3
+ import { CurrencyCode, DeletionResult } from '@deenruv/admin-types';
4
4
  import { useCallback, useEffect } from 'react';
5
5
  import { toast } from 'sonner';
6
6
  import { AssetsCard } from "./AssetsCard";
@@ -174,16 +174,22 @@ export const Variant = ({ variant, currentTranslationLng, onActionCompleted, pro
174
174
  if (!variant)
175
175
  return;
176
176
  apiClient('mutation')({
177
- deleteProductVariant: [{ id: variant.id }, { message: true }],
177
+ deleteProductVariant: [{ id: variant.id }, { message: true, result: true }],
178
178
  })
179
- .then(() => {
180
- onActionCompleted();
181
- toast(t('toasts.deleteProductVariantSuccessToast'), {
182
- description: new Date().toLocaleString(),
179
+ .then(({ deleteProductVariant }) => {
180
+ if (deleteProductVariant.result === DeletionResult.DELETED) {
181
+ onActionCompleted();
182
+ toast(t('toasts.deleteProductVariantSuccessToast'), {
183
+ description: new Date().toLocaleString(),
184
+ });
185
+ return;
186
+ }
187
+ toast.error(t('toasts.deleteProductVariantErrorToast'), {
188
+ description: deleteProductVariant.message,
183
189
  });
184
190
  })
185
191
  .catch(() => toast.error(t('toasts.deleteProductVariantErrorToast')));
186
- }, [variant]);
192
+ }, [variant, onActionCompleted, t]);
187
193
  const setTranslationField = useCallback((field, e) => {
188
194
  const currentValue = translations.find((t) => t.languageCode === currentTranslationLng);
189
195
  const baseTranslation = currentValue ?? {
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useDetailView, useGlobalStore, useSettings, useTranslation } from '@deenruv/react-ui-devkit';
3
+ import { StorefrontAction } from "../../../../components/storefrontAction";
4
+ import { getProductStorefrontActionState, } from './ProductStorefrontAction.logic';
5
+ const PRODUCT_STOREFRONT_FORM_KEYS = ['CreateProductInput', 'translations', 'enabled'];
6
+ export const ProductStorefrontAction = () => {
7
+ const { t } = useTranslation('products');
8
+ const selectedChannelCode = useSettings((state) => state.selectedChannel?.code);
9
+ const languageCode = useSettings((state) => state.translationsLanguage);
10
+ const resolveStorefrontEntityUrl = useGlobalStore((state) => state.ui?.resolveStorefrontEntityUrl);
11
+ const { entity, form, id } = useDetailView('products-detail-view', ...PRODUCT_STOREFRONT_FORM_KEYS);
12
+ const formTranslations = form.base.watch('translations');
13
+ const formEnabled = form.base.watch('enabled');
14
+ if (!id || !entity || !resolveStorefrontEntityUrl)
15
+ return null;
16
+ const state = getProductStorefrontActionState({
17
+ product: entity,
18
+ selectedChannelCode,
19
+ languageCode,
20
+ formTranslations,
21
+ formEnabled,
22
+ resolveStorefrontEntityUrl,
23
+ });
24
+ const label = t('storefrontAction.label');
25
+ if (state.kind === 'hidden')
26
+ return null;
27
+ const disabledTooltips = {
28
+ productDisabled: t('storefrontAction.disabled.productDisabled'),
29
+ missingChannel: t('storefrontAction.disabled.missingChannel'),
30
+ channelNotAssigned: t('storefrontAction.disabled.channelNotAssigned'),
31
+ missingSlug: t('storefrontAction.disabled.missingSlug'),
32
+ unsavedSlug: t('storefrontAction.disabled.unsavedSlug'),
33
+ unsavedEnabled: t('storefrontAction.disabled.unsavedEnabled'),
34
+ resolverFailed: t('storefrontAction.disabled.resolverFailed'),
35
+ resolverEmpty: t('storefrontAction.disabled.resolverEmpty'),
36
+ urlNotAbsolute: t('storefrontAction.disabled.urlNotAbsolute'),
37
+ unsupportedProtocol: t('storefrontAction.disabled.unsupportedProtocol'),
38
+ };
39
+ return (_jsx(StorefrontAction, { label: label, state: state.kind === 'ready'
40
+ ? { kind: 'ready', url: state.url }
41
+ : { kind: 'disabled', tooltip: disabledTooltips[state.reason] } }));
42
+ };
@@ -0,0 +1,39 @@
1
+ import { getStorefrontEntityUrlState, } from '../../../../components/storefrontAction/StorefrontAction.logic';
2
+ const getFormSlug = (formTranslations, languageCode) => {
3
+ if (!Array.isArray(formTranslations))
4
+ return undefined;
5
+ const translation = formTranslations.find((value) => typeof value === 'object' && value !== null && 'languageCode' in value && value.languageCode === languageCode);
6
+ return typeof translation?.slug === 'string' ? translation.slug : undefined;
7
+ };
8
+ export const getProductStorefrontActionState = ({ product, selectedChannelCode, languageCode, formTranslations, formEnabled, resolveStorefrontEntityUrl, }) => {
9
+ if (!selectedChannelCode)
10
+ return { kind: 'disabled', reason: 'missingChannel' };
11
+ const persistedTranslation = languageCode
12
+ ? product.translations.find((translation) => translation.languageCode === languageCode)
13
+ : undefined;
14
+ if (!languageCode || typeof persistedTranslation?.slug !== 'string' || !persistedTranslation.slug.trim()) {
15
+ return { kind: 'disabled', reason: 'missingSlug' };
16
+ }
17
+ const context = {
18
+ entityType: 'product',
19
+ entityId: product.id,
20
+ slug: persistedTranslation.slug,
21
+ channelCode: selectedChannelCode,
22
+ languageCode,
23
+ };
24
+ const urlState = getStorefrontEntityUrlState(context, resolveStorefrontEntityUrl);
25
+ if (urlState.kind === 'hidden')
26
+ return urlState;
27
+ if (!product.enabled)
28
+ return { kind: 'disabled', reason: 'productDisabled' };
29
+ if (!product.channels.some(({ code }) => code === selectedChannelCode)) {
30
+ return { kind: 'disabled', reason: 'channelNotAssigned' };
31
+ }
32
+ if (formEnabled !== product.enabled) {
33
+ return { kind: 'disabled', reason: 'unsavedEnabled' };
34
+ }
35
+ if (getFormSlug(formTranslations, languageCode) !== persistedTranslation.slug) {
36
+ return { kind: 'disabled', reason: 'unsavedSlug' };
37
+ }
38
+ return urlState.kind === 'ready' ? { ...urlState, context } : urlState;
39
+ };
@@ -0,0 +1,2 @@
1
+ export * from './ProductStorefrontAction';
2
+ export * from './ProductStorefrontAction.logic';
@@ -42,7 +42,7 @@ export const RolesDetailPage = () => {
42
42
  if (!id) {
43
43
  throw new Error('Could not find the id.');
44
44
  }
45
- return remove({ input: { id } });
45
+ return remove({ id });
46
46
  }, [remove, id]);
47
47
  return (_jsx("div", { className: "relative flex flex-col gap-y-4", children: _jsx(DetailView, { id: id, locationId: "roles-detail-view", main: {
48
48
  name: 'role',
@@ -31,7 +31,7 @@ export const SellersDetailPage = () => {
31
31
  if (!id) {
32
32
  throw new Error('Could not find the id.');
33
33
  }
34
- return remove({ input: { id } });
34
+ return remove({ id });
35
35
  }, [remove, id]);
36
36
  return (_jsx("div", { className: "relative flex flex-col gap-y-4", children: _jsx(DetailView, { id: id, locationId: "sellers-detail-view", main: {
37
37
  name: 'seller',
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback } from 'react';
3
3
  import { useParams } from 'react-router';
4
4
  import { useTranslation, DetailView, createDeenruvForm, getMutation, useMutation } from '@deenruv/react-ui-devkit';
5
+ import { Permission } from '@deenruv/admin-types';
5
6
  import { ShippingMethodDetailView } from "./_components/ShippingMethodDetailView.js";
6
7
  const isMissingConfigArgValue = (value) => value == null || value.trim() === '';
7
8
  const hasMissingConfigArgs = (operation) => {
@@ -48,7 +49,7 @@ export const ShippingMethodsDetailPage = () => {
48
49
  if (!id) {
49
50
  throw new Error('Could not find the id.');
50
51
  }
51
- return remove({ input: { id } });
52
+ return remove({ id });
52
53
  }, [remove, id]);
53
54
  return (_jsx("div", { className: "relative flex flex-col gap-y-4", children: _jsx(DetailView, { id: id, locationId: "shippingMethods-detail-view", main: {
54
55
  name: 'shippingMethod',
@@ -107,5 +108,9 @@ export const ShippingMethodsDetailPage = () => {
107
108
  onSubmitted: onSubmitHandler,
108
109
  onDeleted: onDeleteHandler,
109
110
  }),
111
+ }, permissions: {
112
+ create: [Permission.CreateShippingMethod, Permission.CreateSettings],
113
+ edit: [Permission.UpdateShippingMethod, Permission.UpdateSettings],
114
+ delete: [Permission.DeleteShippingMethod, Permission.DeleteSettings],
110
115
  } }) }));
111
116
  };
@@ -36,5 +36,5 @@ export const ShippingMethodsListPage = () => {
36
36
  return (_jsx(DetailList, { filterFields: [
37
37
  { key: 'name', operator: 'StringOperators' },
38
38
  { key: 'code', operator: 'StringOperators' },
39
- ], additionalBulkActions: [...EntityChannelManagementBulkAction(tableId)], detailLinkColumn: "id", searchFields: ['name', 'code'], hideColumns: ['customFields', 'translations', 'collections', 'variantList'], entityName: 'ShippingMethod', route: Routes['shippingMethods'], tableId: tableId, fetch: fetch, onRemove: onRemove, createPermissions: [Permission.CreateShippingMethod], deletePermissions: [Permission.DeleteShippingMethod] }));
39
+ ], additionalBulkActions: [...EntityChannelManagementBulkAction(tableId)], detailLinkColumn: "id", searchFields: ['name', 'code'], hideColumns: ['customFields', 'translations', 'collections', 'variantList'], entityName: 'ShippingMethod', route: Routes['shippingMethods'], tableId: tableId, fetch: fetch, onRemove: onRemove, createPermissions: [Permission.CreateShippingMethod, Permission.CreateSettings], deletePermissions: [Permission.DeleteShippingMethod, Permission.DeleteSettings] }));
40
40
  };
@@ -63,7 +63,7 @@ export const Jobs = () => {
63
63
  state: { eq: stateFilter },
64
64
  queueName: { eq: jobQueueFilter },
65
65
  }), [stateFilter, jobQueueFilter]);
66
- const { objects, refetch, Paginate, Search } = useDetailListHook({
66
+ const { objects, refetch, Paginate, Search, loading } = useDetailListHook({
67
67
  searchFields: ['queueName'],
68
68
  fetch: async ({ page, perPage, filter, filterOperator }) => {
69
69
  const { jobs } = await apiClient('query')({
@@ -191,5 +191,5 @@ export const Jobs = () => {
191
191
  getRowId: (row) => row.id,
192
192
  getCoreRowModel: getCoreRowModel(),
193
193
  });
194
- return (_jsx(CustomCard, { title: t('jobs.title'), color: "orange", icon: _jsx(CardIcons.check, {}), upperRight: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FilterToolbar, { Search, setStateFilter, stateFilter, jobQueueFilter, setJobQueueFilter, liveUpdate, setLiveUpdate }), _jsx(ColumnView, { table: table, entityName: "Job" })] }), children: _jsx(ListTable, { columns, isFiltered: false, table, Paginate, tableId: 'jobs-list-view' }) }));
194
+ return (_jsx(CustomCard, { title: t('jobs.title'), color: "orange", icon: _jsx(CardIcons.check, {}), upperRight: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FilterToolbar, { Search, setStateFilter, stateFilter, jobQueueFilter, setJobQueueFilter, liveUpdate, setLiveUpdate }), _jsx(ColumnView, { table: table, entityName: "Job" })] }), children: _jsx(ListTable, { columns, isFiltered: false, table, Paginate, tableId: 'jobs-list-view', loading }) }));
195
195
  };
@@ -25,7 +25,7 @@ const DeleteStockLocationMutation = typedGql('mutation', { scalars })({
25
25
  {
26
26
  input: $('input', 'DeleteStockLocationInput!'),
27
27
  },
28
- { message: true },
28
+ { message: true, result: true },
29
29
  ],
30
30
  });
31
31
  export const StockLocationsDetailPage = () => {
@@ -78,8 +78,8 @@ export const TaxCategoriesDetailPage = () => {
78
78
  onDeleted: onDeleteHandler,
79
79
  }),
80
80
  }, permissions: {
81
- create: Permission.CreateTaxCategory,
82
- edit: Permission.UpdateTaxCategory,
83
- delete: Permission.DeleteTaxCategory,
81
+ create: [Permission.CreateTaxCategory, Permission.CreateSettings],
82
+ edit: [Permission.UpdateTaxCategory, Permission.UpdateSettings],
83
+ delete: [Permission.DeleteTaxCategory, Permission.DeleteSettings],
84
84
  } }) }));
85
85
  };
@@ -42,5 +42,5 @@ export const TaxCategoriesListPage = () => {
42
42
  return (_jsx(DetailList, { filterFields: [
43
43
  { key: 'name', operator: 'StringOperators' },
44
44
  { key: 'isDefault', operator: 'BooleanOperators' },
45
- ], detailLinkColumn: "id", searchFields: ['name'], hideColumns: ['customFields', 'translations'], entityName: 'TaxCategory', route: Routes['taxCategories'], tableId: tableId, fetch: fetch, onRemove: onRemove, createPermissions: [Permission.CreateTaxCategory], deletePermissions: [Permission.DeleteTaxCategory] }));
45
+ ], detailLinkColumn: "id", searchFields: ['name'], hideColumns: ['customFields', 'translations'], entityName: 'TaxCategory', route: Routes['taxCategories'], tableId: tableId, fetch: fetch, onRemove: onRemove, createPermissions: [Permission.CreateTaxCategory, Permission.CreateSettings], deletePermissions: [Permission.DeleteTaxCategory, Permission.DeleteSettings] }));
46
46
  };
@@ -3,6 +3,7 @@ import { useCallback } from 'react';
3
3
  import { useParams } from 'react-router';
4
4
  import { useValidators, DetailView, createDeenruvForm, getMutation, useMutation, useTranslation, } from '@deenruv/react-ui-devkit';
5
5
  import { TaxRateDetailView } from "./_components/TaxRateDetailView.js";
6
+ import { Permission } from '@deenruv/admin-types';
6
7
  const CreateTaxRateMutation = getMutation('createTaxRate');
7
8
  const EditTaxRateMutation = getMutation('updateTaxRate');
8
9
  const DeleteTaxRateMutation = getMutation('deleteTaxRate');
@@ -37,7 +38,7 @@ export const TaxRatesDetailPage = () => {
37
38
  if (!id) {
38
39
  throw new Error('Could not find the id.');
39
40
  }
40
- return remove({ input: { id } });
41
+ return remove({ id });
41
42
  }, [remove, id]);
42
43
  return (_jsx("div", { className: "relative flex flex-col gap-y-4", children: _jsx(DetailView, { id: id, locationId: "taxRates-detail-view", main: {
43
44
  name: 'taxRate',
@@ -58,5 +59,9 @@ export const TaxRatesDetailPage = () => {
58
59
  onSubmitted: onSubmitHandler,
59
60
  onDeleted: onDeleteHandler,
60
61
  }),
62
+ }, permissions: {
63
+ create: [Permission.CreateTaxRate, Permission.CreateSettings],
64
+ edit: [Permission.UpdateTaxRate, Permission.UpdateSettings],
65
+ delete: [Permission.DeleteTaxRate, Permission.DeleteSettings],
61
66
  } }) }));
62
67
  };
@@ -60,5 +60,5 @@ export const TaxRatesListPage = () => {
60
60
  header: () => _jsx(TableLabel, { children: t('table.customerGroup') }),
61
61
  cell: ({ row }) => row.original.customerGroup?.name ?? '—',
62
62
  },
63
- ], entityName: 'TaxRate', route: Routes['taxRates'], tableId: tableId, fetch: fetch, onRemove: onRemove, createPermissions: [Permission.CreateTaxRate], deletePermissions: [Permission.DeleteTaxRate] }));
63
+ ], entityName: 'TaxRate', route: Routes['taxRates'], tableId: tableId, fetch: fetch, onRemove: onRemove, createPermissions: [Permission.CreateTaxRate, Permission.CreateSettings], deletePermissions: [Permission.DeleteTaxRate, Permission.DeleteSettings] }));
64
64
  };
@@ -3,6 +3,7 @@ import { useCallback } from 'react';
3
3
  import { useParams } from 'react-router';
4
4
  import { useValidators, apiClient, useMutation, DetailView, getMutation, createDeenruvForm, useTranslation, } from '@deenruv/react-ui-devkit';
5
5
  import { ZoneDetailView } from "./_components/ZoneDetailView.js";
6
+ import { Permission } from '@deenruv/admin-types';
6
7
  const CreateZoneMutation = getMutation('createZone');
7
8
  const EditZoneMutation = getMutation('updateZone');
8
9
  const DeleteZoneMutation = getMutation('deleteZone');
@@ -67,7 +68,7 @@ export const ZonesDetailPage = () => {
67
68
  if (!id) {
68
69
  throw new Error('Could not find the id.');
69
70
  }
70
- return remove({ input: { id } });
71
+ return remove({ id });
71
72
  }, [remove, id]);
72
73
  return (_jsx("div", { className: "relative flex flex-col gap-y-4", children: _jsx(DetailView, { id: id, locationId: "zones-detail-view", main: {
73
74
  name: 'zone',
@@ -82,5 +83,9 @@ export const ZonesDetailPage = () => {
82
83
  onSubmitted: onSubmitHandler,
83
84
  onDeleted: onDeleteHandler,
84
85
  }),
86
+ }, permissions: {
87
+ create: [Permission.CreateZone, Permission.CreateSettings],
88
+ edit: [Permission.UpdateZone, Permission.UpdateSettings],
89
+ delete: [Permission.DeleteZone, Permission.DeleteSettings],
85
90
  } }) }));
86
91
  };
@@ -48,5 +48,5 @@ export const ZonesListPage = () => {
48
48
  header: () => _jsx(TableLabel, { children: t('table.members') }),
49
49
  cell: ({ row }) => row.original.members.length,
50
50
  },
51
- ], entityName: 'Zone', route: Routes['zones'], tableId: tableId, fetch: fetch, onRemove: onRemove, createPermissions: [Permission.CreateZone], deletePermissions: [Permission.DeleteZone] }));
51
+ ], entityName: 'Zone', route: Routes['zones'], tableId: tableId, fetch: fetch, onRemove: onRemove, createPermissions: [Permission.CreateZone, Permission.CreateSettings], deletePermissions: [Permission.DeleteZone, Permission.DeleteSettings] }));
52
52
  };
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const ADMIN_DASHBOARD_VERSION = '1.0.17-dev.4';
1
+ export const ADMIN_DASHBOARD_VERSION = '1.0.17-dev.41';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deenruv/admin-dashboard",
3
- "version": "1.0.17-dev.4",
3
+ "version": "1.0.17-dev.41",
4
4
  "main": "dist/index.js",
5
5
  "style": "dist/index.css",
6
6
  "types": "dist/index.d.ts",
@@ -80,10 +80,10 @@
80
80
  "yup": "^1.7.1",
81
81
  "zod": "^4.4.3",
82
82
  "zustand": "^5.0.14",
83
- "@deenruv/admin-dashboard": "1.0.17-dev.4",
84
- "@deenruv/react-ui-devkit": "1.0.17-dev.4",
85
- "@deenruv/deenruv-examples-plugin": "1.0.17-dev.4",
86
- "@deenruv/admin-types": "1.0.17-dev.4"
83
+ "@deenruv/admin-dashboard": "1.0.17-dev.41",
84
+ "@deenruv/deenruv-examples-plugin": "1.0.17-dev.41",
85
+ "@deenruv/admin-types": "1.0.17-dev.41",
86
+ "@deenruv/react-ui-devkit": "1.0.17-dev.41"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@tailwindcss/typography": "^0.5.20",