@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,325 @@
|
|
|
1
|
+
import { assetFragment } from '@/graphql/fragments.js';
|
|
2
|
+
import { graphql } from '@/graphql/graphql.js';
|
|
3
|
+
import { gql } from 'awesome-graphql-client';
|
|
4
|
+
|
|
5
|
+
export const orderListDocument = graphql(`
|
|
6
|
+
query GetOrders($options: OrderListOptions) {
|
|
7
|
+
orders(options: $options) {
|
|
8
|
+
items {
|
|
9
|
+
id
|
|
10
|
+
createdAt
|
|
11
|
+
updatedAt
|
|
12
|
+
type
|
|
13
|
+
code
|
|
14
|
+
state
|
|
15
|
+
customer {
|
|
16
|
+
id
|
|
17
|
+
firstName
|
|
18
|
+
lastName
|
|
19
|
+
}
|
|
20
|
+
orderPlacedAt
|
|
21
|
+
total
|
|
22
|
+
totalWithTax
|
|
23
|
+
currencyCode
|
|
24
|
+
|
|
25
|
+
shippingLines {
|
|
26
|
+
shippingMethod {
|
|
27
|
+
name
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
totalItems
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`);
|
|
35
|
+
|
|
36
|
+
export const discountFragment = graphql(`
|
|
37
|
+
fragment Discount on Discount {
|
|
38
|
+
adjustmentSource
|
|
39
|
+
amount
|
|
40
|
+
amountWithTax
|
|
41
|
+
description
|
|
42
|
+
type
|
|
43
|
+
}
|
|
44
|
+
`);
|
|
45
|
+
|
|
46
|
+
export const paymentFragment = graphql(`
|
|
47
|
+
fragment Payment on Payment {
|
|
48
|
+
id
|
|
49
|
+
createdAt
|
|
50
|
+
transactionId
|
|
51
|
+
amount
|
|
52
|
+
method
|
|
53
|
+
state
|
|
54
|
+
metadata
|
|
55
|
+
}
|
|
56
|
+
`);
|
|
57
|
+
|
|
58
|
+
export const refundFragment = graphql(`
|
|
59
|
+
fragment Refund on Refund {
|
|
60
|
+
id
|
|
61
|
+
state
|
|
62
|
+
items
|
|
63
|
+
shipping
|
|
64
|
+
adjustment
|
|
65
|
+
transactionId
|
|
66
|
+
paymentId
|
|
67
|
+
}
|
|
68
|
+
`);
|
|
69
|
+
|
|
70
|
+
export const orderAddressFragment = graphql(`
|
|
71
|
+
fragment OrderAddress on OrderAddress {
|
|
72
|
+
fullName
|
|
73
|
+
company
|
|
74
|
+
streetLine1
|
|
75
|
+
streetLine2
|
|
76
|
+
city
|
|
77
|
+
province
|
|
78
|
+
postalCode
|
|
79
|
+
country
|
|
80
|
+
countryCode
|
|
81
|
+
phoneNumber
|
|
82
|
+
}
|
|
83
|
+
`);
|
|
84
|
+
|
|
85
|
+
export const fulfillmentFragment = graphql(`
|
|
86
|
+
fragment Fulfillment on Fulfillment {
|
|
87
|
+
id
|
|
88
|
+
state
|
|
89
|
+
nextStates
|
|
90
|
+
createdAt
|
|
91
|
+
updatedAt
|
|
92
|
+
method
|
|
93
|
+
lines {
|
|
94
|
+
orderLineId
|
|
95
|
+
quantity
|
|
96
|
+
}
|
|
97
|
+
trackingCode
|
|
98
|
+
}
|
|
99
|
+
`);
|
|
100
|
+
|
|
101
|
+
export const paymentWithRefundsFragment = graphql(`
|
|
102
|
+
fragment PaymentWithRefunds on Payment {
|
|
103
|
+
id
|
|
104
|
+
createdAt
|
|
105
|
+
transactionId
|
|
106
|
+
amount
|
|
107
|
+
method
|
|
108
|
+
state
|
|
109
|
+
nextStates
|
|
110
|
+
errorMessage
|
|
111
|
+
metadata
|
|
112
|
+
refunds {
|
|
113
|
+
id
|
|
114
|
+
createdAt
|
|
115
|
+
state
|
|
116
|
+
items
|
|
117
|
+
adjustment
|
|
118
|
+
total
|
|
119
|
+
paymentId
|
|
120
|
+
reason
|
|
121
|
+
transactionId
|
|
122
|
+
method
|
|
123
|
+
metadata
|
|
124
|
+
lines {
|
|
125
|
+
orderLineId
|
|
126
|
+
quantity
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
`);
|
|
131
|
+
|
|
132
|
+
export const orderLineFragment = graphql(
|
|
133
|
+
`
|
|
134
|
+
fragment OrderLine on OrderLine {
|
|
135
|
+
id
|
|
136
|
+
createdAt
|
|
137
|
+
updatedAt
|
|
138
|
+
featuredAsset {
|
|
139
|
+
...Asset
|
|
140
|
+
}
|
|
141
|
+
productVariant {
|
|
142
|
+
id
|
|
143
|
+
name
|
|
144
|
+
sku
|
|
145
|
+
trackInventory
|
|
146
|
+
stockOnHand
|
|
147
|
+
}
|
|
148
|
+
discounts {
|
|
149
|
+
...Discount
|
|
150
|
+
}
|
|
151
|
+
fulfillmentLines {
|
|
152
|
+
fulfillmentId
|
|
153
|
+
quantity
|
|
154
|
+
}
|
|
155
|
+
unitPrice
|
|
156
|
+
unitPriceWithTax
|
|
157
|
+
proratedUnitPrice
|
|
158
|
+
proratedUnitPriceWithTax
|
|
159
|
+
quantity
|
|
160
|
+
orderPlacedQuantity
|
|
161
|
+
linePrice
|
|
162
|
+
lineTax
|
|
163
|
+
linePriceWithTax
|
|
164
|
+
discountedLinePrice
|
|
165
|
+
discountedLinePriceWithTax
|
|
166
|
+
}
|
|
167
|
+
`,
|
|
168
|
+
[assetFragment],
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
export const orderDetailFragment = graphql(
|
|
172
|
+
`
|
|
173
|
+
fragment OrderDetail on Order {
|
|
174
|
+
id
|
|
175
|
+
createdAt
|
|
176
|
+
updatedAt
|
|
177
|
+
type
|
|
178
|
+
aggregateOrder {
|
|
179
|
+
id
|
|
180
|
+
code
|
|
181
|
+
}
|
|
182
|
+
sellerOrders {
|
|
183
|
+
id
|
|
184
|
+
code
|
|
185
|
+
channels {
|
|
186
|
+
id
|
|
187
|
+
code
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
code
|
|
191
|
+
state
|
|
192
|
+
nextStates
|
|
193
|
+
active
|
|
194
|
+
couponCodes
|
|
195
|
+
customer {
|
|
196
|
+
id
|
|
197
|
+
firstName
|
|
198
|
+
lastName
|
|
199
|
+
}
|
|
200
|
+
lines {
|
|
201
|
+
...OrderLine
|
|
202
|
+
}
|
|
203
|
+
surcharges {
|
|
204
|
+
id
|
|
205
|
+
sku
|
|
206
|
+
description
|
|
207
|
+
price
|
|
208
|
+
priceWithTax
|
|
209
|
+
taxRate
|
|
210
|
+
}
|
|
211
|
+
discounts {
|
|
212
|
+
...Discount
|
|
213
|
+
}
|
|
214
|
+
promotions {
|
|
215
|
+
id
|
|
216
|
+
couponCode
|
|
217
|
+
}
|
|
218
|
+
subTotal
|
|
219
|
+
subTotalWithTax
|
|
220
|
+
total
|
|
221
|
+
totalWithTax
|
|
222
|
+
currencyCode
|
|
223
|
+
shipping
|
|
224
|
+
shippingWithTax
|
|
225
|
+
shippingLines {
|
|
226
|
+
id
|
|
227
|
+
discountedPriceWithTax
|
|
228
|
+
shippingMethod {
|
|
229
|
+
id
|
|
230
|
+
code
|
|
231
|
+
name
|
|
232
|
+
fulfillmentHandlerCode
|
|
233
|
+
description
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
taxSummary {
|
|
237
|
+
description
|
|
238
|
+
taxBase
|
|
239
|
+
taxRate
|
|
240
|
+
taxTotal
|
|
241
|
+
}
|
|
242
|
+
shippingAddress {
|
|
243
|
+
...OrderAddress
|
|
244
|
+
}
|
|
245
|
+
billingAddress {
|
|
246
|
+
...OrderAddress
|
|
247
|
+
}
|
|
248
|
+
payments {
|
|
249
|
+
...PaymentWithRefunds
|
|
250
|
+
}
|
|
251
|
+
fulfillments {
|
|
252
|
+
...Fulfillment
|
|
253
|
+
}
|
|
254
|
+
modifications {
|
|
255
|
+
id
|
|
256
|
+
createdAt
|
|
257
|
+
isSettled
|
|
258
|
+
priceChange
|
|
259
|
+
note
|
|
260
|
+
payment {
|
|
261
|
+
id
|
|
262
|
+
amount
|
|
263
|
+
}
|
|
264
|
+
lines {
|
|
265
|
+
orderLineId
|
|
266
|
+
quantity
|
|
267
|
+
}
|
|
268
|
+
refund {
|
|
269
|
+
id
|
|
270
|
+
paymentId
|
|
271
|
+
total
|
|
272
|
+
}
|
|
273
|
+
surcharges {
|
|
274
|
+
id
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
`,
|
|
279
|
+
[
|
|
280
|
+
discountFragment,
|
|
281
|
+
orderAddressFragment,
|
|
282
|
+
fulfillmentFragment,
|
|
283
|
+
orderLineFragment,
|
|
284
|
+
paymentWithRefundsFragment,
|
|
285
|
+
],
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
export const orderDetailDocument = graphql(
|
|
289
|
+
`
|
|
290
|
+
query GetOrder($id: ID!) {
|
|
291
|
+
order(id: $id) {
|
|
292
|
+
...OrderDetail
|
|
293
|
+
customFields
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
`,
|
|
297
|
+
[orderDetailFragment],
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
export const orderHistoryDocument = graphql(`
|
|
301
|
+
query GetOrderHistory($id: ID!, $options: HistoryEntryListOptions) {
|
|
302
|
+
order(id: $id) {
|
|
303
|
+
id
|
|
304
|
+
createdAt
|
|
305
|
+
updatedAt
|
|
306
|
+
code
|
|
307
|
+
currencyCode
|
|
308
|
+
history(options: $options) {
|
|
309
|
+
totalItems
|
|
310
|
+
items {
|
|
311
|
+
id
|
|
312
|
+
type
|
|
313
|
+
createdAt
|
|
314
|
+
isPublic
|
|
315
|
+
administrator {
|
|
316
|
+
id
|
|
317
|
+
firstName
|
|
318
|
+
lastName
|
|
319
|
+
}
|
|
320
|
+
data
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
`);
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Money } from '@/components/data-display/money.js';
|
|
2
|
+
import { DetailPageButton } from '@/components/shared/detail-page-button.js';
|
|
3
|
+
import { Badge } from '@/components/ui/badge.js';
|
|
4
|
+
import { Button } from '@/components/ui/button.js';
|
|
5
|
+
import { ListPage } from '@/framework/page/list-page.js';
|
|
6
|
+
import { Trans } from '@/lib/trans.js';
|
|
7
|
+
import { createFileRoute, Link } from '@tanstack/react-router';
|
|
8
|
+
import { orderListDocument } from './orders.graphql.js';
|
|
9
|
+
import { useServerConfig } from '@/hooks/use-server-config.js';
|
|
10
|
+
|
|
11
|
+
export const Route = createFileRoute('/_authenticated/_orders/orders')({
|
|
12
|
+
component: OrderListPage,
|
|
13
|
+
loader: () => ({ breadcrumb: () => <Trans>Orders</Trans> }),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
function OrderListPage() {
|
|
17
|
+
const serverConfig = useServerConfig();
|
|
18
|
+
return (
|
|
19
|
+
<ListPage
|
|
20
|
+
pageId="order-list"
|
|
21
|
+
title="Orders"
|
|
22
|
+
onSearchTermChange={searchTerm => {
|
|
23
|
+
return {
|
|
24
|
+
code: {
|
|
25
|
+
contains: searchTerm,
|
|
26
|
+
},
|
|
27
|
+
customerLastName: {
|
|
28
|
+
contains: searchTerm,
|
|
29
|
+
},
|
|
30
|
+
transactionId: {
|
|
31
|
+
contains: searchTerm,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}}
|
|
35
|
+
defaultSort={[{ id: 'orderPlacedAt', desc: true }]}
|
|
36
|
+
transformVariables={variables => {
|
|
37
|
+
return {
|
|
38
|
+
...variables,
|
|
39
|
+
filterOperator: 'OR',
|
|
40
|
+
};
|
|
41
|
+
}}
|
|
42
|
+
listQuery={orderListDocument}
|
|
43
|
+
route={Route}
|
|
44
|
+
customizeColumns={{
|
|
45
|
+
total: {
|
|
46
|
+
header: 'Total',
|
|
47
|
+
cell: ({ cell, row }) => {
|
|
48
|
+
const value = cell.getValue();
|
|
49
|
+
const currencyCode = row.original.currencyCode;
|
|
50
|
+
return <Money value={value} currencyCode={currencyCode} />;
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
totalWithTax: {
|
|
54
|
+
header: 'Total with Tax',
|
|
55
|
+
cell: ({ cell, row }) => {
|
|
56
|
+
const value = cell.getValue();
|
|
57
|
+
const currencyCode = row.original.currencyCode;
|
|
58
|
+
return <Money value={value} currencyCode={currencyCode} />;
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
state: {
|
|
62
|
+
header: 'State',
|
|
63
|
+
cell: ({ cell }) => {
|
|
64
|
+
const value = cell.getValue() as string;
|
|
65
|
+
return <Badge variant="outline">{value}</Badge>;
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
code: {
|
|
69
|
+
header: 'Code',
|
|
70
|
+
cell: ({ cell, row }) => {
|
|
71
|
+
const value = cell.getValue() as string;
|
|
72
|
+
const id = row.original.id;
|
|
73
|
+
return <DetailPageButton id={id} label={value} />;
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
customer: {
|
|
77
|
+
header: 'Customer',
|
|
78
|
+
cell: ({ cell }) => {
|
|
79
|
+
const value = cell.getValue();
|
|
80
|
+
if (!value) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
return (
|
|
84
|
+
<Button asChild variant="ghost">
|
|
85
|
+
<Link to={`/customers/${value.id}`}>
|
|
86
|
+
{value.firstName} {value.lastName}
|
|
87
|
+
</Link>
|
|
88
|
+
</Button>
|
|
89
|
+
);
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
shippingLines: {
|
|
93
|
+
header: 'Shipping',
|
|
94
|
+
cell: ({ cell }) => {
|
|
95
|
+
const value = cell.getValue();
|
|
96
|
+
return <div>{value.map(line => line.shippingMethod.name).join(', ')}</div>;
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
}}
|
|
100
|
+
defaultVisibility={{
|
|
101
|
+
id: false,
|
|
102
|
+
createdAt: false,
|
|
103
|
+
updatedAt: false,
|
|
104
|
+
type: false,
|
|
105
|
+
currencyCode: false,
|
|
106
|
+
}}
|
|
107
|
+
facetedFilters={{
|
|
108
|
+
state: {
|
|
109
|
+
title: 'State',
|
|
110
|
+
options: serverConfig?.orderProcess.map(state => {
|
|
111
|
+
return {
|
|
112
|
+
label: state.name,
|
|
113
|
+
value: state.name,
|
|
114
|
+
}
|
|
115
|
+
}) ?? [],
|
|
116
|
+
},
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ErrorPage } from '@/components/shared/error-page.js';
|
|
2
|
+
import { PermissionGuard } from '@/components/shared/permission-guard.js';
|
|
3
|
+
import { Badge } from '@/components/ui/badge.js';
|
|
4
|
+
import { Button } from '@/components/ui/button.js';
|
|
5
|
+
import {
|
|
6
|
+
CustomFieldsPageBlock,
|
|
7
|
+
Page,
|
|
8
|
+
PageActionBar,
|
|
9
|
+
PageActionBarRight,
|
|
10
|
+
PageBlock,
|
|
11
|
+
PageLayout,
|
|
12
|
+
PageTitle,
|
|
13
|
+
} from '@/framework/layout-engine/page-layout.js';
|
|
14
|
+
import { detailPageRouteLoader } from '@/framework/page/detail-page-route-loader.js';
|
|
15
|
+
import { useDetailPage } from '@/framework/page/use-detail-page.js';
|
|
16
|
+
import { Trans, useLingui } from '@/lib/trans.js';
|
|
17
|
+
import { Link, createFileRoute } from '@tanstack/react-router';
|
|
18
|
+
import { User } from 'lucide-react';
|
|
19
|
+
import { toast } from 'sonner';
|
|
20
|
+
import { OrderAddress } from './components/order-address.js';
|
|
21
|
+
import { OrderHistoryContainer } from './components/order-history/order-history-container.js';
|
|
22
|
+
import { OrderTable } from './components/order-table.js';
|
|
23
|
+
import { OrderTaxSummary } from './components/order-tax-summary.js';
|
|
24
|
+
import { PaymentDetails } from './components/payment-details.js';
|
|
25
|
+
import { orderDetailDocument } from './orders.graphql.js';
|
|
26
|
+
|
|
27
|
+
export const Route = createFileRoute('/_authenticated/_orders/orders_/$id')({
|
|
28
|
+
component: OrderDetailPage,
|
|
29
|
+
loader: detailPageRouteLoader({
|
|
30
|
+
queryDocument: orderDetailDocument,
|
|
31
|
+
breadcrumb(_isNew, entity) {
|
|
32
|
+
return [{ path: '/orders', label: 'Orders' }, entity?.code];
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
errorComponent: ({ error }) => <ErrorPage message={error.message} />,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function OrderDetailPage() {
|
|
39
|
+
const params = Route.useParams();
|
|
40
|
+
const { i18n } = useLingui();
|
|
41
|
+
|
|
42
|
+
const { form, submitHandler, entity, isPending } = useDetailPage({
|
|
43
|
+
queryDocument: orderDetailDocument,
|
|
44
|
+
setValuesForUpdate: entity => {
|
|
45
|
+
return {
|
|
46
|
+
id: entity.id,
|
|
47
|
+
customFields: entity.customFields,
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
params: { id: params.id },
|
|
51
|
+
onSuccess: async () => {
|
|
52
|
+
toast(i18n.t('Successfully updated order'));
|
|
53
|
+
form.reset(form.getValues());
|
|
54
|
+
},
|
|
55
|
+
onError: err => {
|
|
56
|
+
toast(i18n.t('Failed to update order'), {
|
|
57
|
+
description: err instanceof Error ? err.message : 'Unknown error',
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (!entity) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Page pageId="order-detail" form={form} submitHandler={submitHandler}>
|
|
68
|
+
<PageTitle>{entity?.code ?? ''}</PageTitle>
|
|
69
|
+
<PageActionBar>
|
|
70
|
+
<PageActionBarRight>
|
|
71
|
+
<PermissionGuard requires={['UpdateProduct', 'UpdateCatalog']}>
|
|
72
|
+
<Button
|
|
73
|
+
type="submit"
|
|
74
|
+
disabled={!form.formState.isDirty || !form.formState.isValid || isPending}
|
|
75
|
+
>
|
|
76
|
+
<Trans>Update</Trans>
|
|
77
|
+
</Button>
|
|
78
|
+
</PermissionGuard>
|
|
79
|
+
</PageActionBarRight>
|
|
80
|
+
</PageActionBar>
|
|
81
|
+
<PageLayout>
|
|
82
|
+
<PageBlock column="main" blockId="order-table">
|
|
83
|
+
<OrderTable order={entity} />
|
|
84
|
+
</PageBlock>
|
|
85
|
+
<PageBlock column="main" blockId="tax-summary" title={<Trans>Tax summary</Trans>}>
|
|
86
|
+
<OrderTaxSummary order={entity} />
|
|
87
|
+
</PageBlock>
|
|
88
|
+
<CustomFieldsPageBlock column="main" entityType="Order" control={form.control} />
|
|
89
|
+
<PageBlock column="main" blockId="order-history" title={<Trans>Order history</Trans>}>
|
|
90
|
+
<OrderHistoryContainer orderId={entity.id} />
|
|
91
|
+
</PageBlock>
|
|
92
|
+
<PageBlock column="side" blockId="state" title={<Trans>State</Trans>}>
|
|
93
|
+
<Badge variant="outline">{entity?.state}</Badge>
|
|
94
|
+
</PageBlock>
|
|
95
|
+
<PageBlock column="side" blockId="customer" title={<Trans>Customer</Trans>}>
|
|
96
|
+
<Button variant="ghost" asChild>
|
|
97
|
+
<Link to={`/customers/${entity?.customer?.id}`}>
|
|
98
|
+
<User className="w-4 h-4" />
|
|
99
|
+
{entity?.customer?.firstName} {entity?.customer?.lastName}
|
|
100
|
+
</Link>
|
|
101
|
+
</Button>
|
|
102
|
+
<div className="mt-4 divide-y">
|
|
103
|
+
{entity?.shippingAddress && (
|
|
104
|
+
<div className="pb-6">
|
|
105
|
+
<div className="font-medium">
|
|
106
|
+
<Trans>Shipping address</Trans>
|
|
107
|
+
</div>
|
|
108
|
+
<OrderAddress address={entity.shippingAddress} />
|
|
109
|
+
</div>
|
|
110
|
+
)}
|
|
111
|
+
{entity?.billingAddress && (
|
|
112
|
+
<div className="pt-4">
|
|
113
|
+
<div className="font-medium">
|
|
114
|
+
<Trans>Billing address</Trans>
|
|
115
|
+
</div>
|
|
116
|
+
<OrderAddress address={entity.billingAddress} />
|
|
117
|
+
</div>
|
|
118
|
+
)}
|
|
119
|
+
</div>
|
|
120
|
+
</PageBlock>
|
|
121
|
+
<PageBlock column="side" blockId="payment-details" title={<Trans>Payment details</Trans>}>
|
|
122
|
+
{entity?.payments?.map(payment => (
|
|
123
|
+
<PaymentDetails
|
|
124
|
+
key={payment.id}
|
|
125
|
+
payment={payment}
|
|
126
|
+
currencyCode={entity.currencyCode}
|
|
127
|
+
/>
|
|
128
|
+
))}
|
|
129
|
+
</PageBlock>
|
|
130
|
+
</PageLayout>
|
|
131
|
+
</Page>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ConfigurableOperationInput } from '@/components/shared/configurable-operation-input.js';
|
|
2
|
+
import { Button } from '@/components/ui/button.js';
|
|
3
|
+
import {
|
|
4
|
+
DropdownMenu,
|
|
5
|
+
DropdownMenuContent,
|
|
6
|
+
DropdownMenuItem,
|
|
7
|
+
DropdownMenuTrigger,
|
|
8
|
+
} from '@/components/ui/dropdown-menu.js';
|
|
9
|
+
import { api } from '@/graphql/api.js';
|
|
10
|
+
import { configurableOperationDefFragment, ConfigurableOperationDefFragment } from '@/graphql/fragments.js';
|
|
11
|
+
import { graphql } from '@/graphql/graphql.js';
|
|
12
|
+
import { Trans } from '@/lib/trans.js';
|
|
13
|
+
import { useQuery } from '@tanstack/react-query';
|
|
14
|
+
import { ConfigurableOperationInput as ConfigurableOperationInputType } from '@vendure/common/lib/generated-types';
|
|
15
|
+
import { Plus } from 'lucide-react';
|
|
16
|
+
|
|
17
|
+
export const paymentEligibilityCheckersDocument = graphql(
|
|
18
|
+
`
|
|
19
|
+
query GetPaymentEligibilityCheckers {
|
|
20
|
+
paymentMethodEligibilityCheckers {
|
|
21
|
+
...ConfigurableOperationDef
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`,
|
|
25
|
+
[configurableOperationDefFragment],
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
interface PaymentEligibilityCheckerSelectorProps {
|
|
29
|
+
value: ConfigurableOperationInputType | undefined;
|
|
30
|
+
onChange: (value: ConfigurableOperationInputType | undefined) => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function PaymentEligibilityCheckerSelector({
|
|
34
|
+
value,
|
|
35
|
+
onChange,
|
|
36
|
+
}: PaymentEligibilityCheckerSelectorProps) {
|
|
37
|
+
const { data: checkersData } = useQuery({
|
|
38
|
+
queryKey: ['paymentMethodEligibilityCheckers'],
|
|
39
|
+
queryFn: () => api.query(paymentEligibilityCheckersDocument),
|
|
40
|
+
staleTime: 1000 * 60 * 60 * 5,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const checkers = checkersData?.paymentMethodEligibilityCheckers;
|
|
44
|
+
|
|
45
|
+
const onCheckerSelected = (checker: ConfigurableOperationDefFragment) => {
|
|
46
|
+
const checkerDef = checkers?.find(c => c.code === checker.code);
|
|
47
|
+
if (!checkerDef) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
onChange({
|
|
51
|
+
code: checker.code,
|
|
52
|
+
arguments: checkerDef.args.map(arg => ({
|
|
53
|
+
name: arg.name,
|
|
54
|
+
value: arg.defaultValue != null ? arg.defaultValue.toString() : '',
|
|
55
|
+
})),
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const onOperationValueChange = (newVal: ConfigurableOperationInputType) => {
|
|
60
|
+
onChange(newVal);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const onOperationRemove = () => {
|
|
64
|
+
onChange(undefined);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const checkerDef = checkers?.find(c => c.code === value?.code);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div className="flex flex-col gap-2 mt-4">
|
|
71
|
+
{value && checkerDef && (
|
|
72
|
+
<div className="flex flex-col gap-2">
|
|
73
|
+
<ConfigurableOperationInput
|
|
74
|
+
operationDefinition={checkerDef}
|
|
75
|
+
value={value}
|
|
76
|
+
onChange={value => onOperationValueChange(value)}
|
|
77
|
+
onRemove={() => onOperationRemove()}
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
)}
|
|
81
|
+
<DropdownMenu>
|
|
82
|
+
{!value?.code && (
|
|
83
|
+
<DropdownMenuTrigger asChild>
|
|
84
|
+
<Button variant="outline">
|
|
85
|
+
<Plus />
|
|
86
|
+
<Trans>Select Payment Eligibility Checker</Trans>
|
|
87
|
+
</Button>
|
|
88
|
+
</DropdownMenuTrigger>
|
|
89
|
+
)}
|
|
90
|
+
<DropdownMenuContent className="w-96">
|
|
91
|
+
{checkers?.length ? (
|
|
92
|
+
checkers?.map(checker => (
|
|
93
|
+
<DropdownMenuItem key={checker.code} onClick={() => onCheckerSelected(checker)}>
|
|
94
|
+
{checker.description}
|
|
95
|
+
</DropdownMenuItem>
|
|
96
|
+
))
|
|
97
|
+
) : (
|
|
98
|
+
<DropdownMenuItem>No checkers found</DropdownMenuItem>
|
|
99
|
+
)}
|
|
100
|
+
</DropdownMenuContent>
|
|
101
|
+
</DropdownMenu>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
}
|