@vendure-platform/create 0.5.0 → 0.5.1
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/CHANGELOG.md +4 -0
- package/README.md +39 -39
- package/dist/add-to-existing.js +1 -1
- package/dist/assets/demo-data/initial-data.json +663 -663
- package/dist/assets/storefront/components.json +20 -20
- package/dist/assets/storefront/eslint.config.mjs +10 -10
- package/dist/assets/storefront/graphql.config.yml +1 -1
- package/dist/assets/storefront/next.config.ts +5 -4
- package/dist/assets/storefront/package.json +1 -1
- package/dist/assets/storefront/postcss.config.mjs +1 -1
- package/dist/assets/storefront/src/app/[locale]/(catalog)/catalog/page.tsx +17 -21
- package/dist/assets/storefront/src/app/[locale]/(catalog)/collection/[slug]/page.tsx +64 -42
- package/dist/assets/storefront/src/app/[locale]/(catalog)/layout.tsx +1 -5
- package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/actions.ts +69 -65
- package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/page.tsx +64 -38
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/page.tsx +24 -27
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-results.tsx +11 -9
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-term.tsx +4 -4
- package/dist/assets/storefront/src/app/[locale]/(scenario)/[...path]/page.tsx +1 -1
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/accept-invitation-client.tsx +8 -13
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/actions.ts +11 -14
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/page.tsx +30 -33
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/sign-out-and-retry.tsx +6 -6
- package/dist/assets/storefront/src/app/[locale]/account/addresses/actions.ts +30 -45
- package/dist/assets/storefront/src/app/[locale]/account/addresses/address-form.tsx +166 -159
- package/dist/assets/storefront/src/app/[locale]/account/addresses/addresses-client.tsx +35 -26
- package/dist/assets/storefront/src/app/[locale]/account/addresses/loading.tsx +1 -3
- package/dist/assets/storefront/src/app/[locale]/account/addresses/page.tsx +16 -18
- package/dist/assets/storefront/src/app/[locale]/account/approvals/actions.ts +5 -8
- package/dist/assets/storefront/src/app/[locale]/account/approvals/page.tsx +77 -69
- package/dist/assets/storefront/src/app/[locale]/account/company/actions.ts +10 -11
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/actions.ts +6 -15
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/address-form.tsx +57 -49
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/addresses-client.tsx +23 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/page.tsx +30 -30
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/actions.ts +20 -29
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-unit-form.tsx +32 -37
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-units-client.tsx +32 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/page.tsx +24 -24
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/types.ts +7 -4
- package/dist/assets/storefront/src/app/[locale]/account/company/edit-company-form.tsx +11 -21
- package/dist/assets/storefront/src/app/[locale]/account/company/page.tsx +23 -28
- package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/page.tsx +24 -24
- package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/payment-methods-client.tsx +5 -7
- package/dist/assets/storefront/src/app/[locale]/account/company/roles/page.tsx +22 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/roles/roles-client.tsx +11 -26
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/actions.ts +6 -10
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/page.tsx +18 -16
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/tax-ids-client.tsx +74 -67
- package/dist/assets/storefront/src/app/[locale]/account/company/users/actions.ts +16 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/users/edit-user-form.tsx +27 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/users/invite-user-form.tsx +27 -19
- package/dist/assets/storefront/src/app/[locale]/account/company/users/page.tsx +32 -29
- package/dist/assets/storefront/src/app/[locale]/account/company/users/users-client.tsx +35 -38
- package/dist/assets/storefront/src/app/[locale]/account/error.tsx +1 -3
- package/dist/assets/storefront/src/app/[locale]/account/layout.tsx +16 -22
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/page.tsx +151 -103
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-actions.ts +6 -7
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-dialog.tsx +22 -48
- package/dist/assets/storefront/src/app/[locale]/account/orders/loading.tsx +8 -8
- package/dist/assets/storefront/src/app/[locale]/account/orders/page.tsx +101 -61
- package/dist/assets/storefront/src/app/[locale]/account/profile/actions.ts +32 -23
- package/dist/assets/storefront/src/app/[locale]/account/profile/change-password-form.tsx +6 -16
- package/dist/assets/storefront/src/app/[locale]/account/profile/edit-email-form.tsx +7 -17
- package/dist/assets/storefront/src/app/[locale]/account/profile/edit-profile-form.tsx +6 -16
- package/dist/assets/storefront/src/app/[locale]/account/profile/loading.tsx +12 -18
- package/dist/assets/storefront/src/app/[locale]/account/profile/page.tsx +15 -15
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/file-upload-tab.tsx +2 -6
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/manual-entry-tab.tsx +18 -15
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/page.tsx +3 -6
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/preview-table.tsx +10 -2
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/save-to-list-dialog.tsx +24 -26
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/sku-autocomplete.tsx +19 -10
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/text-input-tab.tsx +3 -8
- package/dist/assets/storefront/src/app/[locale]/account/quotes/[id]/page.tsx +86 -59
- package/dist/assets/storefront/src/app/[locale]/account/quotes/actions.ts +38 -45
- package/dist/assets/storefront/src/app/[locale]/account/quotes/new/new-quote-form.tsx +3 -5
- package/dist/assets/storefront/src/app/[locale]/account/quotes/new/page.tsx +6 -6
- package/dist/assets/storefront/src/app/[locale]/account/quotes/page.tsx +92 -59
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/add-item-search.tsx +11 -9
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/add-member-form.tsx +31 -15
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/members-panel.tsx +52 -33
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/page.tsx +22 -14
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/rename-dialog.tsx +34 -13
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/actions.ts +117 -72
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/new/new-shared-cart-form.tsx +21 -14
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/new/page.tsx +10 -10
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/page.tsx +54 -41
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/page.tsx +22 -8
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/shopping-list-detail-client.tsx +62 -49
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/actions.ts +9 -4
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/create-shopping-list-form.tsx +5 -11
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/loading.tsx +1 -1
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/page.tsx +32 -42
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/actions.ts +8 -8
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/claim-form.tsx +6 -10
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/page.tsx +76 -55
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/reveal-code.tsx +10 -6
- package/dist/assets/storefront/src/app/[locale]/account/verify-email/page.tsx +32 -39
- package/dist/assets/storefront/src/app/[locale]/cart/actions.ts +29 -23
- package/dist/assets/storefront/src/app/[locale]/cart/cart-items.tsx +111 -40
- package/dist/assets/storefront/src/app/[locale]/cart/cart-line-actions.tsx +9 -9
- package/dist/assets/storefront/src/app/[locale]/cart/cart-quantity-control.tsx +61 -48
- package/dist/assets/storefront/src/app/[locale]/cart/cart-remove-button.tsx +15 -9
- package/dist/assets/storefront/src/app/[locale]/cart/cart.tsx +38 -41
- package/dist/assets/storefront/src/app/[locale]/cart/code-input.tsx +8 -8
- package/dist/assets/storefront/src/app/[locale]/cart/order-summary.tsx +50 -32
- package/dist/assets/storefront/src/app/[locale]/cart/page.tsx +11 -11
- package/dist/assets/storefront/src/app/[locale]/cart/promotion-code.tsx +48 -42
- package/dist/assets/storefront/src/app/[locale]/cart/reapproval-confirm.tsx +22 -20
- package/dist/assets/storefront/src/app/[locale]/cart/request-quote-button.tsx +7 -16
- package/dist/assets/storefront/src/app/[locale]/checkout/actions.ts +39 -65
- package/dist/assets/storefront/src/app/[locale]/checkout/cancel-quote-checkout-button.tsx +5 -5
- package/dist/assets/storefront/src/app/[locale]/checkout/checkout-flow.tsx +202 -202
- package/dist/assets/storefront/src/app/[locale]/checkout/checkout-provider.tsx +142 -142
- package/dist/assets/storefront/src/app/[locale]/checkout/order-summary.tsx +158 -139
- package/dist/assets/storefront/src/app/[locale]/checkout/page.tsx +56 -47
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/delivery-step.tsx +86 -88
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/payment-step.tsx +90 -91
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/review-step.tsx +166 -161
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/shipping-address-step.tsx +573 -494
- package/dist/assets/storefront/src/app/[locale]/error.tsx +3 -5
- package/dist/assets/storefront/src/app/[locale]/forgot-password/actions.ts +10 -7
- package/dist/assets/storefront/src/app/[locale]/forgot-password/forgot-password-form.tsx +10 -25
- package/dist/assets/storefront/src/app/[locale]/forgot-password/page.tsx +5 -5
- package/dist/assets/storefront/src/app/[locale]/globals.css +48 -48
- package/dist/assets/storefront/src/app/[locale]/layout.tsx +53 -47
- package/dist/assets/storefront/src/app/[locale]/not-found.tsx +3 -5
- package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/order-confirmation.tsx +71 -44
- package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/page.tsx +7 -5
- package/dist/assets/storefront/src/app/[locale]/page.tsx +33 -35
- package/dist/assets/storefront/src/app/[locale]/register/actions.ts +7 -7
- package/dist/assets/storefront/src/app/[locale]/register/page.tsx +22 -16
- package/dist/assets/storefront/src/app/[locale]/register/registration-form.tsx +22 -34
- package/dist/assets/storefront/src/app/[locale]/register-company/actions.ts +15 -19
- package/dist/assets/storefront/src/app/[locale]/register-company/page.tsx +17 -15
- package/dist/assets/storefront/src/app/[locale]/register-company/registration-form.tsx +9 -15
- package/dist/assets/storefront/src/app/[locale]/reset-password/actions.ts +7 -8
- package/dist/assets/storefront/src/app/[locale]/reset-password/page.tsx +18 -12
- package/dist/assets/storefront/src/app/[locale]/reset-password/reset-password-form.tsx +8 -16
- package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/add-to-cart-button.tsx +10 -4
- package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/page.tsx +62 -30
- package/dist/assets/storefront/src/app/[locale]/sign-in/actions.ts +14 -16
- package/dist/assets/storefront/src/app/[locale]/sign-in/login-form.tsx +17 -30
- package/dist/assets/storefront/src/app/[locale]/sign-in/page.tsx +35 -30
- package/dist/assets/storefront/src/app/[locale]/verify/actions.ts +8 -8
- package/dist/assets/storefront/src/app/[locale]/verify/page.tsx +18 -14
- package/dist/assets/storefront/src/app/[locale]/verify/verify-content.tsx +25 -27
- package/dist/assets/storefront/src/app/[locale]/verify-pending/page.tsx +23 -23
- package/dist/assets/storefront/src/app/api/clear-company-context/route.ts +6 -3
- package/dist/assets/storefront/src/app/api/revalidate/route.ts +19 -28
- package/dist/assets/storefront/src/app/api/search-analytics/route.ts +1 -1
- package/dist/assets/storefront/src/components/commerce/account-nav-items.ts +43 -18
- package/dist/assets/storefront/src/components/commerce/account-sidebar.tsx +30 -22
- package/dist/assets/storefront/src/components/commerce/active-filters.tsx +1 -1
- package/dist/assets/storefront/src/components/commerce/add-to-shared-cart.tsx +49 -27
- package/dist/assets/storefront/src/components/commerce/approval-decision-form.tsx +9 -13
- package/dist/assets/storefront/src/components/commerce/approval-status-badge.tsx +23 -15
- package/dist/assets/storefront/src/components/commerce/business-unit-switcher.tsx +11 -11
- package/dist/assets/storefront/src/components/commerce/catalog-search-bar.tsx +2 -2
- package/dist/assets/storefront/src/components/commerce/category-product-section.tsx +28 -16
- package/dist/assets/storefront/src/components/commerce/category-sidebar.tsx +31 -18
- package/dist/assets/storefront/src/components/commerce/collection-hero-banner.tsx +2 -4
- package/dist/assets/storefront/src/components/commerce/company-state-badge.tsx +10 -16
- package/dist/assets/storefront/src/components/commerce/company-switcher.tsx +12 -12
- package/dist/assets/storefront/src/components/commerce/configurator-form.tsx +188 -79
- package/dist/assets/storefront/src/components/commerce/facet-filters.tsx +29 -49
- package/dist/assets/storefront/src/components/commerce/gift-card-pdp.tsx +4 -4
- package/dist/assets/storefront/src/components/commerce/gift-card-product-info.tsx +20 -30
- package/dist/assets/storefront/src/components/commerce/instant-search-dropdown.tsx +258 -227
- package/dist/assets/storefront/src/components/commerce/order-status-badge.tsx +27 -19
- package/dist/assets/storefront/src/components/commerce/packaging-unit-selector.tsx +27 -26
- package/dist/assets/storefront/src/components/commerce/permission-gate.tsx +4 -4
- package/dist/assets/storefront/src/components/commerce/price-range-filter.tsx +5 -5
- package/dist/assets/storefront/src/components/commerce/price-tiers.tsx +38 -21
- package/dist/assets/storefront/src/components/commerce/price.tsx +3 -3
- package/dist/assets/storefront/src/components/commerce/product-card-list.tsx +35 -14
- package/dist/assets/storefront/src/components/commerce/product-card.tsx +31 -16
- package/dist/assets/storefront/src/components/commerce/product-carousel.tsx +20 -12
- package/dist/assets/storefront/src/components/commerce/product-grid.tsx +14 -13
- package/dist/assets/storefront/src/components/commerce/product-image-carousel.tsx +10 -8
- package/dist/assets/storefront/src/components/commerce/product-info.tsx +118 -74
- package/dist/assets/storefront/src/components/commerce/product-list-expansion.tsx +102 -74
- package/dist/assets/storefront/src/components/commerce/product-list-view.tsx +1 -1
- package/dist/assets/storefront/src/components/commerce/product-sidebar.tsx +36 -11
- package/dist/assets/storefront/src/components/commerce/product-view-switcher.tsx +33 -21
- package/dist/assets/storefront/src/components/commerce/quote-action-buttons.tsx +54 -36
- package/dist/assets/storefront/src/components/commerce/quote-activity-timeline.tsx +126 -50
- package/dist/assets/storefront/src/components/commerce/quote-comment-form.tsx +9 -13
- package/dist/assets/storefront/src/components/commerce/quote-csv-export-button.tsx +6 -6
- package/dist/assets/storefront/src/components/commerce/quote-product-search.tsx +22 -18
- package/dist/assets/storefront/src/components/commerce/quote-request-form.tsx +28 -27
- package/dist/assets/storefront/src/components/commerce/quote-status-badge.tsx +26 -18
- package/dist/assets/storefront/src/components/commerce/quote-validity-indicator.tsx +7 -7
- package/dist/assets/storefront/src/components/commerce/quote-version-comparison.tsx +50 -30
- package/dist/assets/storefront/src/components/commerce/related-products.tsx +37 -28
- package/dist/assets/storefront/src/components/commerce/shared-cart-status-badge.tsx +12 -8
- package/dist/assets/storefront/src/components/commerce/shop-by-category.tsx +8 -7
- package/dist/assets/storefront/src/components/commerce/shopping-list-toggle.tsx +14 -20
- package/dist/assets/storefront/src/components/commerce/sort-dropdown.tsx +9 -16
- package/dist/assets/storefront/src/components/commerce/store-credit-summary.tsx +30 -32
- package/dist/assets/storefront/src/components/commerce/subcollection-tiles.tsx +11 -13
- package/dist/assets/storefront/src/components/layout/auth-page-shell.tsx +2 -2
- package/dist/assets/storefront/src/components/layout/draft-mode-indicator.tsx +2 -7
- package/dist/assets/storefront/src/components/layout/draft-mode-link.tsx +4 -2
- package/dist/assets/storefront/src/components/layout/footer.tsx +70 -28
- package/dist/assets/storefront/src/components/layout/navbar/actions.ts +9 -12
- package/dist/assets/storefront/src/components/layout/navbar/cart-icon.tsx +9 -9
- package/dist/assets/storefront/src/components/layout/navbar/channel-picker-wrapper.tsx +4 -9
- package/dist/assets/storefront/src/components/layout/navbar/channel-picker.tsx +13 -8
- package/dist/assets/storefront/src/components/layout/navbar/currency-picker-wrapper.tsx +4 -4
- package/dist/assets/storefront/src/components/layout/navbar/currency-picker.tsx +11 -6
- package/dist/assets/storefront/src/components/layout/navbar/language-picker.tsx +7 -7
- package/dist/assets/storefront/src/components/layout/navbar/login-button.tsx +24 -21
- package/dist/assets/storefront/src/components/layout/navbar/mobile-nav.tsx +8 -8
- package/dist/assets/storefront/src/components/layout/navbar/nav-menu-items.tsx +4 -6
- package/dist/assets/storefront/src/components/layout/navbar/navbar-cart.tsx +1 -1
- package/dist/assets/storefront/src/components/layout/navbar/navbar-collections.tsx +41 -42
- package/dist/assets/storefront/src/components/layout/navbar/navbar-link.tsx +7 -10
- package/dist/assets/storefront/src/components/layout/navbar/navbar-user.tsx +18 -23
- package/dist/assets/storefront/src/components/layout/navbar/theme-switcher.tsx +9 -9
- package/dist/assets/storefront/src/components/layout/navbar.tsx +36 -31
- package/dist/assets/storefront/src/components/layout/search-input.tsx +35 -32
- package/dist/assets/storefront/src/components/providers/awaiting-approval-banner.tsx +12 -10
- package/dist/assets/storefront/src/components/providers/cart-count-server.tsx +14 -12
- package/dist/assets/storefront/src/components/providers/company-context-guard.tsx +4 -4
- package/dist/assets/storefront/src/components/providers/company-permissions-server.tsx +2 -6
- package/dist/assets/storefront/src/components/providers/theme-provider.tsx +3 -3
- package/dist/assets/storefront/src/components/shared/breadcrumbs.tsx +4 -1
- package/dist/assets/storefront/src/components/shared/country-select.tsx +63 -67
- package/dist/assets/storefront/src/components/shared/pagination.tsx +15 -28
- package/dist/assets/storefront/src/components/shared/prefetch-link.tsx +1 -1
- package/dist/assets/storefront/src/components/shared/skeletons/search-input-skeleton.tsx +1 -3
- package/dist/assets/storefront/src/components/ui/accordion.tsx +46 -51
- package/dist/assets/storefront/src/components/ui/alert-dialog.tsx +94 -121
- package/dist/assets/storefront/src/components/ui/alert.tsx +48 -54
- package/dist/assets/storefront/src/components/ui/aspect-ratio.tsx +5 -7
- package/dist/assets/storefront/src/components/ui/avatar.tsx +29 -44
- package/dist/assets/storefront/src/components/ui/badge.tsx +28 -37
- package/dist/assets/storefront/src/components/ui/breadcrumb.tsx +82 -89
- package/dist/assets/storefront/src/components/ui/button.tsx +43 -49
- package/dist/assets/storefront/src/components/ui/calendar.tsx +157 -198
- package/dist/assets/storefront/src/components/ui/card.tsx +53 -76
- package/dist/assets/storefront/src/components/ui/carousel.tsx +194 -212
- package/dist/assets/storefront/src/components/ui/chart.tsx +274 -317
- package/dist/assets/storefront/src/components/ui/checkbox.tsx +24 -27
- package/dist/assets/storefront/src/components/ui/collapsible.tsx +9 -21
- package/dist/assets/storefront/src/components/ui/command.tsx +114 -159
- package/dist/assets/storefront/src/components/ui/context-menu.tsx +167 -199
- package/dist/assets/storefront/src/components/ui/dialog.tsx +97 -114
- package/dist/assets/storefront/src/components/ui/drawer.tsx +93 -107
- package/dist/assets/storefront/src/components/ui/dropdown-menu.tsx +171 -206
- package/dist/assets/storefront/src/components/ui/empty-state.tsx +5 -5
- package/dist/assets/storefront/src/components/ui/field.tsx +196 -208
- package/dist/assets/storefront/src/components/ui/form.tsx +115 -139
- package/dist/assets/storefront/src/components/ui/hover-card.tsx +27 -33
- package/dist/assets/storefront/src/components/ui/input-otp.tsx +50 -59
- package/dist/assets/storefront/src/components/ui/input.tsx +17 -17
- package/dist/assets/storefront/src/components/ui/kbd-shortcut.tsx +3 -1
- package/dist/assets/storefront/src/components/ui/label.tsx +16 -19
- package/dist/assets/storefront/src/components/ui/menubar.tsx +193 -223
- package/dist/assets/storefront/src/components/ui/navigation-menu.tsx +123 -130
- package/dist/assets/storefront/src/components/ui/pagination.tsx +87 -108
- package/dist/assets/storefront/src/components/ui/popover.tsx +29 -35
- package/dist/assets/storefront/src/components/ui/progress.tsx +19 -26
- package/dist/assets/storefront/src/components/ui/radio-group.tsx +32 -38
- package/dist/assets/storefront/src/components/ui/resizable.tsx +37 -42
- package/dist/assets/storefront/src/components/ui/scroll-area.tsx +41 -47
- package/dist/assets/storefront/src/components/ui/select.tsx +130 -152
- package/dist/assets/storefront/src/components/ui/separator.tsx +21 -21
- package/dist/assets/storefront/src/components/ui/sheet.tsx +90 -111
- package/dist/assets/storefront/src/components/ui/sidebar.tsx +611 -649
- package/dist/assets/storefront/src/components/ui/skeleton.tsx +10 -10
- package/dist/assets/storefront/src/components/ui/slider.tsx +50 -55
- package/dist/assets/storefront/src/components/ui/sonner.tsx +20 -20
- package/dist/assets/storefront/src/components/ui/switch.tsx +23 -26
- package/dist/assets/storefront/src/components/ui/table.tsx +65 -97
- package/dist/assets/storefront/src/components/ui/tabs.tsx +39 -55
- package/dist/assets/storefront/src/components/ui/textarea.tsx +14 -14
- package/dist/assets/storefront/src/components/ui/toggle-group.tsx +56 -62
- package/dist/assets/storefront/src/components/ui/toggle.tsx +37 -38
- package/dist/assets/storefront/src/components/ui/tooltip.tsx +38 -46
- package/dist/assets/storefront/src/config/scenario-meta.ts +2 -2
- package/dist/assets/storefront/src/config/scenario.ts +14 -16
- package/dist/assets/storefront/src/contexts/auth-context.tsx +5 -6
- package/dist/assets/storefront/src/graphql.ts +5 -5
- package/dist/assets/storefront/src/hooks/use-mobile.ts +13 -13
- package/dist/assets/storefront/src/i18n/locale-utils.ts +3 -3
- package/dist/assets/storefront/src/i18n/navigation.ts +4 -4
- package/dist/assets/storefront/src/i18n/request.ts +4 -4
- package/dist/assets/storefront/src/i18n/routing.ts +5 -5
- package/dist/assets/storefront/src/i18n/server.ts +3 -3
- package/dist/assets/storefront/src/lib/actions/switch-channel.ts +9 -9
- package/dist/assets/storefront/src/lib/actions/switch-currency.ts +7 -7
- package/dist/assets/storefront/src/lib/auth.ts +1 -1
- package/dist/assets/storefront/src/lib/backend-health.ts +3 -3
- package/dist/assets/storefront/src/lib/cart-count-context.tsx +10 -4
- package/dist/assets/storefront/src/lib/cart-guard-utils.ts +2 -1
- package/dist/assets/storefront/src/lib/cart-guard.ts +7 -6
- package/dist/assets/storefront/src/lib/channel-server.ts +4 -4
- package/dist/assets/storefront/src/lib/company-context.ts +1 -1
- package/dist/assets/storefront/src/lib/company-permissions-context.tsx +1 -5
- package/dist/assets/storefront/src/lib/currency-server.ts +4 -4
- package/dist/assets/storefront/src/lib/format.ts +16 -7
- package/dist/assets/storefront/src/lib/metadata.ts +39 -44
- package/dist/assets/storefront/src/lib/quantity.ts +2 -4
- package/dist/assets/storefront/src/lib/search-bar-context.tsx +7 -4
- package/dist/assets/storefront/src/lib/use-recent-searches.ts +8 -6
- package/dist/assets/storefront/src/lib/utils.ts +3 -3
- package/dist/assets/storefront/src/lib/vendure/actions.ts +18 -16
- package/dist/assets/storefront/src/lib/vendure/api.ts +36 -23
- package/dist/assets/storefront/src/lib/vendure/approval-utils.ts +9 -8
- package/dist/assets/storefront/src/lib/vendure/cached.ts +20 -15
- package/dist/assets/storefront/src/lib/vendure/queries.ts +15 -5
- package/dist/assets/storefront/src/middleware.ts +1 -1
- package/dist/assets/storefront/src/scenarios/customer/hero.tsx +2 -2
- package/dist/assets/storefront/src/scenarios/customer/meta.ts +1 -1
- package/dist/bin/run.js +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/scaffold-storefront-only.js +1 -1
- package/dist/scaffolder.js +1 -1
- package/dist/template-renderer.js +1 -1
- package/package.json +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
addItemsToSharedCart,
|
|
5
|
+
fetchEditableOpenSharedCarts,
|
|
6
|
+
shareMyCart,
|
|
7
|
+
type EditableSharedCart,
|
|
8
|
+
} from '@/app/[locale]/account/shared-carts/actions';
|
|
9
|
+
import { Button } from '@/components/ui/button';
|
|
10
10
|
import {
|
|
11
11
|
Dialog,
|
|
12
12
|
DialogContent,
|
|
@@ -23,15 +23,15 @@ import {
|
|
|
23
23
|
DropdownMenuSeparator,
|
|
24
24
|
DropdownMenuTrigger,
|
|
25
25
|
} from '@/components/ui/dropdown-menu';
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} from '
|
|
26
|
+
import { Input } from '@/components/ui/input';
|
|
27
|
+
import { Label } from '@/components/ui/label';
|
|
28
|
+
import { Textarea } from '@/components/ui/textarea';
|
|
29
|
+
import { useRouter } from '@/i18n/navigation';
|
|
30
|
+
import { ChevronDown, Loader2, Plus, Users } from 'lucide-react';
|
|
31
|
+
import { useState, useTransition } from 'react';
|
|
32
|
+
import { toast } from 'sonner';
|
|
33
33
|
|
|
34
|
-
type CartLine = {productVariantId: string; quantity: number};
|
|
34
|
+
type CartLine = { productVariantId: string; quantity: number };
|
|
35
35
|
|
|
36
36
|
export function AddToSharedCart({
|
|
37
37
|
lines,
|
|
@@ -61,7 +61,7 @@ export function AddToSharedCart({
|
|
|
61
61
|
function loadCarts(open: boolean) {
|
|
62
62
|
if (!open || carts !== null) return;
|
|
63
63
|
setIsLoading(true);
|
|
64
|
-
fetchEditableOpenSharedCarts().then(result => {
|
|
64
|
+
fetchEditableOpenSharedCarts().then((result) => {
|
|
65
65
|
setCarts(result);
|
|
66
66
|
setIsLoading(false);
|
|
67
67
|
});
|
|
@@ -77,7 +77,7 @@ export function AddToSharedCart({
|
|
|
77
77
|
}
|
|
78
78
|
toast.success(`Added to “${cart.name}”`, {
|
|
79
79
|
description: 'Personal discounts don’t apply to shared carts — priced at your company rate.',
|
|
80
|
-
action: {label: 'View', onClick: () => router.push(`/account/shared-carts/${cart.id}`)},
|
|
80
|
+
action: { label: 'View', onClick: () => router.push(`/account/shared-carts/${cart.id}`) },
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -88,8 +88,17 @@ export function AddToSharedCart({
|
|
|
88
88
|
<>
|
|
89
89
|
<DropdownMenu onOpenChange={loadCarts}>
|
|
90
90
|
<DropdownMenuTrigger asChild>
|
|
91
|
-
<Button
|
|
92
|
-
|
|
91
|
+
<Button
|
|
92
|
+
variant="outline"
|
|
93
|
+
size={size}
|
|
94
|
+
disabled={disabled || isPending}
|
|
95
|
+
className={className ?? 'gap-2'}
|
|
96
|
+
>
|
|
97
|
+
{isPending ? (
|
|
98
|
+
<Loader2 className="h-4 w-4 animate-spin" />
|
|
99
|
+
) : (
|
|
100
|
+
<Users className="h-4 w-4" />
|
|
101
|
+
)}
|
|
93
102
|
{label}
|
|
94
103
|
<ChevronDown className="h-4 w-4 opacity-60" />
|
|
95
104
|
</Button>
|
|
@@ -105,8 +114,12 @@ export function AddToSharedCart({
|
|
|
105
114
|
) : (
|
|
106
115
|
<>
|
|
107
116
|
{hasCarts &&
|
|
108
|
-
carts.map(cart => (
|
|
109
|
-
<DropdownMenuItem
|
|
117
|
+
carts.map((cart) => (
|
|
118
|
+
<DropdownMenuItem
|
|
119
|
+
key={cart.id}
|
|
120
|
+
onSelect={() => add(cart)}
|
|
121
|
+
disabled={isPending}
|
|
122
|
+
>
|
|
110
123
|
<Users className="h-4 w-4 mr-2 opacity-70" />
|
|
111
124
|
<span className="truncate">{cart.name}</span>
|
|
112
125
|
</DropdownMenuItem>
|
|
@@ -114,7 +127,10 @@ export function AddToSharedCart({
|
|
|
114
127
|
{canCreate ? (
|
|
115
128
|
<>
|
|
116
129
|
{hasCarts && <DropdownMenuSeparator />}
|
|
117
|
-
<DropdownMenuItem
|
|
130
|
+
<DropdownMenuItem
|
|
131
|
+
onSelect={() => setCreateOpen(true)}
|
|
132
|
+
disabled={isPending}
|
|
133
|
+
>
|
|
118
134
|
<Plus className="h-4 w-4 mr-2" />
|
|
119
135
|
Create new shared cart
|
|
120
136
|
</DropdownMenuItem>
|
|
@@ -181,8 +197,9 @@ function CreateSharedCartDialog({
|
|
|
181
197
|
<DialogHeader>
|
|
182
198
|
<DialogTitle>Create a shared cart</DialogTitle>
|
|
183
199
|
<DialogDescription>
|
|
184
|
-
Start a new shared cart with {lines.length}
|
|
185
|
-
can build the order with
|
|
200
|
+
Start a new shared cart with {lines.length}{' '}
|
|
201
|
+
{lines.length === 1 ? 'item' : 'items'} so colleagues can build the order with
|
|
202
|
+
you.
|
|
186
203
|
</DialogDescription>
|
|
187
204
|
</DialogHeader>
|
|
188
205
|
<div className="space-y-4 py-4">
|
|
@@ -191,7 +208,7 @@ function CreateSharedCartDialog({
|
|
|
191
208
|
<Input
|
|
192
209
|
id="create-shared-cart-name"
|
|
193
210
|
value={name}
|
|
194
|
-
onChange={e => setName(e.target.value)}
|
|
211
|
+
onChange={(e) => setName(e.target.value)}
|
|
195
212
|
maxLength={255}
|
|
196
213
|
required
|
|
197
214
|
autoFocus
|
|
@@ -202,7 +219,7 @@ function CreateSharedCartDialog({
|
|
|
202
219
|
<Textarea
|
|
203
220
|
id="create-shared-cart-description"
|
|
204
221
|
value={description}
|
|
205
|
-
onChange={e => setDescription(e.target.value)}
|
|
222
|
+
onChange={(e) => setDescription(e.target.value)}
|
|
206
223
|
rows={3}
|
|
207
224
|
maxLength={1000}
|
|
208
225
|
placeholder="What is this cart for?"
|
|
@@ -210,7 +227,12 @@ function CreateSharedCartDialog({
|
|
|
210
227
|
</div>
|
|
211
228
|
</div>
|
|
212
229
|
<DialogFooter>
|
|
213
|
-
<Button
|
|
230
|
+
<Button
|
|
231
|
+
type="button"
|
|
232
|
+
variant="ghost"
|
|
233
|
+
onClick={() => onOpenChange(false)}
|
|
234
|
+
disabled={isPending}
|
|
235
|
+
>
|
|
214
236
|
Cancel
|
|
215
237
|
</Button>
|
|
216
238
|
<Button type="submit" disabled={!name.trim() || isPending}>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {Button} from '@/components/ui/button';
|
|
5
|
-
import {Textarea} from '@/components/ui/textarea';
|
|
6
|
-
import {CheckCircle, XCircle} from 'lucide-react';
|
|
7
|
-
import {
|
|
3
|
+
import { submitApprovalDecision } from '@/app/[locale]/account/approvals/actions';
|
|
4
|
+
import { Button } from '@/components/ui/button';
|
|
5
|
+
import { Textarea } from '@/components/ui/textarea';
|
|
6
|
+
import { CheckCircle, XCircle } from 'lucide-react';
|
|
7
|
+
import { useState, useTransition } from 'react';
|
|
8
8
|
|
|
9
9
|
interface ApprovalDecisionFormProps {
|
|
10
10
|
approvalRequestId: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function ApprovalDecisionForm({approvalRequestId}: ApprovalDecisionFormProps) {
|
|
13
|
+
export function ApprovalDecisionForm({ approvalRequestId }: ApprovalDecisionFormProps) {
|
|
14
14
|
const [comment, setComment] = useState('');
|
|
15
15
|
const [isPending, startTransition] = useTransition();
|
|
16
16
|
const [result, setResult] = useState<{ success: boolean; message?: string } | null>(null);
|
|
@@ -47,12 +47,8 @@ export function ApprovalDecisionForm({approvalRequestId}: ApprovalDecisionFormPr
|
|
|
47
47
|
<p className="text-sm text-red-600">{result.message || 'An error occurred'}</p>
|
|
48
48
|
)}
|
|
49
49
|
<div className="flex gap-2">
|
|
50
|
-
<Button
|
|
51
|
-
|
|
52
|
-
onClick={() => handleDecision('APPROVED')}
|
|
53
|
-
disabled={isPending}
|
|
54
|
-
>
|
|
55
|
-
<CheckCircle className="h-4 w-4 mr-1"/>
|
|
50
|
+
<Button size="sm" onClick={() => handleDecision('APPROVED')} disabled={isPending}>
|
|
51
|
+
<CheckCircle className="h-4 w-4 mr-1" />
|
|
56
52
|
Approve
|
|
57
53
|
</Button>
|
|
58
54
|
<Button
|
|
@@ -61,7 +57,7 @@ export function ApprovalDecisionForm({approvalRequestId}: ApprovalDecisionFormPr
|
|
|
61
57
|
onClick={() => handleDecision('REJECTED')}
|
|
62
58
|
disabled={isPending}
|
|
63
59
|
>
|
|
64
|
-
<XCircle className="h-4 w-4 mr-1"/>
|
|
60
|
+
<XCircle className="h-4 w-4 mr-1" />
|
|
65
61
|
Reject
|
|
66
62
|
</Button>
|
|
67
63
|
</div>
|
|
@@ -1,36 +1,44 @@
|
|
|
1
|
-
import {Badge} from '@/components/ui/badge';
|
|
1
|
+
import { Badge } from '@/components/ui/badge';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
Ban,
|
|
4
4
|
CheckCircle,
|
|
5
|
-
|
|
5
|
+
Clock,
|
|
6
6
|
Loader2,
|
|
7
|
-
Ban,
|
|
8
|
-
Timer,
|
|
9
7
|
MessageSquare,
|
|
8
|
+
Timer,
|
|
9
|
+
XCircle,
|
|
10
10
|
type LucideIcon,
|
|
11
11
|
} from 'lucide-react';
|
|
12
12
|
|
|
13
13
|
const STATUS_CONFIG: Record<string, { color: string; label: string; icon: LucideIcon }> = {
|
|
14
|
-
PENDING: {color: 'bg-gray-100 text-gray-800', label: 'Pending', icon: Clock},
|
|
15
|
-
IN_PROGRESS: {color: 'bg-blue-100 text-blue-800', label: 'In Progress', icon: Loader2},
|
|
16
|
-
APPROVED: {color: 'bg-green-100 text-green-800', label: 'Approved', icon: CheckCircle},
|
|
17
|
-
REJECTED: {color: 'bg-red-100 text-red-800', label: 'Rejected', icon: XCircle},
|
|
18
|
-
CANCELLED: {color: 'bg-gray-100 text-gray-500', label: 'Cancelled', icon: Ban},
|
|
19
|
-
EXPIRED: {color: 'bg-yellow-100 text-yellow-800', label: 'Expired', icon: Timer},
|
|
20
|
-
CHANGES_REQUESTED: {
|
|
14
|
+
PENDING: { color: 'bg-gray-100 text-gray-800', label: 'Pending', icon: Clock },
|
|
15
|
+
IN_PROGRESS: { color: 'bg-blue-100 text-blue-800', label: 'In Progress', icon: Loader2 },
|
|
16
|
+
APPROVED: { color: 'bg-green-100 text-green-800', label: 'Approved', icon: CheckCircle },
|
|
17
|
+
REJECTED: { color: 'bg-red-100 text-red-800', label: 'Rejected', icon: XCircle },
|
|
18
|
+
CANCELLED: { color: 'bg-gray-100 text-gray-500', label: 'Cancelled', icon: Ban },
|
|
19
|
+
EXPIRED: { color: 'bg-yellow-100 text-yellow-800', label: 'Expired', icon: Timer },
|
|
20
|
+
CHANGES_REQUESTED: {
|
|
21
|
+
color: 'bg-orange-100 text-orange-800',
|
|
22
|
+
label: 'Changes Requested',
|
|
23
|
+
icon: MessageSquare,
|
|
24
|
+
},
|
|
21
25
|
};
|
|
22
26
|
|
|
23
27
|
interface ApprovalStatusBadgeProps {
|
|
24
28
|
status: string;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
export function ApprovalStatusBadge({status}: ApprovalStatusBadgeProps) {
|
|
28
|
-
const config = STATUS_CONFIG[status] || {
|
|
31
|
+
export function ApprovalStatusBadge({ status }: ApprovalStatusBadgeProps) {
|
|
32
|
+
const config = STATUS_CONFIG[status] || {
|
|
33
|
+
color: 'bg-gray-100 text-gray-800',
|
|
34
|
+
label: status,
|
|
35
|
+
icon: Clock,
|
|
36
|
+
};
|
|
29
37
|
const Icon = config.icon;
|
|
30
38
|
|
|
31
39
|
return (
|
|
32
40
|
<Badge className={config.color} variant="secondary">
|
|
33
|
-
<Icon className="h-3 w-3 mr-1"/>
|
|
41
|
+
<Icon className="h-3 w-3 mr-1" />
|
|
34
42
|
{config.label}
|
|
35
43
|
</Badge>
|
|
36
44
|
);
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { switchBusinessUnitAction } from '@/components/layout/navbar/actions';
|
|
4
|
+
import { Button } from '@/components/ui/button';
|
|
4
5
|
import {
|
|
5
6
|
DropdownMenu,
|
|
6
7
|
DropdownMenuContent,
|
|
7
8
|
DropdownMenuItem,
|
|
8
9
|
DropdownMenuTrigger,
|
|
9
10
|
} from '@/components/ui/dropdown-menu';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {switchBusinessUnitAction} from '@/components/layout/navbar/actions';
|
|
11
|
+
import { Building2, Check, ChevronDown } from 'lucide-react';
|
|
12
|
+
import { useTransition } from 'react';
|
|
13
13
|
interface BusinessUnitSwitcherProps {
|
|
14
14
|
businessUnits: Array<{ id: string; name: string }>;
|
|
15
15
|
activeBusinessUnitId: string | null;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export function BusinessUnitSwitcher({businessUnits, activeBusinessUnitId}: BusinessUnitSwitcherProps) {
|
|
18
|
+
export function BusinessUnitSwitcher({ businessUnits, activeBusinessUnitId }: BusinessUnitSwitcherProps) {
|
|
19
19
|
const [isPending, startTransition] = useTransition();
|
|
20
|
-
const activeBu = businessUnits.find(bu => bu.id === activeBusinessUnitId);
|
|
20
|
+
const activeBu = businessUnits.find((bu) => bu.id === activeBusinessUnitId);
|
|
21
21
|
|
|
22
22
|
if (businessUnits.length <= 1) {
|
|
23
23
|
return null;
|
|
@@ -28,14 +28,14 @@ export function BusinessUnitSwitcher({businessUnits, activeBusinessUnitId}: Busi
|
|
|
28
28
|
<DropdownMenuTrigger asChild>
|
|
29
29
|
<Button variant="ghost" size="sm" className="w-full justify-between" disabled={isPending}>
|
|
30
30
|
<span className="flex items-center gap-2">
|
|
31
|
-
<Building2 className="h-4 w-4"/>
|
|
32
|
-
{isPending ? 'Switching...' :
|
|
31
|
+
<Building2 className="h-4 w-4" />
|
|
32
|
+
{isPending ? 'Switching...' : activeBu?.name ?? 'Select Unit'}
|
|
33
33
|
</span>
|
|
34
|
-
<ChevronDown className="h-3 w-3"/>
|
|
34
|
+
<ChevronDown className="h-3 w-3" />
|
|
35
35
|
</Button>
|
|
36
36
|
</DropdownMenuTrigger>
|
|
37
37
|
<DropdownMenuContent align="start">
|
|
38
|
-
{businessUnits.map(bu => (
|
|
38
|
+
{businessUnits.map((bu) => (
|
|
39
39
|
<DropdownMenuItem
|
|
40
40
|
key={bu.id}
|
|
41
41
|
onClick={() => {
|
|
@@ -45,7 +45,7 @@ export function BusinessUnitSwitcher({businessUnits, activeBusinessUnitId}: Busi
|
|
|
45
45
|
}}
|
|
46
46
|
>
|
|
47
47
|
<span className="flex items-center gap-2">
|
|
48
|
-
{bu.id === activeBusinessUnitId && <Check className="h-3 w-3"/>}
|
|
48
|
+
{bu.id === activeBusinessUnitId && <Check className="h-3 w-3" />}
|
|
49
49
|
{bu.name}
|
|
50
50
|
</span>
|
|
51
51
|
</DropdownMenuItem>
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { InstantSearchDropdown } from '@/components/commerce/instant-search-dropdown';
|
|
4
4
|
import { Input } from '@/components/ui/input';
|
|
5
5
|
import { KbdShortcut } from '@/components/ui/kbd-shortcut';
|
|
6
|
+
import { useRouter } from '@/i18n/navigation';
|
|
6
7
|
import { useSearchBar } from '@/lib/search-bar-context';
|
|
7
8
|
import { Search } from 'lucide-react';
|
|
8
|
-
import { useSearchParams } from 'next/navigation';
|
|
9
9
|
import { useTranslations } from 'next-intl';
|
|
10
|
-
import {
|
|
10
|
+
import { useSearchParams } from 'next/navigation';
|
|
11
11
|
import { useCallback, useEffect, useRef, useState, useTransition } from 'react';
|
|
12
12
|
|
|
13
13
|
export function CatalogSearchBar() {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ArrowRight } from 'lucide-react';
|
|
3
|
-
import { cacheLife, cacheTag } from 'next/cache';
|
|
4
|
-
import {getTranslations} from 'next-intl/server';
|
|
5
|
-
import { publicClient } from '@/lib/vendure/api';
|
|
6
|
-
import { SearchProductsQuery } from '@/lib/vendure/queries';
|
|
1
|
+
import { ProductCard } from '@/components/commerce/product-card';
|
|
7
2
|
import { readFragment } from '@/graphql';
|
|
3
|
+
import { Link } from '@/i18n/navigation';
|
|
4
|
+
import { publicClient } from '@/lib/vendure/api';
|
|
8
5
|
import { ProductCardFragment } from '@/lib/vendure/fragments';
|
|
9
|
-
import {
|
|
6
|
+
import { SearchProductsQuery } from '@/lib/vendure/queries';
|
|
7
|
+
import { ArrowRight } from 'lucide-react';
|
|
8
|
+
import { getTranslations } from 'next-intl/server';
|
|
9
|
+
import { cacheLife, cacheTag } from 'next/cache';
|
|
10
10
|
const PRODUCTS_PER_SECTION = 4;
|
|
11
11
|
|
|
12
12
|
interface CategoryProductSectionProps {
|
|
@@ -21,19 +21,28 @@ async function getCollectionPreviewProducts(slug: string, locale: string, channe
|
|
|
21
21
|
cacheLife('hours');
|
|
22
22
|
cacheTag(`collection-preview-${slug}-${locale}${channelToken ? `-${channelToken}` : ''}`);
|
|
23
23
|
|
|
24
|
-
const [result, error] = await publicClient.query(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
const [result, error] = await publicClient.query(
|
|
25
|
+
SearchProductsQuery,
|
|
26
|
+
{
|
|
27
|
+
input: {
|
|
28
|
+
collectionSlug: slug,
|
|
29
|
+
take: PRODUCTS_PER_SECTION,
|
|
30
|
+
skip: 0,
|
|
31
|
+
groupByProduct: true,
|
|
32
|
+
},
|
|
30
33
|
},
|
|
31
|
-
|
|
34
|
+
{ languageCode: locale, ...(channelToken ? { channelToken } : {}) },
|
|
35
|
+
);
|
|
32
36
|
if (error) return [];
|
|
33
37
|
return result.data.search.items;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
|
-
export async function CategoryProductSection({
|
|
40
|
+
export async function CategoryProductSection({
|
|
41
|
+
name,
|
|
42
|
+
slug,
|
|
43
|
+
locale,
|
|
44
|
+
channelToken,
|
|
45
|
+
}: CategoryProductSectionProps) {
|
|
37
46
|
const [products, t] = await Promise.all([
|
|
38
47
|
getCollectionPreviewProducts(slug, locale, channelToken),
|
|
39
48
|
getTranslations('Catalog'),
|
|
@@ -61,7 +70,10 @@ export async function CategoryProductSection({ name, slug, locale, channelToken
|
|
|
61
70
|
</div>
|
|
62
71
|
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
|
|
63
72
|
{products.map((product) => (
|
|
64
|
-
<ProductCard
|
|
73
|
+
<ProductCard
|
|
74
|
+
key={readFragment(ProductCardFragment, product).productId}
|
|
75
|
+
product={product}
|
|
76
|
+
/>
|
|
65
77
|
))}
|
|
66
78
|
</div>
|
|
67
79
|
</section>
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import Image from 'next/image';
|
|
4
|
-
import {useTranslations} from 'next-intl';
|
|
5
|
-
import {Link, usePathname} from '@/i18n/navigation';
|
|
6
|
-
import { ChevronRight, Layers, LayoutGrid } from 'lucide-react';
|
|
7
|
-
import {
|
|
8
|
-
Sheet,
|
|
9
|
-
SheetContent,
|
|
10
|
-
SheetHeader,
|
|
11
|
-
SheetTitle,
|
|
12
|
-
SheetTrigger,
|
|
13
|
-
} from '@/components/ui/sheet';
|
|
14
3
|
import { Button } from '@/components/ui/button';
|
|
15
|
-
import {
|
|
4
|
+
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from '@/components/ui/sheet';
|
|
16
5
|
import type { ResultOf } from '@/graphql';
|
|
6
|
+
import { Link, usePathname } from '@/i18n/navigation';
|
|
7
|
+
import { cn } from '@/lib/utils';
|
|
17
8
|
import type { GetTopCollectionsQuery } from '@/lib/vendure/queries';
|
|
9
|
+
import { ChevronRight, Layers, LayoutGrid } from 'lucide-react';
|
|
10
|
+
import { useTranslations } from 'next-intl';
|
|
11
|
+
import Image from 'next/image';
|
|
18
12
|
|
|
19
13
|
type Collection = ResultOf<typeof GetTopCollectionsQuery>['collections']['items'][number];
|
|
20
14
|
|
|
@@ -22,7 +16,17 @@ interface CategorySidebarProps {
|
|
|
22
16
|
collections: Collection[];
|
|
23
17
|
}
|
|
24
18
|
|
|
25
|
-
function CategoryLinks({
|
|
19
|
+
function CategoryLinks({
|
|
20
|
+
collections,
|
|
21
|
+
pathname,
|
|
22
|
+
categoriesLabel,
|
|
23
|
+
viewAllLabel,
|
|
24
|
+
}: {
|
|
25
|
+
collections: Collection[];
|
|
26
|
+
pathname: string;
|
|
27
|
+
categoriesLabel: string;
|
|
28
|
+
viewAllLabel: string;
|
|
29
|
+
}) {
|
|
26
30
|
return (
|
|
27
31
|
<nav className="space-y-1">
|
|
28
32
|
<h2 className="font-semibold text-sm pb-2 flex items-center gap-2">
|
|
@@ -33,9 +37,8 @@ function CategoryLinks({ collections, pathname, categoriesLabel, viewAllLabel }:
|
|
|
33
37
|
const href = `/collection/${collection.slug}`;
|
|
34
38
|
const isActive = pathname === href;
|
|
35
39
|
const hasChildren = collection.children && collection.children.length > 0;
|
|
36
|
-
const childActive =
|
|
37
|
-
(c) => pathname === `/collection/${c.slug}
|
|
38
|
-
);
|
|
40
|
+
const childActive =
|
|
41
|
+
hasChildren && collection.children!.some((c) => pathname === `/collection/${c.slug}`);
|
|
39
42
|
|
|
40
43
|
return (
|
|
41
44
|
<div key={collection.id}>
|
|
@@ -106,7 +109,12 @@ export function CategorySidebar({ collections }: CategorySidebarProps) {
|
|
|
106
109
|
<>
|
|
107
110
|
{/* Desktop: sticky sidebar */}
|
|
108
111
|
<div className="hidden lg:block sticky top-20">
|
|
109
|
-
<CategoryLinks
|
|
112
|
+
<CategoryLinks
|
|
113
|
+
collections={collections}
|
|
114
|
+
pathname={pathname}
|
|
115
|
+
categoriesLabel={t('categories')}
|
|
116
|
+
viewAllLabel={t('viewAll')}
|
|
117
|
+
/>
|
|
110
118
|
</div>
|
|
111
119
|
|
|
112
120
|
{/* Mobile: sheet trigger */}
|
|
@@ -123,7 +131,12 @@ export function CategorySidebar({ collections }: CategorySidebarProps) {
|
|
|
123
131
|
<SheetTitle>{t('categories')}</SheetTitle>
|
|
124
132
|
</SheetHeader>
|
|
125
133
|
<div className="px-4 pb-4">
|
|
126
|
-
<CategoryLinks
|
|
134
|
+
<CategoryLinks
|
|
135
|
+
collections={collections}
|
|
136
|
+
pathname={pathname}
|
|
137
|
+
categoriesLabel={t('categories')}
|
|
138
|
+
viewAllLabel={t('viewAll')}
|
|
139
|
+
/>
|
|
127
140
|
</div>
|
|
128
141
|
</SheetContent>
|
|
129
142
|
</Sheet>
|
|
@@ -6,7 +6,7 @@ interface CollectionHeroBannerProps {
|
|
|
6
6
|
imageUrl: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export function CollectionHeroBanner({name, description, imageUrl}: CollectionHeroBannerProps) {
|
|
9
|
+
export function CollectionHeroBanner({ name, description, imageUrl }: CollectionHeroBannerProps) {
|
|
10
10
|
return (
|
|
11
11
|
<section className="relative overflow-hidden rounded-lg mb-6 aspect-[21/9] lg:aspect-[14/3]">
|
|
12
12
|
<Image
|
|
@@ -22,9 +22,7 @@ export function CollectionHeroBanner({name, description, imageUrl}: CollectionHe
|
|
|
22
22
|
className="absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-black/10"
|
|
23
23
|
/>
|
|
24
24
|
<div className="absolute inset-x-0 bottom-0 p-6 md:p-8 text-white">
|
|
25
|
-
<h1 className="text-2xl md:text-4xl font-bold tracking-tight drop-shadow">
|
|
26
|
-
{name}
|
|
27
|
-
</h1>
|
|
25
|
+
<h1 className="text-2xl md:text-4xl font-bold tracking-tight drop-shadow">{name}</h1>
|
|
28
26
|
{description && (
|
|
29
27
|
<p className="mt-2 max-w-2xl text-sm md:text-base text-white/80 line-clamp-2 drop-shadow">
|
|
30
28
|
{description}
|
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
import {Badge} from '@/components/ui/badge';
|
|
2
|
-
import {
|
|
3
|
-
Clock,
|
|
4
|
-
CheckCircle,
|
|
5
|
-
XCircle,
|
|
6
|
-
Ban,
|
|
7
|
-
type LucideIcon,
|
|
8
|
-
} from 'lucide-react';
|
|
1
|
+
import { Badge } from '@/components/ui/badge';
|
|
2
|
+
import { Ban, CheckCircle, Clock, XCircle, type LucideIcon } from 'lucide-react';
|
|
9
3
|
|
|
10
4
|
const STATE_CONFIG: Record<string, { color: string; label: string; icon: LucideIcon }> = {
|
|
11
|
-
Pending: {color: 'bg-amber-100 text-amber-800', label: 'Pending', icon: Clock},
|
|
12
|
-
Active: {color: 'bg-green-100 text-green-800', label: 'Active', icon: CheckCircle},
|
|
13
|
-
Suspended: {color: 'bg-red-100 text-red-800', label: 'Suspended', icon: XCircle},
|
|
14
|
-
Denied: {color: 'bg-red-100 text-red-800', label: 'Denied', icon: Ban},
|
|
15
|
-
Closed: {color: 'bg-gray-100 text-gray-500', label: 'Closed', icon: Ban},
|
|
5
|
+
Pending: { color: 'bg-amber-100 text-amber-800', label: 'Pending', icon: Clock },
|
|
6
|
+
Active: { color: 'bg-green-100 text-green-800', label: 'Active', icon: CheckCircle },
|
|
7
|
+
Suspended: { color: 'bg-red-100 text-red-800', label: 'Suspended', icon: XCircle },
|
|
8
|
+
Denied: { color: 'bg-red-100 text-red-800', label: 'Denied', icon: Ban },
|
|
9
|
+
Closed: { color: 'bg-gray-100 text-gray-500', label: 'Closed', icon: Ban },
|
|
16
10
|
};
|
|
17
11
|
|
|
18
12
|
interface CompanyStateBadgeProps {
|
|
19
13
|
state: string;
|
|
20
14
|
}
|
|
21
15
|
|
|
22
|
-
export function CompanyStateBadge({state}: CompanyStateBadgeProps) {
|
|
23
|
-
const config = STATE_CONFIG[state] || {color: 'bg-gray-100 text-gray-800', label: state, icon: Clock};
|
|
16
|
+
export function CompanyStateBadge({ state }: CompanyStateBadgeProps) {
|
|
17
|
+
const config = STATE_CONFIG[state] || { color: 'bg-gray-100 text-gray-800', label: state, icon: Clock };
|
|
24
18
|
const Icon = config.icon;
|
|
25
19
|
|
|
26
20
|
return (
|
|
27
21
|
<Badge className={config.color} variant="secondary">
|
|
28
|
-
<Icon className="h-3 w-3 mr-1"/>
|
|
22
|
+
<Icon className="h-3 w-3 mr-1" />
|
|
29
23
|
{config.label}
|
|
30
24
|
</Badge>
|
|
31
25
|
);
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { switchCompanyAction } from '@/components/layout/navbar/actions';
|
|
4
|
+
import { Button } from '@/components/ui/button';
|
|
4
5
|
import {
|
|
5
6
|
DropdownMenu,
|
|
6
7
|
DropdownMenuContent,
|
|
7
8
|
DropdownMenuItem,
|
|
8
9
|
DropdownMenuTrigger,
|
|
9
10
|
} from '@/components/ui/dropdown-menu';
|
|
10
|
-
import {
|
|
11
|
-
import {Building, Check, ChevronDown} from 'lucide-react';
|
|
12
|
-
import {
|
|
13
|
-
import type {CompanyUserCompany} from '@/lib/vendure/queries';
|
|
11
|
+
import type { CompanyUserCompany } from '@/lib/vendure/queries';
|
|
12
|
+
import { Building, Check, ChevronDown } from 'lucide-react';
|
|
13
|
+
import { useTransition } from 'react';
|
|
14
14
|
|
|
15
15
|
interface CompanySwitcherProps {
|
|
16
16
|
companies: CompanyUserCompany[];
|
|
17
17
|
activeCompanyId: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export function CompanySwitcher({companies, activeCompanyId}: CompanySwitcherProps) {
|
|
20
|
+
export function CompanySwitcher({ companies, activeCompanyId }: CompanySwitcherProps) {
|
|
21
21
|
const [isPending, startTransition] = useTransition();
|
|
22
|
-
const activeCompany = companies.find(c => c.id === activeCompanyId);
|
|
22
|
+
const activeCompany = companies.find((c) => c.id === activeCompanyId);
|
|
23
23
|
|
|
24
24
|
if (companies.length <= 1) {
|
|
25
25
|
return null;
|
|
@@ -30,14 +30,14 @@ export function CompanySwitcher({companies, activeCompanyId}: CompanySwitcherPro
|
|
|
30
30
|
<DropdownMenuTrigger asChild>
|
|
31
31
|
<Button variant="ghost" size="sm" className="w-full justify-between" disabled={isPending}>
|
|
32
32
|
<span className="flex items-center gap-2">
|
|
33
|
-
<Building className="h-4 w-4"/>
|
|
34
|
-
{isPending ? 'Switching...' :
|
|
33
|
+
<Building className="h-4 w-4" />
|
|
34
|
+
{isPending ? 'Switching...' : activeCompany?.name ?? 'Select Company'}
|
|
35
35
|
</span>
|
|
36
|
-
<ChevronDown className="h-3 w-3"/>
|
|
36
|
+
<ChevronDown className="h-3 w-3" />
|
|
37
37
|
</Button>
|
|
38
38
|
</DropdownMenuTrigger>
|
|
39
39
|
<DropdownMenuContent align="start">
|
|
40
|
-
{companies.map(company => (
|
|
40
|
+
{companies.map((company) => (
|
|
41
41
|
<DropdownMenuItem
|
|
42
42
|
key={company.id}
|
|
43
43
|
onClick={() => {
|
|
@@ -47,7 +47,7 @@ export function CompanySwitcher({companies, activeCompanyId}: CompanySwitcherPro
|
|
|
47
47
|
}}
|
|
48
48
|
>
|
|
49
49
|
<span className="flex items-center gap-2">
|
|
50
|
-
{company.id === activeCompanyId && <Check className="h-3 w-3"/>}
|
|
50
|
+
{company.id === activeCompanyId && <Check className="h-3 w-3" />}
|
|
51
51
|
{company.name}
|
|
52
52
|
</span>
|
|
53
53
|
</DropdownMenuItem>
|