@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.
- package/README.md +4 -0
- package/dist/plugin/dashboard.plugin.d.ts +25 -6
- package/dist/plugin/dashboard.plugin.js +184 -27
- package/dist/plugin/default-page.html +188 -0
- package/dist/vite/vite-plugin-config.js +13 -9
- package/dist/vite/vite-plugin-translations.d.ts +22 -0
- package/dist/vite/vite-plugin-translations.js +66 -0
- package/dist/vite/vite-plugin-vendure-dashboard.js +8 -6
- package/lingui.config.js +25 -2
- package/package.json +159 -156
- package/src/app/app-providers.tsx +0 -4
- package/src/app/common/delete-bulk-action.tsx +6 -5
- package/src/app/common/duplicate-bulk-action.tsx +4 -5
- package/src/app/common/duplicate-entity-dialog.tsx +1 -1
- package/src/app/common/set-document-direction.ts +7 -0
- package/src/app/main.tsx +50 -17
- package/src/app/routes/_authenticated/_administrators/administrators.tsx +8 -6
- package/src/app/routes/_authenticated/_administrators/administrators_.$id.tsx +17 -6
- package/src/app/routes/_authenticated/_administrators/components/role-permissions-display.tsx +2 -2
- package/src/app/routes/_authenticated/_assets/assets.tsx +1 -1
- package/src/app/routes/_authenticated/_assets/assets_.$id.tsx +4 -4
- package/src/app/routes/_authenticated/_assets/components/asset-bulk-actions.tsx +8 -6
- package/src/app/routes/_authenticated/_assets/components/asset-tag-filter.tsx +1 -1
- package/src/app/routes/_authenticated/_assets/components/asset-tags-editor.tsx +1 -1
- package/src/app/routes/_authenticated/_assets/components/manage-tags-dialog.tsx +3 -8
- package/src/app/routes/_authenticated/_channels/channels.tsx +3 -6
- package/src/app/routes/_authenticated/_channels/channels_.$id.tsx +5 -5
- package/src/app/routes/_authenticated/_collections/collections.tsx +3 -4
- package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +4 -6
- package/src/app/routes/_authenticated/_collections/components/collection-bulk-actions.tsx +1 -1
- package/src/app/routes/_authenticated/_collections/components/collection-contents-sheet.tsx +1 -1
- package/src/app/routes/_authenticated/_collections/components/move-collections-dialog.tsx +6 -6
- package/src/app/routes/_authenticated/_countries/countries.graphql.ts +2 -0
- package/src/app/routes/_authenticated/_countries/countries.tsx +2 -3
- package/src/app/routes/_authenticated/_countries/countries_.$id.tsx +4 -4
- package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-sheet.tsx +1 -1
- package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-table.tsx +4 -4
- package/src/app/routes/_authenticated/_customer-groups/customer-groups.tsx +2 -4
- package/src/app/routes/_authenticated/_customer-groups/customer-groups_.$id.tsx +13 -6
- package/src/app/routes/_authenticated/_customers/components/customer-address-card.tsx +8 -8
- package/src/app/routes/_authenticated/_customers/components/customer-address-form.tsx +3 -3
- package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-container.tsx +1 -1
- package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-utils.tsx +1 -1
- package/src/app/routes/_authenticated/_customers/components/customer-history/default-customer-history-components.tsx +1 -1
- package/src/app/routes/_authenticated/_customers/components/customer-history/use-customer-history.ts +1 -1
- package/src/app/routes/_authenticated/_customers/components/customer-status-badge.tsx +1 -1
- package/src/app/routes/_authenticated/_customers/customers.graphql.ts +4 -0
- package/src/app/routes/_authenticated/_customers/customers.tsx +23 -11
- package/src/app/routes/_authenticated/_customers/customers_.$id.tsx +10 -8
- package/src/app/routes/_authenticated/_facets/components/edit-facet-value.tsx +1 -1
- package/src/app/routes/_authenticated/_facets/components/facet-bulk-actions.tsx +6 -5
- package/src/app/routes/_authenticated/_facets/components/facet-values-sheet.tsx +1 -1
- package/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx +1 -1
- package/src/app/routes/_authenticated/_facets/facets.tsx +5 -5
- package/src/app/routes/_authenticated/_facets/facets_.$facetId.values_.$id.tsx +7 -5
- package/src/app/routes/_authenticated/_facets/facets_.$id.tsx +4 -4
- package/src/app/routes/_authenticated/_global-settings/global-settings.tsx +5 -5
- package/src/app/routes/_authenticated/_orders/components/add-manual-payment-dialog.tsx +19 -21
- package/src/app/routes/_authenticated/_orders/components/customer-address-selector.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/edit-order-table.tsx +22 -22
- package/src/app/routes/_authenticated/_orders/components/fulfill-order-dialog.tsx +6 -6
- package/src/app/routes/_authenticated/_orders/components/fulfillment-details.tsx +15 -9
- package/src/app/routes/_authenticated/_orders/components/order-address.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-detail-shared.tsx +11 -9
- package/src/app/routes/_authenticated/_orders/components/order-history/default-order-history-components.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-history/order-history-container.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-history/order-history-utils.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-history/use-order-history.ts +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-line-custom-fields-form.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-modification-preview-dialog.tsx +4 -4
- package/src/app/routes/_authenticated/_orders/components/order-modification-summary.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/order-table-totals.tsx +27 -27
- package/src/app/routes/_authenticated/_orders/components/order-table.tsx +2 -2
- package/src/app/routes/_authenticated/_orders/components/order-tax-summary.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/payment-details.tsx +26 -20
- package/src/app/routes/_authenticated/_orders/components/seller-orders-card.tsx +3 -1
- package/src/app/routes/_authenticated/_orders/components/settle-refund-dialog.tsx +6 -6
- package/src/app/routes/_authenticated/_orders/components/shipping-method-selector.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/state-transition-control.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/components/use-transition-order-to-state.tsx +3 -2
- package/src/app/routes/_authenticated/_orders/orders.tsx +5 -9
- package/src/app/routes/_authenticated/_orders/orders_.$aggregateOrderId_.seller-orders.$sellerOrderId.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/orders_.$id.tsx +1 -1
- package/src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx +4 -4
- package/src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx +17 -17
- package/src/app/routes/_authenticated/_orders/utils/order-detail-loaders.tsx +1 -1
- package/src/app/routes/_authenticated/_payment-methods/payment-methods.tsx +5 -6
- package/src/app/routes/_authenticated/_payment-methods/payment-methods_.$id.tsx +13 -6
- package/src/app/routes/_authenticated/_product-variants/components/product-variant-bulk-actions.tsx +1 -1
- package/src/app/routes/_authenticated/_product-variants/components/variant-price-detail.tsx +1 -1
- package/src/app/routes/_authenticated/_product-variants/product-variants.tsx +9 -2
- package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +13 -6
- package/src/app/routes/_authenticated/_products/components/add-option-group-dialog.tsx +5 -5
- package/src/app/routes/_authenticated/_products/components/add-product-variant-dialog.tsx +5 -5
- package/src/app/routes/_authenticated/_products/components/assign-facet-values-dialog.tsx +5 -4
- package/src/app/routes/_authenticated/_products/components/create-product-options-dialog.tsx +9 -12
- package/src/app/routes/_authenticated/_products/components/create-product-variants-dialog.tsx +1 -1
- package/src/app/routes/_authenticated/_products/components/create-product-variants.tsx +4 -4
- package/src/app/routes/_authenticated/_products/components/option-groups-editor.tsx +1 -1
- package/src/app/routes/_authenticated/_products/components/product-bulk-actions.tsx +1 -1
- package/src/app/routes/_authenticated/_products/components/product-option-select.tsx +3 -3
- package/src/app/routes/_authenticated/_products/components/product-options-table.tsx +9 -6
- package/src/app/routes/_authenticated/_products/products.graphql.ts +31 -31
- package/src/app/routes/_authenticated/_products/products.tsx +11 -6
- package/src/app/routes/_authenticated/_products/products_.$id.tsx +4 -4
- package/src/app/routes/_authenticated/_products/products_.$id_.variants.tsx +11 -11
- package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$id.tsx +8 -12
- package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$productOptionGroupId.options_.$id.tsx +2 -2
- package/src/app/routes/_authenticated/_profile/profile.tsx +4 -4
- package/src/app/routes/_authenticated/_promotions/promotions.tsx +2 -4
- package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +16 -9
- package/src/app/routes/_authenticated/_roles/components/permissions-table-grid.tsx +1 -1
- package/src/app/routes/_authenticated/_roles/roles.tsx +3 -6
- package/src/app/routes/_authenticated/_roles/roles_.$id.tsx +4 -6
- package/src/app/routes/_authenticated/_sellers/sellers.tsx +3 -4
- package/src/app/routes/_authenticated/_sellers/sellers_.$id.tsx +4 -4
- package/src/app/routes/_authenticated/_shipping-methods/components/price-display.tsx +5 -5
- package/src/app/routes/_authenticated/_shipping-methods/components/shipping-method-test-result-wrapper.tsx +1 -1
- package/src/app/routes/_authenticated/_shipping-methods/components/test-address-form.tsx +4 -3
- package/src/app/routes/_authenticated/_shipping-methods/components/test-order-builder.tsx +4 -3
- package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-methods-result.tsx +8 -8
- package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-methods-sheet.tsx +1 -1
- package/src/app/routes/_authenticated/_shipping-methods/components/test-single-method-result.tsx +8 -8
- package/src/app/routes/_authenticated/_shipping-methods/components/test-single-shipping-method-sheet.tsx +4 -4
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.tsx +2 -3
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx +2 -2
- package/src/app/routes/_authenticated/_stock-locations/stock-locations.tsx +3 -4
- package/src/app/routes/_authenticated/_stock-locations/stock-locations_.$id.tsx +13 -6
- package/src/app/routes/_authenticated/_system/healthchecks.tsx +10 -4
- package/src/app/routes/_authenticated/_system/job-queue.tsx +10 -13
- package/src/app/routes/_authenticated/_system/scheduled-tasks.tsx +18 -16
- package/src/app/routes/_authenticated/_tax-categories/tax-categories.tsx +2 -4
- package/src/app/routes/_authenticated/_tax-categories/tax-categories_.$id.tsx +13 -6
- package/src/app/routes/_authenticated/_tax-rates/tax-rates.tsx +8 -12
- package/src/app/routes/_authenticated/_tax-rates/tax-rates_.$id.tsx +6 -4
- package/src/app/routes/_authenticated/_zones/zones.tsx +4 -4
- package/src/app/routes/_authenticated/_zones/zones_.$id.tsx +8 -5
- package/src/app/routes/_authenticated/index.tsx +6 -2
- package/src/app/styles.css +4 -0
- package/src/i18n/common-strings.ts +111 -0
- package/src/i18n/locales/ar.po +4777 -0
- package/src/i18n/locales/cs.po +4777 -0
- package/src/i18n/locales/de.po +4299 -1101
- package/src/i18n/locales/en.po +3857 -659
- package/src/i18n/locales/es.po +4777 -0
- package/src/i18n/locales/fa.po +4777 -0
- package/src/i18n/locales/fr.po +4777 -0
- package/src/i18n/locales/he.po +4777 -0
- package/src/i18n/locales/hr.po +4777 -0
- package/src/i18n/locales/it.po +4777 -0
- package/src/i18n/locales/ja.po +4777 -0
- package/src/i18n/locales/ko.po +4628 -0
- package/src/i18n/locales/nb.po +4777 -0
- package/src/i18n/locales/ne.po +4777 -0
- package/src/i18n/locales/nl.po +4628 -0
- package/src/i18n/locales/pl.po +4777 -0
- package/src/i18n/locales/pt_BR.po +4777 -0
- package/src/i18n/locales/pt_PT.po +4777 -0
- package/src/i18n/locales/ru.po +4777 -0
- package/src/i18n/locales/sv.po +4777 -0
- package/src/i18n/locales/tr.po +4777 -0
- package/src/i18n/locales/uk.po +4777 -0
- package/src/i18n/locales/zh_Hans.po +4777 -0
- package/src/i18n/locales/zh_Hant.po +4777 -0
- package/src/lib/components/data-input/combination-mode-input.tsx +1 -1
- package/src/lib/components/data-input/custom-field-list-input.tsx +11 -7
- package/src/lib/components/data-input/customer-group-input.tsx +27 -33
- package/src/lib/components/data-input/datetime-input.tsx +40 -1
- package/src/lib/components/data-input/default-relation-input.tsx +5 -4
- package/src/lib/components/data-input/product-multi-selector-input.tsx +14 -14
- package/src/lib/components/data-input/relation-selector.tsx +1 -1
- package/src/lib/components/data-input/select-with-options.tsx +1 -1
- package/src/lib/components/data-input/slug-input.tsx +9 -15
- package/src/lib/components/data-table/add-filter-menu.tsx +4 -4
- package/src/lib/components/data-table/data-table-bulk-action-item.tsx +8 -8
- package/src/lib/components/data-table/data-table-bulk-actions.tsx +4 -4
- package/src/lib/components/data-table/data-table-column-header.tsx +13 -8
- package/src/lib/components/data-table/data-table-faceted-filter.tsx +2 -1
- package/src/lib/components/data-table/data-table-filter-dialog.tsx +1 -1
- package/src/lib/components/data-table/data-table-utils.ts +21 -4
- package/src/lib/components/data-table/data-table-view-options.tsx +4 -2
- package/src/lib/components/data-table/data-table.tsx +3 -3
- package/src/lib/components/data-table/filters/data-table-boolean-filter.tsx +4 -4
- package/src/lib/components/data-table/global-views-bar.tsx +1 -1
- package/src/lib/components/data-table/human-readable-operator.tsx +1 -1
- package/src/lib/components/data-table/manage-global-views-button.tsx +1 -1
- package/src/lib/components/data-table/my-views-button.tsx +13 -13
- package/src/lib/components/data-table/refresh-button.tsx +1 -1
- package/src/lib/components/data-table/save-view-button.tsx +11 -11
- package/src/lib/components/data-table/use-generated-columns.tsx +10 -7
- package/src/lib/components/data-table/views-sheet.tsx +79 -71
- package/src/lib/components/date-range-picker.tsx +36 -34
- package/src/lib/components/layout/app-sidebar.tsx +3 -1
- package/src/lib/components/layout/channel-switcher.tsx +8 -10
- package/src/lib/components/layout/dev-mode-indicator.tsx +1 -1
- package/src/lib/components/layout/generated-breadcrumbs.tsx +10 -8
- package/src/lib/components/layout/language-dialog.tsx +34 -13
- package/src/lib/components/layout/manage-languages-dialog.tsx +1 -1
- package/src/lib/components/layout/nav-main.tsx +23 -13
- package/src/lib/components/layout/nav-user.tsx +19 -23
- package/src/lib/components/login/login-form.tsx +1 -1
- package/src/lib/components/shared/asset/asset-bulk-actions.tsx +4 -4
- package/src/lib/components/shared/asset/asset-focal-point-editor.tsx +1 -1
- package/src/lib/components/shared/asset/asset-gallery.tsx +15 -14
- package/src/lib/components/shared/assign-to-channel-bulk-action.tsx +11 -11
- package/src/lib/components/shared/assign-to-channel-dialog.tsx +6 -5
- package/src/lib/components/shared/channel-code-label.tsx +1 -1
- package/src/lib/components/shared/channel-selector.tsx +4 -4
- package/src/lib/components/shared/configurable-operation-multi-selector.tsx +16 -14
- package/src/lib/components/shared/configurable-operation-selector.tsx +1 -1
- package/src/lib/components/shared/confirmation-dialog.tsx +8 -8
- package/src/lib/components/shared/country-selector.tsx +1 -1
- package/src/lib/components/shared/currency-selector.tsx +4 -4
- package/src/lib/components/shared/custom-fields-form.tsx +8 -24
- package/src/lib/components/shared/customer-address-form.tsx +3 -3
- package/src/lib/components/shared/customer-group-selector.tsx +1 -1
- package/src/lib/components/shared/customer-selector.tsx +1 -1
- package/src/lib/components/shared/error-page.tsx +1 -1
- package/src/lib/components/shared/facet-value-selector.tsx +10 -10
- package/src/lib/components/shared/history-timeline/history-note-checkbox.tsx +1 -1
- package/src/lib/components/shared/history-timeline/history-note-editor.tsx +1 -1
- package/src/lib/components/shared/history-timeline/history-note-entry.tsx +1 -1
- package/src/lib/components/shared/language-selector.tsx +4 -4
- package/src/lib/components/shared/navigation-confirmation.tsx +1 -1
- package/src/lib/components/shared/paginated-list-data-table.tsx +21 -18
- package/src/lib/components/shared/remove-from-channel-bulk-action.tsx +6 -5
- package/src/lib/components/shared/rich-text-editor/image-dialog.tsx +1 -1
- package/src/lib/components/shared/rich-text-editor/link-dialog.tsx +1 -1
- package/src/lib/components/shared/rich-text-editor/responsive-toolbar.tsx +1 -1
- package/src/lib/components/shared/rich-text-editor/table-edit-icons.tsx +1 -1
- package/src/lib/components/shared/role-code-label.tsx +1 -1
- package/src/lib/components/shared/role-selector.tsx +4 -4
- package/src/lib/components/shared/seller-selector.tsx +1 -1
- package/src/lib/components/shared/stock-level-label.tsx +3 -5
- package/src/lib/components/shared/table-cell/order-table-cell-components.tsx +3 -1
- package/src/lib/components/shared/tax-category-selector.tsx +1 -1
- package/src/lib/components/shared/translatable-form-field.tsx +15 -15
- package/src/lib/components/shared/zone-selector.tsx +1 -1
- package/src/lib/constants.ts +10 -0
- package/src/lib/framework/dashboard-widget/base-widget.tsx +11 -9
- package/src/lib/framework/dashboard-widget/latest-orders-widget/index.tsx +6 -4
- package/src/lib/framework/dashboard-widget/metrics-widget/index.tsx +8 -5
- package/src/lib/framework/dashboard-widget/orders-summary/index.tsx +7 -4
- package/src/lib/framework/dashboard-widget/widget-filters-context.tsx +3 -1
- package/src/lib/framework/defaults.ts +34 -63
- package/src/lib/framework/layout-engine/page-layout.tsx +36 -36
- package/src/lib/framework/page/detail-page.tsx +10 -10
- package/src/lib/framework/page/use-extended-router.tsx +48 -23
- package/src/lib/graphql/api.ts +22 -7
- package/src/lib/graphql/graphql-env.d.ts +13 -25
- package/src/lib/hooks/use-display-locale.ts +40 -0
- package/src/lib/hooks/use-dynamic-translations.ts +46 -0
- package/src/lib/hooks/use-extended-detail-query.ts +1 -1
- package/src/lib/hooks/use-extended-list-query.ts +1 -1
- package/src/lib/hooks/use-local-format.ts +15 -1
- package/src/lib/hooks/use-saved-views.ts +7 -0
- package/src/lib/hooks/use-ui-language-loader.ts +30 -0
- package/src/lib/lib/load-i18n-messages.ts +17 -0
- package/src/lib/lib/trans.tsx +15 -11
- package/src/lib/providers/auth.tsx +2 -2
- package/src/lib/providers/channel-provider.tsx +3 -2
- package/src/lib/providers/i18n-provider.tsx +7 -14
- package/src/lib/providers/user-settings.tsx +46 -5
|
@@ -4,7 +4,7 @@ import { PermissionGuard } from '@/vdb/components/shared/permission-guard.js';
|
|
|
4
4
|
import { Button } from '@/vdb/components/ui/button.js';
|
|
5
5
|
import { PageActionBarRight } from '@/vdb/framework/layout-engine/page-layout.js';
|
|
6
6
|
import { ListPage } from '@/vdb/framework/page/list-page.js';
|
|
7
|
-
import { Trans } from '
|
|
7
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
8
8
|
import { createFileRoute, Link } from '@tanstack/react-router';
|
|
9
9
|
import { PlusIcon } from 'lucide-react';
|
|
10
10
|
import {
|
|
@@ -20,12 +20,13 @@ export const Route = createFileRoute('/_authenticated/_payment-methods/payment-m
|
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
function PaymentMethodListPage() {
|
|
23
|
+
const { t } = useLingui();
|
|
23
24
|
return (
|
|
24
25
|
<ListPage
|
|
25
26
|
pageId="payment-method-list"
|
|
26
27
|
listQuery={paymentMethodListQuery}
|
|
27
28
|
route={Route}
|
|
28
|
-
title=
|
|
29
|
+
title={<Trans>Payment Methods</Trans>}
|
|
29
30
|
defaultVisibility={{
|
|
30
31
|
name: true,
|
|
31
32
|
code: true,
|
|
@@ -38,7 +39,7 @@ function PaymentMethodListPage() {
|
|
|
38
39
|
}}
|
|
39
40
|
facetedFilters={{
|
|
40
41
|
enabled: {
|
|
41
|
-
title:
|
|
42
|
+
title: t`Enabled`,
|
|
42
43
|
options: [
|
|
43
44
|
{ label: 'Enabled', value: true },
|
|
44
45
|
{ label: 'Disabled', value: false },
|
|
@@ -47,11 +48,9 @@ function PaymentMethodListPage() {
|
|
|
47
48
|
}}
|
|
48
49
|
customizeColumns={{
|
|
49
50
|
name: {
|
|
50
|
-
header: 'Name',
|
|
51
51
|
cell: ({ row }) => <DetailPageButton id={row.original.id} label={row.original.name} />,
|
|
52
52
|
},
|
|
53
53
|
enabled: {
|
|
54
|
-
header: 'Enabled',
|
|
55
54
|
cell: ({ row }) => <BooleanDisplayBadge value={row.original.enabled} />,
|
|
56
55
|
},
|
|
57
56
|
}}
|
|
@@ -75,7 +74,7 @@ function PaymentMethodListPage() {
|
|
|
75
74
|
<Button asChild>
|
|
76
75
|
<Link to="./new">
|
|
77
76
|
<PlusIcon className="mr-2 h-4 w-4" />
|
|
78
|
-
New Payment Method
|
|
77
|
+
<Trans>New Payment Method</Trans>
|
|
79
78
|
</Link>
|
|
80
79
|
</Button>
|
|
81
80
|
</PermissionGuard>
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from '@/vdb/framework/layout-engine/page-layout.js';
|
|
20
20
|
import { detailPageRouteLoader } from '@/vdb/framework/page/detail-page-route-loader.js';
|
|
21
21
|
import { useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
22
|
-
import { Trans, useLingui } from '
|
|
22
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
23
23
|
import { createFileRoute, useNavigate } from '@tanstack/react-router';
|
|
24
24
|
import { toast } from 'sonner';
|
|
25
25
|
import { PaymentEligibilityCheckerSelector } from './components/payment-eligibility-checker-selector.js';
|
|
@@ -51,7 +51,7 @@ function PaymentMethodDetailPage() {
|
|
|
51
51
|
const params = Route.useParams();
|
|
52
52
|
const navigate = useNavigate();
|
|
53
53
|
const creatingNewEntity = params.id === NEW_ENTITY_PATH;
|
|
54
|
-
const {
|
|
54
|
+
const { t } = useLingui();
|
|
55
55
|
|
|
56
56
|
const { form, submitHandler, entity, isPending, resetForm } = useDetailPage({
|
|
57
57
|
pageId,
|
|
@@ -95,16 +95,23 @@ function PaymentMethodDetailPage() {
|
|
|
95
95
|
},
|
|
96
96
|
params: { id: params.id },
|
|
97
97
|
onSuccess: async data => {
|
|
98
|
-
toast.success(
|
|
98
|
+
toast.success(
|
|
99
|
+
creatingNewEntity
|
|
100
|
+
? t`Successfully created payment method`
|
|
101
|
+
: t`Successfully updated payment method`,
|
|
102
|
+
);
|
|
99
103
|
resetForm();
|
|
100
104
|
if (creatingNewEntity) {
|
|
101
105
|
await navigate({ to: `../$id`, params: { id: data.id } });
|
|
102
106
|
}
|
|
103
107
|
},
|
|
104
108
|
onError: err => {
|
|
105
|
-
toast.error(
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
toast.error(
|
|
110
|
+
creatingNewEntity ? t`Failed to create payment method` : t`Failed to update payment method`,
|
|
111
|
+
{
|
|
112
|
+
description: err instanceof Error ? err.message : 'Unknown error',
|
|
113
|
+
},
|
|
114
|
+
);
|
|
108
115
|
},
|
|
109
116
|
});
|
|
110
117
|
|
package/src/app/routes/_authenticated/_product-variants/components/product-variant-bulk-actions.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import { RemoveFromChannelBulkAction } from '@/vdb/components/shared/remove-from
|
|
|
9
9
|
import { BulkActionComponent } from '@/vdb/framework/extension-api/types/data-table.js';
|
|
10
10
|
import { api } from '@/vdb/graphql/api.js';
|
|
11
11
|
import { useChannel } from '@/vdb/hooks/use-channel.js';
|
|
12
|
-
import { Trans } from '
|
|
12
|
+
import { Trans } from '@lingui/react/macro';
|
|
13
13
|
import { DeleteBulkAction } from '../../../../common/delete-bulk-action.js';
|
|
14
14
|
|
|
15
15
|
import { AssignFacetValuesDialog } from '../../_products/components/assign-facet-values-dialog.js';
|
|
@@ -2,7 +2,7 @@ import { Money } from '@/vdb/components/data-display/money.js';
|
|
|
2
2
|
import { api } from '@/vdb/graphql/api.js';
|
|
3
3
|
import { graphql } from '@/vdb/graphql/graphql.js';
|
|
4
4
|
import { useChannel } from '@/vdb/hooks/use-channel.js';
|
|
5
|
-
import { Trans } from '
|
|
5
|
+
import { Trans } from '@lingui/react/macro';
|
|
6
6
|
import { useQuery } from '@tanstack/react-query';
|
|
7
7
|
import { useEffect, useState } from 'react';
|
|
8
8
|
|
|
@@ -3,7 +3,7 @@ import { DetailPageButton } from '@/vdb/components/shared/detail-page-button.js'
|
|
|
3
3
|
import { StockLevelLabel } from '@/vdb/components/shared/stock-level-label.js';
|
|
4
4
|
import { ListPage } from '@/vdb/framework/page/list-page.js';
|
|
5
5
|
import { useLocalFormat } from '@/vdb/hooks/use-local-format.js';
|
|
6
|
-
import { Trans } from '
|
|
6
|
+
import { Trans } from '@lingui/react/macro';
|
|
7
7
|
import { createFileRoute } from '@tanstack/react-router';
|
|
8
8
|
import {
|
|
9
9
|
AssignFacetValuesToProductVariantsBulkAction,
|
|
@@ -25,6 +25,14 @@ function ProductListPage() {
|
|
|
25
25
|
pageId="product-variant-list"
|
|
26
26
|
title={<Trans>Product Variants</Trans>}
|
|
27
27
|
listQuery={productVariantListDocument}
|
|
28
|
+
defaultVisibility={{
|
|
29
|
+
featuredAsset: true,
|
|
30
|
+
name: true,
|
|
31
|
+
sku: true,
|
|
32
|
+
priceWithTax: true,
|
|
33
|
+
enabled: true,
|
|
34
|
+
stockLevels: true,
|
|
35
|
+
}}
|
|
28
36
|
bulkActions={[
|
|
29
37
|
{
|
|
30
38
|
component: AssignProductVariantsToChannelBulkAction,
|
|
@@ -45,7 +53,6 @@ function ProductListPage() {
|
|
|
45
53
|
]}
|
|
46
54
|
customizeColumns={{
|
|
47
55
|
name: {
|
|
48
|
-
header: 'Product Name',
|
|
49
56
|
cell: ({ row: { original } }) => (
|
|
50
57
|
<DetailPageButton id={original.id} label={original.name} />
|
|
51
58
|
),
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
import { detailPageRouteLoader } from '@/vdb/framework/page/detail-page-route-loader.js';
|
|
26
26
|
import { useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
27
27
|
import { useChannel } from '@/vdb/hooks/use-channel.js';
|
|
28
|
-
import { Trans, useLingui } from '
|
|
28
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
29
29
|
import { createFileRoute, useNavigate } from '@tanstack/react-router';
|
|
30
30
|
import { Fragment } from 'react/jsx-runtime';
|
|
31
31
|
import { toast } from 'sonner';
|
|
@@ -61,7 +61,7 @@ function ProductVariantDetailPage() {
|
|
|
61
61
|
const params = Route.useParams();
|
|
62
62
|
const navigate = useNavigate();
|
|
63
63
|
const creatingNewEntity = params.id === NEW_ENTITY_PATH;
|
|
64
|
-
const {
|
|
64
|
+
const { t } = useLingui();
|
|
65
65
|
const { activeChannel } = useChannel();
|
|
66
66
|
|
|
67
67
|
const { form, submitHandler, entity, isPending, resetForm } = useDetailPage({
|
|
@@ -97,16 +97,23 @@ function ProductVariantDetailPage() {
|
|
|
97
97
|
},
|
|
98
98
|
params: { id: params.id },
|
|
99
99
|
onSuccess: data => {
|
|
100
|
-
toast.success(
|
|
100
|
+
toast.success(
|
|
101
|
+
creatingNewEntity
|
|
102
|
+
? t`Successfully created product variant`
|
|
103
|
+
: t`Successfully updated product variant`,
|
|
104
|
+
);
|
|
101
105
|
resetForm();
|
|
102
106
|
if (creatingNewEntity) {
|
|
103
107
|
navigate({ to: `../${(data as any)?.[0]?.id}`, from: Route.id });
|
|
104
108
|
}
|
|
105
109
|
},
|
|
106
110
|
onError: err => {
|
|
107
|
-
toast.error(
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
toast.error(
|
|
112
|
+
creatingNewEntity ? t`Failed to create product variant` : t`Failed to update product variant`,
|
|
113
|
+
{
|
|
114
|
+
description: err instanceof Error ? err.message : 'Unknown error',
|
|
115
|
+
},
|
|
116
|
+
);
|
|
110
117
|
},
|
|
111
118
|
});
|
|
112
119
|
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
} from '@/vdb/components/ui/dialog.js';
|
|
10
10
|
import { Form } from '@/vdb/components/ui/form.js';
|
|
11
11
|
import { api } from '@/vdb/graphql/api.js';
|
|
12
|
-
import { Trans, useLingui } from '@/vdb/lib/trans.js';
|
|
13
12
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
13
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
14
14
|
import { useMutation } from '@tanstack/react-query';
|
|
15
15
|
import { Plus, Save } from 'lucide-react';
|
|
16
16
|
import { useState } from 'react';
|
|
@@ -27,7 +27,7 @@ export function AddOptionGroupDialog({
|
|
|
27
27
|
onSuccess?: () => void;
|
|
28
28
|
}>) {
|
|
29
29
|
const [open, setOpen] = useState(false);
|
|
30
|
-
const {
|
|
30
|
+
const { t } = useLingui();
|
|
31
31
|
|
|
32
32
|
const form = useForm<OptionGroup>({
|
|
33
33
|
resolver: zodResolver(optionGroupSchema),
|
|
@@ -79,12 +79,12 @@ export function AddOptionGroupDialog({
|
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
toast.success(
|
|
82
|
+
toast.success(t`Successfully created option group`);
|
|
83
83
|
setOpen(false);
|
|
84
84
|
onSuccess?.();
|
|
85
85
|
} catch (error) {
|
|
86
|
-
toast.error(
|
|
87
|
-
description: error instanceof Error ? error.message :
|
|
86
|
+
toast.error(t`Failed to create option group`, {
|
|
87
|
+
description: error instanceof Error ? error.message : t`Unknown error`,
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
};
|
|
@@ -14,8 +14,8 @@ import { Input } from '@/vdb/components/ui/input.js';
|
|
|
14
14
|
import { api } from '@/vdb/graphql/api.js';
|
|
15
15
|
import { graphql, ResultOf, VariablesOf } from '@/vdb/graphql/graphql.js';
|
|
16
16
|
import { useChannel } from '@/vdb/hooks/use-channel.js';
|
|
17
|
-
import { Trans, useLingui } from '@/vdb/lib/trans.js';
|
|
18
17
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
18
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
19
19
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
20
20
|
import { Plus } from 'lucide-react';
|
|
21
21
|
import { useCallback, useEffect, useState } from 'react';
|
|
@@ -83,7 +83,7 @@ export function AddProductVariantDialog({
|
|
|
83
83
|
}) {
|
|
84
84
|
const [open, setOpen] = useState(false);
|
|
85
85
|
const { activeChannel } = useChannel();
|
|
86
|
-
const {
|
|
86
|
+
const { t } = useLingui();
|
|
87
87
|
const [duplicateVariantError, setDuplicateVariantError] = useState<string | null>(null);
|
|
88
88
|
const [nameTouched, setNameTouched] = useState(false);
|
|
89
89
|
|
|
@@ -166,13 +166,13 @@ export function AddProductVariantDialog({
|
|
|
166
166
|
const createProductVariantMutation = useMutation({
|
|
167
167
|
mutationFn: api.mutate(createProductVariantDocument),
|
|
168
168
|
onSuccess: (result: ResultOf<typeof createProductVariantDocument>) => {
|
|
169
|
-
toast.success(
|
|
169
|
+
toast.success(t`Successfully created product variant`);
|
|
170
170
|
setOpen(false);
|
|
171
171
|
onSuccess?.();
|
|
172
172
|
},
|
|
173
173
|
onError: error => {
|
|
174
|
-
toast.error(
|
|
175
|
-
description: error instanceof Error ? error.message :
|
|
174
|
+
toast.error(t`Failed to create product variant`, {
|
|
175
|
+
description: error instanceof Error ? error.message : t`Unknown error`,
|
|
176
176
|
});
|
|
177
177
|
},
|
|
178
178
|
});
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
DialogTitle,
|
|
15
15
|
} from '@/vdb/components/ui/dialog.js';
|
|
16
16
|
import { ResultOf } from '@/vdb/graphql/graphql.js';
|
|
17
|
-
import { Trans, useLingui } from '
|
|
17
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
18
18
|
|
|
19
19
|
import { getDetailQueryOptions } from '@/vdb/framework/page/use-detail-page.js';
|
|
20
20
|
|
|
@@ -55,11 +55,12 @@ export function AssignFacetValuesDialog({
|
|
|
55
55
|
detailDocument,
|
|
56
56
|
onSuccess,
|
|
57
57
|
}: AssignFacetValuesDialogProps) {
|
|
58
|
-
const {
|
|
58
|
+
const { t } = useLingui();
|
|
59
59
|
const [selectedValues, setSelectedValues] = useState<FacetValue[]>([]);
|
|
60
60
|
const [facetValuesRemoved, setFacetValuesRemoved] = useState(false);
|
|
61
61
|
const [removedFacetValues, setRemovedFacetValues] = useState<Set<string>>(new Set());
|
|
62
62
|
const queryClient = useQueryClient();
|
|
63
|
+
const entityIdsLength = entityIds.length;
|
|
63
64
|
|
|
64
65
|
// Fetch existing facet values for the entities
|
|
65
66
|
const { data: entitiesData, isLoading } = useQuery({
|
|
@@ -71,7 +72,7 @@ export function AssignFacetValuesDialog({
|
|
|
71
72
|
const { mutate, isPending } = useMutation({
|
|
72
73
|
mutationFn,
|
|
73
74
|
onSuccess: () => {
|
|
74
|
-
toast.success(
|
|
75
|
+
toast.success(t`Successfully updated facet values for ${entityIdsLength} ${entityType}`);
|
|
75
76
|
onSuccess?.();
|
|
76
77
|
onOpenChange(false);
|
|
77
78
|
// Reset state
|
|
@@ -84,7 +85,7 @@ export function AssignFacetValuesDialog({
|
|
|
84
85
|
});
|
|
85
86
|
},
|
|
86
87
|
onError: () => {
|
|
87
|
-
toast.error(`Failed to update facet values for ${
|
|
88
|
+
toast.error(`Failed to update facet values for ${entityIdsLength} ${entityType}`);
|
|
88
89
|
},
|
|
89
90
|
});
|
|
90
91
|
|
package/src/app/routes/_authenticated/_products/components/create-product-options-dialog.tsx
CHANGED
|
@@ -12,8 +12,8 @@ import { Form } from '@/vdb/components/ui/form.js';
|
|
|
12
12
|
import { Input } from '@/vdb/components/ui/input.js';
|
|
13
13
|
import { api } from '@/vdb/graphql/api.js';
|
|
14
14
|
import { graphql } from '@/vdb/graphql/graphql.js';
|
|
15
|
-
import { Trans, useLingui } from '@/vdb/lib/trans.js';
|
|
16
15
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
16
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
17
17
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
18
18
|
import { Plus, Trash2 } from 'lucide-react';
|
|
19
19
|
import { useState } from 'react';
|
|
@@ -90,7 +90,7 @@ export function CreateProductOptionsDialog({
|
|
|
90
90
|
onSuccess?: () => void;
|
|
91
91
|
}) {
|
|
92
92
|
const [open, setOpen] = useState(false);
|
|
93
|
-
const {
|
|
93
|
+
const { t } = useLingui();
|
|
94
94
|
|
|
95
95
|
const { data: productData } = useQuery({
|
|
96
96
|
queryKey: ['product', productId],
|
|
@@ -116,13 +116,13 @@ export function CreateProductOptionsDialog({
|
|
|
116
116
|
const updateProductVariantMutation = useMutation({
|
|
117
117
|
mutationFn: api.mutate(updateProductVariantDocument),
|
|
118
118
|
onSuccess: () => {
|
|
119
|
-
toast.success(
|
|
119
|
+
toast.success(t`Successfully created product options`);
|
|
120
120
|
setOpen(false);
|
|
121
121
|
onSuccess?.();
|
|
122
122
|
},
|
|
123
123
|
onError: error => {
|
|
124
|
-
toast.error(
|
|
125
|
-
description: error instanceof Error ? error.message :
|
|
124
|
+
toast.error(t`Failed to create product options`, {
|
|
125
|
+
description: error instanceof Error ? error.message : t`Unknown error`,
|
|
126
126
|
});
|
|
127
127
|
},
|
|
128
128
|
});
|
|
@@ -206,8 +206,8 @@ export function CreateProductOptionsDialog({
|
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
} catch (error) {
|
|
209
|
-
toast.error(
|
|
210
|
-
description: error instanceof Error ? error.message :
|
|
209
|
+
toast.error(t`Failed to create product options`, {
|
|
210
|
+
description: error instanceof Error ? error.message : t`Unknown error`,
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
};
|
|
@@ -266,7 +266,7 @@ export function CreateProductOptionsDialog({
|
|
|
266
266
|
name={`optionGroups.${groupIndex}.name`}
|
|
267
267
|
label={<Trans>Option group name</Trans>}
|
|
268
268
|
render={({ field }) => (
|
|
269
|
-
<Input {...field} placeholder={
|
|
269
|
+
<Input {...field} placeholder={t`e.g. Size`} />
|
|
270
270
|
)}
|
|
271
271
|
/>
|
|
272
272
|
{groupIndex > 0 && (
|
|
@@ -287,10 +287,7 @@ export function CreateProductOptionsDialog({
|
|
|
287
287
|
name={`optionGroups.${groupIndex}.options.${optionIndex}`}
|
|
288
288
|
label={<Trans>Option name</Trans>}
|
|
289
289
|
render={({ field }) => (
|
|
290
|
-
<Input
|
|
291
|
-
{...field}
|
|
292
|
-
placeholder={i18n.t('e.g. Small')}
|
|
293
|
-
/>
|
|
290
|
+
<Input {...field} placeholder={t`e.g. Small`} />
|
|
294
291
|
)}
|
|
295
292
|
/>
|
|
296
293
|
{optionIndex > 0 && (
|
package/src/app/routes/_authenticated/_products/components/create-product-variants-dialog.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@/vdb/components/ui/dialog.js';
|
|
11
11
|
import { api } from '@/vdb/graphql/api.js';
|
|
12
12
|
import { useChannel } from '@/vdb/hooks/use-channel.js';
|
|
13
|
-
import { Trans } from '
|
|
13
|
+
import { Trans } from '@lingui/react/macro';
|
|
14
14
|
import { normalizeString } from '@/vdb/lib/utils.js';
|
|
15
15
|
import { useMutation } from '@tanstack/react-query';
|
|
16
16
|
import { Plus } from 'lucide-react';
|
|
@@ -5,7 +5,7 @@ import { Input } from '@/vdb/components/ui/input.js';
|
|
|
5
5
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/vdb/components/ui/table.js';
|
|
6
6
|
import { api } from '@/vdb/graphql/api.js';
|
|
7
7
|
import { graphql } from '@/vdb/graphql/graphql.js';
|
|
8
|
-
import { Trans } from '
|
|
8
|
+
import { Trans } from '@lingui/react/macro';
|
|
9
9
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
10
10
|
import { useQuery } from '@tanstack/react-query';
|
|
11
11
|
import { useEffect, useMemo, useState } from 'react';
|
|
@@ -83,9 +83,9 @@ interface CreateProductVariantsProps {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
export function CreateProductVariants({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}: Readonly<CreateProductVariantsProps>) {
|
|
86
|
+
currencyCode = 'USD',
|
|
87
|
+
onChange,
|
|
88
|
+
}: Readonly<CreateProductVariantsProps>) {
|
|
89
89
|
const { data: stockLocationsResult } = useQuery({
|
|
90
90
|
queryKey: ['stockLocations'],
|
|
91
91
|
queryFn: () => api.query(getStockLocationsDocument, { options: { take: 100 } }),
|
|
@@ -2,7 +2,7 @@ import { FormFieldWrapper } from '@/vdb/components/shared/form-field-wrapper.js'
|
|
|
2
2
|
import { Button } from '@/vdb/components/ui/button.js';
|
|
3
3
|
import { Form } from '@/vdb/components/ui/form.js';
|
|
4
4
|
import { Input } from '@/vdb/components/ui/input.js';
|
|
5
|
-
import { Trans } from '
|
|
5
|
+
import { Trans } from '@lingui/react/macro';
|
|
6
6
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
7
7
|
import { Plus, Trash2 } from 'lucide-react';
|
|
8
8
|
import { useEffect } from 'react';
|
|
@@ -9,7 +9,7 @@ import { RemoveFromChannelBulkAction } from '@/vdb/components/shared/remove-from
|
|
|
9
9
|
import { BulkActionComponent } from '@/vdb/framework/extension-api/types/data-table.js';
|
|
10
10
|
import { api } from '@/vdb/graphql/api.js';
|
|
11
11
|
import { useChannel } from '@/vdb/hooks/use-channel.js';
|
|
12
|
-
import { Trans } from '
|
|
12
|
+
import { Trans } from '@lingui/react/macro';
|
|
13
13
|
import { DeleteBulkAction } from '../../../../common/delete-bulk-action.js';
|
|
14
14
|
import { DuplicateBulkAction } from '../../../../common/duplicate-bulk-action.js';
|
|
15
15
|
import {
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
CommandItem,
|
|
9
9
|
} from '@/vdb/components/ui/command.js';
|
|
10
10
|
import { Popover, PopoverContent, PopoverTrigger } from '@/vdb/components/ui/popover.js';
|
|
11
|
-
import { Trans, useLingui } from '@/vdb/lib/trans.js';
|
|
12
11
|
import { cn } from '@/vdb/lib/utils.js';
|
|
12
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
13
13
|
import { Check, ChevronsUpDown, Plus } from 'lucide-react';
|
|
14
14
|
import { useState } from 'react';
|
|
15
15
|
|
|
@@ -41,7 +41,7 @@ export function ProductOptionSelect({
|
|
|
41
41
|
}: Readonly<ProductOptionSelectProps>) {
|
|
42
42
|
const [open, setOpen] = useState(false);
|
|
43
43
|
const [newOptionInput, setNewOptionInput] = useState('');
|
|
44
|
-
const {
|
|
44
|
+
const { t } = useLingui();
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
47
|
<FormFieldWrapper
|
|
@@ -63,7 +63,7 @@ export function ProductOptionSelect({
|
|
|
63
63
|
<PopoverContent className="w-full p-0">
|
|
64
64
|
<Command>
|
|
65
65
|
<CommandInput
|
|
66
|
-
placeholder={
|
|
66
|
+
placeholder={t`Search {name}...`.replace('{name}', group.name)}
|
|
67
67
|
onValueChange={setNewOptionInput}
|
|
68
68
|
/>
|
|
69
69
|
<CommandEmpty className="py-2">
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { DetailPageButton } from '@/vdb/components/shared/detail-page-button.js';
|
|
2
2
|
import { PaginatedListDataTable } from '@/vdb/components/shared/paginated-list-data-table.js';
|
|
3
3
|
import { Button } from '@/vdb/components/ui/button.js';
|
|
4
|
-
import { addCustomFields } from '@/vdb/framework/document-introspection/add-custom-fields.js';
|
|
5
4
|
import { graphql } from '@/vdb/graphql/graphql.js';
|
|
6
|
-
import { Trans } from '
|
|
5
|
+
import { Trans } from '@lingui/react/macro';
|
|
7
6
|
import { Link } from '@tanstack/react-router';
|
|
8
|
-
import { ColumnFiltersState, SortingState } from '@tanstack/react-table';
|
|
7
|
+
import { ColumnFiltersState, SortingState, VisibilityState } from '@tanstack/react-table';
|
|
9
8
|
import { PlusIcon } from 'lucide-react';
|
|
10
9
|
import { useRef, useState } from 'react';
|
|
11
10
|
import { deleteProductOptionDocument } from '../product-option-groups.graphql.js';
|
|
@@ -19,7 +18,6 @@ export const productOptionListDocument = graphql(`
|
|
|
19
18
|
updatedAt
|
|
20
19
|
name
|
|
21
20
|
code
|
|
22
|
-
customFields
|
|
23
21
|
}
|
|
24
22
|
totalItems
|
|
25
23
|
}
|
|
@@ -39,12 +37,16 @@ export function ProductOptionsTable({
|
|
|
39
37
|
const [page, setPage] = useState(1);
|
|
40
38
|
const [pageSize, setPageSize] = useState(10);
|
|
41
39
|
const [filters, setFilters] = useState<ColumnFiltersState>([]);
|
|
40
|
+
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({
|
|
41
|
+
name: true,
|
|
42
|
+
code: true,
|
|
43
|
+
});
|
|
42
44
|
const refreshRef = useRef<() => void>(() => {});
|
|
43
45
|
|
|
44
46
|
return (
|
|
45
47
|
<>
|
|
46
48
|
<PaginatedListDataTable
|
|
47
|
-
listQuery={
|
|
49
|
+
listQuery={productOptionListDocument}
|
|
48
50
|
deleteMutation={deleteProductOptionDocument}
|
|
49
51
|
page={page}
|
|
50
52
|
itemsPerPage={pageSize}
|
|
@@ -57,6 +59,7 @@ export function ProductOptionsTable({
|
|
|
57
59
|
onSortChange={(_, sorting) => {
|
|
58
60
|
setSorting(sorting);
|
|
59
61
|
}}
|
|
62
|
+
onColumnVisibilityChange={(_, value) => setColumnVisibility(value)}
|
|
60
63
|
onFilterChange={(_, filters) => {
|
|
61
64
|
setFilters(filters);
|
|
62
65
|
}}
|
|
@@ -85,9 +88,9 @@ export function ProductOptionsTable({
|
|
|
85
88
|
},
|
|
86
89
|
};
|
|
87
90
|
}}
|
|
91
|
+
defaultVisibility={columnVisibility}
|
|
88
92
|
customizeColumns={{
|
|
89
93
|
name: {
|
|
90
|
-
header: 'Name',
|
|
91
94
|
cell: ({ row }) => (
|
|
92
95
|
<DetailPageButton
|
|
93
96
|
id={row.original.id}
|
|
@@ -15,6 +15,7 @@ export const productListDocument = graphql(`
|
|
|
15
15
|
name
|
|
16
16
|
slug
|
|
17
17
|
enabled
|
|
18
|
+
description
|
|
18
19
|
}
|
|
19
20
|
totalItems
|
|
20
21
|
}
|
|
@@ -59,7 +60,6 @@ export const productDetailFragment = graphql(
|
|
|
59
60
|
code
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
|
-
customFields
|
|
63
63
|
}
|
|
64
64
|
`,
|
|
65
65
|
[assetFragment],
|
|
@@ -108,45 +108,45 @@ export const productDetailDocument = graphql(
|
|
|
108
108
|
[productDetailFragment],
|
|
109
109
|
);
|
|
110
110
|
|
|
111
|
-
export const productDetailWithVariantsDocument = graphql(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
export const productDetailWithVariantsDocument = graphql(`
|
|
112
|
+
query ProductDetailWithVariants($id: ID!) {
|
|
113
|
+
product(id: $id) {
|
|
114
|
+
id
|
|
115
|
+
createdAt
|
|
116
|
+
updatedAt
|
|
117
|
+
name
|
|
118
|
+
variantList {
|
|
119
|
+
totalItems
|
|
120
|
+
}
|
|
121
|
+
optionGroups {
|
|
122
|
+
id
|
|
123
|
+
code
|
|
124
|
+
name
|
|
125
|
+
options {
|
|
120
126
|
id
|
|
121
127
|
code
|
|
122
128
|
name
|
|
123
|
-
options {
|
|
124
|
-
id
|
|
125
|
-
code
|
|
126
|
-
name
|
|
127
|
-
}
|
|
128
129
|
}
|
|
129
|
-
|
|
130
|
+
}
|
|
131
|
+
variants {
|
|
132
|
+
id
|
|
133
|
+
name
|
|
134
|
+
sku
|
|
135
|
+
price
|
|
136
|
+
currencyCode
|
|
137
|
+
priceWithTax
|
|
138
|
+
createdAt
|
|
139
|
+
updatedAt
|
|
140
|
+
options {
|
|
130
141
|
id
|
|
142
|
+
code
|
|
131
143
|
name
|
|
132
|
-
|
|
133
|
-
price
|
|
134
|
-
currencyCode
|
|
135
|
-
priceWithTax
|
|
136
|
-
createdAt
|
|
137
|
-
updatedAt
|
|
138
|
-
options {
|
|
139
|
-
id
|
|
140
|
-
code
|
|
141
|
-
name
|
|
142
|
-
groupId
|
|
143
|
-
}
|
|
144
|
+
groupId
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
);
|
|
148
|
+
}
|
|
149
|
+
`);
|
|
150
150
|
|
|
151
151
|
export const createProductDocument = graphql(`
|
|
152
152
|
mutation CreateProduct($input: CreateProductInput!) {
|