@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,13 +1,13 @@
|
|
|
1
1
|
'use server';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {cookies} from 'next/headers';
|
|
3
|
+
import { setAuthToken } from '@/lib/auth';
|
|
4
|
+
import { client } from '@/lib/vendure/api';
|
|
5
|
+
import { VerifyCustomerAccountMutation } from '@/lib/vendure/mutations';
|
|
6
|
+
import { cookies } from 'next/headers';
|
|
7
7
|
|
|
8
8
|
export async function verifyAccountAction(token: string, password?: string) {
|
|
9
9
|
if (!token) {
|
|
10
|
-
return {error: 'Verification token is required'};
|
|
10
|
+
return { error: 'Verification token is required' };
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const [result, error] = await client.mutate(VerifyCustomerAccountMutation, {
|
|
@@ -16,13 +16,13 @@ export async function verifyAccountAction(token: string, password?: string) {
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
if (error) {
|
|
19
|
-
return {error: 'An unexpected error occurred. Please try again.'};
|
|
19
|
+
return { error: 'An unexpected error occurred. Please try again.' };
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const verifyResult = result.data.verifyCustomerAccount;
|
|
23
23
|
|
|
24
24
|
if (verifyResult.__typename !== 'CurrentUser') {
|
|
25
|
-
return {error: verifyResult.message};
|
|
25
|
+
return { error: verifyResult.message };
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// Store the token in a cookie if returned
|
|
@@ -37,5 +37,5 @@ export async function verifyAccountAction(token: string, password?: string) {
|
|
|
37
37
|
cookieStore.delete('post-verify-redirect');
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
return {success: true, redirectTo: redirectTo || null};
|
|
40
|
+
return { success: true, redirectTo: redirectTo || null };
|
|
41
41
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {Loader2} from 'lucide-react';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {VerifyContent} from './verify-content';
|
|
1
|
+
import { AuthPageShell } from '@/components/layout/auth-page-shell';
|
|
2
|
+
import { Card, CardContent } from '@/components/ui/card';
|
|
3
|
+
import { type Locale } from '@/i18n/routing';
|
|
4
|
+
import { Loader2 } from 'lucide-react';
|
|
5
|
+
import type { Metadata } from 'next';
|
|
6
|
+
import { getTranslations } from 'next-intl/server';
|
|
7
|
+
import { locale as rootLocale } from 'next/root-params';
|
|
8
|
+
import { Suspense } from 'react';
|
|
9
|
+
import { VerifyContent } from './verify-content';
|
|
10
10
|
|
|
11
11
|
export async function generateMetadata(): Promise<Metadata> {
|
|
12
12
|
const locale = (await rootLocale()) as Locale;
|
|
13
|
-
const t = await getTranslations({locale, namespace: 'Verify'});
|
|
13
|
+
const t = await getTranslations({ locale, namespace: 'Verify' });
|
|
14
14
|
return {
|
|
15
15
|
title: t('accountVerified'),
|
|
16
16
|
description: t('accountVerifiedMessage'),
|
|
@@ -22,18 +22,22 @@ function VerifyLoading() {
|
|
|
22
22
|
<Card>
|
|
23
23
|
<CardContent className="pt-6 space-y-4">
|
|
24
24
|
<div className="flex justify-center">
|
|
25
|
-
<Loader2 className="h-16 w-16 text-primary animate-spin"/>
|
|
25
|
+
<Loader2 className="h-16 w-16 text-primary animate-spin" />
|
|
26
26
|
</div>
|
|
27
27
|
</CardContent>
|
|
28
28
|
</Card>
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export default function VerifyPage({
|
|
32
|
+
export default function VerifyPage({
|
|
33
|
+
searchParams,
|
|
34
|
+
}: {
|
|
35
|
+
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
36
|
+
}) {
|
|
33
37
|
return (
|
|
34
38
|
<AuthPageShell>
|
|
35
|
-
<Suspense fallback={<VerifyLoading/>}>
|
|
36
|
-
<VerifyContent searchParams={searchParams}/>
|
|
39
|
+
<Suspense fallback={<VerifyLoading />}>
|
|
40
|
+
<VerifyContent searchParams={searchParams} />
|
|
37
41
|
</Suspense>
|
|
38
42
|
</AuthPageShell>
|
|
39
43
|
);
|
|
@@ -1,30 +1,36 @@
|
|
|
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 { Card, CardContent } from '@/components/ui/card';
|
|
5
|
+
import { Link } from '@/i18n/navigation';
|
|
6
|
+
import { CheckCircle, Loader2, XCircle } from 'lucide-react';
|
|
7
|
+
import { useTranslations } from 'next-intl';
|
|
8
|
+
import { use, useEffect, useState } from 'react';
|
|
9
|
+
import { verifyAccountAction } from './actions';
|
|
10
10
|
|
|
11
11
|
interface VerifyContentProps {
|
|
12
12
|
searchParams: Promise<{ token?: string }>;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export function VerifyContent({searchParams}: VerifyContentProps) {
|
|
15
|
+
export function VerifyContent({ searchParams }: VerifyContentProps) {
|
|
16
16
|
const t = useTranslations('Verify');
|
|
17
17
|
const params = use(searchParams);
|
|
18
18
|
const token = params.token;
|
|
19
|
-
const [result, setResult] = useState<{
|
|
19
|
+
const [result, setResult] = useState<{
|
|
20
|
+
success?: boolean;
|
|
21
|
+
error?: string;
|
|
22
|
+
redirectTo?: string | null;
|
|
23
|
+
} | null>(null);
|
|
20
24
|
|
|
21
25
|
useEffect(() => {
|
|
22
26
|
if (!token) return;
|
|
23
27
|
let cancelled = false;
|
|
24
|
-
verifyAccountAction(token).then(r => {
|
|
28
|
+
verifyAccountAction(token).then((r) => {
|
|
25
29
|
if (!cancelled) setResult(r);
|
|
26
30
|
});
|
|
27
|
-
return () => {
|
|
31
|
+
return () => {
|
|
32
|
+
cancelled = true;
|
|
33
|
+
};
|
|
28
34
|
}, [token]);
|
|
29
35
|
|
|
30
36
|
if (!token) {
|
|
@@ -32,13 +38,11 @@ export function VerifyContent({searchParams}: VerifyContentProps) {
|
|
|
32
38
|
<Card>
|
|
33
39
|
<CardContent className="pt-6 space-y-4">
|
|
34
40
|
<div className="flex justify-center">
|
|
35
|
-
<XCircle className="h-16 w-16 text-destructive"/>
|
|
41
|
+
<XCircle className="h-16 w-16 text-destructive" />
|
|
36
42
|
</div>
|
|
37
43
|
<div className="space-y-2 text-center">
|
|
38
44
|
<h1 className="text-2xl font-bold">{t('invalidLink')}</h1>
|
|
39
|
-
<p className="text-muted-foreground">
|
|
40
|
-
{t('invalidLinkMessage')}
|
|
41
|
-
</p>
|
|
45
|
+
<p className="text-muted-foreground">{t('invalidLinkMessage')}</p>
|
|
42
46
|
</div>
|
|
43
47
|
<div className="flex flex-col gap-2">
|
|
44
48
|
<Link href="/register" className="block">
|
|
@@ -62,7 +66,7 @@ export function VerifyContent({searchParams}: VerifyContentProps) {
|
|
|
62
66
|
<Card>
|
|
63
67
|
<CardContent className="pt-6 space-y-4">
|
|
64
68
|
<div className="flex justify-center">
|
|
65
|
-
<Loader2 className="h-16 w-16 text-muted-foreground animate-spin"/>
|
|
69
|
+
<Loader2 className="h-16 w-16 text-muted-foreground animate-spin" />
|
|
66
70
|
</div>
|
|
67
71
|
<div className="space-y-2 text-center">
|
|
68
72
|
<h1 className="text-2xl font-bold">{t('loading')}</h1>
|
|
@@ -79,18 +83,14 @@ export function VerifyContent({searchParams}: VerifyContentProps) {
|
|
|
79
83
|
<Card>
|
|
80
84
|
<CardContent className="pt-6 space-y-4">
|
|
81
85
|
<div className="flex justify-center">
|
|
82
|
-
<CheckCircle className="h-16 w-16 text-green-600"/>
|
|
86
|
+
<CheckCircle className="h-16 w-16 text-green-600" />
|
|
83
87
|
</div>
|
|
84
88
|
<div className="space-y-2 text-center">
|
|
85
89
|
<h1 className="text-2xl font-bold">{t('accountVerified')}</h1>
|
|
86
|
-
<p className="text-muted-foreground">
|
|
87
|
-
{t('accountVerifiedMessage')}
|
|
88
|
-
</p>
|
|
90
|
+
<p className="text-muted-foreground">{t('accountVerifiedMessage')}</p>
|
|
89
91
|
</div>
|
|
90
92
|
<Link href={continueHref} className="block">
|
|
91
|
-
<Button className="w-full">
|
|
92
|
-
{continueLabel}
|
|
93
|
-
</Button>
|
|
93
|
+
<Button className="w-full">{continueLabel}</Button>
|
|
94
94
|
</Link>
|
|
95
95
|
</CardContent>
|
|
96
96
|
</Card>
|
|
@@ -101,13 +101,11 @@ export function VerifyContent({searchParams}: VerifyContentProps) {
|
|
|
101
101
|
<Card>
|
|
102
102
|
<CardContent className="pt-6 space-y-4">
|
|
103
103
|
<div className="flex justify-center">
|
|
104
|
-
<XCircle className="h-16 w-16 text-destructive"/>
|
|
104
|
+
<XCircle className="h-16 w-16 text-destructive" />
|
|
105
105
|
</div>
|
|
106
106
|
<div className="space-y-2 text-center">
|
|
107
107
|
<h1 className="text-2xl font-bold">{t('verificationFailed')}</h1>
|
|
108
|
-
<p className="text-muted-foreground">
|
|
109
|
-
{result.error || t('verificationFailedMessage')}
|
|
110
|
-
</p>
|
|
108
|
+
<p className="text-muted-foreground">{result.error || t('verificationFailedMessage')}</p>
|
|
111
109
|
</div>
|
|
112
110
|
<div className="flex flex-col gap-2">
|
|
113
111
|
<Link href="/register" className="block">
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {Suspense} from 'react';
|
|
3
|
-
import {getTranslations} from 'next-intl/server';
|
|
4
|
-
import {locale as rootLocale} from 'next/root-params';
|
|
5
|
-
import {type Locale} from '@/i18n/routing';
|
|
6
|
-
import { Card, CardContent, CardFooter } from '@/components/ui/card';
|
|
1
|
+
import { AuthPageShell } from '@/components/layout/auth-page-shell';
|
|
7
2
|
import { Button } from '@/components/ui/button';
|
|
8
|
-
import {
|
|
3
|
+
import { Card, CardContent, CardFooter } from '@/components/ui/card';
|
|
4
|
+
import { Link } from '@/i18n/navigation';
|
|
5
|
+
import { type Locale } from '@/i18n/routing';
|
|
9
6
|
import { CheckCircle } from 'lucide-react';
|
|
10
|
-
import {
|
|
7
|
+
import type { Metadata } from 'next';
|
|
8
|
+
import { getTranslations } from 'next-intl/server';
|
|
9
|
+
import { locale as rootLocale } from 'next/root-params';
|
|
10
|
+
import { Suspense } from 'react';
|
|
11
11
|
|
|
12
12
|
export async function generateMetadata(): Promise<Metadata> {
|
|
13
13
|
const locale = (await rootLocale()) as Locale;
|
|
14
|
-
const t = await getTranslations({locale, namespace: 'Verify.pending'});
|
|
14
|
+
const t = await getTranslations({ locale, namespace: 'Verify.pending' });
|
|
15
15
|
return {
|
|
16
16
|
title: t('title'),
|
|
17
17
|
description: t('message'),
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
async function VerifyPendingContent({
|
|
21
|
+
async function VerifyPendingContent({
|
|
22
|
+
searchParams,
|
|
23
|
+
}: {
|
|
24
|
+
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
25
|
+
}) {
|
|
22
26
|
const resolvedParams = await searchParams;
|
|
23
27
|
const redirectTo = resolvedParams?.redirectTo as string | undefined;
|
|
24
28
|
const t = await getTranslations('Verify.pending');
|
|
25
29
|
|
|
26
|
-
const signInHref = redirectTo
|
|
27
|
-
? `/sign-in?redirectTo=${encodeURIComponent(redirectTo)}`
|
|
28
|
-
: '/sign-in';
|
|
30
|
+
const signInHref = redirectTo ? `/sign-in?redirectTo=${encodeURIComponent(redirectTo)}` : '/sign-in';
|
|
29
31
|
|
|
30
32
|
return (
|
|
31
33
|
<Card>
|
|
@@ -35,28 +37,26 @@ async function VerifyPendingContent({searchParams}: {searchParams: Promise<Recor
|
|
|
35
37
|
</div>
|
|
36
38
|
<div className="space-y-2 text-center">
|
|
37
39
|
<h1 className="text-2xl font-bold">{t('title')}</h1>
|
|
38
|
-
<p className="text-muted-foreground">
|
|
39
|
-
{t('message')}
|
|
40
|
-
</p>
|
|
40
|
+
<p className="text-muted-foreground">{t('message')}</p>
|
|
41
41
|
</div>
|
|
42
42
|
<div className="bg-muted p-4 rounded-md">
|
|
43
|
-
<p className="text-sm text-muted-foreground">
|
|
44
|
-
{t('spamNote')}
|
|
45
|
-
</p>
|
|
43
|
+
<p className="text-sm text-muted-foreground">{t('spamNote')}</p>
|
|
46
44
|
</div>
|
|
47
45
|
</CardContent>
|
|
48
46
|
<CardFooter className="flex flex-col space-y-2">
|
|
49
47
|
<Link href={signInHref} className="w-full">
|
|
50
|
-
<Button className="w-full">
|
|
51
|
-
{t('goToSignIn')}
|
|
52
|
-
</Button>
|
|
48
|
+
<Button className="w-full">{t('goToSignIn')}</Button>
|
|
53
49
|
</Link>
|
|
54
50
|
</CardFooter>
|
|
55
51
|
</Card>
|
|
56
52
|
);
|
|
57
53
|
}
|
|
58
54
|
|
|
59
|
-
export default async function VerifyPendingPage({
|
|
55
|
+
export default async function VerifyPendingPage({
|
|
56
|
+
searchParams,
|
|
57
|
+
}: {
|
|
58
|
+
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
59
|
+
}) {
|
|
60
60
|
return (
|
|
61
61
|
<AuthPageShell>
|
|
62
62
|
<Suspense fallback={null}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {cookies, headers} from 'next/headers';
|
|
2
|
-
import {NextResponse} from 'next/server';
|
|
1
|
+
import { cookies, headers } from 'next/headers';
|
|
2
|
+
import { NextResponse } from 'next/server';
|
|
3
3
|
|
|
4
4
|
const COMPANY_ID_COOKIE = 'vendure-company-id';
|
|
5
5
|
const BUSINESS_UNIT_ID_COOKIE = 'vendure-business-unit-id';
|
|
@@ -22,5 +22,8 @@ export async function GET() {
|
|
|
22
22
|
const referer = headerStore.get('referer');
|
|
23
23
|
const redirectTo = referer ? new URL(referer).pathname : '/';
|
|
24
24
|
|
|
25
|
-
return NextResponse.redirect(
|
|
25
|
+
return NextResponse.redirect(
|
|
26
|
+
new URL(redirectTo, process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3001'),
|
|
27
|
+
302,
|
|
28
|
+
);
|
|
26
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { routing } from '@/i18n/routing';
|
|
2
|
+
import { revalidateTag } from 'next/cache';
|
|
3
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
4
4
|
|
|
5
5
|
// Supported cache tags that can be revalidated.
|
|
6
6
|
// These are locale-independent base names — the endpoint expands them to all locales.
|
|
@@ -23,7 +23,7 @@ const DYNAMIC_TAG_PATTERNS = [
|
|
|
23
23
|
|
|
24
24
|
function isValidTag(tag: string): boolean {
|
|
25
25
|
if ((LOCALE_SENSITIVE_TAGS as readonly string[]).includes(tag)) return true;
|
|
26
|
-
return DYNAMIC_TAG_PATTERNS.some(pattern => pattern.test(tag));
|
|
26
|
+
return DYNAMIC_TAG_PATTERNS.some((pattern) => pattern.test(tag));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -31,7 +31,7 @@ function isValidTag(tag: string): boolean {
|
|
|
31
31
|
* e.g. 'collections' → ['collections-en', 'collections-de']
|
|
32
32
|
*/
|
|
33
33
|
function expandToLocales(tag: string): string[] {
|
|
34
|
-
return routing.locales.map(locale => `${tag}-${locale}`);
|
|
34
|
+
return routing.locales.map((locale) => `${tag}-${locale}`);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export async function POST(request: NextRequest) {
|
|
@@ -41,41 +41,35 @@ export async function POST(request: NextRequest) {
|
|
|
41
41
|
|
|
42
42
|
if (!expectedToken) {
|
|
43
43
|
console.error('REVALIDATION_SECRET environment variable not set');
|
|
44
|
-
return NextResponse.json(
|
|
45
|
-
{error: 'Server configuration error'},
|
|
46
|
-
{status: 500}
|
|
47
|
-
);
|
|
44
|
+
return NextResponse.json({ error: 'Server configuration error' }, { status: 500 });
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
if (authHeader !== `Bearer ${expectedToken}`) {
|
|
51
|
-
return NextResponse.json(
|
|
52
|
-
{error: 'Unauthorized'},
|
|
53
|
-
{status: 401}
|
|
54
|
-
);
|
|
48
|
+
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
55
49
|
}
|
|
56
50
|
|
|
57
51
|
try {
|
|
58
52
|
const body = await request.json();
|
|
59
|
-
const {tags} = body;
|
|
53
|
+
const { tags } = body;
|
|
60
54
|
|
|
61
55
|
if (!tags || !Array.isArray(tags) || tags.length === 0) {
|
|
62
56
|
return NextResponse.json(
|
|
63
|
-
{error: 'Missing or invalid "tags" array in request body'},
|
|
64
|
-
{status: 400}
|
|
57
|
+
{ error: 'Missing or invalid "tags" array in request body' },
|
|
58
|
+
{ status: 400 },
|
|
65
59
|
);
|
|
66
60
|
}
|
|
67
61
|
|
|
68
62
|
// Validate and revalidate each tag, expanding to all locales
|
|
69
|
-
const results: {tag: string; success: boolean; error?: string}[] = [];
|
|
63
|
+
const results: { tag: string; success: boolean; error?: string }[] = [];
|
|
70
64
|
|
|
71
65
|
for (const tag of tags) {
|
|
72
66
|
if (typeof tag !== 'string') {
|
|
73
|
-
results.push({tag: String(tag), success: false, error: 'Invalid tag type'});
|
|
67
|
+
results.push({ tag: String(tag), success: false, error: 'Invalid tag type' });
|
|
74
68
|
continue;
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
if (!isValidTag(tag)) {
|
|
78
|
-
results.push({tag, success: false, error: 'Unknown tag'});
|
|
72
|
+
results.push({ tag, success: false, error: 'Unknown tag' });
|
|
79
73
|
continue;
|
|
80
74
|
}
|
|
81
75
|
|
|
@@ -83,15 +77,15 @@ export async function POST(request: NextRequest) {
|
|
|
83
77
|
const expanded = expandToLocales(tag);
|
|
84
78
|
try {
|
|
85
79
|
for (const localeTag of expanded) {
|
|
86
|
-
revalidateTag(localeTag, {expire: 0});
|
|
80
|
+
revalidateTag(localeTag, { expire: 0 });
|
|
87
81
|
}
|
|
88
|
-
results.push({tag, success: true});
|
|
82
|
+
results.push({ tag, success: true });
|
|
89
83
|
} catch {
|
|
90
|
-
results.push({tag, success: false, error: 'Revalidation failed'});
|
|
84
|
+
results.push({ tag, success: false, error: 'Revalidation failed' });
|
|
91
85
|
}
|
|
92
86
|
}
|
|
93
87
|
|
|
94
|
-
const allSuccessful = results.every(r => r.success);
|
|
88
|
+
const allSuccessful = results.every((r) => r.success);
|
|
95
89
|
|
|
96
90
|
return NextResponse.json(
|
|
97
91
|
{
|
|
@@ -99,12 +93,9 @@ export async function POST(request: NextRequest) {
|
|
|
99
93
|
results,
|
|
100
94
|
timestamp: Date.now(),
|
|
101
95
|
},
|
|
102
|
-
{status: allSuccessful ? 200 : 207} // 207 = Multi-Status
|
|
96
|
+
{ status: allSuccessful ? 200 : 207 }, // 207 = Multi-Status
|
|
103
97
|
);
|
|
104
98
|
} catch {
|
|
105
|
-
return NextResponse.json(
|
|
106
|
-
{error: 'Invalid JSON body'},
|
|
107
|
-
{status: 400}
|
|
108
|
-
);
|
|
99
|
+
return NextResponse.json({ error: 'Invalid JSON body' }, { status: 400 });
|
|
109
100
|
}
|
|
110
101
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
2
1
|
import { client } from '@/lib/vendure/api';
|
|
3
2
|
import { LogSearchResultClickedMutation } from '@/lib/vendure/mutations';
|
|
3
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
4
4
|
|
|
5
5
|
export async function POST(request: NextRequest) {
|
|
6
6
|
const body = await request.json();
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { LucideIcon } from 'lucide-react';
|
|
2
2
|
import {
|
|
3
|
-
Package,
|
|
4
|
-
User,
|
|
5
|
-
MapPin,
|
|
6
|
-
ShieldCheck,
|
|
7
|
-
FileText,
|
|
8
3
|
Building2,
|
|
9
|
-
Users,
|
|
10
|
-
Network,
|
|
11
|
-
Shield,
|
|
12
|
-
MapPinHouse,
|
|
13
4
|
CreditCard,
|
|
14
|
-
|
|
5
|
+
FileText,
|
|
15
6
|
Heart,
|
|
16
|
-
|
|
7
|
+
MapPin,
|
|
8
|
+
MapPinHouse,
|
|
9
|
+
Network,
|
|
10
|
+
Package,
|
|
11
|
+
Receipt,
|
|
12
|
+
Shield,
|
|
13
|
+
ShieldCheck,
|
|
17
14
|
ShoppingCart,
|
|
15
|
+
User,
|
|
16
|
+
Users,
|
|
17
|
+
Zap,
|
|
18
18
|
} from 'lucide-react';
|
|
19
19
|
|
|
20
20
|
export interface NavItem {
|
|
@@ -42,17 +42,42 @@ export const personalNavItems: NavItem[] = [
|
|
|
42
42
|
|
|
43
43
|
export const companyNavItems: CompanyNavItem[] = [
|
|
44
44
|
{ href: '/account/company', label: 'companyProfile', icon: Building2, exact: true },
|
|
45
|
-
{
|
|
46
|
-
|
|
45
|
+
{
|
|
46
|
+
href: '/account/company/users',
|
|
47
|
+
label: 'users',
|
|
48
|
+
icon: Users,
|
|
49
|
+
requiredPermissions: ['ViewUsers', 'ManageUsers'],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
href: '/account/company/business-units',
|
|
53
|
+
label: 'businessUnits',
|
|
54
|
+
icon: Network,
|
|
55
|
+
requiredPermissions: ['ManageBusinessUnits'],
|
|
56
|
+
},
|
|
47
57
|
{ href: '/account/company/roles', label: 'roles', icon: Shield, requiredPermissions: ['ManageRoles'] },
|
|
48
|
-
{
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
{
|
|
59
|
+
href: '/account/company/addresses',
|
|
60
|
+
label: 'companyAddresses',
|
|
61
|
+
icon: MapPinHouse,
|
|
62
|
+
requiredPermissions: ['ManageAddresses'],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
href: '/account/company/payment-methods',
|
|
66
|
+
label: 'paymentMethods',
|
|
67
|
+
icon: CreditCard,
|
|
68
|
+
requiredPermissions: ['ManagePaymentMethods'],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
href: '/account/company/tax-ids',
|
|
72
|
+
label: 'taxIds',
|
|
73
|
+
icon: Receipt,
|
|
74
|
+
requiredPermissions: ['ManageCompany'],
|
|
75
|
+
},
|
|
51
76
|
];
|
|
52
77
|
|
|
53
78
|
export function getVisibleCompanyItems(permissions: string[]): CompanyNavItem[] {
|
|
54
|
-
return companyNavItems.filter(item => {
|
|
79
|
+
return companyNavItems.filter((item) => {
|
|
55
80
|
if (!item.requiredPermissions) return true;
|
|
56
|
-
return item.requiredPermissions.some(p => permissions.includes(p));
|
|
81
|
+
return item.requiredPermissions.some((p) => permissions.includes(p));
|
|
57
82
|
});
|
|
58
83
|
}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {Link, usePathname} from '@/i18n/navigation';
|
|
4
|
-
import { useTranslations } from 'next-intl';
|
|
5
|
-
import { LayoutGrid } from 'lucide-react';
|
|
6
|
-
import {
|
|
7
|
-
Sheet,
|
|
8
|
-
SheetContent,
|
|
9
|
-
SheetHeader,
|
|
10
|
-
SheetTitle,
|
|
11
|
-
SheetTrigger,
|
|
12
|
-
} from '@/components/ui/sheet';
|
|
13
3
|
import { Button } from '@/components/ui/button';
|
|
4
|
+
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from '@/components/ui/sheet';
|
|
5
|
+
import { Link, usePathname } from '@/i18n/navigation';
|
|
14
6
|
import { cn } from '@/lib/utils';
|
|
15
|
-
import {
|
|
7
|
+
import { LayoutGrid } from 'lucide-react';
|
|
8
|
+
import { useTranslations } from 'next-intl';
|
|
9
|
+
import { getVisibleCompanyItems, type NavItem, personalNavItems } from './account-nav-items';
|
|
16
10
|
|
|
17
|
-
function NavLink({
|
|
11
|
+
function NavLink({
|
|
12
|
+
item,
|
|
13
|
+
pathname,
|
|
14
|
+
t,
|
|
15
|
+
}: {
|
|
16
|
+
item: NavItem;
|
|
17
|
+
pathname: string;
|
|
18
|
+
t: ReturnType<typeof useTranslations<'Account'>>;
|
|
19
|
+
}) {
|
|
18
20
|
const isActive = item.exact
|
|
19
21
|
? pathname === item.href
|
|
20
22
|
: pathname === item.href || pathname.startsWith(item.href + '/');
|
|
@@ -24,9 +26,7 @@ function NavLink({ item, pathname, t }: { item: NavItem; pathname: string; t: Re
|
|
|
24
26
|
prefetch={true}
|
|
25
27
|
className={cn(
|
|
26
28
|
'flex items-center gap-3 px-3 py-2 text-sm rounded-md transition-colors',
|
|
27
|
-
isActive
|
|
28
|
-
? 'bg-primary/10 text-primary font-medium'
|
|
29
|
-
: 'text-foreground hover:bg-muted',
|
|
29
|
+
isActive ? 'bg-primary/10 text-primary font-medium' : 'text-foreground hover:bg-muted',
|
|
30
30
|
)}
|
|
31
31
|
>
|
|
32
32
|
<item.icon className="h-4 w-4" />
|
|
@@ -46,14 +46,12 @@ function AccountNavLinks({
|
|
|
46
46
|
pathname: string;
|
|
47
47
|
t: ReturnType<typeof useTranslations<'Account'>>;
|
|
48
48
|
}) {
|
|
49
|
-
const visibleCompanyItems = hasCompany
|
|
50
|
-
? getVisibleCompanyItems(permissions)
|
|
51
|
-
: [];
|
|
49
|
+
const visibleCompanyItems = hasCompany ? getVisibleCompanyItems(permissions) : [];
|
|
52
50
|
|
|
53
51
|
return (
|
|
54
52
|
<nav className="space-y-1">
|
|
55
53
|
<h2 className="font-semibold text-sm pb-2">{t('sidebar.accountHeading')}</h2>
|
|
56
|
-
{personalNavItems.map(item => (
|
|
54
|
+
{personalNavItems.map((item) => (
|
|
57
55
|
<NavLink key={item.href} item={item} pathname={pathname} t={t} />
|
|
58
56
|
))}
|
|
59
57
|
{visibleCompanyItems.length > 0 && (
|
|
@@ -63,7 +61,7 @@ function AccountNavLinks({
|
|
|
63
61
|
{t('sidebar.companySection')}
|
|
64
62
|
</span>
|
|
65
63
|
</div>
|
|
66
|
-
{visibleCompanyItems.map(item => (
|
|
64
|
+
{visibleCompanyItems.map((item) => (
|
|
67
65
|
<NavLink key={item.href} item={item} pathname={pathname} t={t} />
|
|
68
66
|
))}
|
|
69
67
|
</>
|
|
@@ -85,7 +83,12 @@ export function AccountSidebar({ permissions, hasCompany }: AccountSidebarProps)
|
|
|
85
83
|
<>
|
|
86
84
|
{/* Desktop: sticky sidebar */}
|
|
87
85
|
<div className="hidden lg:block sticky top-20">
|
|
88
|
-
<AccountNavLinks
|
|
86
|
+
<AccountNavLinks
|
|
87
|
+
permissions={permissions}
|
|
88
|
+
hasCompany={hasCompany}
|
|
89
|
+
pathname={pathname}
|
|
90
|
+
t={t}
|
|
91
|
+
/>
|
|
89
92
|
</div>
|
|
90
93
|
|
|
91
94
|
{/* Mobile: sheet trigger */}
|
|
@@ -102,7 +105,12 @@ export function AccountSidebar({ permissions, hasCompany }: AccountSidebarProps)
|
|
|
102
105
|
<SheetTitle>{t('sidebar.accountHeading')}</SheetTitle>
|
|
103
106
|
</SheetHeader>
|
|
104
107
|
<div className="px-4 pb-4">
|
|
105
|
-
<AccountNavLinks
|
|
108
|
+
<AccountNavLinks
|
|
109
|
+
permissions={permissions}
|
|
110
|
+
hasCompany={hasCompany}
|
|
111
|
+
pathname={pathname}
|
|
112
|
+
t={t}
|
|
113
|
+
/>
|
|
106
114
|
</div>
|
|
107
115
|
</SheetContent>
|
|
108
116
|
</Sheet>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { usePathname, useRouter } from '@/i18n/navigation';
|
|
3
4
|
import { formatPrice } from '@/lib/format';
|
|
4
5
|
import { RESERVED_PARAMS } from '@/lib/search-helpers';
|
|
5
6
|
import { X } from 'lucide-react';
|
|
6
7
|
import { useLocale } from 'next-intl';
|
|
7
8
|
import { useSearchParams } from 'next/navigation';
|
|
8
|
-
import { usePathname, useRouter } from '@/i18n/navigation';
|
|
9
9
|
|
|
10
10
|
interface FacetValueInfo {
|
|
11
11
|
code: string;
|