@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,14 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
|
4
4
|
import { Hammer } from 'lucide-react';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
5
6
|
import { isDraftModeEnabled } from './draft-mode-action';
|
|
6
|
-
import {
|
|
7
|
-
Tooltip,
|
|
8
|
-
TooltipContent,
|
|
9
|
-
TooltipProvider,
|
|
10
|
-
TooltipTrigger,
|
|
11
|
-
} from '@/components/ui/tooltip';
|
|
12
7
|
|
|
13
8
|
export function DraftModeIndicator() {
|
|
14
9
|
const [active, setActive] = useState(false);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
3
|
import { usePathname } from '@/i18n/navigation';
|
|
5
4
|
import { Hammer } from 'lucide-react';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
6
|
import { isDraftModeEnabled } from './draft-mode-action';
|
|
7
7
|
|
|
8
8
|
export function DraftModeLink() {
|
|
@@ -20,7 +20,9 @@ export function DraftModeLink() {
|
|
|
20
20
|
return (
|
|
21
21
|
<a
|
|
22
22
|
href={href}
|
|
23
|
-
className={`transition-colors inline-flex items-center gap-1.5 ${
|
|
23
|
+
className={`transition-colors inline-flex items-center gap-1.5 ${
|
|
24
|
+
active ? 'text-amber-500 hover:text-amber-600' : 'hover:text-primary'
|
|
25
|
+
}`}
|
|
24
26
|
>
|
|
25
27
|
<Hammer className="h-3.5 w-3.5" />
|
|
26
28
|
{active ? 'Disable Draft Mode' : 'Enable Draft Mode'}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {getActiveCustomer} from '@/lib/vendure/actions';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import { getBranding } from '@/config/branding';
|
|
2
|
+
import { Link } from '@/i18n/navigation';
|
|
3
|
+
import { getActiveChannelToken } from '@/lib/channel-server';
|
|
4
|
+
import { getActiveCustomer } from '@/lib/vendure/actions';
|
|
5
|
+
import { getTopCollections } from '@/lib/vendure/cached';
|
|
6
|
+
import { getTranslations, setRequestLocale } from 'next-intl/server';
|
|
7
|
+
import { cacheLife } from 'next/cache';
|
|
8
|
+
import Image from 'next/image';
|
|
9
|
+
import NextLink from 'next/link';
|
|
9
10
|
import { DraftModeLink } from './draft-mode-link';
|
|
10
|
-
import {getBranding} from '@/config/branding';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'use cache'
|
|
12
|
+
async function Copyright({ allRightsReserved }: { allRightsReserved: string }) {
|
|
13
|
+
'use cache';
|
|
15
14
|
cacheLife('days');
|
|
16
15
|
|
|
17
16
|
const { footer } = getBranding();
|
|
@@ -19,11 +18,11 @@ async function Copyright({allRightsReserved}: {allRightsReserved: string}) {
|
|
|
19
18
|
<div>
|
|
20
19
|
© {new Date().getFullYear()} {footer.copyright}. {allRightsReserved}
|
|
21
20
|
</div>
|
|
22
|
-
)
|
|
21
|
+
);
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
async function FooterCollections({locale, channelToken}: {locale: string; channelToken?: string}) {
|
|
26
|
-
'use cache'
|
|
24
|
+
async function FooterCollections({ locale, channelToken }: { locale: string; channelToken?: string }) {
|
|
25
|
+
'use cache';
|
|
27
26
|
cacheLife('days');
|
|
28
27
|
|
|
29
28
|
const collections = await getTopCollections(locale, channelToken);
|
|
@@ -49,7 +48,7 @@ async function FooterCollections({locale, channelToken}: {locale: string; channe
|
|
|
49
48
|
);
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
async function FooterAuthLink({label}: {label: string}) {
|
|
51
|
+
async function FooterAuthLink({ label }: { label: string }) {
|
|
53
52
|
const customer = await getActiveCustomer();
|
|
54
53
|
if (customer) {
|
|
55
54
|
return null;
|
|
@@ -63,10 +62,10 @@ async function FooterAuthLink({label}: {label: string}) {
|
|
|
63
62
|
);
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
export async function Footer({locale}: {locale: string}) {
|
|
65
|
+
export async function Footer({ locale }: { locale: string }) {
|
|
67
66
|
setRequestLocale(locale);
|
|
68
67
|
const [t, channelToken] = await Promise.all([
|
|
69
|
-
getTranslations({locale, namespace: 'Footer'}),
|
|
68
|
+
getTranslations({ locale, namespace: 'Footer' }),
|
|
70
69
|
getActiveChannelToken(),
|
|
71
70
|
]);
|
|
72
71
|
const { footer, logo, logoInverted } = getBranding();
|
|
@@ -86,27 +85,47 @@ export async function Footer({locale}: {locale: string}) {
|
|
|
86
85
|
<h4 className="text-sm font-semibold mb-4 text-foreground">{t('account')}</h4>
|
|
87
86
|
<ul className="space-y-2 text-sm text-muted-foreground">
|
|
88
87
|
<li>
|
|
89
|
-
<Link
|
|
88
|
+
<Link
|
|
89
|
+
href="/account/orders"
|
|
90
|
+
prefetch={false}
|
|
91
|
+
className="hover:text-primary transition-colors"
|
|
92
|
+
>
|
|
90
93
|
{t('orders')}
|
|
91
94
|
</Link>
|
|
92
95
|
</li>
|
|
93
96
|
<li>
|
|
94
|
-
<Link
|
|
97
|
+
<Link
|
|
98
|
+
href="/account/quotes"
|
|
99
|
+
prefetch={false}
|
|
100
|
+
className="hover:text-primary transition-colors"
|
|
101
|
+
>
|
|
95
102
|
{t('quotes')}
|
|
96
103
|
</Link>
|
|
97
104
|
</li>
|
|
98
105
|
<li>
|
|
99
|
-
<Link
|
|
106
|
+
<Link
|
|
107
|
+
href="/account/company"
|
|
108
|
+
prefetch={false}
|
|
109
|
+
className="hover:text-primary transition-colors"
|
|
110
|
+
>
|
|
100
111
|
{t('company')}
|
|
101
112
|
</Link>
|
|
102
113
|
</li>
|
|
103
114
|
<li>
|
|
104
|
-
<Link
|
|
115
|
+
<Link
|
|
116
|
+
href="/account/addresses"
|
|
117
|
+
prefetch={false}
|
|
118
|
+
className="hover:text-primary transition-colors"
|
|
119
|
+
>
|
|
105
120
|
{t('addresses')}
|
|
106
121
|
</Link>
|
|
107
122
|
</li>
|
|
108
123
|
<li>
|
|
109
|
-
<Link
|
|
124
|
+
<Link
|
|
125
|
+
href="/account/profile"
|
|
126
|
+
prefetch={false}
|
|
127
|
+
className="hover:text-primary transition-colors"
|
|
128
|
+
>
|
|
110
129
|
{t('profile')}
|
|
111
130
|
</Link>
|
|
112
131
|
</li>
|
|
@@ -118,12 +137,20 @@ export async function Footer({locale}: {locale: string}) {
|
|
|
118
137
|
<h4 className="text-sm font-semibold mb-4 text-foreground">{t('customerService')}</h4>
|
|
119
138
|
<ul className="space-y-2 text-sm text-muted-foreground">
|
|
120
139
|
<li>
|
|
121
|
-
<Link
|
|
140
|
+
<Link
|
|
141
|
+
href="/search"
|
|
142
|
+
prefetch={false}
|
|
143
|
+
className="hover:text-primary transition-colors"
|
|
144
|
+
>
|
|
122
145
|
{t('browseProducts')}
|
|
123
146
|
</Link>
|
|
124
147
|
</li>
|
|
125
148
|
<li>
|
|
126
|
-
<Link
|
|
149
|
+
<Link
|
|
150
|
+
href="/register-company"
|
|
151
|
+
prefetch={false}
|
|
152
|
+
className="hover:text-primary transition-colors"
|
|
153
|
+
>
|
|
127
154
|
{t('openTradeAccount')}
|
|
128
155
|
</Link>
|
|
129
156
|
</li>
|
|
@@ -155,11 +182,26 @@ export async function Footer({locale}: {locale: string}) {
|
|
|
155
182
|
|
|
156
183
|
{/* Bottom bar */}
|
|
157
184
|
<div className="mt-10 pt-6 border-t border-border flex flex-col sm:flex-row justify-between items-center gap-4 text-sm text-muted-foreground">
|
|
158
|
-
<Copyright allRightsReserved={t('allRightsReserved')}/>
|
|
185
|
+
<Copyright allRightsReserved={t('allRightsReserved')} />
|
|
159
186
|
<div className="flex items-center gap-4">
|
|
160
187
|
<DraftModeLink />
|
|
161
|
-
<a
|
|
162
|
-
|
|
188
|
+
<a
|
|
189
|
+
href={`${(
|
|
190
|
+
process.env.VENDURE_SHOP_API_URL ?? 'http://localhost:3500/shop-api'
|
|
191
|
+
).replace(/\/shop-api$/, '')}/dev-mailbox/ui`}
|
|
192
|
+
target="_blank"
|
|
193
|
+
rel="noopener noreferrer"
|
|
194
|
+
className="hover:text-primary transition-colors"
|
|
195
|
+
>
|
|
196
|
+
{t('demoMailbox')}
|
|
197
|
+
</a>
|
|
198
|
+
<Image
|
|
199
|
+
src={footerLogo.src}
|
|
200
|
+
alt={footerLogo.alt}
|
|
201
|
+
width={footerLogo.width}
|
|
202
|
+
height={footerLogo.height}
|
|
203
|
+
className="h-4 w-auto invert"
|
|
204
|
+
/>
|
|
163
205
|
</div>
|
|
164
206
|
</div>
|
|
165
207
|
</div>
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
'use server';
|
|
2
2
|
|
|
3
|
-
import {readFragment} from '@/graphql';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {CompanyBusinessUnitFragment} from '@/lib/vendure/fragments';
|
|
7
|
-
import {
|
|
8
|
-
import {revalidatePath, revalidateTag} from 'next/cache';
|
|
3
|
+
import { readFragment } from '@/graphql';
|
|
4
|
+
import { clearBusinessUnitId, setBusinessUnitId, setCompanyId } from '@/lib/company-context';
|
|
5
|
+
import { client } from '@/lib/vendure/api';
|
|
6
|
+
import { CompanyBusinessUnitFragment } from '@/lib/vendure/fragments';
|
|
7
|
+
import { SwitchBusinessUnitMutation } from '@/lib/vendure/mutations';
|
|
8
|
+
import { revalidatePath, revalidateTag } from 'next/cache';
|
|
9
9
|
|
|
10
10
|
export async function switchBusinessUnitAction(businessUnitId: string) {
|
|
11
|
-
const [result, error] = await client.mutate(
|
|
12
|
-
SwitchBusinessUnitMutation,
|
|
13
|
-
{businessUnitId},
|
|
14
|
-
);
|
|
11
|
+
const [result, error] = await client.mutate(SwitchBusinessUnitMutation, { businessUnitId });
|
|
15
12
|
if (error) throw error;
|
|
16
13
|
|
|
17
14
|
const account = result.data.switchBusinessUnit;
|
|
@@ -20,7 +17,7 @@ export async function switchBusinessUnitAction(businessUnitId: string) {
|
|
|
20
17
|
await setBusinessUnitId(activeBu.id);
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
revalidateTag('active-customer', {expire: 0});
|
|
20
|
+
revalidateTag('active-customer', { expire: 0 });
|
|
24
21
|
revalidatePath('/', 'layout');
|
|
25
22
|
}
|
|
26
23
|
|
|
@@ -28,6 +25,6 @@ export async function switchCompanyAction(companyId: string) {
|
|
|
28
25
|
await setCompanyId(companyId);
|
|
29
26
|
await clearBusinessUnitId();
|
|
30
27
|
|
|
31
|
-
revalidateTag('active-customer', {expire: 0});
|
|
28
|
+
revalidateTag('active-customer', { expire: 0 });
|
|
32
29
|
revalidatePath('/', 'layout');
|
|
33
30
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {useTranslations} from 'next-intl';
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
4
|
+
import { Link } from '@/i18n/navigation';
|
|
5
|
+
import { useCartCount } from '@/lib/cart-count-context';
|
|
6
|
+
import { Clock, ShoppingCart } from 'lucide-react';
|
|
7
|
+
import { useTranslations } from 'next-intl';
|
|
8
8
|
|
|
9
9
|
export function CartIcon() {
|
|
10
10
|
const t = useTranslations('Navigation');
|
|
11
11
|
const tCart = useTranslations('Cart');
|
|
12
|
-
const {count, awaitingApprovalOrderCode} = useCartCount();
|
|
12
|
+
const { count, awaitingApprovalOrderCode } = useCartCount();
|
|
13
13
|
const display = count > 99 ? '99+' : count;
|
|
14
14
|
|
|
15
15
|
if (awaitingApprovalOrderCode) {
|
|
@@ -17,12 +17,12 @@ export function CartIcon() {
|
|
|
17
17
|
return (
|
|
18
18
|
<Button variant="ghost" size="icon" asChild className="relative">
|
|
19
19
|
<Link href="/cart" prefetch={false} aria-label={label} title={label}>
|
|
20
|
-
<ShoppingCart className="h-5 w-5 text-muted-foreground"/>
|
|
20
|
+
<ShoppingCart className="h-5 w-5 text-muted-foreground" />
|
|
21
21
|
<span
|
|
22
22
|
className="absolute -top-1 -right-1 bg-amber-500 text-white rounded-full h-4 w-4 flex items-center justify-center"
|
|
23
23
|
aria-hidden
|
|
24
24
|
>
|
|
25
|
-
<Clock className="h-3 w-3"/>
|
|
25
|
+
<Clock className="h-3 w-3" />
|
|
26
26
|
</span>
|
|
27
27
|
<span className="sr-only">{label}</span>
|
|
28
28
|
</Link>
|
|
@@ -33,7 +33,7 @@ export function CartIcon() {
|
|
|
33
33
|
return (
|
|
34
34
|
<Button variant="ghost" size="icon" asChild className="relative">
|
|
35
35
|
<Link href="/cart" prefetch={false}>
|
|
36
|
-
<ShoppingCart className="h-5 w-5"/>
|
|
36
|
+
<ShoppingCart className="h-5 w-5" />
|
|
37
37
|
{count > 0 && (
|
|
38
38
|
<span
|
|
39
39
|
className={`absolute -top-1 -right-1 bg-primary text-primary-foreground text-xs font-bold rounded-full flex items-center justify-center ${
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {getChannelsConfig} from '@/config/scenario';
|
|
2
|
-
import {getActiveChannelToken} from '@/lib/channel-server';
|
|
3
|
-
import {ChannelPicker} from './channel-picker';
|
|
1
|
+
import { getChannelsConfig } from '@/config/scenario';
|
|
2
|
+
import { getActiveChannelToken } from '@/lib/channel-server';
|
|
3
|
+
import { ChannelPicker } from './channel-picker';
|
|
4
4
|
|
|
5
5
|
export async function ChannelPickerWrapper() {
|
|
6
6
|
const channelsConfig = getChannelsConfig();
|
|
@@ -10,10 +10,5 @@ export async function ChannelPickerWrapper() {
|
|
|
10
10
|
// when channelsConfig is set (checked above), so it can never be undefined here.
|
|
11
11
|
const activeToken = (await getActiveChannelToken())!;
|
|
12
12
|
|
|
13
|
-
return
|
|
14
|
-
<ChannelPicker
|
|
15
|
-
channels={channelsConfig.available}
|
|
16
|
-
activeToken={activeToken}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
13
|
+
return <ChannelPicker channels={channelsConfig.available} activeToken={activeToken} />;
|
|
19
14
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {MapPin} from 'lucide-react';
|
|
5
|
-
import {Button} from '@/components/ui/button';
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
6
4
|
import {
|
|
7
5
|
DropdownMenu,
|
|
8
6
|
DropdownMenuContent,
|
|
9
7
|
DropdownMenuItem,
|
|
10
8
|
DropdownMenuTrigger,
|
|
11
9
|
} from '@/components/ui/dropdown-menu';
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
10
|
+
import type { ChannelOption } from '@/config/scenario';
|
|
11
|
+
import { switchChannel } from '@/lib/actions/switch-channel';
|
|
12
|
+
import { MapPin } from 'lucide-react';
|
|
13
|
+
import { useTransition } from 'react';
|
|
14
14
|
|
|
15
15
|
interface ChannelPickerProps {
|
|
16
16
|
channels: ChannelOption[];
|
|
17
17
|
activeToken: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export function ChannelPicker({channels, activeToken}: ChannelPickerProps) {
|
|
20
|
+
export function ChannelPicker({ channels, activeToken }: ChannelPickerProps) {
|
|
21
21
|
const [isPending, startTransition] = useTransition();
|
|
22
22
|
|
|
23
|
-
const active = channels.find(c => c.token === activeToken) ?? channels[0];
|
|
23
|
+
const active = channels.find((c) => c.token === activeToken) ?? channels[0];
|
|
24
24
|
|
|
25
25
|
function handleSwitch(token: string) {
|
|
26
26
|
startTransition(async () => {
|
|
@@ -31,7 +31,12 @@ export function ChannelPicker({channels, activeToken}: ChannelPickerProps) {
|
|
|
31
31
|
return (
|
|
32
32
|
<DropdownMenu>
|
|
33
33
|
<DropdownMenuTrigger asChild>
|
|
34
|
-
<Button
|
|
34
|
+
<Button
|
|
35
|
+
variant="ghost"
|
|
36
|
+
size="sm"
|
|
37
|
+
className="h-9 gap-1 px-2 text-xs font-medium"
|
|
38
|
+
disabled={isPending}
|
|
39
|
+
>
|
|
35
40
|
<MapPin className="size-3.5" />
|
|
36
41
|
{active.countryCode}
|
|
37
42
|
<span className="sr-only">Switch country/channel</span>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {getActiveCurrencyCode} from '@/lib/currency-server';
|
|
3
|
-
import {
|
|
4
|
-
import {CurrencyPicker} from './currency-picker';
|
|
1
|
+
import { getActiveChannelToken } from '@/lib/channel-server';
|
|
2
|
+
import { getActiveCurrencyCode } from '@/lib/currency-server';
|
|
3
|
+
import { getActiveChannelCached } from '@/lib/vendure/cached';
|
|
4
|
+
import { CurrencyPicker } from './currency-picker';
|
|
5
5
|
|
|
6
6
|
export async function CurrencyPickerWrapper() {
|
|
7
7
|
const channelToken = await getActiveChannelToken();
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {DollarSign} from 'lucide-react';
|
|
5
|
-
import {Button} from '@/components/ui/button';
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
6
4
|
import {
|
|
7
5
|
DropdownMenu,
|
|
8
6
|
DropdownMenuContent,
|
|
9
7
|
DropdownMenuItem,
|
|
10
8
|
DropdownMenuTrigger,
|
|
11
9
|
} from '@/components/ui/dropdown-menu';
|
|
12
|
-
import {switchCurrency} from '@/lib/actions/switch-currency';
|
|
10
|
+
import { switchCurrency } from '@/lib/actions/switch-currency';
|
|
11
|
+
import { DollarSign } from 'lucide-react';
|
|
12
|
+
import { useTransition } from 'react';
|
|
13
13
|
|
|
14
14
|
interface CurrencyPickerProps {
|
|
15
15
|
availableCurrencies: string[];
|
|
16
16
|
activeCurrency: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export function CurrencyPicker({availableCurrencies, activeCurrency}: CurrencyPickerProps) {
|
|
19
|
+
export function CurrencyPicker({ availableCurrencies, activeCurrency }: CurrencyPickerProps) {
|
|
20
20
|
const [isPending, startTransition] = useTransition();
|
|
21
21
|
|
|
22
22
|
if (availableCurrencies.length <= 1) return null;
|
|
@@ -30,7 +30,12 @@ export function CurrencyPicker({availableCurrencies, activeCurrency}: CurrencyPi
|
|
|
30
30
|
return (
|
|
31
31
|
<DropdownMenu>
|
|
32
32
|
<DropdownMenuTrigger asChild>
|
|
33
|
-
<Button
|
|
33
|
+
<Button
|
|
34
|
+
variant="ghost"
|
|
35
|
+
size="sm"
|
|
36
|
+
className="h-9 gap-1 px-2 text-xs font-medium"
|
|
37
|
+
disabled={isPending}
|
|
38
|
+
>
|
|
34
39
|
<DollarSign className="size-3.5" />
|
|
35
40
|
{activeCurrency}
|
|
36
41
|
<span className="sr-only">Switch currency</span>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {usePathname, useRouter} from '@/i18n/navigation';
|
|
5
|
-
import {routing, localeNames, type Locale} from '@/i18n/routing';
|
|
6
|
-
import {Globe} from 'lucide-react';
|
|
7
|
-
import {Button} from '@/components/ui/button';
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
8
4
|
import {
|
|
9
5
|
DropdownMenu,
|
|
10
6
|
DropdownMenuContent,
|
|
11
7
|
DropdownMenuItem,
|
|
12
8
|
DropdownMenuTrigger,
|
|
13
9
|
} from '@/components/ui/dropdown-menu';
|
|
14
|
-
import {
|
|
10
|
+
import { usePathname, useRouter } from '@/i18n/navigation';
|
|
11
|
+
import { localeNames, routing, type Locale } from '@/i18n/routing';
|
|
12
|
+
import { Globe } from 'lucide-react';
|
|
13
|
+
import { useLocale } from 'next-intl';
|
|
14
|
+
import { useTransition } from 'react';
|
|
15
15
|
|
|
16
16
|
export function LanguagePicker() {
|
|
17
17
|
const locale = useLocale();
|
|
@@ -23,7 +23,7 @@ export function LanguagePicker() {
|
|
|
23
23
|
|
|
24
24
|
function switchLocale(newLocale: Locale) {
|
|
25
25
|
startTransition(() => {
|
|
26
|
-
router.replace({pathname}, {locale: newLocale});
|
|
26
|
+
router.replace({ pathname }, { locale: newLocale });
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -1,34 +1,37 @@
|
|
|
1
|
-
'use client'
|
|
1
|
+
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { logoutAction } from '@/app/[locale]/sign-in/actions';
|
|
4
|
+
import { useRouter } from '@/i18n/navigation';
|
|
5
|
+
import { useTranslations } from 'next-intl';
|
|
6
|
+
import { ComponentProps, useTransition } from 'react';
|
|
7
7
|
|
|
8
8
|
interface LoginButtonProps extends ComponentProps<'button'> {
|
|
9
9
|
isLoggedIn: boolean;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function LoginButton({isLoggedIn, ...props}: LoginButtonProps) {
|
|
12
|
+
export function LoginButton({ isLoggedIn, ...props }: LoginButtonProps) {
|
|
13
13
|
const t = useTranslations('Navigation');
|
|
14
14
|
const [isPending, startTransition] = useTransition();
|
|
15
15
|
const router = useRouter();
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
|
-
<button
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
<button
|
|
19
|
+
{...props}
|
|
20
|
+
aria-disabled={isPending}
|
|
21
|
+
onClick={() => {
|
|
22
|
+
if (isLoggedIn) {
|
|
23
|
+
startTransition(async () => {
|
|
24
|
+
const result = await logoutAction();
|
|
25
|
+
if (result?.redirectTo) {
|
|
26
|
+
router.replace(result.redirectTo);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
router.push('/sign-in');
|
|
31
|
+
}
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
31
34
|
{isLoggedIn ? t('signOut') : t('signIn')}
|
|
32
35
|
</button>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
4
|
+
import { Input } from '@/components/ui/input';
|
|
5
|
+
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from '@/components/ui/sheet';
|
|
6
|
+
import { Link, useRouter } from '@/i18n/navigation';
|
|
7
|
+
import { Menu, Search } from 'lucide-react';
|
|
8
|
+
import { useTranslations } from 'next-intl';
|
|
9
|
+
import { useState } from 'react';
|
|
10
10
|
|
|
11
11
|
interface NavLink {
|
|
12
12
|
href: string;
|
|
@@ -55,7 +55,7 @@ export function MobileNav({ navLinks }: { navLinks: NavLink[] }) {
|
|
|
55
55
|
</div>
|
|
56
56
|
</form>
|
|
57
57
|
<nav className="flex-1 overflow-y-auto py-2">
|
|
58
|
-
{navLinks.map(({href, label}) => (
|
|
58
|
+
{navLinks.map(({ href, label }) => (
|
|
59
59
|
<Link
|
|
60
60
|
key={href}
|
|
61
61
|
href={href}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getVisibleCompanyItems, personalNavItems } from '@/components/commerce/account-nav-items';
|
|
4
4
|
import {
|
|
5
5
|
DropdownMenuGroup,
|
|
6
6
|
DropdownMenuItem,
|
|
@@ -14,7 +14,7 @@ export function PersonalNavMenuItems() {
|
|
|
14
14
|
const t = useTranslations('Navigation');
|
|
15
15
|
return (
|
|
16
16
|
<DropdownMenuGroup>
|
|
17
|
-
{personalNavItems.map(item => (
|
|
17
|
+
{personalNavItems.map((item) => (
|
|
18
18
|
<DropdownMenuItem key={item.href} asChild>
|
|
19
19
|
<Link href={item.href} prefetch={false}>
|
|
20
20
|
<item.icon className="mr-2 h-4 w-4" />
|
|
@@ -33,11 +33,9 @@ export function CompanyNavMenuItems({ permissions }: { permissions: string[] })
|
|
|
33
33
|
return (
|
|
34
34
|
<>
|
|
35
35
|
<DropdownMenuSeparator />
|
|
36
|
-
<DropdownMenuLabel className="text-xs text-muted-foreground">
|
|
37
|
-
{t('company')}
|
|
38
|
-
</DropdownMenuLabel>
|
|
36
|
+
<DropdownMenuLabel className="text-xs text-muted-foreground">{t('company')}</DropdownMenuLabel>
|
|
39
37
|
<DropdownMenuGroup>
|
|
40
|
-
{items.map(item => (
|
|
38
|
+
{items.map((item) => (
|
|
41
39
|
<DropdownMenuItem key={item.href} asChild>
|
|
42
40
|
<Link href={item.href} prefetch={false}>
|
|
43
41
|
<item.icon className="mr-2 h-4 w-4" />
|