@vendure-platform/create 0.1.0
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/README.md +70 -0
- package/dist/assets/demo-data/branding/logo.svg +4 -0
- package/dist/assets/demo-data/images/absorbent-pad.webp +0 -0
- package/dist/assets/demo-data/images/adjustable-wrench.webp +0 -0
- package/dist/assets/demo-data/images/anchor-bolt.webp +0 -0
- package/dist/assets/demo-data/images/angle-grinder.webp +0 -0
- package/dist/assets/demo-data/images/barrier-tape.webp +0 -0
- package/dist/assets/demo-data/images/bench-grinder.webp +0 -0
- package/dist/assets/demo-data/images/bracket.webp +0 -0
- package/dist/assets/demo-data/images/broom.webp +0 -0
- package/dist/assets/demo-data/images/bucket.webp +0 -0
- package/dist/assets/demo-data/images/cable-gland.webp +0 -0
- package/dist/assets/demo-data/images/cable-tie.webp +0 -0
- package/dist/assets/demo-data/images/cable-tray.webp +0 -0
- package/dist/assets/demo-data/images/cable.webp +0 -0
- package/dist/assets/demo-data/images/chimney-base-kit.webp +0 -0
- package/dist/assets/demo-data/images/chimney-cowl-bird-guard.webp +0 -0
- package/dist/assets/demo-data/images/chimney-cowl-open.webp +0 -0
- package/dist/assets/demo-data/images/chimney-storm-collar.webp +0 -0
- package/dist/assets/demo-data/images/chimney-wall-bracket.webp +0 -0
- package/dist/assets/demo-data/images/circular-saw.webp +0 -0
- package/dist/assets/demo-data/images/cleaning-spray.webp +0 -0
- package/dist/assets/demo-data/images/conduit.webp +0 -0
- package/dist/assets/demo-data/images/cordless-drill.webp +0 -0
- package/dist/assets/demo-data/images/drill-bits.webp +0 -0
- package/dist/assets/demo-data/images/dust-mask.webp +0 -0
- package/dist/assets/demo-data/images/ear-defenders.webp +0 -0
- package/dist/assets/demo-data/images/ear-plugs.webp +0 -0
- package/dist/assets/demo-data/images/extension-lead.webp +0 -0
- package/dist/assets/demo-data/images/eye-wash-station.webp +0 -0
- package/dist/assets/demo-data/images/face-shield.webp +0 -0
- package/dist/assets/demo-data/images/file-set.webp +0 -0
- package/dist/assets/demo-data/images/first-aid-kit.webp +0 -0
- package/dist/assets/demo-data/images/floor-sign.webp +0 -0
- package/dist/assets/demo-data/images/flue-bend-45.webp +0 -0
- package/dist/assets/demo-data/images/flue-bend-90.webp +0 -0
- package/dist/assets/demo-data/images/flue-section-1000mm.webp +0 -0
- package/dist/assets/demo-data/images/flue-section-250mm.webp +0 -0
- package/dist/assets/demo-data/images/flue-section-500mm.webp +0 -0
- package/dist/assets/demo-data/images/fuse.webp +0 -0
- package/dist/assets/demo-data/images/glove-dispenser.webp +0 -0
- package/dist/assets/demo-data/images/grinding-disc.webp +0 -0
- package/dist/assets/demo-data/images/hacksaw.webp +0 -0
- package/dist/assets/demo-data/images/hammer.webp +0 -0
- package/dist/assets/demo-data/images/hand-sanitiser.webp +0 -0
- package/dist/assets/demo-data/images/head-torch.webp +0 -0
- package/dist/assets/demo-data/images/heat-gun.webp +0 -0
- package/dist/assets/demo-data/images/hex-bolt.webp +0 -0
- package/dist/assets/demo-data/images/hex-key-set.webp +0 -0
- package/dist/assets/demo-data/images/hex-nut.webp +0 -0
- package/dist/assets/demo-data/images/hi-vis-jacket.webp +0 -0
- package/dist/assets/demo-data/images/hi-vis-vest.webp +0 -0
- package/dist/assets/demo-data/images/hose-clamp.webp +0 -0
- package/dist/assets/demo-data/images/impact-driver.webp +0 -0
- package/dist/assets/demo-data/images/jigsaw.webp +0 -0
- package/dist/assets/demo-data/images/junction-box.webp +0 -0
- package/dist/assets/demo-data/images/knee-pads.webp +0 -0
- package/dist/assets/demo-data/images/machine-screw.webp +0 -0
- package/dist/assets/demo-data/images/made-to-order-configurable-chimney.webp +0 -0
- package/dist/assets/demo-data/images/mallet.webp +0 -0
- package/dist/assets/demo-data/images/mcb.webp +0 -0
- package/dist/assets/demo-data/images/mop.webp +0 -0
- package/dist/assets/demo-data/images/paper-towels.webp +0 -0
- package/dist/assets/demo-data/images/pipe-wrench.webp +0 -0
- package/dist/assets/demo-data/images/pliers-set.webp +0 -0
- package/dist/assets/demo-data/images/pry-bar.webp +0 -0
- package/dist/assets/demo-data/images/rcd.webp +0 -0
- package/dist/assets/demo-data/images/reciprocating-saw.webp +0 -0
- package/dist/assets/demo-data/images/rivet.webp +0 -0
- package/dist/assets/demo-data/images/roof-flashing-high-pitch.webp +0 -0
- package/dist/assets/demo-data/images/roof-flashing-low-pitch.webp +0 -0
- package/dist/assets/demo-data/images/safety-boots.webp +0 -0
- package/dist/assets/demo-data/images/safety-glasses.webp +0 -0
- package/dist/assets/demo-data/images/safety-harness.webp +0 -0
- package/dist/assets/demo-data/images/safety-helmet.webp +0 -0
- package/dist/assets/demo-data/images/safety-sign.webp +0 -0
- package/dist/assets/demo-data/images/sanding-disc.webp +0 -0
- package/dist/assets/demo-data/images/saw-blade.webp +0 -0
- package/dist/assets/demo-data/images/screwdriver-set.webp +0 -0
- package/dist/assets/demo-data/images/screwdriver.webp +0 -0
- package/dist/assets/demo-data/images/self-tapping-screw.webp +0 -0
- package/dist/assets/demo-data/images/socket-set.webp +0 -0
- package/dist/assets/demo-data/images/socket.webp +0 -0
- package/dist/assets/demo-data/images/spanner-set.webp +0 -0
- package/dist/assets/demo-data/images/spanner.webp +0 -0
- package/dist/assets/demo-data/images/spill-kit.webp +0 -0
- package/dist/assets/demo-data/images/spirit-level.webp +0 -0
- package/dist/assets/demo-data/images/switch.webp +0 -0
- package/dist/assets/demo-data/images/tape-measure.webp +0 -0
- package/dist/assets/demo-data/images/terminal-block.webp +0 -0
- package/dist/assets/demo-data/images/threaded-rod.webp +0 -0
- package/dist/assets/demo-data/images/torque-wrench.webp +0 -0
- package/dist/assets/demo-data/images/utility-knife.webp +0 -0
- package/dist/assets/demo-data/images/wall-pass-sleeve.webp +0 -0
- package/dist/assets/demo-data/images/wall-plug.webp +0 -0
- package/dist/assets/demo-data/images/washer.webp +0 -0
- package/dist/assets/demo-data/images/waste-bin.webp +0 -0
- package/dist/assets/demo-data/images/wire-connector.webp +0 -0
- package/dist/assets/demo-data/images/wire-cutters.webp +0 -0
- package/dist/assets/demo-data/images/wood-screw.webp +0 -0
- package/dist/assets/demo-data/images/work-gloves.webp +0 -0
- package/dist/assets/demo-data/images/work-light.webp +0 -0
- package/dist/assets/demo-data/initial-data.json +667 -0
- package/dist/assets/demo-data/products.csv +779 -0
- package/dist/assets/storefront/.env.example +14 -0
- package/dist/assets/storefront/.env.local +1 -0
- package/dist/assets/storefront/components.json +22 -0
- package/dist/assets/storefront/eslint.config.mjs +23 -0
- package/dist/assets/storefront/graphql.config.yml +2 -0
- package/dist/assets/storefront/messages/de.json +1196 -0
- package/dist/assets/storefront/messages/en.json +1196 -0
- package/dist/assets/storefront/next-env.d.ts +6 -0
- package/dist/assets/storefront/next.config.ts +73 -0
- package/dist/assets/storefront/package.json +77 -0
- package/dist/assets/storefront/postcss.config.mjs +5 -0
- package/dist/assets/storefront/public/next.svg +22 -0
- package/dist/assets/storefront/public/scenarios/b2b-wholesale/hero/hero-bg.webp +0 -0
- package/dist/assets/storefront/public/scenarios/b2b-wholesale/logo.svg +4 -0
- package/dist/assets/storefront/public/scenarios/default/logo.svg +4 -0
- package/dist/assets/storefront/public/scenarios/kaminpro/hero/hero-bg.webp +0 -0
- package/dist/assets/storefront/public/scenarios/kaminpro/logo.svg +7 -0
- package/dist/assets/storefront/public/vendure.svg +4 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/catalog/page.tsx +65 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/collection/[slug]/loading.tsx +24 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/collection/[slug]/page.tsx +194 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/layout.tsx +9 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/actions.ts +139 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/loading.tsx +46 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/page.tsx +330 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/actions.ts +11 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/loading.tsx +20 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/page.tsx +97 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-analytics-tracker.tsx +46 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-results.tsx +53 -0
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-term.tsx +26 -0
- package/dist/assets/storefront/src/app/[locale]/(scenario)/[...path]/page.tsx +31 -0
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/accept-invitation-client.tsx +56 -0
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/actions.ts +32 -0
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/page.tsx +85 -0
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/sign-out-and-retry.tsx +26 -0
- package/dist/assets/storefront/src/app/[locale]/account/addresses/actions.ts +125 -0
- package/dist/assets/storefront/src/app/[locale]/account/addresses/address-form.tsx +180 -0
- package/dist/assets/storefront/src/app/[locale]/account/addresses/addresses-client.tsx +292 -0
- package/dist/assets/storefront/src/app/[locale]/account/addresses/loading.tsx +48 -0
- package/dist/assets/storefront/src/app/[locale]/account/addresses/page.tsx +54 -0
- package/dist/assets/storefront/src/app/[locale]/account/approvals/actions.ts +28 -0
- package/dist/assets/storefront/src/app/[locale]/account/approvals/page.tsx +340 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/actions.ts +33 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/actions.ts +83 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/address-form.tsx +267 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/addresses-client.tsx +253 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/page.tsx +75 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/actions.ts +70 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-unit-form.tsx +153 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-units-client.tsx +210 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/page.tsx +66 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/types.ts +8 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/edit-company-form.tsx +57 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/page.tsx +89 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/page.tsx +65 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/payment-methods-client.tsx +55 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/roles/page.tsx +66 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/roles/roles-client.tsx +93 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/actions.ts +51 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/page.tsx +57 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/tax-ids-client.tsx +326 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/users/actions.ts +74 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/users/edit-user-form.tsx +157 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/users/invite-user-form.tsx +133 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/users/page.tsx +104 -0
- package/dist/assets/storefront/src/app/[locale]/account/company/users/users-client.tsx +266 -0
- package/dist/assets/storefront/src/app/[locale]/account/error.tsx +24 -0
- package/dist/assets/storefront/src/app/[locale]/account/layout.tsx +50 -0
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/page.tsx +463 -0
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-actions.ts +160 -0
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-dialog.tsx +386 -0
- package/dist/assets/storefront/src/app/[locale]/account/orders/loading.tsx +45 -0
- package/dist/assets/storefront/src/app/[locale]/account/orders/page.tsx +309 -0
- package/dist/assets/storefront/src/app/[locale]/account/profile/actions.ts +106 -0
- package/dist/assets/storefront/src/app/[locale]/account/profile/change-password-form.tsx +82 -0
- package/dist/assets/storefront/src/app/[locale]/account/profile/edit-email-form.tsx +88 -0
- package/dist/assets/storefront/src/app/[locale]/account/profile/edit-profile-form.tsx +80 -0
- package/dist/assets/storefront/src/app/[locale]/account/profile/loading.tsx +54 -0
- package/dist/assets/storefront/src/app/[locale]/account/profile/page.tsx +44 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/actions.ts +103 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/file-upload-tab.tsx +148 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/manual-entry-tab.tsx +112 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/page.tsx +26 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/preview-table.tsx +170 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/quick-order-form.tsx +243 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/save-to-list-dialog.tsx +153 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/sku-autocomplete.tsx +118 -0
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/text-input-tab.tsx +40 -0
- package/dist/assets/storefront/src/app/[locale]/account/quotes/[id]/page.tsx +260 -0
- package/dist/assets/storefront/src/app/[locale]/account/quotes/actions.ts +253 -0
- package/dist/assets/storefront/src/app/[locale]/account/quotes/new/new-quote-form.tsx +28 -0
- package/dist/assets/storefront/src/app/[locale]/account/quotes/new/page.tsx +51 -0
- package/dist/assets/storefront/src/app/[locale]/account/quotes/page.tsx +248 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/loading.tsx +44 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/page.tsx +51 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/shopping-list-detail-client.tsx +562 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/actions.ts +235 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/create-shopping-list-form.tsx +86 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/loading.tsx +48 -0
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/page.tsx +176 -0
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/actions.ts +31 -0
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/claim-form.tsx +41 -0
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/page.tsx +190 -0
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/reveal-code.tsx +38 -0
- package/dist/assets/storefront/src/app/[locale]/account/verify-email/page.tsx +117 -0
- package/dist/assets/storefront/src/app/[locale]/cart/actions.ts +128 -0
- package/dist/assets/storefront/src/app/[locale]/cart/cart-items.tsx +228 -0
- package/dist/assets/storefront/src/app/[locale]/cart/cart-line-actions.tsx +55 -0
- package/dist/assets/storefront/src/app/[locale]/cart/cart-quantity-control.tsx +158 -0
- package/dist/assets/storefront/src/app/[locale]/cart/cart-remove-button.tsx +36 -0
- package/dist/assets/storefront/src/app/[locale]/cart/cart.tsx +151 -0
- package/dist/assets/storefront/src/app/[locale]/cart/code-input.tsx +49 -0
- package/dist/assets/storefront/src/app/[locale]/cart/loading.tsx +10 -0
- package/dist/assets/storefront/src/app/[locale]/cart/order-summary.tsx +178 -0
- package/dist/assets/storefront/src/app/[locale]/cart/page.tsx +33 -0
- package/dist/assets/storefront/src/app/[locale]/cart/promotion-code.tsx +142 -0
- package/dist/assets/storefront/src/app/[locale]/cart/reapproval-confirm.tsx +76 -0
- package/dist/assets/storefront/src/app/[locale]/cart/request-quote-button.tsx +80 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/actions.ts +192 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/cancel-quote-checkout-button.tsx +30 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/checkout-flow.tsx +214 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/checkout-provider.tsx +181 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/loading.tsx +90 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/order-summary.tsx +160 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/page.tsx +154 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/delivery-step.tsx +107 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/payment-step.tsx +110 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/review-step.tsx +180 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/shipping-address-step.tsx +518 -0
- package/dist/assets/storefront/src/app/[locale]/checkout/types.ts +7 -0
- package/dist/assets/storefront/src/app/[locale]/error.tsx +28 -0
- package/dist/assets/storefront/src/app/[locale]/forgot-password/actions.ts +28 -0
- package/dist/assets/storefront/src/app/[locale]/forgot-password/forgot-password-form.tsx +128 -0
- package/dist/assets/storefront/src/app/[locale]/forgot-password/page.tsx +24 -0
- package/dist/assets/storefront/src/app/[locale]/globals.css +72 -0
- package/dist/assets/storefront/src/app/[locale]/layout.tsx +202 -0
- package/dist/assets/storefront/src/app/[locale]/not-found.tsx +26 -0
- package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/order-confirmation.tsx +296 -0
- package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/page.tsx +18 -0
- package/dist/assets/storefront/src/app/[locale]/page.tsx +125 -0
- package/dist/assets/storefront/src/app/[locale]/register/actions.ts +50 -0
- package/dist/assets/storefront/src/app/[locale]/register/page.tsx +82 -0
- package/dist/assets/storefront/src/app/[locale]/register/registration-form.tsx +237 -0
- package/dist/assets/storefront/src/app/[locale]/register-company/actions.ts +40 -0
- package/dist/assets/storefront/src/app/[locale]/register-company/page.tsx +43 -0
- package/dist/assets/storefront/src/app/[locale]/register-company/registration-form.tsx +48 -0
- package/dist/assets/storefront/src/app/[locale]/reset-password/actions.ts +40 -0
- package/dist/assets/storefront/src/app/[locale]/reset-password/page.tsx +32 -0
- package/dist/assets/storefront/src/app/[locale]/reset-password/reset-password-form.tsx +96 -0
- package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/add-to-cart-button.tsx +31 -0
- package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/loading.tsx +29 -0
- package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/page.tsx +157 -0
- package/dist/assets/storefront/src/app/[locale]/sign-in/actions.ts +76 -0
- package/dist/assets/storefront/src/app/[locale]/sign-in/login-form.tsx +177 -0
- package/dist/assets/storefront/src/app/[locale]/sign-in/page.tsx +81 -0
- package/dist/assets/storefront/src/app/[locale]/verify/actions.ts +41 -0
- package/dist/assets/storefront/src/app/[locale]/verify/page.tsx +40 -0
- package/dist/assets/storefront/src/app/[locale]/verify/verify-content.tsx +127 -0
- package/dist/assets/storefront/src/app/[locale]/verify-pending/page.tsx +67 -0
- package/dist/assets/storefront/src/app/api/clear-company-context/route.ts +26 -0
- package/dist/assets/storefront/src/app/api/draft/disable/route.ts +12 -0
- package/dist/assets/storefront/src/app/api/draft/route.ts +17 -0
- package/dist/assets/storefront/src/app/api/revalidate/route.ts +110 -0
- package/dist/assets/storefront/src/app/api/search-analytics/route.ts +16 -0
- package/dist/assets/storefront/src/app/favicon.ico +0 -0
- package/dist/assets/storefront/src/components/commerce/account-nav-items.ts +56 -0
- package/dist/assets/storefront/src/components/commerce/account-sidebar.tsx +112 -0
- package/dist/assets/storefront/src/components/commerce/active-filters.tsx +107 -0
- package/dist/assets/storefront/src/components/commerce/approval-decision-form.tsx +70 -0
- package/dist/assets/storefront/src/components/commerce/approval-status-badge.tsx +37 -0
- package/dist/assets/storefront/src/components/commerce/business-unit-switcher.tsx +56 -0
- package/dist/assets/storefront/src/components/commerce/catalog-search-bar.tsx +83 -0
- package/dist/assets/storefront/src/components/commerce/category-product-section.tsx +69 -0
- package/dist/assets/storefront/src/components/commerce/category-sidebar.tsx +133 -0
- package/dist/assets/storefront/src/components/commerce/collection-hero-banner.tsx +36 -0
- package/dist/assets/storefront/src/components/commerce/company-state-badge.tsx +32 -0
- package/dist/assets/storefront/src/components/commerce/company-switcher.tsx +58 -0
- package/dist/assets/storefront/src/components/commerce/configurator-form.tsx +606 -0
- package/dist/assets/storefront/src/components/commerce/facet-filters.tsx +286 -0
- package/dist/assets/storefront/src/components/commerce/gift-card-pdp.tsx +43 -0
- package/dist/assets/storefront/src/components/commerce/gift-card-product-info.tsx +137 -0
- package/dist/assets/storefront/src/components/commerce/highlighted-text.tsx +30 -0
- package/dist/assets/storefront/src/components/commerce/instant-search-dropdown.tsx +377 -0
- package/dist/assets/storefront/src/components/commerce/order-status-badge.tsx +41 -0
- package/dist/assets/storefront/src/components/commerce/packaging-unit-selector.tsx +146 -0
- package/dist/assets/storefront/src/components/commerce/permission-gate.tsx +20 -0
- package/dist/assets/storefront/src/components/commerce/price-range-filter.tsx +111 -0
- package/dist/assets/storefront/src/components/commerce/price-tiers.tsx +98 -0
- package/dist/assets/storefront/src/components/commerce/price.tsx +29 -0
- package/dist/assets/storefront/src/components/commerce/product-card-list.tsx +121 -0
- package/dist/assets/storefront/src/components/commerce/product-card.tsx +89 -0
- package/dist/assets/storefront/src/components/commerce/product-carousel.tsx +42 -0
- package/dist/assets/storefront/src/components/commerce/product-grid.tsx +54 -0
- package/dist/assets/storefront/src/components/commerce/product-image-carousel.tsx +127 -0
- package/dist/assets/storefront/src/components/commerce/product-info.tsx +525 -0
- package/dist/assets/storefront/src/components/commerce/product-list-expansion.tsx +393 -0
- package/dist/assets/storefront/src/components/commerce/product-list-view.tsx +34 -0
- package/dist/assets/storefront/src/components/commerce/product-sidebar.tsx +175 -0
- package/dist/assets/storefront/src/components/commerce/product-view-switcher.tsx +107 -0
- package/dist/assets/storefront/src/components/commerce/quote-action-buttons.tsx +235 -0
- package/dist/assets/storefront/src/components/commerce/quote-activity-timeline.tsx +320 -0
- package/dist/assets/storefront/src/components/commerce/quote-comment-form.tsx +52 -0
- package/dist/assets/storefront/src/components/commerce/quote-csv-export-button.tsx +97 -0
- package/dist/assets/storefront/src/components/commerce/quote-product-search.tsx +139 -0
- package/dist/assets/storefront/src/components/commerce/quote-request-form.tsx +252 -0
- package/dist/assets/storefront/src/components/commerce/quote-status-badge.tsx +41 -0
- package/dist/assets/storefront/src/components/commerce/quote-validity-indicator.tsx +33 -0
- package/dist/assets/storefront/src/components/commerce/quote-version-comparison.tsx +88 -0
- package/dist/assets/storefront/src/components/commerce/related-products.tsx +56 -0
- package/dist/assets/storefront/src/components/commerce/shop-by-category.tsx +59 -0
- package/dist/assets/storefront/src/components/commerce/shopping-list-toggle.tsx +158 -0
- package/dist/assets/storefront/src/components/commerce/sort-dropdown.tsx +51 -0
- package/dist/assets/storefront/src/components/commerce/store-credit-summary.tsx +45 -0
- package/dist/assets/storefront/src/components/commerce/subcollection-tiles.tsx +56 -0
- package/dist/assets/storefront/src/components/layout/auth-page-shell.tsx +15 -0
- package/dist/assets/storefront/src/components/layout/draft-mode-action.ts +8 -0
- package/dist/assets/storefront/src/components/layout/draft-mode-indicator.tsx +54 -0
- package/dist/assets/storefront/src/components/layout/draft-mode-link.tsx +29 -0
- package/dist/assets/storefront/src/components/layout/footer.tsx +168 -0
- package/dist/assets/storefront/src/components/layout/navbar/actions.ts +33 -0
- package/dist/assets/storefront/src/components/layout/navbar/cart-icon.tsx +50 -0
- package/dist/assets/storefront/src/components/layout/navbar/channel-picker-wrapper.tsx +19 -0
- package/dist/assets/storefront/src/components/layout/navbar/channel-picker.tsx +53 -0
- package/dist/assets/storefront/src/components/layout/navbar/currency-picker-wrapper.tsx +21 -0
- package/dist/assets/storefront/src/components/layout/navbar/currency-picker.tsx +52 -0
- package/dist/assets/storefront/src/components/layout/navbar/language-picker.tsx +51 -0
- package/dist/assets/storefront/src/components/layout/navbar/login-button.tsx +34 -0
- package/dist/assets/storefront/src/components/layout/navbar/mobile-nav.tsx +74 -0
- package/dist/assets/storefront/src/components/layout/navbar/nav-menu-items.tsx +51 -0
- package/dist/assets/storefront/src/components/layout/navbar/navbar-cart.tsx +5 -0
- package/dist/assets/storefront/src/components/layout/navbar/navbar-collections.tsx +291 -0
- package/dist/assets/storefront/src/components/layout/navbar/navbar-link.tsx +28 -0
- package/dist/assets/storefront/src/components/layout/navbar/navbar-user.tsx +147 -0
- package/dist/assets/storefront/src/components/layout/navbar/theme-switcher.tsx +39 -0
- package/dist/assets/storefront/src/components/layout/navbar.tsx +117 -0
- package/dist/assets/storefront/src/components/layout/search-input.tsx +71 -0
- package/dist/assets/storefront/src/components/providers/awaiting-approval-banner.tsx +58 -0
- package/dist/assets/storefront/src/components/providers/cart-count-server.tsx +31 -0
- package/dist/assets/storefront/src/components/providers/company-context-guard.tsx +47 -0
- package/dist/assets/storefront/src/components/providers/company-permissions-server.tsx +14 -0
- package/dist/assets/storefront/src/components/providers/theme-provider.tsx +16 -0
- package/dist/assets/storefront/src/components/shared/breadcrumbs.tsx +39 -0
- package/dist/assets/storefront/src/components/shared/catalog-sidebar-skeleton.tsx +21 -0
- package/dist/assets/storefront/src/components/shared/country-select.tsx +83 -0
- package/dist/assets/storefront/src/components/shared/error-state.tsx +16 -0
- package/dist/assets/storefront/src/components/shared/pagination.tsx +119 -0
- package/dist/assets/storefront/src/components/shared/prefetch-link.tsx +36 -0
- package/dist/assets/storefront/src/components/shared/product-grid-skeleton.tsx +26 -0
- package/dist/assets/storefront/src/components/shared/scenario-paused.tsx +80 -0
- package/dist/assets/storefront/src/components/shared/skeletons/cart-skeleton.tsx +48 -0
- package/dist/assets/storefront/src/components/shared/skeletons/navbar-user-skeleton.tsx +9 -0
- package/dist/assets/storefront/src/components/shared/skeletons/search-input-skeleton.tsx +7 -0
- package/dist/assets/storefront/src/components/shared/skeletons/search-results-skeleton.tsx +17 -0
- package/dist/assets/storefront/src/components/ui/accordion.tsx +66 -0
- package/dist/assets/storefront/src/components/ui/alert-dialog.tsx +157 -0
- package/dist/assets/storefront/src/components/ui/alert.tsx +66 -0
- package/dist/assets/storefront/src/components/ui/aspect-ratio.tsx +11 -0
- package/dist/assets/storefront/src/components/ui/avatar.tsx +53 -0
- package/dist/assets/storefront/src/components/ui/badge.tsx +46 -0
- package/dist/assets/storefront/src/components/ui/breadcrumb.tsx +109 -0
- package/dist/assets/storefront/src/components/ui/button.tsx +58 -0
- package/dist/assets/storefront/src/components/ui/calendar.tsx +213 -0
- package/dist/assets/storefront/src/components/ui/card.tsx +92 -0
- package/dist/assets/storefront/src/components/ui/carousel.tsx +241 -0
- package/dist/assets/storefront/src/components/ui/chart.tsx +357 -0
- package/dist/assets/storefront/src/components/ui/checkbox.tsx +32 -0
- package/dist/assets/storefront/src/components/ui/collapsible.tsx +33 -0
- package/dist/assets/storefront/src/components/ui/command.tsx +184 -0
- package/dist/assets/storefront/src/components/ui/context-menu.tsx +252 -0
- package/dist/assets/storefront/src/components/ui/dialog.tsx +143 -0
- package/dist/assets/storefront/src/components/ui/drawer.tsx +135 -0
- package/dist/assets/storefront/src/components/ui/dropdown-menu.tsx +257 -0
- package/dist/assets/storefront/src/components/ui/empty-state.tsx +37 -0
- package/dist/assets/storefront/src/components/ui/field.tsx +244 -0
- package/dist/assets/storefront/src/components/ui/form.tsx +167 -0
- package/dist/assets/storefront/src/components/ui/hover-card.tsx +44 -0
- package/dist/assets/storefront/src/components/ui/input-otp.tsx +77 -0
- package/dist/assets/storefront/src/components/ui/input.tsx +21 -0
- package/dist/assets/storefront/src/components/ui/kbd-shortcut.tsx +20 -0
- package/dist/assets/storefront/src/components/ui/label.tsx +24 -0
- package/dist/assets/storefront/src/components/ui/menubar.tsx +276 -0
- package/dist/assets/storefront/src/components/ui/navigation-menu.tsx +168 -0
- package/dist/assets/storefront/src/components/ui/pagination.tsx +127 -0
- package/dist/assets/storefront/src/components/ui/popover.tsx +48 -0
- package/dist/assets/storefront/src/components/ui/progress.tsx +31 -0
- package/dist/assets/storefront/src/components/ui/radio-group.tsx +45 -0
- package/dist/assets/storefront/src/components/ui/resizable.tsx +56 -0
- package/dist/assets/storefront/src/components/ui/scroll-area.tsx +58 -0
- package/dist/assets/storefront/src/components/ui/select.tsx +185 -0
- package/dist/assets/storefront/src/components/ui/separator.tsx +28 -0
- package/dist/assets/storefront/src/components/ui/sheet.tsx +139 -0
- package/dist/assets/storefront/src/components/ui/sidebar.tsx +728 -0
- package/dist/assets/storefront/src/components/ui/skeleton.tsx +13 -0
- package/dist/assets/storefront/src/components/ui/slider.tsx +63 -0
- package/dist/assets/storefront/src/components/ui/sonner.tsx +25 -0
- package/dist/assets/storefront/src/components/ui/switch.tsx +31 -0
- package/dist/assets/storefront/src/components/ui/table.tsx +116 -0
- package/dist/assets/storefront/src/components/ui/tabs.tsx +66 -0
- package/dist/assets/storefront/src/components/ui/textarea.tsx +18 -0
- package/dist/assets/storefront/src/components/ui/toggle-group.tsx +73 -0
- package/dist/assets/storefront/src/components/ui/toggle.tsx +47 -0
- package/dist/assets/storefront/src/components/ui/tooltip.tsx +61 -0
- package/dist/assets/storefront/src/config/branding.ts +4 -0
- package/dist/assets/storefront/src/config/scenario-meta.ts +46 -0
- package/dist/assets/storefront/src/config/scenario.ts +313 -0
- package/dist/assets/storefront/src/contexts/auth-context.tsx +35 -0
- package/dist/assets/storefront/src/graphql.ts +14 -0
- package/dist/assets/storefront/src/hooks/use-mobile.ts +19 -0
- package/dist/assets/storefront/src/i18n/locale-utils.ts +33 -0
- package/dist/assets/storefront/src/i18n/locales.ts +18 -0
- package/dist/assets/storefront/src/i18n/navigation.ts +35 -0
- package/dist/assets/storefront/src/i18n/request.ts +19 -0
- package/dist/assets/storefront/src/i18n/routing.ts +19 -0
- package/dist/assets/storefront/src/i18n/server.ts +16 -0
- package/dist/assets/storefront/src/lib/actions/switch-channel.ts +32 -0
- package/dist/assets/storefront/src/lib/actions/switch-currency.ts +25 -0
- package/dist/assets/storefront/src/lib/auth.ts +18 -0
- package/dist/assets/storefront/src/lib/backend-health.ts +38 -0
- package/dist/assets/storefront/src/lib/cart-count-context.tsx +59 -0
- package/dist/assets/storefront/src/lib/cart-guard-utils.ts +10 -0
- package/dist/assets/storefront/src/lib/cart-guard.ts +104 -0
- package/dist/assets/storefront/src/lib/channel-server.ts +28 -0
- package/dist/assets/storefront/src/lib/channel.ts +2 -0
- package/dist/assets/storefront/src/lib/company-context.ts +35 -0
- package/dist/assets/storefront/src/lib/company-permissions-context.tsx +40 -0
- package/dist/assets/storefront/src/lib/currency-server.ts +20 -0
- package/dist/assets/storefront/src/lib/currency.ts +2 -0
- package/dist/assets/storefront/src/lib/format.ts +48 -0
- package/dist/assets/storefront/src/lib/metadata.ts +85 -0
- package/dist/assets/storefront/src/lib/quantity.test.js +20 -0
- package/dist/assets/storefront/src/lib/quantity.ts +20 -0
- package/dist/assets/storefront/src/lib/search-bar-context.tsx +45 -0
- package/dist/assets/storefront/src/lib/search-helpers.ts +69 -0
- package/dist/assets/storefront/src/lib/use-recent-searches.ts +55 -0
- package/dist/assets/storefront/src/lib/utils.ts +6 -0
- package/dist/assets/storefront/src/lib/vendure/actions.ts +96 -0
- package/dist/assets/storefront/src/lib/vendure/api.ts +164 -0
- package/dist/assets/storefront/src/lib/vendure/approval-utils.ts +21 -0
- package/dist/assets/storefront/src/lib/vendure/cached.ts +71 -0
- package/dist/assets/storefront/src/lib/vendure/fragments.ts +213 -0
- package/dist/assets/storefront/src/lib/vendure/instant-search-action.ts +104 -0
- package/dist/assets/storefront/src/lib/vendure/mutations.ts +1136 -0
- package/dist/assets/storefront/src/lib/vendure/queries.ts +1406 -0
- package/dist/assets/storefront/src/middleware.ts +11 -0
- package/dist/assets/storefront/src/scenarios/b2b-wholesale/branding.ts +180 -0
- package/dist/assets/storefront/src/scenarios/b2b-wholesale/hero.tsx +122 -0
- package/dist/assets/storefront/src/scenarios/b2b-wholesale/index.ts +21 -0
- package/dist/assets/storefront/src/scenarios/b2b-wholesale/meta.ts +3 -0
- package/dist/assets/storefront/src/scenarios/default/branding.ts +148 -0
- package/dist/assets/storefront/src/scenarios/default/hero.tsx +107 -0
- package/dist/assets/storefront/src/scenarios/default/index.ts +12 -0
- package/dist/assets/storefront/src/scenarios/default/meta.ts +3 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/auth-gate.tsx +36 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/branding.ts +238 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/cart-items.tsx +359 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/hero.tsx +123 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/index.ts +50 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/meta.ts +9 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/banners.tsx +21 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/bom-basket.tsx +221 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/btn.tsx +38 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/chip.tsx +35 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/config-header.tsx +72 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/field-row.tsx +126 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/info-dot.tsx +38 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/login-notice.tsx +81 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/module-panel.tsx +144 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/quote-dialog.tsx +110 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/schematic.tsx +674 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/components/why-panel.tsx +66 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/configurator-pdp.tsx +43 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/configurator-shell.tsx +320 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/lib/data.ts +150 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/lib/types.ts +30 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/pdp/styles.css +104 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/shop-by-system.tsx +97 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/system-finder/decision-tree.ts +261 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/system-finder/page.tsx +21 -0
- package/dist/assets/storefront/src/scenarios/kaminpro/system-finder/wizard.tsx +600 -0
- package/dist/assets/storefront/src/schema.graphql.placeholder +5 -0
- package/dist/assets/storefront/tsconfig.json +37 -0
- package/dist/assets/templates/CLAUDE.md.hbs +63 -0
- package/dist/assets/templates/README.md.hbs +53 -0
- package/dist/assets/templates/custom-populate.ts.hbs +28 -0
- package/dist/assets/templates/docker-compose.yml.hbs +29 -0
- package/dist/assets/templates/env.hbs +44 -0
- package/dist/assets/templates/environment.d.ts.hbs +32 -0
- package/dist/assets/templates/gitignore.hbs +7 -0
- package/dist/assets/templates/index.ts.hbs +16 -0
- package/dist/assets/templates/npmrc.hbs +1 -0
- package/dist/assets/templates/populate.ts.hbs +27 -0
- package/dist/assets/templates/root-package.json.hbs +17 -0
- package/dist/assets/templates/server-package.json.hbs +31 -0
- package/dist/assets/templates/tsconfig.dashboard.json.hbs +17 -0
- package/dist/assets/templates/tsconfig.root.json.hbs +16 -0
- package/dist/assets/templates/tsconfig.server.json.hbs +20 -0
- package/dist/assets/templates/vendure-config.ts.hbs +80 -0
- package/dist/assets/templates/vite.config.mts.hbs +27 -0
- package/dist/bin/run.d.ts +2 -0
- package/dist/bin/run.js +79 -0
- package/dist/bin/run.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +154 -0
- package/dist/cli.js.map +1 -0
- package/dist/git-init.d.ts +4 -0
- package/dist/git-init.js +60 -0
- package/dist/git-init.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin-registry.d.ts +10 -0
- package/dist/plugin-registry.js +485 -0
- package/dist/plugin-registry.js.map +1 -0
- package/dist/scaffolder.d.ts +10 -0
- package/dist/scaffolder.js +218 -0
- package/dist/scaffolder.js.map +1 -0
- package/dist/storefront-copier.d.ts +6 -0
- package/dist/storefront-copier.js +68 -0
- package/dist/storefront-copier.js.map +1 -0
- package/dist/template-renderer.d.ts +30 -0
- package/dist/template-renderer.js +177 -0
- package/dist/template-renderer.js.map +1 -0
- package/dist/types.d.ts +60 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {use, useEffect, useState} from 'react';
|
|
4
|
+
import {useTranslations} from 'next-intl';
|
|
5
|
+
import {verifyAccountAction} from './actions';
|
|
6
|
+
import {Card, CardContent} from '@/components/ui/card';
|
|
7
|
+
import {Button} from '@/components/ui/button';
|
|
8
|
+
import {Link} from '@/i18n/navigation';
|
|
9
|
+
import {CheckCircle, XCircle, Loader2} from 'lucide-react';
|
|
10
|
+
|
|
11
|
+
interface VerifyContentProps {
|
|
12
|
+
searchParams: Promise<{ token?: string }>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function VerifyContent({searchParams}: VerifyContentProps) {
|
|
16
|
+
const t = useTranslations('Verify');
|
|
17
|
+
const params = use(searchParams);
|
|
18
|
+
const token = params.token;
|
|
19
|
+
const [result, setResult] = useState<{success?: boolean; error?: string; redirectTo?: string | null} | null>(null);
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (!token) return;
|
|
23
|
+
let cancelled = false;
|
|
24
|
+
verifyAccountAction(token).then(r => {
|
|
25
|
+
if (!cancelled) setResult(r);
|
|
26
|
+
});
|
|
27
|
+
return () => { cancelled = true; };
|
|
28
|
+
}, [token]);
|
|
29
|
+
|
|
30
|
+
if (!token) {
|
|
31
|
+
return (
|
|
32
|
+
<Card>
|
|
33
|
+
<CardContent className="pt-6 space-y-4">
|
|
34
|
+
<div className="flex justify-center">
|
|
35
|
+
<XCircle className="h-16 w-16 text-destructive"/>
|
|
36
|
+
</div>
|
|
37
|
+
<div className="space-y-2 text-center">
|
|
38
|
+
<h1 className="text-2xl font-bold">{t('invalidLink')}</h1>
|
|
39
|
+
<p className="text-muted-foreground">
|
|
40
|
+
{t('invalidLinkMessage')}
|
|
41
|
+
</p>
|
|
42
|
+
</div>
|
|
43
|
+
<div className="flex flex-col gap-2">
|
|
44
|
+
<Link href="/register" className="block">
|
|
45
|
+
<Button variant="outline" className="w-full">
|
|
46
|
+
{t('createNewAccount')}
|
|
47
|
+
</Button>
|
|
48
|
+
</Link>
|
|
49
|
+
<Link href="/sign-in" className="block">
|
|
50
|
+
<Button variant="ghost" className="w-full">
|
|
51
|
+
{t('backToSignIn')}
|
|
52
|
+
</Button>
|
|
53
|
+
</Link>
|
|
54
|
+
</div>
|
|
55
|
+
</CardContent>
|
|
56
|
+
</Card>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!result) {
|
|
61
|
+
return (
|
|
62
|
+
<Card>
|
|
63
|
+
<CardContent className="pt-6 space-y-4">
|
|
64
|
+
<div className="flex justify-center">
|
|
65
|
+
<Loader2 className="h-16 w-16 text-muted-foreground animate-spin"/>
|
|
66
|
+
</div>
|
|
67
|
+
<div className="space-y-2 text-center">
|
|
68
|
+
<h1 className="text-2xl font-bold">{t('loading')}</h1>
|
|
69
|
+
</div>
|
|
70
|
+
</CardContent>
|
|
71
|
+
</Card>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (result.success) {
|
|
76
|
+
const continueHref = result.redirectTo || '/sign-in';
|
|
77
|
+
const continueLabel = result.redirectTo ? 'Continue' : t('backToSignIn');
|
|
78
|
+
return (
|
|
79
|
+
<Card>
|
|
80
|
+
<CardContent className="pt-6 space-y-4">
|
|
81
|
+
<div className="flex justify-center">
|
|
82
|
+
<CheckCircle className="h-16 w-16 text-green-600"/>
|
|
83
|
+
</div>
|
|
84
|
+
<div className="space-y-2 text-center">
|
|
85
|
+
<h1 className="text-2xl font-bold">{t('accountVerified')}</h1>
|
|
86
|
+
<p className="text-muted-foreground">
|
|
87
|
+
{t('accountVerifiedMessage')}
|
|
88
|
+
</p>
|
|
89
|
+
</div>
|
|
90
|
+
<Link href={continueHref} className="block">
|
|
91
|
+
<Button className="w-full">
|
|
92
|
+
{continueLabel}
|
|
93
|
+
</Button>
|
|
94
|
+
</Link>
|
|
95
|
+
</CardContent>
|
|
96
|
+
</Card>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<Card>
|
|
102
|
+
<CardContent className="pt-6 space-y-4">
|
|
103
|
+
<div className="flex justify-center">
|
|
104
|
+
<XCircle className="h-16 w-16 text-destructive"/>
|
|
105
|
+
</div>
|
|
106
|
+
<div className="space-y-2 text-center">
|
|
107
|
+
<h1 className="text-2xl font-bold">{t('verificationFailed')}</h1>
|
|
108
|
+
<p className="text-muted-foreground">
|
|
109
|
+
{result.error || t('verificationFailedMessage')}
|
|
110
|
+
</p>
|
|
111
|
+
</div>
|
|
112
|
+
<div className="flex flex-col gap-2">
|
|
113
|
+
<Link href="/register" className="block">
|
|
114
|
+
<Button variant="outline" className="w-full">
|
|
115
|
+
{t('createNewAccount')}
|
|
116
|
+
</Button>
|
|
117
|
+
</Link>
|
|
118
|
+
<Link href="/sign-in" className="block">
|
|
119
|
+
<Button variant="ghost" className="w-full">
|
|
120
|
+
{t('backToSignIn')}
|
|
121
|
+
</Button>
|
|
122
|
+
</Link>
|
|
123
|
+
</div>
|
|
124
|
+
</CardContent>
|
|
125
|
+
</Card>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type {Metadata} from 'next';
|
|
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';
|
|
7
|
+
import { Button } from '@/components/ui/button';
|
|
8
|
+
import {Link} from '@/i18n/navigation';
|
|
9
|
+
import { CheckCircle } from 'lucide-react';
|
|
10
|
+
import {AuthPageShell} from '@/components/layout/auth-page-shell';
|
|
11
|
+
|
|
12
|
+
export async function generateMetadata(): Promise<Metadata> {
|
|
13
|
+
const locale = (await rootLocale()) as Locale;
|
|
14
|
+
const t = await getTranslations({locale, namespace: 'Verify.pending'});
|
|
15
|
+
return {
|
|
16
|
+
title: t('title'),
|
|
17
|
+
description: t('message'),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function VerifyPendingContent({searchParams}: {searchParams: Promise<Record<string, string | string[] | undefined>>}) {
|
|
22
|
+
const resolvedParams = await searchParams;
|
|
23
|
+
const redirectTo = resolvedParams?.redirectTo as string | undefined;
|
|
24
|
+
const t = await getTranslations('Verify.pending');
|
|
25
|
+
|
|
26
|
+
const signInHref = redirectTo
|
|
27
|
+
? `/sign-in?redirectTo=${encodeURIComponent(redirectTo)}`
|
|
28
|
+
: '/sign-in';
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Card>
|
|
32
|
+
<CardContent className="pt-6 space-y-4">
|
|
33
|
+
<div className="flex justify-center">
|
|
34
|
+
<CheckCircle className="h-16 w-16 text-green-600" />
|
|
35
|
+
</div>
|
|
36
|
+
<div className="space-y-2 text-center">
|
|
37
|
+
<h1 className="text-2xl font-bold">{t('title')}</h1>
|
|
38
|
+
<p className="text-muted-foreground">
|
|
39
|
+
{t('message')}
|
|
40
|
+
</p>
|
|
41
|
+
</div>
|
|
42
|
+
<div className="bg-muted p-4 rounded-md">
|
|
43
|
+
<p className="text-sm text-muted-foreground">
|
|
44
|
+
{t('spamNote')}
|
|
45
|
+
</p>
|
|
46
|
+
</div>
|
|
47
|
+
</CardContent>
|
|
48
|
+
<CardFooter className="flex flex-col space-y-2">
|
|
49
|
+
<Link href={signInHref} className="w-full">
|
|
50
|
+
<Button className="w-full">
|
|
51
|
+
{t('goToSignIn')}
|
|
52
|
+
</Button>
|
|
53
|
+
</Link>
|
|
54
|
+
</CardFooter>
|
|
55
|
+
</Card>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default async function VerifyPendingPage({searchParams}: {searchParams: Promise<Record<string, string | string[] | undefined>>}) {
|
|
60
|
+
return (
|
|
61
|
+
<AuthPageShell>
|
|
62
|
+
<Suspense fallback={null}>
|
|
63
|
+
<VerifyPendingContent searchParams={searchParams} />
|
|
64
|
+
</Suspense>
|
|
65
|
+
</AuthPageShell>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {cookies, headers} from 'next/headers';
|
|
2
|
+
import {NextResponse} from 'next/server';
|
|
3
|
+
|
|
4
|
+
const COMPANY_ID_COOKIE = 'vendure-company-id';
|
|
5
|
+
const BUSINESS_UNIT_ID_COOKIE = 'vendure-business-unit-id';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Route Handler that clears stale company context cookies and redirects back.
|
|
9
|
+
*
|
|
10
|
+
* Called by CompanyContextGuard when it detects the `vendure-company-id` cookie
|
|
11
|
+
* points to a company that no longer exists (e.g. after a database repopulate).
|
|
12
|
+
* Server Components can't modify cookies directly, so this handler exists as the
|
|
13
|
+
* mechanism to clear them.
|
|
14
|
+
*/
|
|
15
|
+
export async function GET() {
|
|
16
|
+
const cookieStore = await cookies();
|
|
17
|
+
cookieStore.delete(COMPANY_ID_COOKIE);
|
|
18
|
+
cookieStore.delete(BUSINESS_UNIT_ID_COOKIE);
|
|
19
|
+
|
|
20
|
+
// Redirect to home — the referer would be ideal but may not be reliable
|
|
21
|
+
const headerStore = await headers();
|
|
22
|
+
const referer = headerStore.get('referer');
|
|
23
|
+
const redirectTo = referer ? new URL(referer).pathname : '/';
|
|
24
|
+
|
|
25
|
+
return NextResponse.redirect(new URL(redirectTo, process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3001'), 302);
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { draftMode } from 'next/headers';
|
|
2
|
+
import { redirect } from 'next/navigation';
|
|
3
|
+
|
|
4
|
+
export async function GET(request: Request) {
|
|
5
|
+
const { searchParams } = new URL(request.url);
|
|
6
|
+
const slug = searchParams.get('slug');
|
|
7
|
+
|
|
8
|
+
const draft = await draftMode();
|
|
9
|
+
draft.disable();
|
|
10
|
+
|
|
11
|
+
redirect(slug || '/');
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { draftMode } from 'next/headers';
|
|
2
|
+
import { redirect } from 'next/navigation';
|
|
3
|
+
|
|
4
|
+
export async function GET(request: Request) {
|
|
5
|
+
const { searchParams } = new URL(request.url);
|
|
6
|
+
const secret = searchParams.get('secret');
|
|
7
|
+
const slug = searchParams.get('slug');
|
|
8
|
+
|
|
9
|
+
if (secret !== process.env.DRAFT_MODE_SECRET) {
|
|
10
|
+
return new Response('Invalid token', { status: 401 });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const draft = await draftMode();
|
|
14
|
+
draft.enable();
|
|
15
|
+
|
|
16
|
+
redirect(slug || '/');
|
|
17
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {revalidateTag} from 'next/cache';
|
|
2
|
+
import {NextRequest, NextResponse} from 'next/server';
|
|
3
|
+
import {routing} from '@/i18n/routing';
|
|
4
|
+
|
|
5
|
+
// Supported cache tags that can be revalidated.
|
|
6
|
+
// These are locale-independent base names — the endpoint expands them to all locales.
|
|
7
|
+
const LOCALE_SENSITIVE_TAGS = [
|
|
8
|
+
'collections',
|
|
9
|
+
'countries',
|
|
10
|
+
'featured-products',
|
|
11
|
+
'gift-card-templates',
|
|
12
|
+
'products',
|
|
13
|
+
] as const;
|
|
14
|
+
|
|
15
|
+
// Dynamic tags follow patterns like 'product-{slug}-{locale}', 'collection-{slug}-{locale}'
|
|
16
|
+
const DYNAMIC_TAG_PATTERNS = [
|
|
17
|
+
/^product-.+$/,
|
|
18
|
+
/^collection-.+$/,
|
|
19
|
+
/^collection-meta-.+$/,
|
|
20
|
+
/^collection-preview-.+$/,
|
|
21
|
+
/^related-products-.+$/,
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
function isValidTag(tag: string): boolean {
|
|
25
|
+
if ((LOCALE_SENSITIVE_TAGS as readonly string[]).includes(tag)) return true;
|
|
26
|
+
return DYNAMIC_TAG_PATTERNS.some(pattern => pattern.test(tag));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Expand a base tag to all locale-suffixed variants.
|
|
31
|
+
* e.g. 'collections' → ['collections-en', 'collections-de']
|
|
32
|
+
*/
|
|
33
|
+
function expandToLocales(tag: string): string[] {
|
|
34
|
+
return routing.locales.map(locale => `${tag}-${locale}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export async function POST(request: NextRequest) {
|
|
38
|
+
// Verify the secret token
|
|
39
|
+
const authHeader = request.headers.get('authorization');
|
|
40
|
+
const expectedToken = process.env.REVALIDATION_SECRET;
|
|
41
|
+
|
|
42
|
+
if (!expectedToken) {
|
|
43
|
+
console.error('REVALIDATION_SECRET environment variable not set');
|
|
44
|
+
return NextResponse.json(
|
|
45
|
+
{error: 'Server configuration error'},
|
|
46
|
+
{status: 500}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (authHeader !== `Bearer ${expectedToken}`) {
|
|
51
|
+
return NextResponse.json(
|
|
52
|
+
{error: 'Unauthorized'},
|
|
53
|
+
{status: 401}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
const body = await request.json();
|
|
59
|
+
const {tags} = body;
|
|
60
|
+
|
|
61
|
+
if (!tags || !Array.isArray(tags) || tags.length === 0) {
|
|
62
|
+
return NextResponse.json(
|
|
63
|
+
{error: 'Missing or invalid "tags" array in request body'},
|
|
64
|
+
{status: 400}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Validate and revalidate each tag, expanding to all locales
|
|
69
|
+
const results: {tag: string; success: boolean; error?: string}[] = [];
|
|
70
|
+
|
|
71
|
+
for (const tag of tags) {
|
|
72
|
+
if (typeof tag !== 'string') {
|
|
73
|
+
results.push({tag: String(tag), success: false, error: 'Invalid tag type'});
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!isValidTag(tag)) {
|
|
78
|
+
results.push({tag, success: false, error: 'Unknown tag'});
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Expand to locale-suffixed tags and revalidate each
|
|
83
|
+
const expanded = expandToLocales(tag);
|
|
84
|
+
try {
|
|
85
|
+
for (const localeTag of expanded) {
|
|
86
|
+
revalidateTag(localeTag, {expire: 0});
|
|
87
|
+
}
|
|
88
|
+
results.push({tag, success: true});
|
|
89
|
+
} catch {
|
|
90
|
+
results.push({tag, success: false, error: 'Revalidation failed'});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const allSuccessful = results.every(r => r.success);
|
|
95
|
+
|
|
96
|
+
return NextResponse.json(
|
|
97
|
+
{
|
|
98
|
+
revalidated: allSuccessful,
|
|
99
|
+
results,
|
|
100
|
+
timestamp: Date.now(),
|
|
101
|
+
},
|
|
102
|
+
{status: allSuccessful ? 200 : 207} // 207 = Multi-Status
|
|
103
|
+
);
|
|
104
|
+
} catch {
|
|
105
|
+
return NextResponse.json(
|
|
106
|
+
{error: 'Invalid JSON body'},
|
|
107
|
+
{status: 400}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import { client } from '@/lib/vendure/api';
|
|
3
|
+
import { LogSearchResultClickedMutation } from '@/lib/vendure/mutations';
|
|
4
|
+
|
|
5
|
+
export async function POST(request: NextRequest) {
|
|
6
|
+
const body = await request.json();
|
|
7
|
+
const { queryId, position, resultId } = body;
|
|
8
|
+
if (!queryId || position == null || !resultId) {
|
|
9
|
+
return NextResponse.json({ error: 'Missing fields' }, { status: 400 });
|
|
10
|
+
}
|
|
11
|
+
// Fire-and-forget — don't await the mutation result
|
|
12
|
+
client.mutate(LogSearchResultClickedMutation, {
|
|
13
|
+
input: { queryId, position: Number(position), resultId },
|
|
14
|
+
});
|
|
15
|
+
return NextResponse.json({ ok: true });
|
|
16
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { LucideIcon } from 'lucide-react';
|
|
2
|
+
import {
|
|
3
|
+
Package,
|
|
4
|
+
User,
|
|
5
|
+
MapPin,
|
|
6
|
+
ShieldCheck,
|
|
7
|
+
FileText,
|
|
8
|
+
Building2,
|
|
9
|
+
Users,
|
|
10
|
+
Network,
|
|
11
|
+
Shield,
|
|
12
|
+
MapPinHouse,
|
|
13
|
+
CreditCard,
|
|
14
|
+
Receipt,
|
|
15
|
+
Heart,
|
|
16
|
+
Zap,
|
|
17
|
+
} from 'lucide-react';
|
|
18
|
+
|
|
19
|
+
export interface NavItem {
|
|
20
|
+
href: string;
|
|
21
|
+
label: string;
|
|
22
|
+
icon: LucideIcon;
|
|
23
|
+
exact?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface CompanyNavItem extends NavItem {
|
|
27
|
+
requiredPermissions?: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const personalNavItems: NavItem[] = [
|
|
31
|
+
{ href: '/account/orders', label: 'orders', icon: Package },
|
|
32
|
+
{ href: '/account/store-credits', label: 'storeCredits', icon: CreditCard },
|
|
33
|
+
{ href: '/account/quotes', label: 'quotes', icon: FileText },
|
|
34
|
+
{ href: '/account/shopping-lists', label: 'shoppingLists', icon: Heart },
|
|
35
|
+
{ href: '/account/quick-order', label: 'quickOrder', icon: Zap },
|
|
36
|
+
{ href: '/account/approvals', label: 'approvals', icon: ShieldCheck },
|
|
37
|
+
{ href: '/account/addresses', label: 'addresses', icon: MapPin },
|
|
38
|
+
{ href: '/account/profile', label: 'profile', icon: User },
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
export const companyNavItems: CompanyNavItem[] = [
|
|
42
|
+
{ href: '/account/company', label: 'companyProfile', icon: Building2, exact: true },
|
|
43
|
+
{ href: '/account/company/users', label: 'users', icon: Users, requiredPermissions: ['ViewUsers', 'ManageUsers'] },
|
|
44
|
+
{ href: '/account/company/business-units', label: 'businessUnits', icon: Network, requiredPermissions: ['ManageBusinessUnits'] },
|
|
45
|
+
{ href: '/account/company/roles', label: 'roles', icon: Shield, requiredPermissions: ['ManageRoles'] },
|
|
46
|
+
{ href: '/account/company/addresses', label: 'companyAddresses', icon: MapPinHouse, requiredPermissions: ['ManageAddresses'] },
|
|
47
|
+
{ href: '/account/company/payment-methods', label: 'paymentMethods', icon: CreditCard, requiredPermissions: ['ManagePaymentMethods'] },
|
|
48
|
+
{ href: '/account/company/tax-ids', label: 'taxIds', icon: Receipt, requiredPermissions: ['ManageCompany'] },
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
export function getVisibleCompanyItems(permissions: string[]): CompanyNavItem[] {
|
|
52
|
+
return companyNavItems.filter(item => {
|
|
53
|
+
if (!item.requiredPermissions) return true;
|
|
54
|
+
return item.requiredPermissions.some(p => permissions.includes(p));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
'use client';
|
|
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
|
+
import { Button } from '@/components/ui/button';
|
|
14
|
+
import { cn } from '@/lib/utils';
|
|
15
|
+
import { type NavItem, personalNavItems, getVisibleCompanyItems } from './account-nav-items';
|
|
16
|
+
|
|
17
|
+
function NavLink({ item, pathname, t }: { item: NavItem; pathname: string; t: ReturnType<typeof useTranslations<'Account'>> }) {
|
|
18
|
+
const isActive = item.exact
|
|
19
|
+
? pathname === item.href
|
|
20
|
+
: pathname === item.href || pathname.startsWith(item.href + '/');
|
|
21
|
+
return (
|
|
22
|
+
<Link
|
|
23
|
+
href={item.href}
|
|
24
|
+
prefetch={true}
|
|
25
|
+
className={cn(
|
|
26
|
+
'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',
|
|
30
|
+
)}
|
|
31
|
+
>
|
|
32
|
+
<item.icon className="h-4 w-4" />
|
|
33
|
+
{t(`sidebar.${item.label}`)}
|
|
34
|
+
</Link>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function AccountNavLinks({
|
|
39
|
+
permissions,
|
|
40
|
+
hasCompany,
|
|
41
|
+
pathname,
|
|
42
|
+
t,
|
|
43
|
+
}: {
|
|
44
|
+
permissions: string[];
|
|
45
|
+
hasCompany: boolean;
|
|
46
|
+
pathname: string;
|
|
47
|
+
t: ReturnType<typeof useTranslations<'Account'>>;
|
|
48
|
+
}) {
|
|
49
|
+
const visibleCompanyItems = hasCompany
|
|
50
|
+
? getVisibleCompanyItems(permissions)
|
|
51
|
+
: [];
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<nav className="space-y-1">
|
|
55
|
+
<h2 className="font-semibold text-sm pb-2">{t('sidebar.accountHeading')}</h2>
|
|
56
|
+
{personalNavItems.map(item => (
|
|
57
|
+
<NavLink key={item.href} item={item} pathname={pathname} t={t} />
|
|
58
|
+
))}
|
|
59
|
+
{visibleCompanyItems.length > 0 && (
|
|
60
|
+
<>
|
|
61
|
+
<div className="pt-4 pb-2 px-3">
|
|
62
|
+
<span className="text-xs font-semibold uppercase text-muted-foreground tracking-wider">
|
|
63
|
+
{t('sidebar.companySection')}
|
|
64
|
+
</span>
|
|
65
|
+
</div>
|
|
66
|
+
{visibleCompanyItems.map(item => (
|
|
67
|
+
<NavLink key={item.href} item={item} pathname={pathname} t={t} />
|
|
68
|
+
))}
|
|
69
|
+
</>
|
|
70
|
+
)}
|
|
71
|
+
</nav>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface AccountSidebarProps {
|
|
76
|
+
permissions: string[];
|
|
77
|
+
hasCompany: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function AccountSidebar({ permissions, hasCompany }: AccountSidebarProps) {
|
|
81
|
+
const t = useTranslations('Account');
|
|
82
|
+
const pathname = usePathname();
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<>
|
|
86
|
+
{/* Desktop: sticky sidebar */}
|
|
87
|
+
<div className="hidden lg:block sticky top-20">
|
|
88
|
+
<AccountNavLinks permissions={permissions} hasCompany={hasCompany} pathname={pathname} t={t} />
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
{/* Mobile: sheet trigger */}
|
|
92
|
+
<div className="lg:hidden">
|
|
93
|
+
<Sheet>
|
|
94
|
+
<SheetTrigger asChild>
|
|
95
|
+
<Button variant="outline" size="sm" className="gap-2">
|
|
96
|
+
<LayoutGrid className="h-4 w-4" />
|
|
97
|
+
{t('sidebar.accountMenu')}
|
|
98
|
+
</Button>
|
|
99
|
+
</SheetTrigger>
|
|
100
|
+
<SheetContent side="left" className="overflow-y-auto">
|
|
101
|
+
<SheetHeader>
|
|
102
|
+
<SheetTitle>{t('sidebar.accountHeading')}</SheetTitle>
|
|
103
|
+
</SheetHeader>
|
|
104
|
+
<div className="px-4 pb-4">
|
|
105
|
+
<AccountNavLinks permissions={permissions} hasCompany={hasCompany} pathname={pathname} t={t} />
|
|
106
|
+
</div>
|
|
107
|
+
</SheetContent>
|
|
108
|
+
</Sheet>
|
|
109
|
+
</div>
|
|
110
|
+
</>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { formatPrice } from '@/lib/format';
|
|
4
|
+
import { RESERVED_PARAMS } from '@/lib/search-helpers';
|
|
5
|
+
import { X } from 'lucide-react';
|
|
6
|
+
import { useLocale } from 'next-intl';
|
|
7
|
+
import { useSearchParams } from 'next/navigation';
|
|
8
|
+
import { usePathname, useRouter } from '@/i18n/navigation';
|
|
9
|
+
|
|
10
|
+
interface FacetValueInfo {
|
|
11
|
+
code: string;
|
|
12
|
+
name: string;
|
|
13
|
+
facetCode: string;
|
|
14
|
+
facetName: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ActiveFiltersProps {
|
|
18
|
+
facetValueMap: FacetValueInfo[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function FilterChip({ onClick, children }: { onClick: () => void; children: React.ReactNode }) {
|
|
22
|
+
return (
|
|
23
|
+
<button
|
|
24
|
+
onClick={onClick}
|
|
25
|
+
className="inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-primary/10 text-primary text-xs border border-primary/20 hover:bg-primary/20 transition-colors"
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
<X className="h-3 w-3 ml-0.5" />
|
|
29
|
+
</button>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function ActiveFilters({ facetValueMap }: ActiveFiltersProps) {
|
|
34
|
+
const pathname = usePathname();
|
|
35
|
+
const searchParams = useSearchParams();
|
|
36
|
+
const router = useRouter();
|
|
37
|
+
const locale = useLocale();
|
|
38
|
+
const formatWholePrice = (cents: number) =>
|
|
39
|
+
formatPrice(cents, locale, undefined, { minimumFractionDigits: 0, maximumFractionDigits: 0 });
|
|
40
|
+
|
|
41
|
+
const activeFacets: FacetValueInfo[] = [];
|
|
42
|
+
for (const [key, value] of searchParams.entries()) {
|
|
43
|
+
if (RESERVED_PARAMS.has(key) || !value) continue;
|
|
44
|
+
const valueCodes = value.split(',');
|
|
45
|
+
for (const code of valueCodes) {
|
|
46
|
+
const match = facetValueMap.find((fv) => fv.facetCode === key && fv.code === code);
|
|
47
|
+
if (match) activeFacets.push(match);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Check for price range and inStock
|
|
52
|
+
const priceMin = searchParams.get('priceMin');
|
|
53
|
+
const priceMax = searchParams.get('priceMax');
|
|
54
|
+
const hasPriceFilter = priceMin != null || priceMax != null;
|
|
55
|
+
const hasInStock = searchParams.get('inStock') === 'true';
|
|
56
|
+
|
|
57
|
+
if (activeFacets.length === 0 && !hasPriceFilter && !hasInStock) return null;
|
|
58
|
+
|
|
59
|
+
const removeFacet = (facetCode: string, valueCode: string) => {
|
|
60
|
+
const params = new URLSearchParams(searchParams);
|
|
61
|
+
const current = params.get(facetCode)?.split(',') ?? [];
|
|
62
|
+
const updated = current.filter((c) => c !== valueCode);
|
|
63
|
+
if (updated.length > 0) {
|
|
64
|
+
params.set(facetCode, updated.join(','));
|
|
65
|
+
} else {
|
|
66
|
+
params.delete(facetCode);
|
|
67
|
+
}
|
|
68
|
+
params.delete('page');
|
|
69
|
+
router.push(`${pathname}?${params.toString()}`);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const removeParam = (key: string) => {
|
|
73
|
+
const params = new URLSearchParams(searchParams);
|
|
74
|
+
params.delete(key);
|
|
75
|
+
params.delete('page');
|
|
76
|
+
router.push(`${pathname}?${params.toString()}`);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const removePriceFilter = () => {
|
|
80
|
+
const params = new URLSearchParams(searchParams);
|
|
81
|
+
params.delete('priceMin');
|
|
82
|
+
params.delete('priceMax');
|
|
83
|
+
params.delete('page');
|
|
84
|
+
router.push(`${pathname}?${params.toString()}`);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div className="flex flex-wrap items-center gap-1.5">
|
|
89
|
+
{activeFacets.map((fv) => (
|
|
90
|
+
<FilterChip
|
|
91
|
+
key={`${fv.facetCode}-${fv.code}`}
|
|
92
|
+
onClick={() => removeFacet(fv.facetCode, fv.code)}
|
|
93
|
+
>
|
|
94
|
+
<span className="text-muted-foreground">{fv.facetName}:</span>
|
|
95
|
+
{fv.name}
|
|
96
|
+
</FilterChip>
|
|
97
|
+
))}
|
|
98
|
+
{hasPriceFilter && (
|
|
99
|
+
<FilterChip onClick={removePriceFilter}>
|
|
100
|
+
Price: {formatWholePrice(Number(priceMin) || 0)} –{' '}
|
|
101
|
+
{formatWholePrice(Number(priceMax) || 0)}
|
|
102
|
+
</FilterChip>
|
|
103
|
+
)}
|
|
104
|
+
{hasInStock && <FilterChip onClick={() => removeParam('inStock')}>In Stock Only</FilterChip>}
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|