@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,18 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {getActiveCustomer} from '@/lib/vendure/actions';
|
|
6
|
-
import {getActiveChannelCached} from '@/lib/vendure/cached';
|
|
7
|
-
import {getActiveChannelToken} from '@/lib/channel-server';
|
|
8
|
-
import {
|
|
9
|
-
Table,
|
|
10
|
-
TableBody,
|
|
11
|
-
TableCell,
|
|
12
|
-
TableHead,
|
|
13
|
-
TableHeader,
|
|
14
|
-
TableRow,
|
|
15
|
-
} from '@/components/ui/table';
|
|
1
|
+
import { Price } from '@/components/commerce/price';
|
|
2
|
+
import { QuoteStatusBadge } from '@/components/commerce/quote-status-badge';
|
|
3
|
+
import { ErrorState } from '@/components/shared/error-state';
|
|
4
|
+
import { Button } from '@/components/ui/button';
|
|
16
5
|
import {
|
|
17
6
|
Pagination,
|
|
18
7
|
PaginationContent,
|
|
@@ -22,14 +11,18 @@ import {
|
|
|
22
11
|
PaginationNext,
|
|
23
12
|
PaginationPrevious,
|
|
24
13
|
} from '@/components/ui/pagination';
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
14
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
|
15
|
+
import { Link, redirect } from '@/i18n/navigation';
|
|
16
|
+
import { getActiveChannelToken } from '@/lib/channel-server';
|
|
17
|
+
import { formatDate } from '@/lib/format';
|
|
18
|
+
import { getActiveCustomer } from '@/lib/vendure/actions';
|
|
19
|
+
import { client } from '@/lib/vendure/api';
|
|
20
|
+
import { getActiveChannelCached } from '@/lib/vendure/cached';
|
|
21
|
+
import { GetMyQuotesQuery } from '@/lib/vendure/queries';
|
|
22
|
+
import { ArrowRightIcon, Plus } from 'lucide-react';
|
|
23
|
+
import type { Metadata } from 'next';
|
|
24
|
+
import { getTranslations, setRequestLocale } from 'next-intl/server';
|
|
25
|
+
import { Suspense } from 'react';
|
|
33
26
|
|
|
34
27
|
export const metadata: Metadata = {
|
|
35
28
|
title: 'Quotes',
|
|
@@ -49,7 +42,17 @@ type QuoteRow = {
|
|
|
49
42
|
|
|
50
43
|
type QuotesTranslations = Awaited<ReturnType<typeof getTranslations<'Quotes'>>>;
|
|
51
44
|
|
|
52
|
-
function QuoteTable({
|
|
45
|
+
function QuoteTable({
|
|
46
|
+
quotes,
|
|
47
|
+
locale,
|
|
48
|
+
currencyCode,
|
|
49
|
+
t,
|
|
50
|
+
}: {
|
|
51
|
+
quotes: QuoteRow[];
|
|
52
|
+
locale: string;
|
|
53
|
+
currencyCode: string;
|
|
54
|
+
t: QuotesTranslations;
|
|
55
|
+
}) {
|
|
53
56
|
return (
|
|
54
57
|
<div className="border rounded-lg">
|
|
55
58
|
<Table>
|
|
@@ -69,22 +72,16 @@ function QuoteTable({quotes, locale, currencyCode, t}: {quotes: QuoteRow[]; loca
|
|
|
69
72
|
<TableCell className="font-medium">
|
|
70
73
|
<Button asChild variant="outline">
|
|
71
74
|
<Link href={`/account/quotes/${quote.id}`}>
|
|
72
|
-
{quote.quoteNumber} <ArrowRightIcon/>
|
|
75
|
+
{quote.quoteNumber} <ArrowRightIcon />
|
|
73
76
|
</Link>
|
|
74
77
|
</Button>
|
|
75
78
|
</TableCell>
|
|
79
|
+
<TableCell>{formatDate(quote.createdAt, locale)}</TableCell>
|
|
80
|
+
<TableCell>{quote.requestedBy}</TableCell>
|
|
76
81
|
<TableCell>
|
|
77
|
-
{
|
|
78
|
-
</TableCell>
|
|
79
|
-
<TableCell>
|
|
80
|
-
{quote.requestedBy}
|
|
81
|
-
</TableCell>
|
|
82
|
-
<TableCell>
|
|
83
|
-
<QuoteStatusBadge status={quote.status}/>
|
|
84
|
-
</TableCell>
|
|
85
|
-
<TableCell>
|
|
86
|
-
{t('itemCount', {count: quote.itemCount})}
|
|
82
|
+
<QuoteStatusBadge status={quote.status} />
|
|
87
83
|
</TableCell>
|
|
84
|
+
<TableCell>{t('itemCount', { count: quote.itemCount })}</TableCell>
|
|
88
85
|
<TableCell className="text-right">
|
|
89
86
|
{quote.total != null ? (
|
|
90
87
|
<Price value={quote.total} currencyCode={currencyCode} taxLabel="excl" />
|
|
@@ -100,16 +97,34 @@ function QuoteTable({quotes, locale, currencyCode, t}: {quotes: QuoteRow[]; loca
|
|
|
100
97
|
);
|
|
101
98
|
}
|
|
102
99
|
|
|
103
|
-
export default async function QuotesPage(props: {
|
|
100
|
+
export default async function QuotesPage(props: {
|
|
101
|
+
params: Promise<{ locale: string }>;
|
|
102
|
+
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
103
|
+
}) {
|
|
104
104
|
return (
|
|
105
|
-
<Suspense
|
|
105
|
+
<Suspense
|
|
106
|
+
fallback={
|
|
107
|
+
<div>
|
|
108
|
+
<div className="flex items-center justify-between mb-6">
|
|
109
|
+
<h1 className="text-3xl font-bold">Quotes</h1>
|
|
110
|
+
</div>
|
|
111
|
+
<p className="text-sm text-muted-foreground">Loading quotes...</p>
|
|
112
|
+
</div>
|
|
113
|
+
}
|
|
114
|
+
>
|
|
106
115
|
<QuotesContent params={props.params} searchParamsPromise={props.searchParams} />
|
|
107
116
|
</Suspense>
|
|
108
117
|
);
|
|
109
118
|
}
|
|
110
119
|
|
|
111
|
-
async function QuotesContent({
|
|
112
|
-
|
|
120
|
+
async function QuotesContent({
|
|
121
|
+
params,
|
|
122
|
+
searchParamsPromise,
|
|
123
|
+
}: {
|
|
124
|
+
params: Promise<{ locale: string }>;
|
|
125
|
+
searchParamsPromise: Promise<Record<string, string | string[] | undefined>>;
|
|
126
|
+
}) {
|
|
127
|
+
const { locale } = await params;
|
|
113
128
|
setRequestLocale(locale);
|
|
114
129
|
const channelToken = await getActiveChannelToken();
|
|
115
130
|
const [t, searchParams, activeCustomer, channel] = await Promise.all([
|
|
@@ -124,16 +139,13 @@ async function QuotesContent({params, searchParamsPromise}: {params: Promise<{lo
|
|
|
124
139
|
const skip = (currentPage - 1) * ITEMS_PER_PAGE;
|
|
125
140
|
if (!activeCustomer) return await redirect('/sign-in');
|
|
126
141
|
|
|
127
|
-
const [result, error] = await client.query(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
skip,
|
|
133
|
-
sort: {createdAt: 'DESC' as any},
|
|
134
|
-
},
|
|
142
|
+
const [result, error] = await client.query(GetMyQuotesQuery, {
|
|
143
|
+
options: {
|
|
144
|
+
take: ITEMS_PER_PAGE,
|
|
145
|
+
skip,
|
|
146
|
+
sort: { createdAt: 'DESC' as any },
|
|
135
147
|
},
|
|
136
|
-
);
|
|
148
|
+
});
|
|
137
149
|
if (error) {
|
|
138
150
|
return (
|
|
139
151
|
<div>
|
|
@@ -158,9 +170,7 @@ async function QuotesContent({params, searchParamsPromise}: {params: Promise<{lo
|
|
|
158
170
|
quoteNumber: quote.quoteNumber,
|
|
159
171
|
createdAt: quote.createdAt,
|
|
160
172
|
status: quote.status,
|
|
161
|
-
requestedBy: quote.customer
|
|
162
|
-
? `${quote.customer.firstName} ${quote.customer.lastName}`
|
|
163
|
-
: '—',
|
|
173
|
+
requestedBy: quote.customer ? `${quote.customer.firstName} ${quote.customer.lastName}` : '—',
|
|
164
174
|
itemCount: quote.currentVersion?.lineItems.length ?? 0,
|
|
165
175
|
total: quote.currentVersion?.total ?? null,
|
|
166
176
|
};
|
|
@@ -192,14 +202,24 @@ async function QuotesContent({params, searchParamsPromise}: {params: Promise<{lo
|
|
|
192
202
|
{myQuoteRows.length > 0 && (
|
|
193
203
|
<section>
|
|
194
204
|
<h2 className="text-2xl font-bold mb-4">{t('myQuotesHeading')}</h2>
|
|
195
|
-
<QuoteTable
|
|
205
|
+
<QuoteTable
|
|
206
|
+
quotes={myQuoteRows}
|
|
207
|
+
locale={locale}
|
|
208
|
+
currencyCode={currencyCode}
|
|
209
|
+
t={t}
|
|
210
|
+
/>
|
|
196
211
|
</section>
|
|
197
212
|
)}
|
|
198
213
|
|
|
199
214
|
{companyQuoteRows.length > 0 && (
|
|
200
215
|
<section>
|
|
201
216
|
<h2 className="text-2xl font-bold mb-4">{t('companyQuotesHeading')}</h2>
|
|
202
|
-
<QuoteTable
|
|
217
|
+
<QuoteTable
|
|
218
|
+
quotes={companyQuoteRows}
|
|
219
|
+
locale={locale}
|
|
220
|
+
currencyCode={currencyCode}
|
|
221
|
+
t={t}
|
|
222
|
+
/>
|
|
203
223
|
</section>
|
|
204
224
|
)}
|
|
205
225
|
</div>
|
|
@@ -215,11 +235,18 @@ async function QuotesContent({params, searchParamsPromise}: {params: Promise<{lo
|
|
|
215
235
|
className={currentPage === 1 ? 'pointer-events-none opacity-50' : ''}
|
|
216
236
|
/>
|
|
217
237
|
</PaginationItem>
|
|
218
|
-
{Array.from({length: totalPages}, (_, i) => i + 1).map((page) => {
|
|
219
|
-
if (
|
|
238
|
+
{Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => {
|
|
239
|
+
if (
|
|
240
|
+
page === 1 ||
|
|
241
|
+
page === totalPages ||
|
|
242
|
+
(page >= currentPage - 1 && page <= currentPage + 1)
|
|
243
|
+
) {
|
|
220
244
|
return (
|
|
221
245
|
<PaginationItem key={page}>
|
|
222
|
-
<PaginationLink
|
|
246
|
+
<PaginationLink
|
|
247
|
+
href={`/account/quotes?page=${page}`}
|
|
248
|
+
isActive={page === currentPage}
|
|
249
|
+
>
|
|
223
250
|
{page}
|
|
224
251
|
</PaginationLink>
|
|
225
252
|
</PaginationItem>
|
|
@@ -227,7 +254,7 @@ async function QuotesContent({params, searchParamsPromise}: {params: Promise<{lo
|
|
|
227
254
|
} else if (page === currentPage - 2 || page === currentPage + 2) {
|
|
228
255
|
return (
|
|
229
256
|
<PaginationItem key={page}>
|
|
230
|
-
<PaginationEllipsis/>
|
|
257
|
+
<PaginationEllipsis />
|
|
231
258
|
</PaginationItem>
|
|
232
259
|
);
|
|
233
260
|
}
|
|
@@ -235,8 +262,14 @@ async function QuotesContent({params, searchParamsPromise}: {params: Promise<{lo
|
|
|
235
262
|
})}
|
|
236
263
|
<PaginationItem>
|
|
237
264
|
<PaginationNext
|
|
238
|
-
href={
|
|
239
|
-
|
|
265
|
+
href={
|
|
266
|
+
currentPage < totalPages
|
|
267
|
+
? `/account/quotes?page=${currentPage + 1}`
|
|
268
|
+
: '#'
|
|
269
|
+
}
|
|
270
|
+
className={
|
|
271
|
+
currentPage === totalPages ? 'pointer-events-none opacity-50' : ''
|
|
272
|
+
}
|
|
240
273
|
/>
|
|
241
274
|
</PaginationItem>
|
|
242
275
|
</PaginationContent>
|
package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/add-item-search.tsx
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Input } from '@/components/ui/input';
|
|
4
|
+
import { Loader2, Plus, Search } from 'lucide-react';
|
|
4
5
|
import Image from 'next/image';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {searchVariantsForSharedCart, addItemToSharedCart, type VariantSearchResult} from '../actions';
|
|
6
|
+
import { useEffect, useRef, useState, useTransition } from 'react';
|
|
7
|
+
import { toast } from 'sonner';
|
|
8
|
+
import { addItemToSharedCart, searchVariantsForSharedCart, type VariantSearchResult } from '../actions';
|
|
9
9
|
|
|
10
|
-
export function AddItemSearch({sharedCartId, onAdded}: {sharedCartId: string; onAdded: () => void}) {
|
|
10
|
+
export function AddItemSearch({ sharedCartId, onAdded }: { sharedCartId: string; onAdded: () => void }) {
|
|
11
11
|
const [term, setTerm] = useState('');
|
|
12
12
|
const [results, setResults] = useState<VariantSearchResult[]>([]);
|
|
13
13
|
const [open, setOpen] = useState(false);
|
|
@@ -72,12 +72,14 @@ export function AddItemSearch({sharedCartId, onAdded}: {sharedCartId: string; on
|
|
|
72
72
|
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
|
73
73
|
<Input
|
|
74
74
|
value={term}
|
|
75
|
-
onChange={e => onTermChange(e.target.value)}
|
|
75
|
+
onChange={(e) => onTermChange(e.target.value)}
|
|
76
76
|
onFocus={() => results.length > 0 && setOpen(true)}
|
|
77
77
|
placeholder="Search products to add…"
|
|
78
78
|
className="pl-9"
|
|
79
79
|
/>
|
|
80
|
-
{isSearching &&
|
|
80
|
+
{isSearching && (
|
|
81
|
+
<Loader2 className="absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 animate-spin text-muted-foreground" />
|
|
82
|
+
)}
|
|
81
83
|
</div>
|
|
82
84
|
|
|
83
85
|
{open && (
|
|
@@ -85,7 +87,7 @@ export function AddItemSearch({sharedCartId, onAdded}: {sharedCartId: string; on
|
|
|
85
87
|
{results.length === 0 ? (
|
|
86
88
|
<p className="p-3 text-sm text-muted-foreground">No products found.</p>
|
|
87
89
|
) : (
|
|
88
|
-
results.map(item => (
|
|
90
|
+
results.map((item) => (
|
|
89
91
|
<button
|
|
90
92
|
key={item.productVariantId}
|
|
91
93
|
type="button"
|
package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/add-member-form.tsx
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { ROLE_OPTIONS } from '@/components/commerce/shared-cart-role';
|
|
4
|
+
import { Button } from '@/components/ui/button';
|
|
5
|
+
import {
|
|
6
|
+
Dialog,
|
|
7
|
+
DialogContent,
|
|
8
|
+
DialogDescription,
|
|
9
|
+
DialogFooter,
|
|
10
|
+
DialogHeader,
|
|
11
|
+
DialogTitle,
|
|
12
|
+
DialogTrigger,
|
|
13
|
+
} from '@/components/ui/dialog';
|
|
14
|
+
import { Label } from '@/components/ui/label';
|
|
15
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
|
16
|
+
import { Loader2, UserPlus } from 'lucide-react';
|
|
17
|
+
import { useState, useTransition } from 'react';
|
|
18
|
+
import { toast } from 'sonner';
|
|
11
19
|
import {
|
|
12
|
-
fetchCompanyMembers,
|
|
13
20
|
addSharedCartMember,
|
|
21
|
+
fetchCompanyMembers,
|
|
14
22
|
type CompanyMemberOption,
|
|
15
23
|
type SharedCartRole,
|
|
16
24
|
} from '../actions';
|
|
@@ -37,7 +45,7 @@ export function AddMemberDialog({
|
|
|
37
45
|
}
|
|
38
46
|
}
|
|
39
47
|
|
|
40
|
-
const available = (candidates ?? []).filter(c => !excludeCustomerIds.has(c.customerId));
|
|
48
|
+
const available = (candidates ?? []).filter((c) => !excludeCustomerIds.has(c.customerId));
|
|
41
49
|
|
|
42
50
|
function add() {
|
|
43
51
|
if (!selected) return;
|
|
@@ -65,7 +73,9 @@ export function AddMemberDialog({
|
|
|
65
73
|
<DialogContent>
|
|
66
74
|
<DialogHeader>
|
|
67
75
|
<DialogTitle>Add a colleague</DialogTitle>
|
|
68
|
-
<DialogDescription>
|
|
76
|
+
<DialogDescription>
|
|
77
|
+
Choose someone from your company and the access they should have.
|
|
78
|
+
</DialogDescription>
|
|
69
79
|
</DialogHeader>
|
|
70
80
|
|
|
71
81
|
<div className="space-y-4 py-2">
|
|
@@ -74,14 +84,16 @@ export function AddMemberDialog({
|
|
|
74
84
|
{candidates === null ? (
|
|
75
85
|
<p className="text-sm text-muted-foreground">Loading colleagues…</p>
|
|
76
86
|
) : available.length === 0 ? (
|
|
77
|
-
<p className="text-sm text-muted-foreground">
|
|
87
|
+
<p className="text-sm text-muted-foreground">
|
|
88
|
+
Everyone in your company is already a member.
|
|
89
|
+
</p>
|
|
78
90
|
) : (
|
|
79
91
|
<Select value={selected} onValueChange={setSelected} disabled={isPending}>
|
|
80
92
|
<SelectTrigger className="w-full">
|
|
81
93
|
<SelectValue placeholder="Select a colleague" />
|
|
82
94
|
</SelectTrigger>
|
|
83
95
|
<SelectContent>
|
|
84
|
-
{available.map(c => (
|
|
96
|
+
{available.map((c) => (
|
|
85
97
|
<SelectItem key={c.customerId} value={c.customerId}>
|
|
86
98
|
{c.firstName} {c.lastName} — {c.emailAddress}
|
|
87
99
|
</SelectItem>
|
|
@@ -93,12 +105,16 @@ export function AddMemberDialog({
|
|
|
93
105
|
|
|
94
106
|
<div className="space-y-2">
|
|
95
107
|
<Label>Role</Label>
|
|
96
|
-
<Select
|
|
108
|
+
<Select
|
|
109
|
+
value={role}
|
|
110
|
+
onValueChange={(v) => setRole(v as SharedCartRole)}
|
|
111
|
+
disabled={isPending}
|
|
112
|
+
>
|
|
97
113
|
<SelectTrigger className="w-full">
|
|
98
114
|
<SelectValue />
|
|
99
115
|
</SelectTrigger>
|
|
100
116
|
<SelectContent>
|
|
101
|
-
{ROLE_OPTIONS.map(o => (
|
|
117
|
+
{ROLE_OPTIONS.map((o) => (
|
|
102
118
|
<SelectItem key={o.value} value={o.value}>
|
|
103
119
|
<span className="font-medium">{o.label}</span>
|
|
104
120
|
<span className="text-muted-foreground"> — {o.hint}</span>
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { ROLE_OPTIONS, roleLabel } from '@/components/commerce/shared-cart-role';
|
|
4
|
+
import {
|
|
5
|
+
AlertDialog,
|
|
6
|
+
AlertDialogAction,
|
|
7
|
+
AlertDialogCancel,
|
|
8
|
+
AlertDialogContent,
|
|
9
|
+
AlertDialogDescription,
|
|
10
|
+
AlertDialogFooter,
|
|
11
|
+
AlertDialogHeader,
|
|
12
|
+
AlertDialogTitle,
|
|
13
|
+
} from '@/components/ui/alert-dialog';
|
|
14
|
+
import { Badge } from '@/components/ui/badge';
|
|
15
|
+
import { Button } from '@/components/ui/button';
|
|
7
16
|
import {
|
|
8
17
|
DropdownMenu,
|
|
9
18
|
DropdownMenuContent,
|
|
@@ -16,26 +25,17 @@ import {
|
|
|
16
25
|
DropdownMenuSubTrigger,
|
|
17
26
|
DropdownMenuTrigger,
|
|
18
27
|
} from '@/components/ui/dropdown-menu';
|
|
28
|
+
import { Crown, Loader2, MoreHorizontal, ShieldCheck, UserMinus } from 'lucide-react';
|
|
29
|
+
import { useState, useTransition } from 'react';
|
|
30
|
+
import { toast } from 'sonner';
|
|
19
31
|
import {
|
|
20
|
-
AlertDialog,
|
|
21
|
-
AlertDialogAction,
|
|
22
|
-
AlertDialogCancel,
|
|
23
|
-
AlertDialogContent,
|
|
24
|
-
AlertDialogDescription,
|
|
25
|
-
AlertDialogFooter,
|
|
26
|
-
AlertDialogHeader,
|
|
27
|
-
AlertDialogTitle,
|
|
28
|
-
} from '@/components/ui/alert-dialog';
|
|
29
|
-
import {Crown, MoreHorizontal, ShieldCheck, UserMinus, Loader2} from 'lucide-react';
|
|
30
|
-
import {ROLE_OPTIONS, roleLabel} from '@/components/commerce/shared-cart-role';
|
|
31
|
-
import {
|
|
32
|
-
setSharedCartMemberRole,
|
|
33
32
|
removeSharedCartMember,
|
|
33
|
+
setSharedCartMemberRole,
|
|
34
34
|
transferSharedCartOwnership,
|
|
35
35
|
type SharedCartData,
|
|
36
36
|
type SharedCartRole,
|
|
37
37
|
} from '../actions';
|
|
38
|
-
import {AddMemberDialog} from './add-member-form';
|
|
38
|
+
import { AddMemberDialog } from './add-member-form';
|
|
39
39
|
|
|
40
40
|
export function MembersPanel({
|
|
41
41
|
cart,
|
|
@@ -48,9 +48,9 @@ export function MembersPanel({
|
|
|
48
48
|
canManage: boolean;
|
|
49
49
|
onChanged: () => void;
|
|
50
50
|
}) {
|
|
51
|
-
const [transferTarget, setTransferTarget] = useState<{customerId: string; name: string} | null>(null);
|
|
51
|
+
const [transferTarget, setTransferTarget] = useState<{ customerId: string; name: string } | null>(null);
|
|
52
52
|
const isOpen = cart.status === 'Open';
|
|
53
|
-
const existingIds = new Set(cart.members.map(m => m.customer.id));
|
|
53
|
+
const existingIds = new Set(cart.members.map((m) => m.customer.id));
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
56
|
<section className="border rounded-lg">
|
|
@@ -61,7 +61,7 @@ export function MembersPanel({
|
|
|
61
61
|
</div>
|
|
62
62
|
|
|
63
63
|
<ul className="divide-y">
|
|
64
|
-
{cart.members.map(member => {
|
|
64
|
+
{cart.members.map((member) => {
|
|
65
65
|
const isOwner = member.customer.id === cart.owner.id;
|
|
66
66
|
const isYou = member.customer.id === viewerId;
|
|
67
67
|
const name = `${member.customer.firstName} ${member.customer.lastName}`.trim();
|
|
@@ -71,9 +71,13 @@ export function MembersPanel({
|
|
|
71
71
|
<div className="min-w-0 flex-1">
|
|
72
72
|
<p className="text-sm font-medium truncate">
|
|
73
73
|
{name}
|
|
74
|
-
{isYou &&
|
|
74
|
+
{isYou && (
|
|
75
|
+
<span className="text-muted-foreground font-normal"> (you)</span>
|
|
76
|
+
)}
|
|
77
|
+
</p>
|
|
78
|
+
<p className="text-xs text-muted-foreground truncate">
|
|
79
|
+
{member.customer.emailAddress}
|
|
75
80
|
</p>
|
|
76
|
-
<p className="text-xs text-muted-foreground truncate">{member.customer.emailAddress}</p>
|
|
77
81
|
</div>
|
|
78
82
|
|
|
79
83
|
{isOwner ? (
|
|
@@ -92,7 +96,9 @@ export function MembersPanel({
|
|
|
92
96
|
cartId={cart.id}
|
|
93
97
|
member={member}
|
|
94
98
|
onChanged={onChanged}
|
|
95
|
-
onTransfer={() =>
|
|
99
|
+
onTransfer={() =>
|
|
100
|
+
setTransferTarget({ customerId: member.customer.id, name })
|
|
101
|
+
}
|
|
96
102
|
/>
|
|
97
103
|
)}
|
|
98
104
|
</li>
|
|
@@ -150,8 +156,18 @@ function MemberMenu({
|
|
|
150
156
|
return (
|
|
151
157
|
<DropdownMenu>
|
|
152
158
|
<DropdownMenuTrigger asChild>
|
|
153
|
-
<Button
|
|
154
|
-
|
|
159
|
+
<Button
|
|
160
|
+
variant="ghost"
|
|
161
|
+
size="icon"
|
|
162
|
+
className="h-8 w-8 shrink-0"
|
|
163
|
+
disabled={isPending}
|
|
164
|
+
aria-label="Member actions"
|
|
165
|
+
>
|
|
166
|
+
{isPending ? (
|
|
167
|
+
<Loader2 className="h-4 w-4 animate-spin" />
|
|
168
|
+
) : (
|
|
169
|
+
<MoreHorizontal className="h-4 w-4" />
|
|
170
|
+
)}
|
|
155
171
|
</Button>
|
|
156
172
|
</DropdownMenuTrigger>
|
|
157
173
|
<DropdownMenuContent align="end" className="w-48">
|
|
@@ -161,8 +177,11 @@ function MemberMenu({
|
|
|
161
177
|
Change role
|
|
162
178
|
</DropdownMenuSubTrigger>
|
|
163
179
|
<DropdownMenuSubContent>
|
|
164
|
-
<DropdownMenuRadioGroup
|
|
165
|
-
{
|
|
180
|
+
<DropdownMenuRadioGroup
|
|
181
|
+
value={member.role}
|
|
182
|
+
onValueChange={(v) => changeRole(v as SharedCartRole)}
|
|
183
|
+
>
|
|
184
|
+
{ROLE_OPTIONS.map((o) => (
|
|
166
185
|
<DropdownMenuRadioItem key={o.value} value={o.value}>
|
|
167
186
|
{o.label}
|
|
168
187
|
</DropdownMenuRadioItem>
|
|
@@ -191,7 +210,7 @@ function TransferOwnershipDialog({
|
|
|
191
210
|
onTransferred,
|
|
192
211
|
}: {
|
|
193
212
|
cartId: string;
|
|
194
|
-
target: {customerId: string; name: string} | null;
|
|
213
|
+
target: { customerId: string; name: string } | null;
|
|
195
214
|
onClose: () => void;
|
|
196
215
|
onTransferred: () => void;
|
|
197
216
|
}) {
|
|
@@ -212,19 +231,19 @@ function TransferOwnershipDialog({
|
|
|
212
231
|
}
|
|
213
232
|
|
|
214
233
|
return (
|
|
215
|
-
<AlertDialog open={target !== null} onOpenChange={open => !open && onClose()}>
|
|
234
|
+
<AlertDialog open={target !== null} onOpenChange={(open) => !open && onClose()}>
|
|
216
235
|
<AlertDialogContent>
|
|
217
236
|
<AlertDialogHeader>
|
|
218
237
|
<AlertDialogTitle>Transfer ownership?</AlertDialogTitle>
|
|
219
238
|
<AlertDialogDescription>
|
|
220
|
-
{target?.name} will become the owner and gain full control of this cart. You'll
|
|
221
|
-
role.
|
|
239
|
+
{target?.name} will become the owner and gain full control of this cart. You'll
|
|
240
|
+
keep your current role.
|
|
222
241
|
</AlertDialogDescription>
|
|
223
242
|
</AlertDialogHeader>
|
|
224
243
|
<AlertDialogFooter>
|
|
225
244
|
<AlertDialogCancel disabled={isPending}>Cancel</AlertDialogCancel>
|
|
226
245
|
<AlertDialogAction
|
|
227
|
-
onClick={e => {
|
|
246
|
+
onClick={(e) => {
|
|
228
247
|
e.preventDefault();
|
|
229
248
|
confirm();
|
|
230
249
|
}}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {client} from '@/lib/vendure/api';
|
|
4
|
-
import {GetSharedCartQuery} from '@/lib/vendure/queries';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {setRequestLocale} from 'next-intl/server';
|
|
8
|
-
import {
|
|
9
|
-
import {SharedCartDetailClient} from './shared-cart-detail-client';
|
|
1
|
+
import { Link, redirect } from '@/i18n/navigation';
|
|
2
|
+
import { getActiveCustomer } from '@/lib/vendure/actions';
|
|
3
|
+
import { client } from '@/lib/vendure/api';
|
|
4
|
+
import { GetSharedCartQuery } from '@/lib/vendure/queries';
|
|
5
|
+
import { ArrowLeft } from 'lucide-react';
|
|
6
|
+
import type { Metadata } from 'next';
|
|
7
|
+
import { setRequestLocale } from 'next-intl/server';
|
|
8
|
+
import { Suspense } from 'react';
|
|
9
|
+
import { SharedCartDetailClient } from './shared-cart-detail-client';
|
|
10
10
|
|
|
11
11
|
export const metadata: Metadata = {
|
|
12
12
|
title: 'Shared Cart',
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export default function SharedCartDetailPage(props: {params: Promise<{locale: string; id: string}>}) {
|
|
15
|
+
export default function SharedCartDetailPage(props: { params: Promise<{ locale: string; id: string }> }) {
|
|
16
16
|
return (
|
|
17
17
|
<Suspense fallback={<p className="text-sm text-muted-foreground">Loading shared cart…</p>}>
|
|
18
18
|
<SharedCartDetailContent paramsPromise={props.params} />
|
|
@@ -20,13 +20,17 @@ export default function SharedCartDetailPage(props: {params: Promise<{locale: st
|
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
async function SharedCartDetailContent({
|
|
24
|
-
|
|
23
|
+
async function SharedCartDetailContent({
|
|
24
|
+
paramsPromise,
|
|
25
|
+
}: {
|
|
26
|
+
paramsPromise: Promise<{ locale: string; id: string }>;
|
|
27
|
+
}) {
|
|
28
|
+
const { locale, id } = await paramsPromise;
|
|
25
29
|
setRequestLocale(locale);
|
|
26
30
|
|
|
27
31
|
const [activeCustomer, [result, error]] = await Promise.all([
|
|
28
32
|
getActiveCustomer(),
|
|
29
|
-
client.query(GetSharedCartQuery, {id}),
|
|
33
|
+
client.query(GetSharedCartQuery, { id }),
|
|
30
34
|
]);
|
|
31
35
|
|
|
32
36
|
if (!activeCustomer) return await redirect('/sign-in');
|
|
@@ -41,7 +45,11 @@ async function SharedCartDetailContent({paramsPromise}: {paramsPromise: Promise<
|
|
|
41
45
|
<ArrowLeft className="h-4 w-4" />
|
|
42
46
|
Shared carts
|
|
43
47
|
</Link>
|
|
44
|
-
<SharedCartDetailClient
|
|
48
|
+
<SharedCartDetailClient
|
|
49
|
+
initialCart={result.data.sharedCart}
|
|
50
|
+
viewerId={activeCustomer.id}
|
|
51
|
+
locale={locale}
|
|
52
|
+
/>
|
|
45
53
|
</div>
|
|
46
54
|
);
|
|
47
55
|
}
|