@vendure/dashboard 3.2.0
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 +13 -0
- package/dist/plugin/.vendure-dashboard-temp/dev-config.js +227 -0
- package/dist/plugin/.vendure-dashboard-temp/dev-config.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/api/api-extensions.js +33 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/api/api-extensions.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/api/mv.resolver.js +69 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/api/mv.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-order-process.js +110 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-order-process.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-order-seller-strategy.js +134 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-order-seller-strategy.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-payment-handler.js +86 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-payment-handler.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-shipping-eligibility-checker.js +49 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-shipping-eligibility-checker.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-shipping-line-assignment-strategy.js +57 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-shipping-line-assignment-strategy.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/constants.js +20 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/constants.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/multivendor.plugin.js +151 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/multivendor.plugin.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/payment/mv-connect-sdk.js +47 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/payment/mv-connect-sdk.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/service/mv.service.js +222 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/service/mv.service.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/types.js +4 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/types.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/package.json +3 -0
- package/dist/plugin/.vendure-dashboard-temp/schema.graphql +6378 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/api-extensions.js +103 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/api-extensions.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-entity.resolver.js +105 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-entity.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-admin.resolver.js +183 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-admin.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-entity.resolver.js +113 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-entity.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-shop.resolver.js +112 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-shop.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/entities/product-review.entity.js +111 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/entities/product-review.entity.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/generated-admin-types.js +616 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/generated-admin-types.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/generated-shop-types.js +563 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/generated-shop-types.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/reviews-plugin.js +135 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/reviews-plugin.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/types.js +4 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/types.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/tsconfig.json +10 -0
- package/dist/plugin/config-loader.d.ts +27 -0
- package/dist/plugin/config-loader.js +141 -0
- package/dist/plugin/constants.d.ts +5 -0
- package/dist/plugin/constants.js +277 -0
- package/dist/plugin/index.d.ts +1 -0
- package/dist/plugin/index.js +1 -0
- package/dist/plugin/schema-generator.d.ts +5 -0
- package/dist/plugin/schema-generator.js +24 -0
- package/dist/plugin/ui-config.d.ts +3 -0
- package/dist/plugin/ui-config.js +35 -0
- package/dist/plugin/vite-plugin-admin-api-schema.d.ts +24 -0
- package/dist/plugin/vite-plugin-admin-api-schema.js +82 -0
- package/dist/plugin/vite-plugin-config-loader.d.ts +17 -0
- package/dist/plugin/vite-plugin-config-loader.js +56 -0
- package/dist/plugin/vite-plugin-config.d.ts +4 -0
- package/dist/plugin/vite-plugin-config.js +38 -0
- package/dist/plugin/vite-plugin-dashboard-metadata.d.ts +9 -0
- package/dist/plugin/vite-plugin-dashboard-metadata.js +52 -0
- package/dist/plugin/vite-plugin-gql-tada.d.ts +6 -0
- package/dist/plugin/vite-plugin-gql-tada.js +51 -0
- package/dist/plugin/vite-plugin-set-root.d.ts +4 -0
- package/dist/plugin/vite-plugin-set-root.js +15 -0
- package/dist/plugin/vite-plugin-ui-config.d.ts +15 -0
- package/dist/plugin/vite-plugin-ui-config.js +43 -0
- package/dist/plugin/vite-plugin-vendure-dashboard.d.ts +35 -0
- package/dist/plugin/vite-plugin-vendure-dashboard.js +81 -0
- package/index.html +15 -0
- package/lingui.config.js +12 -0
- package/package.json +118 -0
- package/src/app/app-providers.tsx +30 -0
- package/src/app/main.tsx +97 -0
- package/src/app/routeTree.gen.ts +1372 -0
- package/src/app/routes/__root.tsx +24 -0
- package/src/app/routes/_authenticated/_administrators/administrators.graphql.ts +79 -0
- package/src/app/routes/_authenticated/_administrators/administrators.tsx +86 -0
- package/src/app/routes/_authenticated/_administrators/administrators_.$id.tsx +155 -0
- package/src/app/routes/_authenticated/_administrators/components/role-permissions-display.tsx +133 -0
- package/src/app/routes/_authenticated/_assets/assets.tsx +19 -0
- package/src/app/routes/_authenticated/_channels/channels.graphql.ts +93 -0
- package/src/app/routes/_authenticated/_channels/channels.tsx +60 -0
- package/src/app/routes/_authenticated/_channels/channels_.$id.tsx +248 -0
- package/src/app/routes/_authenticated/_collections/collections.graphql.ts +133 -0
- package/src/app/routes/_authenticated/_collections/collections.tsx +195 -0
- package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +224 -0
- package/src/app/routes/_authenticated/_collections/components/collection-contents-preview-table.tsx +127 -0
- package/src/app/routes/_authenticated/_collections/components/collection-contents-sheet.tsx +46 -0
- package/src/app/routes/_authenticated/_collections/components/collection-contents-table.tsx +82 -0
- package/src/app/routes/_authenticated/_collections/components/collection-filters-selector.tsx +91 -0
- package/src/app/routes/_authenticated/_countries/countries.graphql.ts +69 -0
- package/src/app/routes/_authenticated/_countries/countries.tsx +67 -0
- package/src/app/routes/_authenticated/_countries/countries_.$id.tsx +122 -0
- package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-sheet.tsx +44 -0
- package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-table.tsx +129 -0
- package/src/app/routes/_authenticated/_customer-groups/customer-groups.graphql.ts +71 -0
- package/src/app/routes/_authenticated/_customer-groups/customer-groups.tsx +68 -0
- package/src/app/routes/_authenticated/_customer-groups/customer-groups_.$id.tsx +111 -0
- package/src/app/routes/_authenticated/_customers/components/customer-address-card.tsx +155 -0
- package/src/app/routes/_authenticated/_customers/components/customer-address-form.tsx +344 -0
- package/src/app/routes/_authenticated/_customers/components/customer-group-controls.tsx +4 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-container.tsx +78 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history.tsx +77 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/index.ts +3 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/use-customer-history.ts +169 -0
- package/src/app/routes/_authenticated/_customers/components/customer-order-table.tsx +88 -0
- package/src/app/routes/_authenticated/_customers/components/customer-status-badge.tsx +33 -0
- package/src/app/routes/_authenticated/_customers/customers.graphql.ts +204 -0
- package/src/app/routes/_authenticated/_customers/customers.tsx +82 -0
- package/src/app/routes/_authenticated/_customers/customers_.$id.tsx +274 -0
- package/src/app/routes/_authenticated/_facets/components/edit-facet-value.tsx +129 -0
- package/src/app/routes/_authenticated/_facets/components/facet-values-sheet.tsx +46 -0
- package/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx +97 -0
- package/src/app/routes/_authenticated/_facets/facets.graphql.ts +104 -0
- package/src/app/routes/_authenticated/_facets/facets.tsx +97 -0
- package/src/app/routes/_authenticated/_facets/facets_.$id.tsx +139 -0
- package/src/app/routes/_authenticated/_global-settings/global-settings.graphql.ts +28 -0
- package/src/app/routes/_authenticated/_global-settings/global-settings.tsx +161 -0
- package/src/app/routes/_authenticated/_orders/components/order-address.tsx +58 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/index.ts +3 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/order-history-container.tsx +73 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/order-history.tsx +96 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/use-order-history.ts +171 -0
- package/src/app/routes/_authenticated/_orders/components/order-table.tsx +169 -0
- package/src/app/routes/_authenticated/_orders/components/order-tax-summary.tsx +39 -0
- package/src/app/routes/_authenticated/_orders/components/payment-details.tsx +61 -0
- package/src/app/routes/_authenticated/_orders/orders.graphql.ts +325 -0
- package/src/app/routes/_authenticated/_orders/orders.tsx +120 -0
- package/src/app/routes/_authenticated/_orders/orders_.$id.tsx +133 -0
- package/src/app/routes/_authenticated/_payment-methods/components/payment-eligibility-checker-selector.tsx +104 -0
- package/src/app/routes/_authenticated/_payment-methods/components/payment-handler-selector.tsx +100 -0
- package/src/app/routes/_authenticated/_payment-methods/payment-methods.graphql.ts +83 -0
- package/src/app/routes/_authenticated/_payment-methods/payment-methods.tsx +64 -0
- package/src/app/routes/_authenticated/_payment-methods/payment-methods_.$id.tsx +183 -0
- package/src/app/routes/_authenticated/_product-variants/components/variant-price-detail.tsx +87 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants.graphql.ts +123 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants.tsx +78 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +331 -0
- package/src/app/routes/_authenticated/_products/components/create-product-variants-dialog.tsx +228 -0
- package/src/app/routes/_authenticated/_products/components/create-product-variants.tsx +462 -0
- package/src/app/routes/_authenticated/_products/components/option-value-input.tsx +96 -0
- package/src/app/routes/_authenticated/_products/components/product-variants-table.tsx +87 -0
- package/src/app/routes/_authenticated/_products/products.graphql.ts +116 -0
- package/src/app/routes/_authenticated/_products/products.tsx +48 -0
- package/src/app/routes/_authenticated/_products/products_.$id.tsx +196 -0
- package/src/app/routes/_authenticated/_profile/profile.graphql.ts +23 -0
- package/src/app/routes/_authenticated/_profile/profile.tsx +122 -0
- package/src/app/routes/_authenticated/_promotions/components/promotion-actions-selector.tsx +107 -0
- package/src/app/routes/_authenticated/_promotions/components/promotion-conditions-selector.tsx +107 -0
- package/src/app/routes/_authenticated/_promotions/promotions.graphql.ts +96 -0
- package/src/app/routes/_authenticated/_promotions/promotions.tsx +61 -0
- package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +235 -0
- package/src/app/routes/_authenticated/_roles/components/expandable-permissions.tsx +54 -0
- package/src/app/routes/_authenticated/_roles/components/permissions-grid.tsx +116 -0
- package/src/app/routes/_authenticated/_roles/roles.graphql.ts +67 -0
- package/src/app/routes/_authenticated/_roles/roles.tsx +96 -0
- package/src/app/routes/_authenticated/_roles/roles_.$id.tsx +142 -0
- package/src/app/routes/_authenticated/_sellers/sellers.graphql.ts +61 -0
- package/src/app/routes/_authenticated/_sellers/sellers.tsx +51 -0
- package/src/app/routes/_authenticated/_sellers/sellers_.$id.tsx +111 -0
- package/src/app/routes/_authenticated/_shipping-methods/components/fulfillment-handler-selector.tsx +56 -0
- package/src/app/routes/_authenticated/_shipping-methods/components/shipping-calculator-selector.tsx +101 -0
- package/src/app/routes/_authenticated/_shipping-methods/components/shipping-eligibility-checker-selector.tsx +101 -0
- package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-method-dialog.tsx +32 -0
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.graphql.ts +83 -0
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.tsx +55 -0
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx +171 -0
- package/src/app/routes/_authenticated/_stock-locations/stock-locations.graphql.ts +62 -0
- package/src/app/routes/_authenticated/_stock-locations/stock-locations.tsx +48 -0
- package/src/app/routes/_authenticated/_stock-locations/stock-locations_.$id.tsx +115 -0
- package/src/app/routes/_authenticated/_system/components/payload-dialog.tsx +34 -0
- package/src/app/routes/_authenticated/_system/healthchecks.tsx +93 -0
- package/src/app/routes/_authenticated/_system/job-queue.graphql.ts +43 -0
- package/src/app/routes/_authenticated/_system/job-queue.tsx +161 -0
- package/src/app/routes/_authenticated/_tax-categories/tax-categories.graphql.ts +63 -0
- package/src/app/routes/_authenticated/_tax-categories/tax-categories.tsx +65 -0
- package/src/app/routes/_authenticated/_tax-categories/tax-categories_.$id.tsx +115 -0
- package/src/app/routes/_authenticated/_tax-rates/tax-rates.graphql.ts +75 -0
- package/src/app/routes/_authenticated/_tax-rates/tax-rates.tsx +108 -0
- package/src/app/routes/_authenticated/_tax-rates/tax-rates_.$id.tsx +148 -0
- package/src/app/routes/_authenticated/_zones/components/zone-countries-add.tsx +0 -0
- package/src/app/routes/_authenticated/_zones/components/zone-countries-sheet.tsx +31 -0
- package/src/app/routes/_authenticated/_zones/components/zone-countries-table.tsx +79 -0
- package/src/app/routes/_authenticated/_zones/zones.graphql.ts +96 -0
- package/src/app/routes/_authenticated/_zones/zones.tsx +57 -0
- package/src/app/routes/_authenticated/_zones/zones_.$id.tsx +103 -0
- package/src/app/routes/_authenticated/index.tsx +194 -0
- package/src/app/routes/_authenticated.tsx +25 -0
- package/src/app/routes/login.tsx +48 -0
- package/src/app/styles.css +82 -0
- package/src/app/tailwindcss-animate.css +275 -0
- package/src/i18n/locales/de.po +1579 -0
- package/src/i18n/locales/en.po +1579 -0
- package/src/lib/components/data-display/boolean.tsx +23 -0
- package/src/lib/components/data-display/date-time.tsx +13 -0
- package/src/lib/components/data-display/json.tsx +5 -0
- package/src/lib/components/data-display/money.tsx +15 -0
- package/src/lib/components/data-input/affixed-input.tsx +49 -0
- package/src/lib/components/data-input/customer-group-input.tsx +72 -0
- package/src/lib/components/data-input/datetime-input.tsx +150 -0
- package/src/lib/components/data-input/facet-value-input.tsx +68 -0
- package/src/lib/components/data-input/money-input.tsx +112 -0
- package/src/lib/components/data-input/richt-text-input.tsx +99 -0
- package/src/lib/components/data-table/data-table-column-header.tsx +73 -0
- package/src/lib/components/data-table/data-table-faceted-filter.tsx +172 -0
- package/src/lib/components/data-table/data-table-filter-dialog.tsx +73 -0
- package/src/lib/components/data-table/data-table-pagination.tsx +87 -0
- package/src/lib/components/data-table/data-table-view-options.tsx +53 -0
- package/src/lib/components/data-table/data-table.tsx +218 -0
- package/src/lib/components/layout/app-layout.tsx +42 -0
- package/src/lib/components/layout/app-sidebar.tsx +34 -0
- package/src/lib/components/layout/channel-switcher.tsx +87 -0
- package/src/lib/components/layout/content-language-selector.tsx +41 -0
- package/src/lib/components/layout/generated-breadcrumbs.tsx +82 -0
- package/src/lib/components/layout/language-dialog.tsx +104 -0
- package/src/lib/components/layout/nav-main.tsx +178 -0
- package/src/lib/components/layout/nav-projects.tsx +81 -0
- package/src/lib/components/layout/nav-user.tsx +176 -0
- package/src/lib/components/layout/prerelease-popup.tsx +38 -0
- package/src/lib/components/login/login-form.tsx +173 -0
- package/src/lib/components/shared/alerts.tsx +20 -0
- package/src/lib/components/shared/animated-number.tsx +49 -0
- package/src/lib/components/shared/asset-gallery.tsx +433 -0
- package/src/lib/components/shared/asset-picker-dialog.tsx +72 -0
- package/src/lib/components/shared/asset-preview-dialog.tsx +48 -0
- package/src/lib/components/shared/asset-preview.tsx +345 -0
- package/src/lib/components/shared/assigned-facet-values.tsx +68 -0
- package/src/lib/components/shared/channel-code-label.tsx +7 -0
- package/src/lib/components/shared/channel-selector.tsx +51 -0
- package/src/lib/components/shared/configurable-operation-arg-input.tsx +51 -0
- package/src/lib/components/shared/configurable-operation-input.tsx +133 -0
- package/src/lib/components/shared/confirmation-dialog.tsx +58 -0
- package/src/lib/components/shared/copyable-text.tsx +31 -0
- package/src/lib/components/shared/country-selector.tsx +105 -0
- package/src/lib/components/shared/currency-selector.tsx +33 -0
- package/src/lib/components/shared/custom-fields-form.tsx +86 -0
- package/src/lib/components/shared/customer-address-form.tsx +330 -0
- package/src/lib/components/shared/customer-group-chip.tsx +30 -0
- package/src/lib/components/shared/customer-group-selector.tsx +62 -0
- package/src/lib/components/shared/customer-selector.tsx +107 -0
- package/src/lib/components/shared/detail-page-button.tsx +22 -0
- package/src/lib/components/shared/entity-assets.tsx +340 -0
- package/src/lib/components/shared/error-page.tsx +31 -0
- package/src/lib/components/shared/facet-value-chip.tsx +45 -0
- package/src/lib/components/shared/facet-value-selector.tsx +306 -0
- package/src/lib/components/shared/focal-point-control.tsx +65 -0
- package/src/lib/components/shared/form-field-wrapper.tsx +37 -0
- package/src/lib/components/shared/history-timeline/history-entry.tsx +112 -0
- package/src/lib/components/shared/history-timeline/history-note-checkbox.tsx +28 -0
- package/src/lib/components/shared/history-timeline/history-note-editor.tsx +60 -0
- package/src/lib/components/shared/history-timeline/history-note-input.tsx +39 -0
- package/src/lib/components/shared/history-timeline/history-timeline.tsx +56 -0
- package/src/lib/components/shared/icon-mark.tsx +18 -0
- package/src/lib/components/shared/language-selector.tsx +48 -0
- package/src/lib/components/shared/logo-mark.tsx +24 -0
- package/src/lib/components/shared/multi-select.tsx +159 -0
- package/src/lib/components/shared/option-value-input.tsx +95 -0
- package/src/lib/components/shared/paginated-list-data-table.tsx +520 -0
- package/src/lib/components/shared/permission-guard.tsx +21 -0
- package/src/lib/components/shared/rich-text-editor.tsx +0 -0
- package/src/lib/components/shared/role-code-label.tsx +8 -0
- package/src/lib/components/shared/role-selector.tsx +56 -0
- package/src/lib/components/shared/seller-selector.tsx +107 -0
- package/src/lib/components/shared/tax-category-selector.tsx +65 -0
- package/src/lib/components/shared/translatable-form-field.tsx +74 -0
- package/src/lib/components/shared/vendure-image.tsx +159 -0
- package/src/lib/components/shared/zone-selector.tsx +66 -0
- package/src/lib/components/ui/accordion.tsx +59 -0
- package/src/lib/components/ui/alert-dialog.tsx +128 -0
- package/src/lib/components/ui/alert.tsx +60 -0
- package/src/lib/components/ui/avatar.tsx +38 -0
- package/src/lib/components/ui/badge.tsx +38 -0
- package/src/lib/components/ui/breadcrumb.tsx +102 -0
- package/src/lib/components/ui/button.tsx +51 -0
- package/src/lib/components/ui/calendar.tsx +69 -0
- package/src/lib/components/ui/card.tsx +47 -0
- package/src/lib/components/ui/checkbox.tsx +27 -0
- package/src/lib/components/ui/collapsible.tsx +33 -0
- package/src/lib/components/ui/command.tsx +133 -0
- package/src/lib/components/ui/dialog.tsx +116 -0
- package/src/lib/components/ui/dropdown-menu.tsx +220 -0
- package/src/lib/components/ui/form.tsx +141 -0
- package/src/lib/components/ui/hover-card.tsx +36 -0
- package/src/lib/components/ui/input.tsx +19 -0
- package/src/lib/components/ui/label.tsx +21 -0
- package/src/lib/components/ui/pagination.tsx +127 -0
- package/src/lib/components/ui/popover.tsx +40 -0
- package/src/lib/components/ui/scroll-area.tsx +50 -0
- package/src/lib/components/ui/select.tsx +161 -0
- package/src/lib/components/ui/separator.tsx +26 -0
- package/src/lib/components/ui/sheet.tsx +118 -0
- package/src/lib/components/ui/sidebar.tsx +696 -0
- package/src/lib/components/ui/skeleton.tsx +13 -0
- package/src/lib/components/ui/sonner.tsx +27 -0
- package/src/lib/components/ui/switch.tsx +26 -0
- package/src/lib/components/ui/table.tsx +82 -0
- package/src/lib/components/ui/tabs.tsx +48 -0
- package/src/lib/components/ui/textarea.tsx +18 -0
- package/src/lib/components/ui/tooltip.tsx +51 -0
- package/src/lib/constants.ts +326 -0
- package/src/lib/framework/component-registry/component-registry.tsx +70 -0
- package/src/lib/framework/component-registry/dynamic-component.tsx +58 -0
- package/src/lib/framework/dashboard-widget/base-widget.tsx +97 -0
- package/src/lib/framework/dashboard-widget/latest-orders-widget/index.tsx +96 -0
- package/src/lib/framework/dashboard-widget/latest-orders-widget/latest-orders-widget.graphql.ts +35 -0
- package/src/lib/framework/dashboard-widget/metrics-widget/chart.tsx +24 -0
- package/src/lib/framework/dashboard-widget/metrics-widget/index.tsx +82 -0
- package/src/lib/framework/dashboard-widget/metrics-widget/metrics-widget.graphql.ts +14 -0
- package/src/lib/framework/dashboard-widget/orders-summary/index.tsx +167 -0
- package/src/lib/framework/dashboard-widget/orders-summary/order-summary-widget.graphql.ts +14 -0
- package/src/lib/framework/dashboard-widget/types.ts +22 -0
- package/src/lib/framework/dashboard-widget/widget-extensions.tsx +19 -0
- package/src/lib/framework/defaults.ts +219 -0
- package/src/lib/framework/document-introspection/add-custom-fields.spec.ts +242 -0
- package/src/lib/framework/document-introspection/add-custom-fields.ts +246 -0
- package/src/lib/framework/document-introspection/get-document-structure.spec.ts +310 -0
- package/src/lib/framework/document-introspection/get-document-structure.ts +460 -0
- package/src/lib/framework/document-introspection/hooks.ts +10 -0
- package/src/lib/framework/extension-api/define-dashboard-extension.ts +66 -0
- package/src/lib/framework/extension-api/extension-api-types.ts +58 -0
- package/src/lib/framework/extension-api/use-dashboard-extensions.ts +26 -0
- package/src/lib/framework/form-engine/form-schema-tools.ts +98 -0
- package/src/lib/framework/form-engine/use-generated-form.tsx +116 -0
- package/src/lib/framework/layout-engine/layout-extensions.ts +30 -0
- package/src/lib/framework/layout-engine/location-wrapper.tsx +96 -0
- package/src/lib/framework/layout-engine/page-layout.tsx +272 -0
- package/src/lib/framework/nav-menu/nav-menu-extensions.ts +66 -0
- package/src/lib/framework/page/detail-page-route-loader.tsx +48 -0
- package/src/lib/framework/page/detail-page.tsx +131 -0
- package/src/lib/framework/page/list-page.tsx +166 -0
- package/src/lib/framework/page/page-api.ts +9 -0
- package/src/lib/framework/page/page-types.ts +51 -0
- package/src/lib/framework/page/use-detail-page.ts +217 -0
- package/src/lib/framework/page/use-extended-router.tsx +69 -0
- package/src/lib/framework/registry/global-registry.ts +46 -0
- package/src/lib/framework/registry/registry-types.ts +15 -0
- package/src/lib/graphql/api.ts +61 -0
- package/src/lib/graphql/fragments.tsx +54 -0
- package/src/lib/graphql/graphql-env.d.ts +499 -0
- package/src/lib/graphql/graphql.ts +15 -0
- package/src/lib/hooks/use-auth.tsx +11 -0
- package/src/lib/hooks/use-channel.ts +12 -0
- package/src/lib/hooks/use-custom-field-config.ts +10 -0
- package/src/lib/hooks/use-grouped-permissions.ts +54 -0
- package/src/lib/hooks/use-local-format.ts +119 -0
- package/src/lib/hooks/use-mobile.ts +19 -0
- package/src/lib/hooks/use-page.tsx +11 -0
- package/src/lib/hooks/use-permissions.ts +22 -0
- package/src/lib/hooks/use-server-config.ts +4 -0
- package/src/lib/hooks/use-theme.ts +10 -0
- package/src/lib/hooks/use-user-settings.tsx +12 -0
- package/src/lib/index.ts +149 -0
- package/src/lib/lib/trans.tsx +16 -0
- package/src/lib/lib/utils.ts +60 -0
- package/src/lib/providers/auth.tsx +152 -0
- package/src/lib/providers/channel-provider.tsx +121 -0
- package/src/lib/providers/i18n-provider.tsx +28 -0
- package/src/lib/providers/server-config.tsx +279 -0
- package/src/lib/providers/theme-provider.tsx +54 -0
- package/src/lib/providers/user-settings.tsx +89 -0
- package/src/lib/virtual.d.ts +12 -0
- package/vite/config-loader.ts +181 -0
- package/vite/constants.ts +280 -0
- package/vite/index.ts +1 -0
- package/vite/schema-generator.ts +40 -0
- package/vite/ui-config.ts +60 -0
- package/vite/vite-plugin-admin-api-schema.ts +141 -0
- package/vite/vite-plugin-config-loader.ts +64 -0
- package/vite/vite-plugin-config.ts +42 -0
- package/vite/vite-plugin-dashboard-metadata.ts +58 -0
- package/vite/vite-plugin-gql-tada.ts +62 -0
- package/vite/vite-plugin-theme.ts +195 -0
- package/vite/vite-plugin-ui-config.ts +60 -0
- package/vite/vite-plugin-vendure-dashboard.ts +118 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { CustomerGroupChip } from '@/components/shared/customer-group-chip.js';
|
|
2
|
+
import { CustomerGroupSelector } from '@/components/shared/customer-group-selector.js';
|
|
3
|
+
import { ErrorPage } from '@/components/shared/error-page.js';
|
|
4
|
+
import { FormFieldWrapper } from '@/components/shared/form-field-wrapper.js';
|
|
5
|
+
import { PermissionGuard } from '@/components/shared/permission-guard.js';
|
|
6
|
+
import { Button } from '@/components/ui/button.js';
|
|
7
|
+
import {
|
|
8
|
+
Dialog,
|
|
9
|
+
DialogContent,
|
|
10
|
+
DialogDescription,
|
|
11
|
+
DialogHeader,
|
|
12
|
+
DialogTitle,
|
|
13
|
+
DialogTrigger,
|
|
14
|
+
} from '@/components/ui/dialog.js';
|
|
15
|
+
import { Input } from '@/components/ui/input.js';
|
|
16
|
+
import { NEW_ENTITY_PATH } from '@/constants.js';
|
|
17
|
+
import {
|
|
18
|
+
CustomFieldsPageBlock,
|
|
19
|
+
DetailFormGrid,
|
|
20
|
+
Page,
|
|
21
|
+
PageActionBar,
|
|
22
|
+
PageActionBarRight,
|
|
23
|
+
PageBlock,
|
|
24
|
+
PageLayout,
|
|
25
|
+
PageTitle,
|
|
26
|
+
} from '@/framework/layout-engine/page-layout.js';
|
|
27
|
+
import { detailPageRouteLoader } from '@/framework/page/detail-page-route-loader.js';
|
|
28
|
+
import { useDetailPage } from '@/framework/page/use-detail-page.js';
|
|
29
|
+
import { api } from '@/graphql/api.js';
|
|
30
|
+
import { Trans, useLingui } from '@/lib/trans.js';
|
|
31
|
+
import { useMutation } from '@tanstack/react-query';
|
|
32
|
+
import { createFileRoute, useNavigate } from '@tanstack/react-router';
|
|
33
|
+
import { Plus } from 'lucide-react';
|
|
34
|
+
import { useState } from 'react';
|
|
35
|
+
import { toast } from 'sonner';
|
|
36
|
+
import { CustomerAddressCard } from './components/customer-address-card.js';
|
|
37
|
+
import { CustomerAddressForm } from './components/customer-address-form.js';
|
|
38
|
+
import { CustomerHistoryContainer } from './components/customer-history/customer-history-container.js';
|
|
39
|
+
import { CustomerOrderTable } from './components/customer-order-table.js';
|
|
40
|
+
import { CustomerStatusBadge } from './components/customer-status-badge.js';
|
|
41
|
+
import {
|
|
42
|
+
addCustomerToGroupDocument,
|
|
43
|
+
createCustomerAddressDocument,
|
|
44
|
+
createCustomerDocument,
|
|
45
|
+
customerDetailDocument,
|
|
46
|
+
removeCustomerFromGroupDocument,
|
|
47
|
+
updateCustomerDocument,
|
|
48
|
+
} from './customers.graphql.js';
|
|
49
|
+
|
|
50
|
+
export const Route = createFileRoute('/_authenticated/_customers/customers_/$id')({
|
|
51
|
+
component: CustomerDetailPage,
|
|
52
|
+
loader: detailPageRouteLoader({
|
|
53
|
+
queryDocument: customerDetailDocument,
|
|
54
|
+
breadcrumb: (isNew, entity) => [
|
|
55
|
+
{ path: '/customers', label: 'Customers' },
|
|
56
|
+
isNew ? <Trans>New customer</Trans> : `${entity?.firstName} ${entity?.lastName}`,
|
|
57
|
+
],
|
|
58
|
+
}),
|
|
59
|
+
errorComponent: ({ error }) => <ErrorPage message={error.message} />,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
function CustomerDetailPage() {
|
|
63
|
+
const params = Route.useParams();
|
|
64
|
+
const navigate = useNavigate();
|
|
65
|
+
const creatingNewEntity = params.id === NEW_ENTITY_PATH;
|
|
66
|
+
const { i18n } = useLingui();
|
|
67
|
+
const [newAddressOpen, setNewAddressOpen] = useState(false);
|
|
68
|
+
|
|
69
|
+
const { form, submitHandler, entity, isPending, refreshEntity, resetForm } = useDetailPage({
|
|
70
|
+
queryDocument: customerDetailDocument,
|
|
71
|
+
createDocument: createCustomerDocument,
|
|
72
|
+
updateDocument: updateCustomerDocument,
|
|
73
|
+
setValuesForUpdate: entity => {
|
|
74
|
+
return {
|
|
75
|
+
id: entity.id,
|
|
76
|
+
title: entity.title,
|
|
77
|
+
emailAddress: entity.emailAddress,
|
|
78
|
+
firstName: entity.firstName,
|
|
79
|
+
lastName: entity.lastName,
|
|
80
|
+
phoneNumber: entity.phoneNumber,
|
|
81
|
+
addresses: entity.addresses,
|
|
82
|
+
customFields: entity.customFields,
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
params: { id: params.id },
|
|
86
|
+
onSuccess: async data => {
|
|
87
|
+
if (data.__typename === 'Customer') {
|
|
88
|
+
toast.success(i18n.t('Successfully updated customer'));
|
|
89
|
+
resetForm();
|
|
90
|
+
if (creatingNewEntity) {
|
|
91
|
+
await navigate({ to: `../$id`, params: { id: data.id } });
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
toast.error(i18n.t('Failed to update customer'), {
|
|
95
|
+
description: data.message,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
onError: err => {
|
|
100
|
+
toast.error(i18n.t('Failed to update customer'), {
|
|
101
|
+
description: err instanceof Error ? err.message : 'Unknown error',
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const { mutate: createAddress } = useMutation({
|
|
107
|
+
mutationFn: api.mutate(createCustomerAddressDocument),
|
|
108
|
+
onSuccess: () => {
|
|
109
|
+
setNewAddressOpen(false);
|
|
110
|
+
refreshEntity();
|
|
111
|
+
},
|
|
112
|
+
onError: () => {
|
|
113
|
+
toast.error(i18n.t('Failed to create address'));
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const { mutate: addCustomerToGroup } = useMutation({
|
|
118
|
+
mutationFn: api.mutate(addCustomerToGroupDocument),
|
|
119
|
+
onSuccess: () => {
|
|
120
|
+
refreshEntity();
|
|
121
|
+
},
|
|
122
|
+
onError: () => {
|
|
123
|
+
toast(i18n.t('Failed to add customer to group'));
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const { mutate: removeCustomerFromGroup } = useMutation({
|
|
128
|
+
mutationFn: api.mutate(removeCustomerFromGroupDocument),
|
|
129
|
+
onSuccess: () => {
|
|
130
|
+
refreshEntity();
|
|
131
|
+
},
|
|
132
|
+
onError: () => {
|
|
133
|
+
toast(i18n.t('Failed to remove customer from group'));
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const customerName = entity ? `${entity.firstName} ${entity.lastName}` : '';
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<Page pageId="customer-detail" form={form} submitHandler={submitHandler}>
|
|
141
|
+
<PageTitle>{creatingNewEntity ? <Trans>New customer</Trans> : customerName}</PageTitle>
|
|
142
|
+
<PageActionBar>
|
|
143
|
+
<PageActionBarRight>
|
|
144
|
+
<PermissionGuard requires={['UpdateCustomer']}>
|
|
145
|
+
<Button
|
|
146
|
+
type="submit"
|
|
147
|
+
disabled={!form.formState.isDirty || !form.formState.isValid || isPending}
|
|
148
|
+
>
|
|
149
|
+
<Trans>Update</Trans>
|
|
150
|
+
</Button>
|
|
151
|
+
</PermissionGuard>
|
|
152
|
+
</PageActionBarRight>
|
|
153
|
+
</PageActionBar>
|
|
154
|
+
<PageLayout>
|
|
155
|
+
<PageBlock column="main" blockId="main-form">
|
|
156
|
+
<DetailFormGrid>
|
|
157
|
+
<FormFieldWrapper
|
|
158
|
+
control={form.control}
|
|
159
|
+
name="title"
|
|
160
|
+
label={<Trans>Title</Trans>}
|
|
161
|
+
render={({ field }) => <Input {...field} />}
|
|
162
|
+
/>
|
|
163
|
+
<div></div>
|
|
164
|
+
<FormFieldWrapper
|
|
165
|
+
control={form.control}
|
|
166
|
+
name="firstName"
|
|
167
|
+
label={<Trans>First name</Trans>}
|
|
168
|
+
render={({ field }) => <Input {...field} />}
|
|
169
|
+
/>
|
|
170
|
+
<FormFieldWrapper
|
|
171
|
+
control={form.control}
|
|
172
|
+
name="lastName"
|
|
173
|
+
label={<Trans>Last name</Trans>}
|
|
174
|
+
render={({ field }) => <Input {...field} />}
|
|
175
|
+
/>
|
|
176
|
+
<FormFieldWrapper
|
|
177
|
+
control={form.control}
|
|
178
|
+
name="emailAddress"
|
|
179
|
+
label={<Trans>Email address</Trans>}
|
|
180
|
+
render={({ field }) => <Input {...field} />}
|
|
181
|
+
/>
|
|
182
|
+
<FormFieldWrapper
|
|
183
|
+
control={form.control}
|
|
184
|
+
name="phoneNumber"
|
|
185
|
+
label={<Trans>Phone number</Trans>}
|
|
186
|
+
render={({ field }) => <Input {...field} />}
|
|
187
|
+
/>
|
|
188
|
+
</DetailFormGrid>
|
|
189
|
+
</PageBlock>
|
|
190
|
+
<CustomFieldsPageBlock column="main" entityType="Customer" control={form.control} />
|
|
191
|
+
|
|
192
|
+
{entity && (
|
|
193
|
+
<>
|
|
194
|
+
<PageBlock column="main" blockId="addresses" title={<Trans>Addresses</Trans>}>
|
|
195
|
+
<DetailFormGrid>
|
|
196
|
+
{entity?.addresses?.map(address => (
|
|
197
|
+
<CustomerAddressCard
|
|
198
|
+
key={address.id}
|
|
199
|
+
address={address}
|
|
200
|
+
editable
|
|
201
|
+
deletable
|
|
202
|
+
onUpdate={() => {
|
|
203
|
+
refreshEntity();
|
|
204
|
+
}}
|
|
205
|
+
onDelete={() => {
|
|
206
|
+
refreshEntity();
|
|
207
|
+
}}
|
|
208
|
+
/>
|
|
209
|
+
))}
|
|
210
|
+
</DetailFormGrid>
|
|
211
|
+
|
|
212
|
+
<Dialog open={newAddressOpen} onOpenChange={setNewAddressOpen}>
|
|
213
|
+
<DialogTrigger asChild>
|
|
214
|
+
<Button variant="outline">
|
|
215
|
+
<Plus className="w-4 h-4" /> <Trans>Add new address</Trans>
|
|
216
|
+
</Button>
|
|
217
|
+
</DialogTrigger>
|
|
218
|
+
<DialogContent>
|
|
219
|
+
<DialogHeader>
|
|
220
|
+
<DialogTitle>
|
|
221
|
+
<Trans>Add new address</Trans>
|
|
222
|
+
</DialogTitle>
|
|
223
|
+
<DialogDescription>
|
|
224
|
+
<Trans>Add a new address to the customer.</Trans>
|
|
225
|
+
</DialogDescription>
|
|
226
|
+
</DialogHeader>
|
|
227
|
+
<CustomerAddressForm
|
|
228
|
+
onSubmit={values => {
|
|
229
|
+
const { id, ...input } = values;
|
|
230
|
+
createAddress({
|
|
231
|
+
customerId: entity.id,
|
|
232
|
+
input,
|
|
233
|
+
});
|
|
234
|
+
}}
|
|
235
|
+
/>
|
|
236
|
+
</DialogContent>
|
|
237
|
+
</Dialog>
|
|
238
|
+
</PageBlock>
|
|
239
|
+
|
|
240
|
+
<PageBlock column="main" blockId="orders" title={<Trans>Orders</Trans>}>
|
|
241
|
+
<CustomerOrderTable customerId={entity.id} />
|
|
242
|
+
</PageBlock>
|
|
243
|
+
<PageBlock column="main" blockId="history" title={<Trans>Customer history</Trans>}>
|
|
244
|
+
<CustomerHistoryContainer customerId={entity.id} />
|
|
245
|
+
</PageBlock>
|
|
246
|
+
<PageBlock column="side" blockId="status" title={<Trans>Status</Trans>}>
|
|
247
|
+
<CustomerStatusBadge user={entity.user} />
|
|
248
|
+
</PageBlock>
|
|
249
|
+
<PageBlock column="side" blockId="groups" title={<Trans>Customer groups</Trans>}>
|
|
250
|
+
<div
|
|
251
|
+
className={`flex flex-col gap-2 ${entity?.groups?.length > 0 ? 'mb-2' : ''}`}
|
|
252
|
+
>
|
|
253
|
+
{entity?.groups?.map(group => (
|
|
254
|
+
<CustomerGroupChip
|
|
255
|
+
key={group.id}
|
|
256
|
+
group={group}
|
|
257
|
+
onRemove={groupId =>
|
|
258
|
+
removeCustomerFromGroup({ customerId: entity.id, groupId })
|
|
259
|
+
}
|
|
260
|
+
/>
|
|
261
|
+
))}
|
|
262
|
+
</div>
|
|
263
|
+
<CustomerGroupSelector
|
|
264
|
+
onSelect={group =>
|
|
265
|
+
addCustomerToGroup({ customerId: entity.id, groupId: group.id })
|
|
266
|
+
}
|
|
267
|
+
/>
|
|
268
|
+
</PageBlock>
|
|
269
|
+
</>
|
|
270
|
+
)}
|
|
271
|
+
</PageLayout>
|
|
272
|
+
</Page>
|
|
273
|
+
);
|
|
274
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { usePaginatedList } from '@/components/shared/paginated-list-data-table.js';
|
|
2
|
+
import { Button } from '@/components/ui/button.js';
|
|
3
|
+
import { Form, FormControl, FormItem, FormLabel, FormMessage } from '@/components/ui/form.js';
|
|
4
|
+
import { Input } from '@/components/ui/input.js';
|
|
5
|
+
import { api } from '@/graphql/api.js';
|
|
6
|
+
import { graphql } from '@/graphql/graphql.js';
|
|
7
|
+
import { useUserSettings } from '@/hooks/use-user-settings.js';
|
|
8
|
+
import { Trans } from '@/lib/trans.js';
|
|
9
|
+
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
10
|
+
import { useForm } from 'react-hook-form';
|
|
11
|
+
|
|
12
|
+
const facetValuesDocument = graphql(`
|
|
13
|
+
query FacetValue($options: FacetValueListOptions) {
|
|
14
|
+
facetValues(options: $options) {
|
|
15
|
+
items {
|
|
16
|
+
id
|
|
17
|
+
name
|
|
18
|
+
code
|
|
19
|
+
customFields
|
|
20
|
+
translations {
|
|
21
|
+
id
|
|
22
|
+
languageCode
|
|
23
|
+
name
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`);
|
|
29
|
+
|
|
30
|
+
const updateFacetValueDocument = graphql(`
|
|
31
|
+
mutation UpdateFacetValue($input: [UpdateFacetValueInput!]!) {
|
|
32
|
+
updateFacetValues(input: $input) {
|
|
33
|
+
id
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`);
|
|
37
|
+
|
|
38
|
+
export interface EditFacetValueProps {
|
|
39
|
+
facetValueId: string;
|
|
40
|
+
onSuccess?: () => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function EditFacetValue({ facetValueId, onSuccess }: EditFacetValueProps) {
|
|
44
|
+
const {
|
|
45
|
+
settings: { contentLanguage },
|
|
46
|
+
} = useUserSettings();
|
|
47
|
+
const { refetchPaginatedList } = usePaginatedList();
|
|
48
|
+
const { data: facetValues } = useQuery({
|
|
49
|
+
queryKey: ['facetValues', facetValueId],
|
|
50
|
+
queryFn: () => api.query(facetValuesDocument, { options: { filter: { id: { eq: facetValueId } } } }),
|
|
51
|
+
});
|
|
52
|
+
const { mutate: updateFacetValue } = useMutation({
|
|
53
|
+
mutationFn: api.mutate(updateFacetValueDocument),
|
|
54
|
+
onSuccess: () => {
|
|
55
|
+
refetchPaginatedList();
|
|
56
|
+
onSuccess?.();
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
const facetValue = facetValues?.facetValues.items[0];
|
|
60
|
+
|
|
61
|
+
const form = useForm({
|
|
62
|
+
values: {
|
|
63
|
+
name: facetValue?.name ?? '',
|
|
64
|
+
code: facetValue?.code ?? '',
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
if (!facetValue) {
|
|
69
|
+
return <div>Facet value not found</div>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const handleSave = (values: { name: string; code: string }) => {
|
|
73
|
+
const translations = facetValue.translations.map(translation => {
|
|
74
|
+
if (translation.languageCode === contentLanguage) {
|
|
75
|
+
return {
|
|
76
|
+
id: translation.id,
|
|
77
|
+
languageCode: translation.languageCode,
|
|
78
|
+
name: values.name,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return translation;
|
|
82
|
+
});
|
|
83
|
+
updateFacetValue({
|
|
84
|
+
input: [
|
|
85
|
+
{
|
|
86
|
+
id: facetValue.id,
|
|
87
|
+
translations,
|
|
88
|
+
code: values.code,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<div className="grid gap-4">
|
|
96
|
+
<div className="space-y-2">
|
|
97
|
+
<h4 className="font-medium leading-none">Edit Facet Value</h4>
|
|
98
|
+
<p className="text-sm text-muted-foreground">Update the name and code of this facet value.</p>
|
|
99
|
+
</div>
|
|
100
|
+
<Form {...form}>
|
|
101
|
+
<form onSubmit={form.handleSubmit(handleSave)} className="grid gap-2">
|
|
102
|
+
<FormItem>
|
|
103
|
+
<FormLabel>
|
|
104
|
+
<Trans>Name</Trans>
|
|
105
|
+
</FormLabel>
|
|
106
|
+
<FormControl>
|
|
107
|
+
<Input placeholder="" {...form.register('name')} />
|
|
108
|
+
</FormControl>
|
|
109
|
+
<FormMessage />
|
|
110
|
+
</FormItem>
|
|
111
|
+
<FormItem>
|
|
112
|
+
<FormLabel>
|
|
113
|
+
<Trans>Code</Trans>
|
|
114
|
+
</FormLabel>
|
|
115
|
+
<FormControl>
|
|
116
|
+
<Input placeholder="" {...form.register('code')} />
|
|
117
|
+
</FormControl>
|
|
118
|
+
<FormMessage />
|
|
119
|
+
</FormItem>
|
|
120
|
+
<div className="flex justify-end">
|
|
121
|
+
<Button type="submit" size="sm">
|
|
122
|
+
<Trans>Save changes</Trans>
|
|
123
|
+
</Button>
|
|
124
|
+
</div>
|
|
125
|
+
</form>
|
|
126
|
+
</Form>
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Sheet,
|
|
3
|
+
SheetContent,
|
|
4
|
+
SheetDescription,
|
|
5
|
+
SheetHeader,
|
|
6
|
+
SheetTitle,
|
|
7
|
+
SheetTrigger,
|
|
8
|
+
} from '@/components/ui/sheet.js';
|
|
9
|
+
import { Trans } from '@/lib/trans.js';
|
|
10
|
+
import { PanelLeftOpen } from 'lucide-react';
|
|
11
|
+
import { FacetValuesTable } from './facet-values-table.js';
|
|
12
|
+
import { Button } from '@/components/ui/button.js';
|
|
13
|
+
|
|
14
|
+
export interface FacetValuesSheetProps {
|
|
15
|
+
facetName: string;
|
|
16
|
+
facetId: string;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function FacetValuesSheet({ facetName, facetId, children }: FacetValuesSheetProps) {
|
|
21
|
+
return (
|
|
22
|
+
<Sheet>
|
|
23
|
+
<SheetTrigger asChild>
|
|
24
|
+
<Button variant="outline" size="sm" className="flex items-center gap-2">
|
|
25
|
+
{children}
|
|
26
|
+
<PanelLeftOpen className="w-4 h-4" />
|
|
27
|
+
</Button>
|
|
28
|
+
</SheetTrigger>
|
|
29
|
+
<SheetContent className="min-w-[90vw] lg:min-w-[800px]">
|
|
30
|
+
<SheetHeader>
|
|
31
|
+
<SheetTitle>
|
|
32
|
+
<Trans>Facet values for {facetName}</Trans>
|
|
33
|
+
</SheetTitle>
|
|
34
|
+
<SheetDescription>
|
|
35
|
+
<Trans>
|
|
36
|
+
These are the facet values for the <strong>{facetName}</strong> facet.
|
|
37
|
+
</Trans>
|
|
38
|
+
</SheetDescription>
|
|
39
|
+
</SheetHeader>
|
|
40
|
+
<div className="px-4">
|
|
41
|
+
<FacetValuesTable facetId={facetId} />
|
|
42
|
+
</div>
|
|
43
|
+
</SheetContent>
|
|
44
|
+
</Sheet>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { PaginatedListDataTable } from '@/components/shared/paginated-list-data-table.js';
|
|
2
|
+
import { Button } from '@/components/ui/button.js';
|
|
3
|
+
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover.js';
|
|
4
|
+
import { addCustomFields } from '@/framework/document-introspection/add-custom-fields.js';
|
|
5
|
+
import { graphql } from '@/graphql/graphql.js';
|
|
6
|
+
import { Trans } from '@/lib/trans.js';
|
|
7
|
+
import { ColumnFiltersState, SortingState } from '@tanstack/react-table';
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
import { EditFacetValue } from './edit-facet-value.js';
|
|
10
|
+
|
|
11
|
+
export const facetValueListDocument = graphql(`
|
|
12
|
+
query FacetValueList($options: FacetValueListOptions) {
|
|
13
|
+
facetValues(options: $options) {
|
|
14
|
+
items {
|
|
15
|
+
id
|
|
16
|
+
createdAt
|
|
17
|
+
updatedAt
|
|
18
|
+
name
|
|
19
|
+
code
|
|
20
|
+
customFields
|
|
21
|
+
}
|
|
22
|
+
totalItems
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`);
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export interface FacetValuesTableProps {
|
|
29
|
+
facetId: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function FacetValuesTable({ facetId }: FacetValuesTableProps) {
|
|
33
|
+
const [sorting, setSorting] = useState<SortingState>([]);
|
|
34
|
+
const [page, setPage] = useState(1);
|
|
35
|
+
const [pageSize, setPageSize] = useState(10);
|
|
36
|
+
const [filters, setFilters] = useState<ColumnFiltersState>([]);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<PaginatedListDataTable
|
|
40
|
+
listQuery={addCustomFields(facetValueListDocument)}
|
|
41
|
+
page={page}
|
|
42
|
+
itemsPerPage={pageSize}
|
|
43
|
+
sorting={sorting}
|
|
44
|
+
columnFilters={filters}
|
|
45
|
+
onPageChange={(_, page, perPage) => {
|
|
46
|
+
setPage(page);
|
|
47
|
+
setPageSize(perPage);
|
|
48
|
+
}}
|
|
49
|
+
onSortChange={(_, sorting) => {
|
|
50
|
+
setSorting(sorting);
|
|
51
|
+
}}
|
|
52
|
+
onFilterChange={(_, filters) => {
|
|
53
|
+
setFilters(filters);
|
|
54
|
+
}}
|
|
55
|
+
transformVariables={variables => {
|
|
56
|
+
const filter = variables.options?.filter ?? {};
|
|
57
|
+
return {
|
|
58
|
+
options: {
|
|
59
|
+
filter: {
|
|
60
|
+
...filter,
|
|
61
|
+
facetId: { eq: facetId },
|
|
62
|
+
},
|
|
63
|
+
sort: variables.options?.sort,
|
|
64
|
+
take: pageSize,
|
|
65
|
+
skip: (page - 1) * pageSize,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}}
|
|
69
|
+
onSearchTermChange={searchTerm => {
|
|
70
|
+
return {
|
|
71
|
+
name: {
|
|
72
|
+
contains: searchTerm,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}}
|
|
76
|
+
additionalColumns={{
|
|
77
|
+
actions: {
|
|
78
|
+
header: 'Actions',
|
|
79
|
+
cell: ({ row }) => {
|
|
80
|
+
const [open, setOpen] = useState(false);
|
|
81
|
+
const facetValue = row.original;
|
|
82
|
+
return (
|
|
83
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
84
|
+
<PopoverTrigger asChild>
|
|
85
|
+
<Button type="button" variant="outline" size="sm"><Trans>Edit</Trans></Button>
|
|
86
|
+
</PopoverTrigger>
|
|
87
|
+
<PopoverContent className="w-80">
|
|
88
|
+
<EditFacetValue facetValueId={facetValue.id} onSuccess={() => setOpen(false)} />
|
|
89
|
+
</PopoverContent>
|
|
90
|
+
</Popover>
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { graphql } from '@/graphql/graphql.js';
|
|
2
|
+
|
|
3
|
+
export const facetValueFragment = graphql(`
|
|
4
|
+
fragment FacetValue on FacetValue {
|
|
5
|
+
id
|
|
6
|
+
createdAt
|
|
7
|
+
updatedAt
|
|
8
|
+
languageCode
|
|
9
|
+
code
|
|
10
|
+
name
|
|
11
|
+
translations {
|
|
12
|
+
id
|
|
13
|
+
languageCode
|
|
14
|
+
name
|
|
15
|
+
}
|
|
16
|
+
facet {
|
|
17
|
+
id
|
|
18
|
+
createdAt
|
|
19
|
+
updatedAt
|
|
20
|
+
name
|
|
21
|
+
code
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`);
|
|
25
|
+
|
|
26
|
+
export const facetWithValuesFragment = graphql(
|
|
27
|
+
`
|
|
28
|
+
fragment FacetWithValueList on Facet {
|
|
29
|
+
id
|
|
30
|
+
createdAt
|
|
31
|
+
updatedAt
|
|
32
|
+
name
|
|
33
|
+
code
|
|
34
|
+
languageCode
|
|
35
|
+
isPrivate
|
|
36
|
+
valueList(options: $facetValueListOptions) {
|
|
37
|
+
totalItems
|
|
38
|
+
items {
|
|
39
|
+
...FacetValue
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`,
|
|
44
|
+
[facetValueFragment],
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export const facetListDocument = graphql(
|
|
48
|
+
`
|
|
49
|
+
query FacetList($options: FacetListOptions, $facetValueListOptions: FacetValueListOptions) {
|
|
50
|
+
facets(options: $options) {
|
|
51
|
+
items {
|
|
52
|
+
...FacetWithValueList
|
|
53
|
+
}
|
|
54
|
+
totalItems
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`,
|
|
58
|
+
[facetWithValuesFragment],
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
export const facetDetailDocument = graphql(`
|
|
62
|
+
query FacetDetail($id: ID!) {
|
|
63
|
+
facet(id: $id) {
|
|
64
|
+
id
|
|
65
|
+
createdAt
|
|
66
|
+
updatedAt
|
|
67
|
+
name
|
|
68
|
+
code
|
|
69
|
+
languageCode
|
|
70
|
+
isPrivate
|
|
71
|
+
translations {
|
|
72
|
+
id
|
|
73
|
+
languageCode
|
|
74
|
+
name
|
|
75
|
+
}
|
|
76
|
+
customFields
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`);
|
|
80
|
+
|
|
81
|
+
export const createFacetDocument = graphql(`
|
|
82
|
+
mutation CreateFacet($input: CreateFacetInput!) {
|
|
83
|
+
createFacet(input: $input) {
|
|
84
|
+
id
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
`);
|
|
88
|
+
|
|
89
|
+
export const updateFacetDocument = graphql(`
|
|
90
|
+
mutation UpdateFacet($input: UpdateFacetInput!) {
|
|
91
|
+
updateFacet(input: $input) {
|
|
92
|
+
id
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`);
|
|
96
|
+
|
|
97
|
+
export const deleteFacetDocument = graphql(`
|
|
98
|
+
mutation DeleteFacet($id: ID!) {
|
|
99
|
+
deleteFacet(id: $id) {
|
|
100
|
+
result
|
|
101
|
+
message
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`);
|