@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.
- package/README.md +4 -0
- package/dist/plugin/api/api-extensions.js +11 -14
- package/dist/plugin/api/metrics.resolver.d.ts +2 -2
- package/dist/plugin/api/metrics.resolver.js +2 -2
- package/dist/plugin/config/metrics-strategies.d.ts +9 -9
- package/dist/plugin/config/metrics-strategies.js +6 -6
- package/dist/plugin/constants.d.ts +2 -0
- package/dist/plugin/constants.js +3 -1
- package/dist/plugin/dashboard.plugin.js +13 -0
- package/dist/plugin/service/metrics.service.d.ts +3 -3
- package/dist/plugin/service/metrics.service.js +37 -53
- package/dist/plugin/types.d.ts +9 -12
- package/dist/plugin/types.js +7 -11
- 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 +10 -8
- 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 +10 -6
- package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +16 -5
- 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 +18 -6
- 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.graphql.ts +10 -0
- 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-group-badge.tsx +19 -0
- package/src/app/routes/_authenticated/_products/components/product-option-select.tsx +3 -3
- package/src/app/routes/_authenticated/_products/components/product-options-table.tsx +114 -0
- package/src/app/routes/_authenticated/_products/product-option-groups.graphql.ts +103 -0
- package/src/app/routes/_authenticated/_products/products.graphql.ts +44 -32
- package/src/app/routes/_authenticated/_products/products.tsx +34 -5
- package/src/app/routes/_authenticated/_products/products_.$id.tsx +29 -12
- package/src/app/routes/_authenticated/_products/products_.$id_.variants.tsx +11 -11
- package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$id.tsx +177 -0
- package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$productOptionGroupId.options_.$id.tsx +208 -0
- 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 +11 -11
- package/src/app/routes/_authenticated/_shipping-methods/components/test-order-builder.tsx +1 -1
- 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/components/zone-countries-sheet.tsx +4 -1
- 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 +46 -25
- 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-display/json.tsx +16 -1
- 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/index.ts +3 -0
- 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 +290 -0
- package/src/lib/components/data-table/add-filter-menu.tsx +17 -10
- package/src/lib/components/data-table/data-table-bulk-action-item.tsx +45 -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-context.tsx +91 -0
- package/src/lib/components/data-table/data-table-faceted-filter.tsx +2 -1
- package/src/lib/components/data-table/data-table-filter-badge.tsx +9 -5
- 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 +21 -10
- package/src/lib/components/data-table/data-table.tsx +146 -94
- package/src/lib/components/data-table/filters/data-table-boolean-filter.tsx +4 -4
- package/src/lib/components/data-table/global-views-bar.tsx +97 -0
- package/src/lib/components/data-table/global-views-sheet.tsx +11 -0
- package/src/lib/components/data-table/human-readable-operator.tsx +1 -1
- package/src/lib/components/data-table/manage-global-views-button.tsx +26 -0
- package/src/lib/components/data-table/my-views-button.tsx +47 -0
- package/src/lib/components/data-table/refresh-button.tsx +12 -3
- package/src/lib/components/data-table/save-view-button.tsx +41 -0
- package/src/lib/components/data-table/save-view-dialog.tsx +113 -0
- package/src/lib/components/data-table/use-generated-columns.tsx +13 -8
- package/src/lib/components/data-table/user-views-sheet.tsx +11 -0
- package/src/lib/components/data-table/views-sheet.tsx +305 -0
- package/src/lib/components/date-range-picker.tsx +186 -0
- 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 +64 -34
- 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/components/ui/button.tsx +1 -1
- package/src/lib/framework/dashboard-widget/base-widget.tsx +11 -9
- package/src/lib/framework/dashboard-widget/latest-orders-widget/index.tsx +35 -6
- package/src/lib/framework/dashboard-widget/metrics-widget/index.tsx +18 -12
- package/src/lib/framework/dashboard-widget/metrics-widget/metrics-widget.graphql.ts +9 -3
- package/src/lib/framework/dashboard-widget/orders-summary/index.tsx +26 -79
- package/src/lib/framework/dashboard-widget/widget-filters-context.tsx +35 -0
- package/src/lib/framework/defaults.ts +34 -63
- package/src/lib/framework/document-introspection/add-custom-fields.spec.ts +319 -9
- package/src/lib/framework/document-introspection/add-custom-fields.ts +60 -31
- package/src/lib/framework/document-introspection/get-document-structure.spec.ts +1 -159
- package/src/lib/framework/document-introspection/include-only-selected-list-fields.spec.ts +1840 -0
- package/src/lib/framework/document-introspection/include-only-selected-list-fields.ts +940 -0
- package/src/lib/framework/document-introspection/testing-utils.ts +161 -0
- package/src/lib/framework/extension-api/display-component-extensions.tsx +2 -0
- package/src/lib/framework/extension-api/types/data-table.ts +62 -4
- package/src/lib/framework/extension-api/types/navigation.ts +16 -0
- package/src/lib/framework/form-engine/utils.ts +34 -0
- 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/list-page.tsx +289 -4
- package/src/lib/framework/page/use-extended-router.tsx +101 -34
- package/src/lib/graphql/api.ts +6 -2
- package/src/lib/graphql/graphql-env.d.ts +38 -26
- 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 +6 -1
- package/src/lib/hooks/use-local-format.ts +15 -1
- package/src/lib/hooks/use-saved-views.ts +230 -0
- package/src/lib/hooks/use-ui-language-loader.ts +30 -0
- package/src/lib/index.ts +15 -0
- package/src/lib/lib/load-i18n-messages.ts +17 -0
- package/src/lib/lib/trans.tsx +15 -11
- package/src/lib/providers/i18n-provider.tsx +7 -14
- package/src/lib/types/saved-views.ts +39 -0
- package/src/lib/utils/saved-views-utils.ts +40 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { SlugInput } from '@/vdb/components/data-input/index.js';
|
|
2
|
+
import { ErrorPage } from '@/vdb/components/shared/error-page.js';
|
|
3
|
+
import { FormFieldWrapper } from '@/vdb/components/shared/form-field-wrapper.js';
|
|
4
|
+
import { PermissionGuard } from '@/vdb/components/shared/permission-guard.js';
|
|
5
|
+
import { TranslatableFormFieldWrapper } from '@/vdb/components/shared/translatable-form-field.js';
|
|
6
|
+
import { Button } from '@/vdb/components/ui/button.js';
|
|
7
|
+
import { Input } from '@/vdb/components/ui/input.js';
|
|
8
|
+
import { NEW_ENTITY_PATH } from '@/vdb/constants.js';
|
|
9
|
+
import { extendDetailFormQuery } from '@/vdb/framework/document-extension/extend-detail-form-query.js';
|
|
10
|
+
import { addCustomFields } from '@/vdb/framework/document-introspection/add-custom-fields.js';
|
|
11
|
+
import {
|
|
12
|
+
CustomFieldsPageBlock,
|
|
13
|
+
DetailFormGrid,
|
|
14
|
+
Page,
|
|
15
|
+
PageActionBar,
|
|
16
|
+
PageActionBarRight,
|
|
17
|
+
PageBlock,
|
|
18
|
+
PageLayout,
|
|
19
|
+
PageTitle,
|
|
20
|
+
} from '@/vdb/framework/layout-engine/page-layout.js';
|
|
21
|
+
import { getDetailQueryOptions, useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
22
|
+
import { api } from '@/vdb/graphql/api.js';
|
|
23
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
24
|
+
import { createFileRoute, ParsedLocation, useNavigate } from '@tanstack/react-router';
|
|
25
|
+
import { toast } from 'sonner';
|
|
26
|
+
import {
|
|
27
|
+
createProductOptionDocument,
|
|
28
|
+
productIdNameDocument,
|
|
29
|
+
productOptionDetailDocument,
|
|
30
|
+
productOptionGroupIdNameDocument,
|
|
31
|
+
updateProductOptionDocument,
|
|
32
|
+
} from './product-option-groups.graphql.js';
|
|
33
|
+
|
|
34
|
+
const pageId = 'product-option-detail';
|
|
35
|
+
|
|
36
|
+
export const Route = createFileRoute(
|
|
37
|
+
'/_authenticated/_products/products_/$productId/option-groups/$productOptionGroupId/options_/$id',
|
|
38
|
+
)({
|
|
39
|
+
component: ProductOptionDetailPage,
|
|
40
|
+
loader: async ({ context, params }: { context: any; params: any; location: ParsedLocation }) => {
|
|
41
|
+
if (!params.id) {
|
|
42
|
+
throw new Error('ID param is required');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const isNew = params.id === NEW_ENTITY_PATH;
|
|
46
|
+
let optionGroupName: string | undefined;
|
|
47
|
+
let optionGroupId = params.productOptionGroupId;
|
|
48
|
+
const { extendedQuery: extendedQueryDocument } = extendDetailFormQuery(
|
|
49
|
+
addCustomFields(productOptionDetailDocument),
|
|
50
|
+
pageId,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const result = isNew
|
|
54
|
+
? null
|
|
55
|
+
: await context.queryClient.ensureQueryData(
|
|
56
|
+
getDetailQueryOptions(extendedQueryDocument, { id: params.id }),
|
|
57
|
+
);
|
|
58
|
+
const productResult = await context.queryClient.fetchQuery({
|
|
59
|
+
queryKey: [pageId, 'productIdName', params.productId],
|
|
60
|
+
queryFn: () => api.query(productIdNameDocument, { id: params.productId }),
|
|
61
|
+
});
|
|
62
|
+
const entityName = 'ProductOption';
|
|
63
|
+
|
|
64
|
+
if (!result?.productOption && !isNew) {
|
|
65
|
+
throw new Error(`${entityName} with the ID ${params.id} was not found`);
|
|
66
|
+
}
|
|
67
|
+
if (isNew) {
|
|
68
|
+
const optionGroupResult = await context.queryClient.fetchQuery({
|
|
69
|
+
queryKey: [pageId, 'optionGroupIdName', optionGroupId],
|
|
70
|
+
queryFn: () => api.query(productOptionGroupIdNameDocument, { id: optionGroupId }),
|
|
71
|
+
});
|
|
72
|
+
optionGroupName = optionGroupResult.productOptionGroup?.name;
|
|
73
|
+
} else {
|
|
74
|
+
optionGroupName = result.productOption.group.name;
|
|
75
|
+
}
|
|
76
|
+
const productId = params.productId;
|
|
77
|
+
return {
|
|
78
|
+
breadcrumb: [
|
|
79
|
+
{ path: '/products', label: <Trans>Products</Trans> },
|
|
80
|
+
{ path: `/products/${productId}`, label: productResult.product.name },
|
|
81
|
+
{ path: `/products/${productId}`, label: <Trans>Option Groups</Trans> },
|
|
82
|
+
{
|
|
83
|
+
path: `/products/${productId}/option-groups/${optionGroupId}`,
|
|
84
|
+
label: optionGroupName,
|
|
85
|
+
},
|
|
86
|
+
isNew ? <Trans>New option</Trans> : result.productOption?.name,
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
errorComponent: ({ error }) => <ErrorPage message={error.message} />,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
function ProductOptionDetailPage() {
|
|
94
|
+
const params = Route.useParams();
|
|
95
|
+
const navigate = useNavigate();
|
|
96
|
+
const creatingNewEntity = params.id === NEW_ENTITY_PATH;
|
|
97
|
+
const { t } = useLingui();
|
|
98
|
+
|
|
99
|
+
const { form, submitHandler, entity, isPending, resetForm } = useDetailPage({
|
|
100
|
+
pageId,
|
|
101
|
+
queryDocument: productOptionDetailDocument,
|
|
102
|
+
createDocument: createProductOptionDocument,
|
|
103
|
+
updateDocument: updateProductOptionDocument,
|
|
104
|
+
setValuesForUpdate: entity => {
|
|
105
|
+
return {
|
|
106
|
+
id: entity.id,
|
|
107
|
+
code: entity.code,
|
|
108
|
+
name: entity.name,
|
|
109
|
+
translations: entity.translations.map(translation => ({
|
|
110
|
+
id: translation.id,
|
|
111
|
+
languageCode: translation.languageCode,
|
|
112
|
+
name: translation.name,
|
|
113
|
+
customFields: (translation as any).customFields,
|
|
114
|
+
})),
|
|
115
|
+
customFields: entity.customFields as any,
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
transformCreateInput: (value): any => {
|
|
119
|
+
return {
|
|
120
|
+
...value,
|
|
121
|
+
productOptionGroupId: params.productOptionGroupId,
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
params: { id: params.id },
|
|
125
|
+
onSuccess: async data => {
|
|
126
|
+
toast(
|
|
127
|
+
i18n.t(
|
|
128
|
+
creatingNewEntity
|
|
129
|
+
? 'Successfully created product option'
|
|
130
|
+
: 'Successfully updated product option',
|
|
131
|
+
),
|
|
132
|
+
);
|
|
133
|
+
resetForm();
|
|
134
|
+
const created = Array.isArray(data) ? data[0] : data;
|
|
135
|
+
if (creatingNewEntity && created) {
|
|
136
|
+
await navigate({ to: `../$id`, params: { id: (created as any).id } });
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
onError: err => {
|
|
140
|
+
toast(
|
|
141
|
+
i18n.t(
|
|
142
|
+
creatingNewEntity ? 'Failed to create product option' : 'Failed to update product option',
|
|
143
|
+
),
|
|
144
|
+
{
|
|
145
|
+
description: err instanceof Error ? err.message : 'Unknown error',
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<Page pageId={pageId} form={form} submitHandler={submitHandler} entity={entity}>
|
|
153
|
+
<PageTitle>
|
|
154
|
+
{creatingNewEntity ? <Trans>New product option</Trans> : ((entity as any)?.name ?? '')}
|
|
155
|
+
</PageTitle>
|
|
156
|
+
<PageActionBar>
|
|
157
|
+
<PageActionBarRight>
|
|
158
|
+
<PermissionGuard requires={['UpdateProduct', 'UpdateCatalog']}>
|
|
159
|
+
<Button
|
|
160
|
+
type="submit"
|
|
161
|
+
disabled={!form.formState.isDirty || !form.formState.isValid || isPending}
|
|
162
|
+
>
|
|
163
|
+
{creatingNewEntity ? <Trans>Create</Trans> : <Trans>Update</Trans>}
|
|
164
|
+
</Button>
|
|
165
|
+
</PermissionGuard>
|
|
166
|
+
</PageActionBarRight>
|
|
167
|
+
</PageActionBar>
|
|
168
|
+
<PageLayout>
|
|
169
|
+
<PageBlock column="side" blockId="option-group-info">
|
|
170
|
+
{entity?.group && (
|
|
171
|
+
<div className="space-y-2">
|
|
172
|
+
<div className="text-sm font-medium">
|
|
173
|
+
<Trans>Product Option Group</Trans>
|
|
174
|
+
</div>
|
|
175
|
+
<div className="text-sm text-muted-foreground">{entity?.group.name}</div>
|
|
176
|
+
<div className="text-xs text-muted-foreground">{entity?.group.code}</div>
|
|
177
|
+
</div>
|
|
178
|
+
)}
|
|
179
|
+
</PageBlock>
|
|
180
|
+
<PageBlock column="main" blockId="main-form">
|
|
181
|
+
<DetailFormGrid>
|
|
182
|
+
<TranslatableFormFieldWrapper
|
|
183
|
+
control={form.control}
|
|
184
|
+
name="name"
|
|
185
|
+
label={<Trans>Name</Trans>}
|
|
186
|
+
render={({ field }) => <Input {...field} />}
|
|
187
|
+
/>
|
|
188
|
+
<FormFieldWrapper
|
|
189
|
+
control={form.control}
|
|
190
|
+
name="code"
|
|
191
|
+
label={<Trans>Code</Trans>}
|
|
192
|
+
render={({ field }) => (
|
|
193
|
+
<SlugInput
|
|
194
|
+
fieldName="code"
|
|
195
|
+
watchFieldName="name"
|
|
196
|
+
entityName="ProductOption"
|
|
197
|
+
entityId={entity?.id}
|
|
198
|
+
{...field}
|
|
199
|
+
/>
|
|
200
|
+
)}
|
|
201
|
+
/>
|
|
202
|
+
</DetailFormGrid>
|
|
203
|
+
</PageBlock>
|
|
204
|
+
<CustomFieldsPageBlock column="main" entityType="ProductOption" control={form.control} />
|
|
205
|
+
</PageLayout>
|
|
206
|
+
</Page>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from '@/vdb/framework/layout-engine/page-layout.js';
|
|
15
15
|
import { useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
16
16
|
import { api } from '@/vdb/graphql/api.js';
|
|
17
|
-
import { Trans, useLingui } from '
|
|
17
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
18
18
|
import { createFileRoute } from '@tanstack/react-router';
|
|
19
19
|
import { toast } from 'sonner';
|
|
20
20
|
import { activeAdministratorDocument, updateAdministratorDocument } from './profile.graphql.js';
|
|
@@ -34,7 +34,7 @@ export const Route = createFileRoute('/_authenticated/_profile/profile')({
|
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
function ProfilePage() {
|
|
37
|
-
const {
|
|
37
|
+
const { t } = useLingui();
|
|
38
38
|
|
|
39
39
|
const { form, submitHandler, isPending } = useDetailPage({
|
|
40
40
|
queryDocument: activeAdministratorDocument,
|
|
@@ -58,11 +58,11 @@ function ProfilePage() {
|
|
|
58
58
|
},
|
|
59
59
|
params: { id: 'undefined' },
|
|
60
60
|
onSuccess: async data => {
|
|
61
|
-
toast(
|
|
61
|
+
toast(t`Successfully updated profile`);
|
|
62
62
|
form.reset(form.getValues());
|
|
63
63
|
},
|
|
64
64
|
onError: err => {
|
|
65
|
-
toast(
|
|
65
|
+
toast(t`Failed to update profile`, {
|
|
66
66
|
description: err instanceof Error ? err.message : 'Unknown error',
|
|
67
67
|
});
|
|
68
68
|
},
|
|
@@ -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 } from '@lingui/react/macro';
|
|
8
8
|
import { createFileRoute, Link } from '@tanstack/react-router';
|
|
9
9
|
import { PlusIcon } from 'lucide-react';
|
|
10
10
|
import {
|
|
@@ -26,7 +26,7 @@ function PromotionListPage() {
|
|
|
26
26
|
pageId="promotion-list"
|
|
27
27
|
listQuery={promotionListDocument}
|
|
28
28
|
route={Route}
|
|
29
|
-
title=
|
|
29
|
+
title={<Trans>Promotions</Trans>}
|
|
30
30
|
defaultVisibility={{
|
|
31
31
|
name: true,
|
|
32
32
|
couponCode: true,
|
|
@@ -42,11 +42,9 @@ function PromotionListPage() {
|
|
|
42
42
|
}}
|
|
43
43
|
customizeColumns={{
|
|
44
44
|
name: {
|
|
45
|
-
header: 'Name',
|
|
46
45
|
cell: ({ row }) => <DetailPageButton id={row.original.id} label={row.original.name} />,
|
|
47
46
|
},
|
|
48
47
|
enabled: {
|
|
49
|
-
header: 'Enabled',
|
|
50
48
|
cell: ({ row }) => <BooleanDisplayBadge value={row.original.enabled} />,
|
|
51
49
|
},
|
|
52
50
|
}}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from '@/vdb/framework/layout-engine/page-layout.js';
|
|
21
21
|
import { detailPageRouteLoader } from '@/vdb/framework/page/detail-page-route-loader.js';
|
|
22
22
|
import { useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
23
|
-
import { Trans, useLingui } from '
|
|
23
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
24
24
|
import { createFileRoute, useNavigate } from '@tanstack/react-router';
|
|
25
25
|
import { toast } from 'sonner';
|
|
26
26
|
import { PromotionActionsSelector } from './components/promotion-actions-selector.js';
|
|
@@ -52,7 +52,7 @@ function PromotionDetailPage() {
|
|
|
52
52
|
const params = Route.useParams();
|
|
53
53
|
const navigate = useNavigate();
|
|
54
54
|
const creatingNewEntity = params.id === NEW_ENTITY_PATH;
|
|
55
|
-
const {
|
|
55
|
+
const { t } = useLingui();
|
|
56
56
|
|
|
57
57
|
const { form, submitHandler, entity, isPending, resetForm } = useDetailPage({
|
|
58
58
|
pageId,
|
|
@@ -99,19 +99,24 @@ function PromotionDetailPage() {
|
|
|
99
99
|
params: { id: params.id },
|
|
100
100
|
onSuccess: async data => {
|
|
101
101
|
if (data.__typename === 'Promotion') {
|
|
102
|
-
toast.success(
|
|
102
|
+
toast.success(
|
|
103
|
+
creatingNewEntity ? t`Successfully created promotion` : t`Successfully updated promotion`,
|
|
104
|
+
);
|
|
103
105
|
resetForm();
|
|
104
106
|
if (creatingNewEntity) {
|
|
105
107
|
await navigate({ to: `../$id`, params: { id: data.id } });
|
|
106
108
|
}
|
|
107
109
|
} else {
|
|
108
|
-
toast.error(
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
toast.error(
|
|
111
|
+
creatingNewEntity ? t`Failed to create promotion` : t`Failed to update promotion`,
|
|
112
|
+
{
|
|
113
|
+
description: data.message,
|
|
114
|
+
},
|
|
115
|
+
);
|
|
111
116
|
}
|
|
112
117
|
},
|
|
113
118
|
onError: err => {
|
|
114
|
-
toast.error(
|
|
119
|
+
toast.error(creatingNewEntity ? t`Failed to create promotion` : t`Failed to update promotion`, {
|
|
115
120
|
description: err instanceof Error ? err.message : 'Unknown error',
|
|
116
121
|
});
|
|
117
122
|
},
|
|
@@ -169,8 +174,9 @@ function PromotionDetailPage() {
|
|
|
169
174
|
label={<Trans>Starts at</Trans>}
|
|
170
175
|
render={({ field }) => (
|
|
171
176
|
<DateTimeInput
|
|
177
|
+
{...field}
|
|
172
178
|
value={field.value}
|
|
173
|
-
onChange={value => field.onChange(value
|
|
179
|
+
onChange={value => field.onChange(value)}
|
|
174
180
|
/>
|
|
175
181
|
)}
|
|
176
182
|
/>
|
|
@@ -180,8 +186,9 @@ function PromotionDetailPage() {
|
|
|
180
186
|
label={<Trans>Ends at</Trans>}
|
|
181
187
|
render={({ field }) => (
|
|
182
188
|
<DateTimeInput
|
|
189
|
+
{...field}
|
|
183
190
|
value={field.value}
|
|
184
|
-
onChange={value => field.onChange(value
|
|
191
|
+
onChange={value => field.onChange(value)}
|
|
185
192
|
/>
|
|
186
193
|
)}
|
|
187
194
|
/>
|
|
@@ -3,8 +3,8 @@ import { Switch } from '@/vdb/components/ui/switch.js';
|
|
|
3
3
|
import { Table, TableBody, TableCell, TableRow } from '@/vdb/components/ui/table.js';
|
|
4
4
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/vdb/components/ui/tooltip.js';
|
|
5
5
|
import { useGroupedPermissions } from '@/vdb/hooks/use-grouped-permissions.js';
|
|
6
|
-
import { Trans, useLingui } from '@/vdb/lib/trans.js';
|
|
7
6
|
import { ServerConfig } from '@/vdb/providers/server-config.js';
|
|
7
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
8
8
|
import { InfoIcon } from 'lucide-react';
|
|
9
9
|
|
|
10
10
|
interface PermissionsTableGridProps {
|
|
@@ -7,7 +7,7 @@ import { Button } from '@/vdb/components/ui/button.js';
|
|
|
7
7
|
import { CUSTOMER_ROLE_CODE, SUPER_ADMIN_ROLE_CODE } from '@/vdb/constants.js';
|
|
8
8
|
import { PageActionBarRight } from '@/vdb/framework/layout-engine/page-layout.js';
|
|
9
9
|
import { ListPage } from '@/vdb/framework/page/list-page.js';
|
|
10
|
-
import { Trans } from '
|
|
10
|
+
import { Trans } from '@lingui/react/macro';
|
|
11
11
|
import { createFileRoute, Link } from '@tanstack/react-router';
|
|
12
12
|
import { LayersIcon, PlusIcon } from 'lucide-react';
|
|
13
13
|
import { ExpandablePermissions } from './components/expandable-permissions.js';
|
|
@@ -25,7 +25,7 @@ function RoleListPage() {
|
|
|
25
25
|
return (
|
|
26
26
|
<ListPage
|
|
27
27
|
pageId="role-list"
|
|
28
|
-
title=
|
|
28
|
+
title={<Trans>Roles</Trans>}
|
|
29
29
|
listQuery={roleListQuery}
|
|
30
30
|
route={Route}
|
|
31
31
|
defaultVisibility={{
|
|
@@ -36,7 +36,6 @@ function RoleListPage() {
|
|
|
36
36
|
}}
|
|
37
37
|
customizeColumns={{
|
|
38
38
|
code: {
|
|
39
|
-
header: 'Code',
|
|
40
39
|
cell: ({ row }) => {
|
|
41
40
|
return (
|
|
42
41
|
<DetailPageButton
|
|
@@ -48,7 +47,6 @@ function RoleListPage() {
|
|
|
48
47
|
},
|
|
49
48
|
},
|
|
50
49
|
permissions: {
|
|
51
|
-
header: 'Permissions',
|
|
52
50
|
cell: ({ row }) => {
|
|
53
51
|
if (SYSTEM_ROLES.includes(row.original.code)) {
|
|
54
52
|
return (
|
|
@@ -62,7 +60,6 @@ function RoleListPage() {
|
|
|
62
60
|
},
|
|
63
61
|
},
|
|
64
62
|
channels: {
|
|
65
|
-
header: 'Channels',
|
|
66
63
|
cell: ({ row }) => {
|
|
67
64
|
if (SYSTEM_ROLES.includes(row.original.code)) {
|
|
68
65
|
return null;
|
|
@@ -92,7 +89,7 @@ function RoleListPage() {
|
|
|
92
89
|
<Button asChild>
|
|
93
90
|
<Link to="./new">
|
|
94
91
|
<PlusIcon className="mr-2 h-4 w-4" />
|
|
95
|
-
New Role
|
|
92
|
+
<Trans>New Role</Trans>
|
|
96
93
|
</Link>
|
|
97
94
|
</Button>
|
|
98
95
|
</PermissionGuard>
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from '@/vdb/framework/layout-engine/page-layout.js';
|
|
17
17
|
import { detailPageRouteLoader } from '@/vdb/framework/page/detail-page-route-loader.js';
|
|
18
18
|
import { useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
19
|
-
import { Trans, useLingui } from '
|
|
19
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
20
20
|
import { createFileRoute, useNavigate } from '@tanstack/react-router';
|
|
21
21
|
import { toast } from 'sonner';
|
|
22
22
|
import { PermissionsTableGrid } from './components/permissions-table-grid.js';
|
|
@@ -43,7 +43,7 @@ function RoleDetailPage() {
|
|
|
43
43
|
const params = Route.useParams();
|
|
44
44
|
const navigate = useNavigate();
|
|
45
45
|
const creatingNewEntity = params.id === NEW_ENTITY_PATH;
|
|
46
|
-
const {
|
|
46
|
+
const { t } = useLingui();
|
|
47
47
|
|
|
48
48
|
const { form, submitHandler, entity, isPending, resetForm } = useDetailPage({
|
|
49
49
|
pageId,
|
|
@@ -61,16 +61,14 @@ function RoleDetailPage() {
|
|
|
61
61
|
},
|
|
62
62
|
params: { id: params.id },
|
|
63
63
|
onSuccess: async data => {
|
|
64
|
-
toast.success(
|
|
65
|
-
i18n.t(creatingNewEntity ? 'Successfully created role' : 'Successfully updated role'),
|
|
66
|
-
);
|
|
64
|
+
toast.success(creatingNewEntity ? t`Successfully created role` : t`Successfully updated role`);
|
|
67
65
|
resetForm();
|
|
68
66
|
if (creatingNewEntity) {
|
|
69
67
|
await navigate({ to: `../$id`, params: { id: data.id } });
|
|
70
68
|
}
|
|
71
69
|
},
|
|
72
70
|
onError: err => {
|
|
73
|
-
toast.error(
|
|
71
|
+
toast.error(creatingNewEntity ? t`Failed to create role` : t`Failed to update role`, {
|
|
74
72
|
description: err instanceof Error ? err.message : 'Unknown error',
|
|
75
73
|
});
|
|
76
74
|
},
|
|
@@ -3,7 +3,7 @@ import { PermissionGuard } from '@/vdb/components/shared/permission-guard.js';
|
|
|
3
3
|
import { Button } from '@/vdb/components/ui/button.js';
|
|
4
4
|
import { PageActionBarRight } from '@/vdb/framework/layout-engine/page-layout.js';
|
|
5
5
|
import { ListPage } from '@/vdb/framework/page/list-page.js';
|
|
6
|
-
import { Trans } from '
|
|
6
|
+
import { Trans } from '@lingui/react/macro';
|
|
7
7
|
import { createFileRoute, Link } from '@tanstack/react-router';
|
|
8
8
|
import { PlusIcon } from 'lucide-react';
|
|
9
9
|
import { DeleteSellersBulkAction } from './components/seller-bulk-actions.js';
|
|
@@ -20,7 +20,7 @@ function SellerListPage() {
|
|
|
20
20
|
pageId="seller-list"
|
|
21
21
|
listQuery={sellerListQuery}
|
|
22
22
|
route={Route}
|
|
23
|
-
title=
|
|
23
|
+
title={<Trans>Sellers</Trans>}
|
|
24
24
|
defaultVisibility={{
|
|
25
25
|
name: true,
|
|
26
26
|
}}
|
|
@@ -31,7 +31,6 @@ function SellerListPage() {
|
|
|
31
31
|
}}
|
|
32
32
|
customizeColumns={{
|
|
33
33
|
name: {
|
|
34
|
-
header: 'Name',
|
|
35
34
|
cell: ({ row }) => <DetailPageButton id={row.original.id} label={row.original.name} />,
|
|
36
35
|
},
|
|
37
36
|
}}
|
|
@@ -47,7 +46,7 @@ function SellerListPage() {
|
|
|
47
46
|
<Button asChild>
|
|
48
47
|
<Link to="./new">
|
|
49
48
|
<PlusIcon className="mr-2 h-4 w-4" />
|
|
50
|
-
New Seller
|
|
49
|
+
<Trans>New Seller</Trans>
|
|
51
50
|
</Link>
|
|
52
51
|
</Button>
|
|
53
52
|
</PermissionGuard>
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from '@/vdb/framework/layout-engine/page-layout.js';
|
|
16
16
|
import { detailPageRouteLoader } from '@/vdb/framework/page/detail-page-route-loader.js';
|
|
17
17
|
import { useDetailPage } from '@/vdb/framework/page/use-detail-page.js';
|
|
18
|
-
import { Trans, useLingui } from '
|
|
18
|
+
import { Trans, useLingui } from '@lingui/react/macro';
|
|
19
19
|
import { createFileRoute, useNavigate } from '@tanstack/react-router';
|
|
20
20
|
import { toast } from 'sonner';
|
|
21
21
|
import { createSellerDocument, sellerDetailDocument, updateSellerDocument } from './sellers.graphql.js';
|
|
@@ -39,7 +39,7 @@ function SellerDetailPage() {
|
|
|
39
39
|
const params = Route.useParams();
|
|
40
40
|
const navigate = useNavigate();
|
|
41
41
|
const creatingNewEntity = params.id === NEW_ENTITY_PATH;
|
|
42
|
-
const {
|
|
42
|
+
const { t } = useLingui();
|
|
43
43
|
|
|
44
44
|
const { form, submitHandler, entity, isPending, resetForm } = useDetailPage({
|
|
45
45
|
pageId,
|
|
@@ -55,14 +55,14 @@ function SellerDetailPage() {
|
|
|
55
55
|
},
|
|
56
56
|
params: { id: params.id },
|
|
57
57
|
onSuccess: async data => {
|
|
58
|
-
toast(
|
|
58
|
+
toast(creatingNewEntity ? t`Successfully created seller` : t`Successfully updated seller`);
|
|
59
59
|
form.reset(form.getValues());
|
|
60
60
|
if (creatingNewEntity) {
|
|
61
61
|
await navigate({ to: `../$id`, params: { id: data.id } });
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
onError: err => {
|
|
65
|
-
toast(
|
|
65
|
+
toast(creatingNewEntity ? t`Failed to create seller` : t`Failed to update seller`, {
|
|
66
66
|
description: err instanceof Error ? err.message : 'Unknown error',
|
|
67
67
|
});
|
|
68
68
|
},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Money } from '@/vdb/components/data-display/money.js';
|
|
2
|
-
import { Trans } from '
|
|
2
|
+
import { Trans } from '@lingui/react/macro';
|
|
3
3
|
|
|
4
4
|
export function PriceDisplay({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}: Readonly<{
|
|
5
|
+
price,
|
|
6
|
+
priceWithTax,
|
|
7
|
+
currencyCode,
|
|
8
|
+
}: Readonly<{
|
|
9
9
|
price: number;
|
|
10
10
|
priceWithTax: number;
|
|
11
11
|
currencyCode: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Alert, AlertDescription } from '@/vdb/components/ui/alert.js';
|
|
2
2
|
import { Button } from '@/vdb/components/ui/button.js';
|
|
3
3
|
import { Card, CardContent, CardHeader, CardTitle } from '@/vdb/components/ui/card.js';
|
|
4
|
-
import { Trans } from '
|
|
4
|
+
import { Trans } from '@lingui/react/macro';
|
|
5
5
|
import { PlayIcon } from 'lucide-react';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
@@ -5,7 +5,7 @@ import { Input } from '@/vdb/components/ui/input.js';
|
|
|
5
5
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/vdb/components/ui/select.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 { useQuery } from '@tanstack/react-query';
|
|
10
10
|
import { useEffect, useRef } from 'react';
|
|
11
11
|
import { useForm } from 'react-hook-form';
|
|
@@ -47,16 +47,16 @@ export function TestAddressForm({ onAddressChange }: Readonly<TestAddressFormPro
|
|
|
47
47
|
return stored
|
|
48
48
|
? JSON.parse(stored)
|
|
49
49
|
: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
fullName: '',
|
|
51
|
+
company: '',
|
|
52
|
+
streetLine1: '',
|
|
53
|
+
streetLine2: '',
|
|
54
|
+
city: '',
|
|
55
|
+
province: '',
|
|
56
|
+
postalCode: '',
|
|
57
|
+
countryCode: '',
|
|
58
|
+
phoneNumber: '',
|
|
59
|
+
};
|
|
60
60
|
} catch {
|
|
61
61
|
return {
|
|
62
62
|
fullName: '',
|
|
@@ -9,7 +9,7 @@ import { Input } from '@/vdb/components/ui/input.js';
|
|
|
9
9
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/vdb/components/ui/table.js';
|
|
10
10
|
import { useChannel } from '@/vdb/hooks/use-channel.js';
|
|
11
11
|
import { useLocalFormat } from '@/vdb/hooks/use-local-format.js';
|
|
12
|
-
import { Trans } from '
|
|
12
|
+
import { Trans } from '@lingui/react/macro';
|
|
13
13
|
import {
|
|
14
14
|
ColumnDef,
|
|
15
15
|
flexRender,
|
package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-methods-result.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Badge } from '@/vdb/components/ui/badge.js';
|
|
2
2
|
import { useChannel } from '@/vdb/hooks/use-channel.js';
|
|
3
|
-
import { Trans } from '
|
|
3
|
+
import { Trans } from '@lingui/react/macro';
|
|
4
4
|
import { Check } from 'lucide-react';
|
|
5
5
|
import { MetadataBadges } from './metadata-badges.js';
|
|
6
6
|
import { PriceDisplay } from './price-display.js';
|
|
@@ -26,13 +26,13 @@ interface ShippingEligibilityTestResultProps {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export function TestShippingMethodsResult({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}: Readonly<ShippingEligibilityTestResultProps>) {
|
|
29
|
+
testResult,
|
|
30
|
+
okToRun,
|
|
31
|
+
testDataUpdated,
|
|
32
|
+
hasTestedOnce,
|
|
33
|
+
onRunTest,
|
|
34
|
+
loading = false,
|
|
35
|
+
}: Readonly<ShippingEligibilityTestResultProps>) {
|
|
36
36
|
const { activeChannel } = useChannel();
|
|
37
37
|
const currencyCode = activeChannel?.defaultCurrencyCode ?? 'USD';
|
|
38
38
|
const hasResults = testResult && testResult.length > 0;
|
package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-methods-sheet.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
SheetTitle,
|
|
8
8
|
SheetTrigger,
|
|
9
9
|
} from '@/vdb/components/ui/sheet.js';
|
|
10
|
-
import { Trans } from '
|
|
10
|
+
import { Trans } from '@lingui/react/macro';
|
|
11
11
|
import { FlaskConical } from 'lucide-react';
|
|
12
12
|
import { useState } from 'react';
|
|
13
13
|
import { TestShippingMethods } from './test-shipping-methods.js';
|
package/src/app/routes/_authenticated/_shipping-methods/components/test-single-method-result.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useChannel } from '@/vdb/hooks/use-channel.js';
|
|
2
|
-
import { Trans } from '
|
|
2
|
+
import { Trans } from '@lingui/react/macro';
|
|
3
3
|
import { ResultOf } from 'gql.tada';
|
|
4
4
|
import { Check } from 'lucide-react';
|
|
5
5
|
import { testShippingMethodDocument } from '../shipping-methods.graphql.js';
|
|
@@ -19,13 +19,13 @@ interface TestSingleMethodResultProps {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export function TestSingleMethodResult({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}: Readonly<TestSingleMethodResultProps>) {
|
|
22
|
+
testResult,
|
|
23
|
+
okToRun,
|
|
24
|
+
testDataUpdated,
|
|
25
|
+
hasTestedOnce,
|
|
26
|
+
onRunTest,
|
|
27
|
+
loading = false,
|
|
28
|
+
}: Readonly<TestSingleMethodResultProps>) {
|
|
29
29
|
const { activeChannel } = useChannel();
|
|
30
30
|
const currencyCode = activeChannel?.defaultCurrencyCode ?? 'USD';
|
|
31
31
|
const showEmptyState = testResult === undefined && hasTestedOnce && !testDataUpdated && !loading;
|