@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,28 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {Suspense} from 'react';
|
|
3
|
-
import {client} from '@/lib/vendure/api';
|
|
4
|
-
import {GetMySharedCartsQuery, GetCompanySharedCartsQuery} from '@/lib/vendure/queries';
|
|
5
|
-
import {getActiveCustomer, getCompanyAccount} from '@/lib/vendure/actions';
|
|
1
|
+
import { Price } from '@/components/commerce/price';
|
|
6
2
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from '@/components/
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
3
|
+
canCreateSharedCarts,
|
|
4
|
+
canManageSharedCarts,
|
|
5
|
+
roleLabel,
|
|
6
|
+
} from '@/components/commerce/shared-cart-role';
|
|
7
|
+
import { SharedCartStatusBadge } from '@/components/commerce/shared-cart-status-badge';
|
|
8
|
+
import { ErrorState } from '@/components/shared/error-state';
|
|
9
|
+
import { Pagination } from '@/components/shared/pagination';
|
|
10
|
+
import { Badge } from '@/components/ui/badge';
|
|
11
|
+
import { Button } from '@/components/ui/button';
|
|
12
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
|
13
|
+
import { Link, redirect } from '@/i18n/navigation';
|
|
14
|
+
import { formatDate } from '@/lib/format';
|
|
15
|
+
import { cn } from '@/lib/utils';
|
|
16
|
+
import { getActiveCustomer, getCompanyAccount } from '@/lib/vendure/actions';
|
|
17
|
+
import { client } from '@/lib/vendure/api';
|
|
18
|
+
import { GetCompanySharedCartsQuery, GetMySharedCartsQuery } from '@/lib/vendure/queries';
|
|
19
|
+
import { ArrowRight, Plus, ShoppingCart, Users } from 'lucide-react';
|
|
20
|
+
import type { Metadata } from 'next';
|
|
21
|
+
import { setRequestLocale } from 'next-intl/server';
|
|
22
|
+
import { Suspense } from 'react';
|
|
26
23
|
|
|
27
24
|
export const metadata: Metadata = {
|
|
28
25
|
title: 'Shared Carts',
|
|
@@ -31,7 +28,7 @@ export const metadata: Metadata = {
|
|
|
31
28
|
const ITEMS_PER_PAGE = 10;
|
|
32
29
|
|
|
33
30
|
export default function SharedCartsPage(props: {
|
|
34
|
-
params: Promise<{locale: string}>;
|
|
31
|
+
params: Promise<{ locale: string }>;
|
|
35
32
|
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
36
33
|
}) {
|
|
37
34
|
return (
|
|
@@ -54,10 +51,10 @@ async function SharedCartsContent({
|
|
|
54
51
|
params,
|
|
55
52
|
searchParamsPromise,
|
|
56
53
|
}: {
|
|
57
|
-
params: Promise<{locale: string}>;
|
|
54
|
+
params: Promise<{ locale: string }>;
|
|
58
55
|
searchParamsPromise: Promise<Record<string, string | string[] | undefined>>;
|
|
59
56
|
}) {
|
|
60
|
-
const {locale} = await params;
|
|
57
|
+
const { locale } = await params;
|
|
61
58
|
setRequestLocale(locale);
|
|
62
59
|
const [searchParams, activeCustomer, companyAccount] = await Promise.all([
|
|
63
60
|
searchParamsPromise,
|
|
@@ -80,11 +77,11 @@ async function SharedCartsContent({
|
|
|
80
77
|
const currentPage = Number.isFinite(parsedPage) && parsedPage > 0 ? parsedPage : 1;
|
|
81
78
|
const skip = (currentPage - 1) * ITEMS_PER_PAGE;
|
|
82
79
|
|
|
83
|
-
const options = {take: ITEMS_PER_PAGE, skip, sort: {updatedAt: 'DESC' as never}};
|
|
80
|
+
const options = { take: ITEMS_PER_PAGE, skip, sort: { updatedAt: 'DESC' as never } };
|
|
84
81
|
const [result, error] =
|
|
85
82
|
scope === 'company'
|
|
86
|
-
? await client.query(GetCompanySharedCartsQuery, {options})
|
|
87
|
-
: await client.query(GetMySharedCartsQuery, {options});
|
|
83
|
+
? await client.query(GetCompanySharedCartsQuery, { options })
|
|
84
|
+
: await client.query(GetMySharedCartsQuery, { options });
|
|
88
85
|
|
|
89
86
|
if (error) {
|
|
90
87
|
return (
|
|
@@ -96,7 +93,8 @@ async function SharedCartsContent({
|
|
|
96
93
|
);
|
|
97
94
|
}
|
|
98
95
|
|
|
99
|
-
const list =
|
|
96
|
+
const list =
|
|
97
|
+
'companySharedCarts' in result.data ? result.data.companySharedCarts : result.data.mySharedCarts;
|
|
100
98
|
const carts = list.items;
|
|
101
99
|
const totalItems = list.totalItems;
|
|
102
100
|
const totalPages = Math.ceil(totalItems / ITEMS_PER_PAGE);
|
|
@@ -125,9 +123,11 @@ async function SharedCartsContent({
|
|
|
125
123
|
</TableRow>
|
|
126
124
|
</TableHeader>
|
|
127
125
|
<TableBody>
|
|
128
|
-
{carts.map(cart => {
|
|
126
|
+
{carts.map((cart) => {
|
|
129
127
|
const isOwner = cart.owner.id === activeCustomer.id;
|
|
130
|
-
const membership = cart.members.find(
|
|
128
|
+
const membership = cart.members.find(
|
|
129
|
+
(m) => m.customer.id === activeCustomer.id,
|
|
130
|
+
);
|
|
131
131
|
const yourRole = isOwner ? 'owner' : membership?.role;
|
|
132
132
|
return (
|
|
133
133
|
<TableRow key={cart.id} className="hover:bg-muted/50">
|
|
@@ -154,17 +154,28 @@ async function SharedCartsContent({
|
|
|
154
154
|
<TableCell>
|
|
155
155
|
{cart.owner.firstName} {cart.owner.lastName}
|
|
156
156
|
</TableCell>
|
|
157
|
-
<TableCell className="text-center tabular-nums">
|
|
158
|
-
|
|
157
|
+
<TableCell className="text-center tabular-nums">
|
|
158
|
+
{cart.members.length}
|
|
159
|
+
</TableCell>
|
|
160
|
+
<TableCell className="text-center tabular-nums">
|
|
161
|
+
{cart.order.totalQuantity}
|
|
162
|
+
</TableCell>
|
|
159
163
|
<TableCell className="text-right">
|
|
160
|
-
<Price
|
|
164
|
+
<Price
|
|
165
|
+
value={cart.order.totalWithTax}
|
|
166
|
+
currencyCode={cart.order.currencyCode}
|
|
167
|
+
taxLabel="incl"
|
|
168
|
+
/>
|
|
161
169
|
</TableCell>
|
|
162
170
|
<TableCell className="text-muted-foreground whitespace-nowrap">
|
|
163
171
|
{formatDate(cart.updatedAt, locale)}
|
|
164
172
|
</TableCell>
|
|
165
173
|
<TableCell>
|
|
166
174
|
<Button asChild variant="ghost" size="icon">
|
|
167
|
-
<Link
|
|
175
|
+
<Link
|
|
176
|
+
href={`/account/shared-carts/${cart.id}`}
|
|
177
|
+
aria-label={`Open ${cart.name}`}
|
|
178
|
+
>
|
|
168
179
|
<ArrowRight className="h-4 w-4" />
|
|
169
180
|
</Link>
|
|
170
181
|
</Button>
|
|
@@ -186,7 +197,7 @@ async function SharedCartsContent({
|
|
|
186
197
|
);
|
|
187
198
|
}
|
|
188
199
|
|
|
189
|
-
function Header({canCreate}: {canCreate: boolean}) {
|
|
200
|
+
function Header({ canCreate }: { canCreate: boolean }) {
|
|
190
201
|
return (
|
|
191
202
|
<div className="flex flex-wrap items-start justify-between gap-4 mb-6">
|
|
192
203
|
<div>
|
|
@@ -210,11 +221,13 @@ function Header({canCreate}: {canCreate: boolean}) {
|
|
|
210
221
|
|
|
211
222
|
// Segmented control letting a company admin switch between their own carts and every cart in the
|
|
212
223
|
// company. Rendered only for admins; the query and access check are enforced server-side.
|
|
213
|
-
function ScopeTabs({scope}: {scope: 'mine' | 'company'}) {
|
|
224
|
+
function ScopeTabs({ scope }: { scope: 'mine' | 'company' }) {
|
|
214
225
|
const tabClass = (active: boolean) =>
|
|
215
226
|
cn(
|
|
216
227
|
'px-3 py-1.5 text-sm font-medium rounded-md transition-colors',
|
|
217
|
-
active
|
|
228
|
+
active
|
|
229
|
+
? 'bg-background shadow-sm text-foreground'
|
|
230
|
+
: 'text-muted-foreground hover:text-foreground',
|
|
218
231
|
);
|
|
219
232
|
return (
|
|
220
233
|
<div className="mb-6 inline-flex rounded-lg border bg-muted p-1">
|
|
@@ -228,7 +241,7 @@ function ScopeTabs({scope}: {scope: 'mine' | 'company'}) {
|
|
|
228
241
|
);
|
|
229
242
|
}
|
|
230
243
|
|
|
231
|
-
function EmptyState({canCreate, scope}: {canCreate: boolean; scope: 'mine' | 'company'}) {
|
|
244
|
+
function EmptyState({ canCreate, scope }: { canCreate: boolean; scope: 'mine' | 'company' }) {
|
|
232
245
|
return (
|
|
233
246
|
<div className="border border-dashed rounded-lg py-16 px-6 text-center">
|
|
234
247
|
<div className="mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted">
|
|
@@ -1,26 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { redirect } from '@/i18n/navigation';
|
|
2
|
+
import { getActiveChannelToken } from '@/lib/channel-server';
|
|
3
3
|
import { getActiveCustomer } from '@/lib/vendure/actions';
|
|
4
4
|
import { getActiveChannelCached } from '@/lib/vendure/cached';
|
|
5
|
-
import {
|
|
6
|
-
import { getActiveUserShoppingList, getActiveUserShoppingLists } from '../actions';
|
|
5
|
+
import type { Metadata } from 'next';
|
|
7
6
|
import { notFound } from 'next/navigation';
|
|
8
|
-
import {
|
|
7
|
+
import { Suspense } from 'react';
|
|
8
|
+
import { getActiveUserShoppingList, getActiveUserShoppingLists } from '../actions';
|
|
9
9
|
import { ShoppingListDetailClient } from './shopping-list-detail-client';
|
|
10
10
|
|
|
11
11
|
export const metadata: Metadata = {
|
|
12
12
|
title: 'Shopping List',
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export default async function ShoppingListDetailPage({
|
|
15
|
+
export default async function ShoppingListDetailPage({
|
|
16
|
+
params,
|
|
17
|
+
}: {
|
|
18
|
+
params: Promise<{ locale: string; id: string }>;
|
|
19
|
+
}) {
|
|
16
20
|
return (
|
|
17
|
-
<Suspense
|
|
21
|
+
<Suspense
|
|
22
|
+
fallback={
|
|
23
|
+
<div className="flex items-center justify-center py-12">
|
|
24
|
+
<p className="text-sm text-muted-foreground">Loading...</p>
|
|
25
|
+
</div>
|
|
26
|
+
}
|
|
27
|
+
>
|
|
18
28
|
<ShoppingListDetailContent paramsPromise={params} />
|
|
19
29
|
</Suspense>
|
|
20
30
|
);
|
|
21
31
|
}
|
|
22
32
|
|
|
23
|
-
async function ShoppingListDetailContent({
|
|
33
|
+
async function ShoppingListDetailContent({
|
|
34
|
+
paramsPromise,
|
|
35
|
+
}: {
|
|
36
|
+
paramsPromise: Promise<{ locale: string; id: string }>;
|
|
37
|
+
}) {
|
|
24
38
|
const { id } = await paramsPromise;
|
|
25
39
|
|
|
26
40
|
const customer = await getActiveCustomer();
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { useLocale, useTranslations } from 'next-intl';
|
|
5
|
-
import { useRouter } from '@/i18n/navigation';
|
|
6
|
-
import Image from 'next/image';
|
|
7
|
-
import {Link} from '@/i18n/navigation';
|
|
8
|
-
import { Button } from '@/components/ui/button';
|
|
9
|
-
import { Input } from '@/components/ui/input';
|
|
10
|
-
import { Switch } from '@/components/ui/switch';
|
|
11
|
-
import { Badge } from '@/components/ui/badge';
|
|
12
|
-
import { Label } from '@/components/ui/label';
|
|
13
|
-
import {
|
|
14
|
-
DropdownMenu,
|
|
15
|
-
DropdownMenuContent,
|
|
16
|
-
DropdownMenuItem,
|
|
17
|
-
DropdownMenuTrigger,
|
|
18
|
-
} from '@/components/ui/dropdown-menu';
|
|
3
|
+
import { Price } from '@/components/commerce/price';
|
|
19
4
|
import {
|
|
20
5
|
AlertDialog,
|
|
21
6
|
AlertDialogAction,
|
|
@@ -27,30 +12,44 @@ import {
|
|
|
27
12
|
AlertDialogTitle,
|
|
28
13
|
AlertDialogTrigger,
|
|
29
14
|
} from '@/components/ui/alert-dialog';
|
|
15
|
+
import { Badge } from '@/components/ui/badge';
|
|
16
|
+
import { Button } from '@/components/ui/button';
|
|
17
|
+
import {
|
|
18
|
+
DropdownMenu,
|
|
19
|
+
DropdownMenuContent,
|
|
20
|
+
DropdownMenuItem,
|
|
21
|
+
DropdownMenuTrigger,
|
|
22
|
+
} from '@/components/ui/dropdown-menu';
|
|
23
|
+
import { Input } from '@/components/ui/input';
|
|
24
|
+
import { Label } from '@/components/ui/label';
|
|
25
|
+
import { Switch } from '@/components/ui/switch';
|
|
26
|
+
import { Textarea } from '@/components/ui/textarea';
|
|
27
|
+
import { Link, useRouter } from '@/i18n/navigation';
|
|
28
|
+
import { formatDate } from '@/lib/format';
|
|
30
29
|
import {
|
|
31
30
|
ArrowLeft,
|
|
31
|
+
Check,
|
|
32
32
|
Copy,
|
|
33
|
-
|
|
33
|
+
MessageSquare,
|
|
34
34
|
Minus,
|
|
35
|
+
MoreHorizontal,
|
|
36
|
+
MoveRight,
|
|
35
37
|
Pencil,
|
|
36
38
|
Plus,
|
|
37
39
|
ShoppingCart,
|
|
38
40
|
Trash2,
|
|
39
|
-
MoveRight,
|
|
40
|
-
Check,
|
|
41
|
-
MessageSquare,
|
|
42
41
|
} from 'lucide-react';
|
|
43
|
-
import {
|
|
44
|
-
import
|
|
42
|
+
import { useLocale, useTranslations } from 'next-intl';
|
|
43
|
+
import Image from 'next/image';
|
|
44
|
+
import { useCallback, useRef, useState, useTransition } from 'react';
|
|
45
45
|
import { toast } from 'sonner';
|
|
46
|
-
import { Textarea } from '@/components/ui/textarea';
|
|
47
46
|
import {
|
|
48
|
-
updateShoppingList,
|
|
49
|
-
deleteShoppingList,
|
|
50
|
-
setShoppingListVisibility,
|
|
51
|
-
removeFromShoppingList,
|
|
52
47
|
addShoppingListItemsToOrder,
|
|
48
|
+
deleteShoppingList,
|
|
53
49
|
moveShoppingListItems,
|
|
50
|
+
removeFromShoppingList,
|
|
51
|
+
setShoppingListVisibility,
|
|
52
|
+
updateShoppingList,
|
|
54
53
|
updateShoppingListItem,
|
|
55
54
|
} from '../actions';
|
|
56
55
|
|
|
@@ -224,7 +223,11 @@ function ItemNoteEditor({
|
|
|
224
223
|
);
|
|
225
224
|
}
|
|
226
225
|
|
|
227
|
-
export function ShoppingListDetailClient({
|
|
226
|
+
export function ShoppingListDetailClient({
|
|
227
|
+
shoppingList,
|
|
228
|
+
otherShoppingLists,
|
|
229
|
+
currencyCode,
|
|
230
|
+
}: ShoppingListDetailClientProps) {
|
|
228
231
|
const tRoot = useTranslations('ShoppingLists');
|
|
229
232
|
const t = useTranslations('ShoppingLists.detail');
|
|
230
233
|
const router = useRouter();
|
|
@@ -412,7 +415,7 @@ export function ShoppingListDetailClient({ shoppingList, otherShoppingLists, cur
|
|
|
412
415
|
<AlertDialogHeader>
|
|
413
416
|
<AlertDialogTitle>{t('deleteDialogTitle')}</AlertDialogTitle>
|
|
414
417
|
<AlertDialogDescription>
|
|
415
|
-
{t('deleteDialogDescription', {name: shoppingList.name})}
|
|
418
|
+
{t('deleteDialogDescription', { name: shoppingList.name })}
|
|
416
419
|
</AlertDialogDescription>
|
|
417
420
|
</AlertDialogHeader>
|
|
418
421
|
<AlertDialogFooter>
|
|
@@ -435,13 +438,13 @@ export function ShoppingListDetailClient({ shoppingList, otherShoppingLists, cur
|
|
|
435
438
|
{items.length > 0 && (
|
|
436
439
|
<div className="flex items-center justify-between mb-4">
|
|
437
440
|
<p className="text-sm text-muted-foreground">
|
|
438
|
-
{tRoot('itemCount', {count: shoppingList.totalItems})}
|
|
441
|
+
{tRoot('itemCount', { count: shoppingList.totalItems })}
|
|
439
442
|
</p>
|
|
440
443
|
<Button onClick={handleAddAllToCart} disabled={isPending || inStockItems.length === 0}>
|
|
441
444
|
<ShoppingCart className="mr-2 h-4 w-4" />
|
|
442
445
|
{inStockItems.length === items.length
|
|
443
446
|
? t('addAllToCartButton')
|
|
444
|
-
: t('addInStockToCartButton', {count: inStockItems.length})}
|
|
447
|
+
: t('addInStockToCartButton', { count: inStockItems.length })}
|
|
445
448
|
</Button>
|
|
446
449
|
</div>
|
|
447
450
|
)}
|
|
@@ -457,15 +460,15 @@ export function ShoppingListDetailClient({ shoppingList, otherShoppingLists, cur
|
|
|
457
460
|
) : (
|
|
458
461
|
<div className="space-y-4">
|
|
459
462
|
{items.map((item) => (
|
|
460
|
-
<div
|
|
461
|
-
key={item.id}
|
|
462
|
-
className="flex items-center gap-4 border rounded-lg p-4"
|
|
463
|
-
>
|
|
463
|
+
<div key={item.id} className="flex items-center gap-4 border rounded-lg p-4">
|
|
464
464
|
{/* Thumbnail */}
|
|
465
465
|
<Link href={`/product/${item.productVariant.product.slug}`} className="shrink-0">
|
|
466
466
|
{item.productVariant.product.featuredAsset ? (
|
|
467
467
|
<Image
|
|
468
|
-
src={
|
|
468
|
+
src={
|
|
469
|
+
item.productVariant.product.featuredAsset.preview +
|
|
470
|
+
'?preset=thumb'
|
|
471
|
+
}
|
|
469
472
|
alt={item.productVariant.product.name}
|
|
470
473
|
width={80}
|
|
471
474
|
height={80}
|
|
@@ -486,14 +489,19 @@ export function ShoppingListDetailClient({ shoppingList, otherShoppingLists, cur
|
|
|
486
489
|
</Link>
|
|
487
490
|
<p className="text-sm text-muted-foreground">{item.productVariant.name}</p>
|
|
488
491
|
<div className="flex items-center gap-2 mt-1">
|
|
489
|
-
<Price
|
|
492
|
+
<Price
|
|
493
|
+
value={item.productVariant.priceWithTax}
|
|
494
|
+
currencyCode={currencyCode}
|
|
495
|
+
/>
|
|
490
496
|
{item.purchased && (
|
|
491
497
|
<Badge variant="secondary">{t('purchasedBadge')}</Badge>
|
|
492
498
|
)}
|
|
493
499
|
{item.productVariant.stockLevel === OUT_OF_STOCK ? (
|
|
494
500
|
<Badge variant="destructive">{t('outOfStockBadge')}</Badge>
|
|
495
501
|
) : (
|
|
496
|
-
<Badge variant="outline" className="text-green-600 border-green-600">
|
|
502
|
+
<Badge variant="outline" className="text-green-600 border-green-600">
|
|
503
|
+
{t('inStockBadge')}
|
|
504
|
+
</Badge>
|
|
497
505
|
)}
|
|
498
506
|
</div>
|
|
499
507
|
<ItemQuantityControl
|
|
@@ -511,7 +519,7 @@ export function ShoppingListDetailClient({ shoppingList, otherShoppingLists, cur
|
|
|
511
519
|
disabled={isPending}
|
|
512
520
|
/>
|
|
513
521
|
<p className="text-xs text-muted-foreground mt-1">
|
|
514
|
-
{t('addedDate', {date: formatDate(item.createdAt, locale)})}
|
|
522
|
+
{t('addedDate', { date: formatDate(item.createdAt, locale) })}
|
|
515
523
|
</p>
|
|
516
524
|
</div>
|
|
517
525
|
|
|
@@ -522,7 +530,11 @@ export function ShoppingListDetailClient({ shoppingList, otherShoppingLists, cur
|
|
|
522
530
|
size="sm"
|
|
523
531
|
onClick={() => handleAddItemToCart(item.id)}
|
|
524
532
|
disabled={isPending || item.productVariant.stockLevel === OUT_OF_STOCK}
|
|
525
|
-
title={
|
|
533
|
+
title={
|
|
534
|
+
item.productVariant.stockLevel === OUT_OF_STOCK
|
|
535
|
+
? t('outOfStockTitle')
|
|
536
|
+
: t('addToCartTitle')
|
|
537
|
+
}
|
|
526
538
|
>
|
|
527
539
|
<ShoppingCart className="h-4 w-4" />
|
|
528
540
|
</Button>
|
|
@@ -534,15 +546,16 @@ export function ShoppingListDetailClient({ shoppingList, otherShoppingLists, cur
|
|
|
534
546
|
</Button>
|
|
535
547
|
</DropdownMenuTrigger>
|
|
536
548
|
<DropdownMenuContent align="end">
|
|
537
|
-
{otherShoppingLists.length > 0 &&
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
549
|
+
{otherShoppingLists.length > 0 &&
|
|
550
|
+
otherShoppingLists.map((target) => (
|
|
551
|
+
<DropdownMenuItem
|
|
552
|
+
key={target.id}
|
|
553
|
+
onClick={() => handleMoveItem(item.id, target.id)}
|
|
554
|
+
>
|
|
555
|
+
<MoveRight className="mr-2 h-4 w-4" />
|
|
556
|
+
{t('moveToMenuItem', { listName: target.name })}
|
|
557
|
+
</DropdownMenuItem>
|
|
558
|
+
))}
|
|
546
559
|
<DropdownMenuItem
|
|
547
560
|
onClick={() => handleRemoveItem(item.id)}
|
|
548
561
|
className="text-destructive"
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use server';
|
|
2
2
|
|
|
3
3
|
import { FragmentOf, readFragment } from '@/graphql';
|
|
4
|
+
import { redirect } from '@/i18n/navigation';
|
|
4
5
|
import { getAuthToken, setAuthToken } from '@/lib/auth';
|
|
5
6
|
import { client } from '@/lib/vendure/api';
|
|
6
7
|
import { ShoppingListFragment, ShoppingListItemFragment } from '@/lib/vendure/fragments';
|
|
7
8
|
import {
|
|
8
|
-
AddToShoppingListMutation,
|
|
9
9
|
AddShoppingListItemsToOrderMutation,
|
|
10
|
+
AddToShoppingListMutation,
|
|
10
11
|
CreateShoppingListMutation,
|
|
11
12
|
DeleteShoppingListMutation,
|
|
12
13
|
MoveShoppingListItemsMutation,
|
|
@@ -22,7 +23,6 @@ import {
|
|
|
22
23
|
GetShoppingListsWithItemVariantsQuery,
|
|
23
24
|
} from '@/lib/vendure/queries';
|
|
24
25
|
import { updateTag } from 'next/cache';
|
|
25
|
-
import { redirect } from '@/i18n/navigation';
|
|
26
26
|
|
|
27
27
|
// --- Data fetching (query + unmask) ---
|
|
28
28
|
|
|
@@ -162,7 +162,9 @@ export async function createShoppingList(name: string, description?: string) {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
export async function updateShoppingList(id: string, name?: string, description?: string) {
|
|
165
|
-
const [result, error] = await client.mutate(UpdateShoppingListMutation, {
|
|
165
|
+
const [result, error] = await client.mutate(UpdateShoppingListMutation, {
|
|
166
|
+
input: { id, name, description },
|
|
167
|
+
});
|
|
166
168
|
|
|
167
169
|
if (error) {
|
|
168
170
|
return { success: false, error: 'Failed to update shopping list' };
|
|
@@ -210,7 +212,10 @@ export async function addShoppingListItemsToOrder(itemIds: string[]) {
|
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
export async function moveShoppingListItems(itemIds: string[], targetShoppingListId: string) {
|
|
213
|
-
const [result, error] = await client.mutate(MoveShoppingListItemsMutation, {
|
|
215
|
+
const [result, error] = await client.mutate(MoveShoppingListItemsMutation, {
|
|
216
|
+
itemIds,
|
|
217
|
+
targetShoppingListId,
|
|
218
|
+
});
|
|
214
219
|
|
|
215
220
|
if (error) {
|
|
216
221
|
return { success: false, error: 'Failed to move shopping list items' };
|
package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/create-shopping-list-form.tsx
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useState, useTransition } from 'react';
|
|
4
3
|
import { Button } from '@/components/ui/button';
|
|
4
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog';
|
|
5
5
|
import { Input } from '@/components/ui/input';
|
|
6
6
|
import { Label } from '@/components/ui/label';
|
|
7
|
-
import {
|
|
8
|
-
Dialog,
|
|
9
|
-
DialogContent,
|
|
10
|
-
DialogHeader,
|
|
11
|
-
DialogTitle,
|
|
12
|
-
DialogTrigger,
|
|
13
|
-
} from '@/components/ui/dialog';
|
|
7
|
+
import { useRouter } from '@/i18n/navigation';
|
|
14
8
|
import { Plus } from 'lucide-react';
|
|
15
|
-
import {
|
|
9
|
+
import { useTranslations } from 'next-intl';
|
|
10
|
+
import { useState, useTransition } from 'react';
|
|
16
11
|
import { toast } from 'sonner';
|
|
17
|
-
import {
|
|
18
|
-
import {useTranslations} from 'next-intl';
|
|
12
|
+
import { createShoppingList } from './actions';
|
|
19
13
|
|
|
20
14
|
export function CreateShoppingListForm() {
|
|
21
15
|
const tRoot = useTranslations('ShoppingLists');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
|
2
1
|
import { Skeleton } from '@/components/ui/skeleton';
|
|
2
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
|
3
3
|
|
|
4
4
|
export default function ShoppingListsLoading() {
|
|
5
5
|
return (
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getActiveCustomer } from '@/lib/vendure/actions';
|
|
3
|
-
import { getActiveUserShoppingLists } from './actions';
|
|
1
|
+
import { ErrorState } from '@/components/shared/error-state';
|
|
4
2
|
import { Badge } from '@/components/ui/badge';
|
|
5
3
|
import { Button } from '@/components/ui/button';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
TableBody,
|
|
9
|
-
TableCell,
|
|
10
|
-
TableHead,
|
|
11
|
-
TableHeader,
|
|
12
|
-
TableRow,
|
|
13
|
-
} from '@/components/ui/table';
|
|
14
|
-
import { ErrorState } from '@/components/shared/error-state';
|
|
15
|
-
import { ArrowRightIcon } from 'lucide-react';
|
|
4
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
|
5
|
+
import { Link, redirect } from '@/i18n/navigation';
|
|
16
6
|
import { formatDate } from '@/lib/format';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
7
|
+
import { getActiveCustomer } from '@/lib/vendure/actions';
|
|
8
|
+
import { ArrowRightIcon } from 'lucide-react';
|
|
9
|
+
import type { Metadata } from 'next';
|
|
10
|
+
import { getTranslations, setRequestLocale } from 'next-intl/server';
|
|
11
|
+
import { getActiveUserShoppingLists } from './actions';
|
|
20
12
|
import { CreateShoppingListForm } from './create-shopping-list-form';
|
|
21
13
|
|
|
22
14
|
export const metadata: Metadata = {
|
|
@@ -36,7 +28,17 @@ type ShoppingListRow = {
|
|
|
36
28
|
|
|
37
29
|
type ShoppingListsTranslations = Awaited<ReturnType<typeof getTranslations<'ShoppingLists'>>>;
|
|
38
30
|
|
|
39
|
-
function ShoppingListTable({
|
|
31
|
+
function ShoppingListTable({
|
|
32
|
+
lists,
|
|
33
|
+
showOwner,
|
|
34
|
+
locale,
|
|
35
|
+
t,
|
|
36
|
+
}: {
|
|
37
|
+
lists: ShoppingListRow[];
|
|
38
|
+
showOwner?: boolean;
|
|
39
|
+
locale: string;
|
|
40
|
+
t: ShoppingListsTranslations;
|
|
41
|
+
}) {
|
|
40
42
|
return (
|
|
41
43
|
<div className="border rounded-lg">
|
|
42
44
|
<Table>
|
|
@@ -55,33 +57,26 @@ function ShoppingListTable({ lists, showOwner, locale, t }: { lists: ShoppingLis
|
|
|
55
57
|
<TableRow key={list.id} className="hover:bg-muted/50">
|
|
56
58
|
<TableCell className="font-medium">
|
|
57
59
|
<span className="flex items-center gap-2">
|
|
58
|
-
<Link
|
|
60
|
+
<Link
|
|
61
|
+
href={`/account/shopping-lists/${list.id}`}
|
|
62
|
+
className="hover:underline"
|
|
63
|
+
>
|
|
59
64
|
{list.name}
|
|
60
65
|
</Link>
|
|
61
|
-
{list.isDefault && (
|
|
62
|
-
<Badge variant="outline">{t('defaultBadge')}</Badge>
|
|
63
|
-
)}
|
|
66
|
+
{list.isDefault && <Badge variant="outline">{t('defaultBadge')}</Badge>}
|
|
64
67
|
</span>
|
|
65
68
|
{list.description && (
|
|
66
|
-
<p className="text-sm text-muted-foreground mt-1">
|
|
67
|
-
{list.description}
|
|
68
|
-
</p>
|
|
69
|
+
<p className="text-sm text-muted-foreground mt-1">{list.description}</p>
|
|
69
70
|
)}
|
|
70
71
|
</TableCell>
|
|
71
|
-
{showOwner &&
|
|
72
|
-
|
|
73
|
-
)}
|
|
74
|
-
<TableCell>
|
|
75
|
-
{t('itemCount', {count: list.totalItems})}
|
|
76
|
-
</TableCell>
|
|
72
|
+
{showOwner && <TableCell>{list.owner}</TableCell>}
|
|
73
|
+
<TableCell>{t('itemCount', { count: list.totalItems })}</TableCell>
|
|
77
74
|
<TableCell>
|
|
78
75
|
<Badge variant={list.isPublic ? 'default' : 'secondary'}>
|
|
79
76
|
{list.isPublic ? t('publicBadge') : t('privateBadge')}
|
|
80
77
|
</Badge>
|
|
81
78
|
</TableCell>
|
|
82
|
-
<TableCell>
|
|
83
|
-
{formatDate(list.createdAt, locale)}
|
|
84
|
-
</TableCell>
|
|
79
|
+
<TableCell>{formatDate(list.createdAt, locale)}</TableCell>
|
|
85
80
|
<TableCell>
|
|
86
81
|
<Button asChild variant="outline" size="sm">
|
|
87
82
|
<Link href={`/account/shopping-lists/${list.id}`}>
|
|
@@ -97,13 +92,10 @@ function ShoppingListTable({ lists, showOwner, locale, t }: { lists: ShoppingLis
|
|
|
97
92
|
);
|
|
98
93
|
}
|
|
99
94
|
|
|
100
|
-
export default async function ShoppingListsPage({params}: {params: Promise<{locale: string}>}) {
|
|
101
|
-
const {locale} = await params;
|
|
95
|
+
export default async function ShoppingListsPage({ params }: { params: Promise<{ locale: string }> }) {
|
|
96
|
+
const { locale } = await params;
|
|
102
97
|
setRequestLocale(locale);
|
|
103
|
-
const [t, customer] = await Promise.all([
|
|
104
|
-
getTranslations('ShoppingLists'),
|
|
105
|
-
getActiveCustomer(),
|
|
106
|
-
]);
|
|
98
|
+
const [t, customer] = await Promise.all([getTranslations('ShoppingLists'), getActiveCustomer()]);
|
|
107
99
|
if (!customer) {
|
|
108
100
|
return await redirect('/sign-in');
|
|
109
101
|
}
|
|
@@ -130,9 +122,7 @@ export default async function ShoppingListsPage({params}: {params: Promise<{loca
|
|
|
130
122
|
isPublic: list.isPublic,
|
|
131
123
|
totalItems: list.totalItems,
|
|
132
124
|
createdAt: list.createdAt,
|
|
133
|
-
owner: list.customer
|
|
134
|
-
? `${list.customer.firstName} ${list.customer.lastName}`
|
|
135
|
-
: undefined,
|
|
125
|
+
owner: list.customer ? `${list.customer.firstName} ${list.customer.lastName}` : undefined,
|
|
136
126
|
};
|
|
137
127
|
if (list.customer?.id === customer.id) {
|
|
138
128
|
myLists.push(row);
|