@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,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {useRef, useTransition} from 'react';
|
|
4
|
+
import {useRouter} from '@/i18n/navigation';
|
|
5
|
+
import {toast} from 'sonner';
|
|
6
|
+
import {Button} from '@/components/ui/button';
|
|
7
|
+
import {Input} from '@/components/ui/input';
|
|
8
|
+
import {Loader2} from 'lucide-react';
|
|
9
|
+
import {applyCode} from './actions';
|
|
10
|
+
import {useTranslations} from 'next-intl';
|
|
11
|
+
|
|
12
|
+
export function CodeInput() {
|
|
13
|
+
const t = useTranslations('Cart');
|
|
14
|
+
const router = useRouter();
|
|
15
|
+
const [isPending, startTransition] = useTransition();
|
|
16
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
17
|
+
|
|
18
|
+
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
const code = inputRef.current?.value.trim();
|
|
21
|
+
if (!code) return;
|
|
22
|
+
|
|
23
|
+
startTransition(async () => {
|
|
24
|
+
const result = await applyCode(code);
|
|
25
|
+
if (result.success) {
|
|
26
|
+
if (inputRef.current) inputRef.current.value = '';
|
|
27
|
+
router.refresh();
|
|
28
|
+
} else {
|
|
29
|
+
toast.error(result.error || t('failedToApplyCode'));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<form onSubmit={handleSubmit} className="flex gap-2">
|
|
36
|
+
<Input
|
|
37
|
+
ref={inputRef}
|
|
38
|
+
type="text"
|
|
39
|
+
placeholder={t('enterCode')}
|
|
40
|
+
className="flex-1"
|
|
41
|
+
required
|
|
42
|
+
disabled={isPending}
|
|
43
|
+
/>
|
|
44
|
+
<Button type="submit" disabled={isPending}>
|
|
45
|
+
{isPending ? <Loader2 className="h-4 w-4 animate-spin" /> : t('apply')}
|
|
46
|
+
</Button>
|
|
47
|
+
</form>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CartSkeleton } from '@/components/shared/skeletons/cart-skeleton';
|
|
2
|
+
|
|
3
|
+
export default function CartLoading() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="container mx-auto px-4 py-8 mt-[var(--page-top-offset)]">
|
|
6
|
+
<div className="h-9 w-48 bg-muted animate-pulse rounded mb-8" />
|
|
7
|
+
<CartSkeleton />
|
|
8
|
+
</div>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import {Link} from '@/i18n/navigation';
|
|
2
|
+
import {Button} from '@/components/ui/button';
|
|
3
|
+
import {Price} from '@/components/commerce/price';
|
|
4
|
+
import {maskCode} from '@/lib/format';
|
|
5
|
+
import {RequestQuoteButton} from './request-quote-button';
|
|
6
|
+
import {getAuthToken} from '@/lib/auth';
|
|
7
|
+
import {getActiveCustomer, getCompanyAccount} from '@/lib/vendure/actions';
|
|
8
|
+
import {getTranslations} from 'next-intl/server';
|
|
9
|
+
|
|
10
|
+
type ActiveOrder = {
|
|
11
|
+
id: string;
|
|
12
|
+
currencyCode: string;
|
|
13
|
+
subTotal: number;
|
|
14
|
+
subTotalWithTax: number;
|
|
15
|
+
shipping: number;
|
|
16
|
+
shippingWithTax: number;
|
|
17
|
+
total: number;
|
|
18
|
+
totalWithTax: number;
|
|
19
|
+
storeCreditsApplied: Array<{ code: string; balance: number; amountDeducted: number }>;
|
|
20
|
+
totalWithTaxAfterStoreCredit: number;
|
|
21
|
+
lines: Array<{
|
|
22
|
+
id: string;
|
|
23
|
+
quantity: number;
|
|
24
|
+
unitPrice: number;
|
|
25
|
+
productVariant: {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
sku: string;
|
|
29
|
+
product: {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
slug: string;
|
|
33
|
+
featuredAsset?: { id: string; preview: string } | null;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}>;
|
|
37
|
+
taxSummary?: Array<{
|
|
38
|
+
description: string;
|
|
39
|
+
taxRate: number;
|
|
40
|
+
taxTotal: number;
|
|
41
|
+
}>;
|
|
42
|
+
discounts?: Array<{
|
|
43
|
+
description: string;
|
|
44
|
+
amount: number;
|
|
45
|
+
amountWithTax: number;
|
|
46
|
+
}> | null;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export async function OrderSummary({activeOrder}: { activeOrder: ActiveOrder }) {
|
|
50
|
+
const t = await getTranslations('Cart');
|
|
51
|
+
const hasCreditsApplied = activeOrder.storeCreditsApplied.length > 0;
|
|
52
|
+
const authToken = await getAuthToken();
|
|
53
|
+
const taxTotal = activeOrder.totalWithTax - activeOrder.total;
|
|
54
|
+
const MIN_QTY_FOR_QUOTE = 50;
|
|
55
|
+
const hasHighQuantityLine = activeOrder.lines.some(line => line.quantity >= MIN_QTY_FOR_QUOTE);
|
|
56
|
+
|
|
57
|
+
// Check PlaceOrders permission for company users
|
|
58
|
+
const companyAccount = await getCompanyAccount();
|
|
59
|
+
const canCheckout = !companyAccount || companyAccount.permissions.includes('PlaceOrders');
|
|
60
|
+
|
|
61
|
+
// Only show quote button for logged-in customers (not anonymous sessions)
|
|
62
|
+
let senderInfo: { name: string; email: string; company?: string } | null = null;
|
|
63
|
+
if (hasHighQuantityLine) {
|
|
64
|
+
const customer = await getActiveCustomer();
|
|
65
|
+
if (customer) {
|
|
66
|
+
senderInfo = {
|
|
67
|
+
name: `${customer.firstName} ${customer.lastName}`,
|
|
68
|
+
email: customer.emailAddress,
|
|
69
|
+
company: companyAccount?.company?.name,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div className="border rounded-lg p-6 bg-card">
|
|
76
|
+
<h2 className="text-xl font-bold mb-4">{t('orderSummary')}</h2>
|
|
77
|
+
|
|
78
|
+
<div className="space-y-2 mb-4">
|
|
79
|
+
<div className="flex justify-between text-sm">
|
|
80
|
+
<span className="text-muted-foreground">{t('subtotal')}</span>
|
|
81
|
+
<span>
|
|
82
|
+
<Price value={activeOrder.subTotal} currencyCode={activeOrder.currencyCode}/>
|
|
83
|
+
</span>
|
|
84
|
+
</div>
|
|
85
|
+
{activeOrder.discounts && activeOrder.discounts.length > 0 && (
|
|
86
|
+
<>
|
|
87
|
+
{activeOrder.discounts.map((discount, index) => (
|
|
88
|
+
<div key={index} className="flex justify-between text-sm text-green-600">
|
|
89
|
+
<span>{discount.description}</span>
|
|
90
|
+
<span>
|
|
91
|
+
<Price value={discount.amount} currencyCode={activeOrder.currencyCode}/>
|
|
92
|
+
</span>
|
|
93
|
+
</div>
|
|
94
|
+
))}
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
97
|
+
<div className="flex justify-between text-sm">
|
|
98
|
+
<span className="text-muted-foreground">{t('shipping')}</span>
|
|
99
|
+
<span>
|
|
100
|
+
{activeOrder.shipping > 0
|
|
101
|
+
? <Price value={activeOrder.shipping} currencyCode={activeOrder.currencyCode}/>
|
|
102
|
+
: t('calculatedAtCheckout')}
|
|
103
|
+
</span>
|
|
104
|
+
</div>
|
|
105
|
+
{activeOrder.taxSummary && activeOrder.taxSummary.length > 0 ? (
|
|
106
|
+
activeOrder.taxSummary.map((tax, index) => (
|
|
107
|
+
<div key={index} className="flex justify-between text-sm">
|
|
108
|
+
<span className="text-muted-foreground">
|
|
109
|
+
{tax.description} ({tax.taxRate}%)
|
|
110
|
+
</span>
|
|
111
|
+
<span>
|
|
112
|
+
<Price value={tax.taxTotal} currencyCode={activeOrder.currencyCode}/>
|
|
113
|
+
</span>
|
|
114
|
+
</div>
|
|
115
|
+
))
|
|
116
|
+
) : (
|
|
117
|
+
<div className="flex justify-between text-sm">
|
|
118
|
+
<span className="text-muted-foreground">{t('tax')}</span>
|
|
119
|
+
<span>
|
|
120
|
+
<Price value={taxTotal} currencyCode={activeOrder.currencyCode}/>
|
|
121
|
+
</span>
|
|
122
|
+
</div>
|
|
123
|
+
)}
|
|
124
|
+
{hasCreditsApplied && activeOrder.storeCreditsApplied.map((credit) => (
|
|
125
|
+
<div key={credit.code} className="flex justify-between text-sm text-green-600">
|
|
126
|
+
<span>{t('storeCredit', {code: maskCode(credit.code)})}</span>
|
|
127
|
+
<span>-<Price value={credit.amountDeducted} currencyCode={activeOrder.currencyCode}/></span>
|
|
128
|
+
</div>
|
|
129
|
+
))}
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<div className="border-t pt-4 mb-6">
|
|
133
|
+
<div className="flex justify-between font-bold text-lg">
|
|
134
|
+
<span>{t('total')}</span>
|
|
135
|
+
<span>
|
|
136
|
+
{hasCreditsApplied ? (
|
|
137
|
+
<span className="flex items-center gap-2">
|
|
138
|
+
<span className="text-sm font-normal text-muted-foreground line-through">
|
|
139
|
+
<Price value={activeOrder.totalWithTax} currencyCode={activeOrder.currencyCode}/>
|
|
140
|
+
</span>
|
|
141
|
+
<Price value={activeOrder.totalWithTaxAfterStoreCredit} currencyCode={activeOrder.currencyCode} taxLabel="incl" />
|
|
142
|
+
</span>
|
|
143
|
+
) : (
|
|
144
|
+
<Price value={activeOrder.totalWithTax} currencyCode={activeOrder.currencyCode} taxLabel="incl" />
|
|
145
|
+
)}
|
|
146
|
+
</span>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
{canCheckout ? (
|
|
151
|
+
<Button className="w-full" size="lg" asChild>
|
|
152
|
+
<Link href="/checkout">{t('proceedToCheckout')}</Link>
|
|
153
|
+
</Button>
|
|
154
|
+
) : (
|
|
155
|
+
<div className="space-y-2">
|
|
156
|
+
<Button className="w-full" size="lg" disabled>
|
|
157
|
+
{t('checkoutNotPermitted')}
|
|
158
|
+
</Button>
|
|
159
|
+
<p className="text-xs text-muted-foreground text-center">
|
|
160
|
+
{t('noOrderingPermissions')}
|
|
161
|
+
</p>
|
|
162
|
+
</div>
|
|
163
|
+
)}
|
|
164
|
+
|
|
165
|
+
{senderInfo && (
|
|
166
|
+
<RequestQuoteButton
|
|
167
|
+
cartLines={activeOrder.lines}
|
|
168
|
+
currencyCode={activeOrder.currencyCode}
|
|
169
|
+
sender={senderInfo}
|
|
170
|
+
/>
|
|
171
|
+
)}
|
|
172
|
+
|
|
173
|
+
<Button variant="outline" className="w-full mt-2" asChild>
|
|
174
|
+
<Link href="/">{t('continueShopping')}</Link>
|
|
175
|
+
</Button>
|
|
176
|
+
</div>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type {Metadata} from 'next';
|
|
2
|
+
import {Cart} from "@/app/[locale]/cart/cart";
|
|
3
|
+
import {Suspense} from "react";
|
|
4
|
+
import {CartSkeleton} from "@/components/shared/skeletons/cart-skeleton";
|
|
5
|
+
import {noIndexRobots} from '@/lib/metadata';
|
|
6
|
+
import {locale as rootLocale} from 'next/root-params';
|
|
7
|
+
import {getTranslations} from 'next-intl/server';
|
|
8
|
+
import {type Locale} from '@/i18n/routing';
|
|
9
|
+
|
|
10
|
+
export async function generateMetadata(): Promise<Metadata> {
|
|
11
|
+
const locale = (await rootLocale()) as Locale;
|
|
12
|
+
const t = await getTranslations({locale, namespace: 'Cart'});
|
|
13
|
+
return {
|
|
14
|
+
title: t('title'),
|
|
15
|
+
description: t('description'),
|
|
16
|
+
robots: noIndexRobots(),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default async function CartPage() {
|
|
21
|
+
const locale = (await rootLocale()) as Locale;
|
|
22
|
+
const t = await getTranslations({locale, namespace: 'Cart'});
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className="container mx-auto px-4 py-8 mt-[var(--page-top-offset)]">
|
|
26
|
+
<h1 className="text-3xl font-bold mb-8">{t('title')}</h1>
|
|
27
|
+
|
|
28
|
+
<Suspense fallback={<CartSkeleton />}>
|
|
29
|
+
<Cart/>
|
|
30
|
+
</Suspense>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import {Button} from '@/components/ui/button';
|
|
2
|
+
import {Card, CardContent, CardDescription, CardHeader, CardTitle} from '@/components/ui/card';
|
|
3
|
+
import {Tag, Wallet} from 'lucide-react';
|
|
4
|
+
import {applyStoreCredit, removePromotionCode, removeStoreCredit} from './actions';
|
|
5
|
+
import {CodeInput} from './code-input';
|
|
6
|
+
import {client} from '@/lib/vendure/api';
|
|
7
|
+
import {GetMyStoreCreditsQuery} from '@/lib/vendure/queries';
|
|
8
|
+
import {getActiveCustomer} from '@/lib/vendure/actions';
|
|
9
|
+
import {Price} from '@/components/commerce/price';
|
|
10
|
+
import {maskCode} from '@/lib/format';
|
|
11
|
+
import {getTranslations} from 'next-intl/server';
|
|
12
|
+
|
|
13
|
+
const MAX_STORE_CREDITS_IN_CART = 100;
|
|
14
|
+
|
|
15
|
+
type ActiveOrder = {
|
|
16
|
+
id: string;
|
|
17
|
+
couponCodes?: string[] | null;
|
|
18
|
+
storeCreditsApplied: Array<{ code: string; balance: number; amountDeducted: number }>;
|
|
19
|
+
totalWithTaxAfterStoreCredit: number;
|
|
20
|
+
currencyCode: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export async function PromotionCode({activeOrder}: { activeOrder: ActiveOrder }) {
|
|
24
|
+
const [t, activeCustomer, [creditsResult, creditsError]] = await Promise.all([
|
|
25
|
+
getTranslations('Cart'),
|
|
26
|
+
getActiveCustomer(),
|
|
27
|
+
client.query(GetMyStoreCreditsQuery, {options: {take: MAX_STORE_CREDITS_IN_CART}}),
|
|
28
|
+
]);
|
|
29
|
+
const availableCredits = creditsError ? [] : (creditsResult.data.myStoreCredits?.items ?? []);
|
|
30
|
+
const appliedCodes = new Set(activeOrder.storeCreditsApplied.map(c => c.code));
|
|
31
|
+
const activeCustomerId = activeCustomer?.id;
|
|
32
|
+
// Only show credits the current customer can actually redeem (own + unclaimed)
|
|
33
|
+
// Hide when order is already fully covered by applied credits
|
|
34
|
+
const orderFullyCovered = activeOrder.totalWithTaxAfterStoreCredit <= 0;
|
|
35
|
+
const redeemableCredits = orderFullyCovered ? [] : availableCredits.filter(
|
|
36
|
+
c => !appliedCodes.has(c.code) && (!c.issuedTo || c.issuedTo.id === activeCustomerId),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Card>
|
|
41
|
+
<CardHeader>
|
|
42
|
+
<CardTitle className="text-lg flex items-center gap-2">
|
|
43
|
+
<Tag className="h-5 w-5"/>
|
|
44
|
+
{t('promotionCode')}
|
|
45
|
+
</CardTitle>
|
|
46
|
+
<CardDescription>
|
|
47
|
+
{t('enterDiscountCode')}
|
|
48
|
+
</CardDescription>
|
|
49
|
+
</CardHeader>
|
|
50
|
+
<CardContent className="space-y-4">
|
|
51
|
+
{/* Applied coupon codes */}
|
|
52
|
+
{activeOrder.couponCodes && activeOrder.couponCodes.length > 0 && (
|
|
53
|
+
<div className="space-y-2">
|
|
54
|
+
{activeOrder.couponCodes.map((code) => (
|
|
55
|
+
<div key={code}
|
|
56
|
+
className="flex items-center justify-between p-3 border rounded-md bg-green-50 dark:bg-green-950/20">
|
|
57
|
+
<div className="flex items-center gap-2">
|
|
58
|
+
<Tag className="h-4 w-4 text-green-600"/>
|
|
59
|
+
<span className="font-medium text-sm">{code}</span>
|
|
60
|
+
</div>
|
|
61
|
+
<form action={removePromotionCode}>
|
|
62
|
+
<input type="hidden" name="code" value={code}/>
|
|
63
|
+
<Button
|
|
64
|
+
type="submit"
|
|
65
|
+
variant="ghost"
|
|
66
|
+
size="sm"
|
|
67
|
+
className="h-8 text-destructive hover:text-destructive hover:bg-destructive/10"
|
|
68
|
+
>
|
|
69
|
+
{t('remove')}
|
|
70
|
+
</Button>
|
|
71
|
+
</form>
|
|
72
|
+
</div>
|
|
73
|
+
))}
|
|
74
|
+
</div>
|
|
75
|
+
)}
|
|
76
|
+
|
|
77
|
+
{/* Applied store credits */}
|
|
78
|
+
{activeOrder.storeCreditsApplied.length > 0 && (
|
|
79
|
+
<div className="space-y-2">
|
|
80
|
+
{activeOrder.storeCreditsApplied.map((credit) => (
|
|
81
|
+
<div key={credit.code}
|
|
82
|
+
className="flex items-center justify-between p-3 border rounded-md bg-green-50 dark:bg-green-950/20">
|
|
83
|
+
<div className="flex items-center gap-2">
|
|
84
|
+
<Wallet className="h-4 w-4 text-green-600"/>
|
|
85
|
+
<span className="font-medium text-sm">
|
|
86
|
+
{maskCode(credit.code)}
|
|
87
|
+
</span>
|
|
88
|
+
<span className="text-xs text-green-600">
|
|
89
|
+
-<Price value={credit.amountDeducted} currencyCode={activeOrder.currencyCode}/>
|
|
90
|
+
</span>
|
|
91
|
+
</div>
|
|
92
|
+
<form action={removeStoreCredit}>
|
|
93
|
+
<input type="hidden" name="code" value={credit.code}/>
|
|
94
|
+
<Button
|
|
95
|
+
type="submit"
|
|
96
|
+
variant="ghost"
|
|
97
|
+
size="sm"
|
|
98
|
+
className="h-8 text-destructive hover:text-destructive hover:bg-destructive/10"
|
|
99
|
+
>
|
|
100
|
+
{t('remove')}
|
|
101
|
+
</Button>
|
|
102
|
+
</form>
|
|
103
|
+
</div>
|
|
104
|
+
))}
|
|
105
|
+
</div>
|
|
106
|
+
)}
|
|
107
|
+
|
|
108
|
+
{/* Available store credits from account */}
|
|
109
|
+
{redeemableCredits.length > 0 && (
|
|
110
|
+
<div className="space-y-2">
|
|
111
|
+
<p className="text-xs text-muted-foreground font-medium flex items-center gap-1.5">
|
|
112
|
+
<Wallet className="h-3.5 w-3.5"/>
|
|
113
|
+
{t('availableStoreCredits')}
|
|
114
|
+
</p>
|
|
115
|
+
{redeemableCredits.map((credit) => (
|
|
116
|
+
<div key={credit.id}
|
|
117
|
+
className="flex items-center justify-between p-3 border rounded-md">
|
|
118
|
+
<div className="flex items-center gap-2">
|
|
119
|
+
<span className="font-mono text-sm">
|
|
120
|
+
{maskCode(credit.code)}
|
|
121
|
+
</span>
|
|
122
|
+
<span className="text-xs text-muted-foreground">
|
|
123
|
+
<Price value={credit.balance} currencyCode={credit.currencyCode}/>
|
|
124
|
+
</span>
|
|
125
|
+
</div>
|
|
126
|
+
<form action={applyStoreCredit}>
|
|
127
|
+
<input type="hidden" name="code" value={credit.code}/>
|
|
128
|
+
<Button type="submit" variant="outline" size="sm" className="h-8">
|
|
129
|
+
{t('apply')}
|
|
130
|
+
</Button>
|
|
131
|
+
</form>
|
|
132
|
+
</div>
|
|
133
|
+
))}
|
|
134
|
+
</div>
|
|
135
|
+
)}
|
|
136
|
+
|
|
137
|
+
{/* Code input */}
|
|
138
|
+
<CodeInput />
|
|
139
|
+
</CardContent>
|
|
140
|
+
</Card>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {useState, useCallback, useRef} from 'react';
|
|
4
|
+
import {
|
|
5
|
+
AlertDialog,
|
|
6
|
+
AlertDialogAction,
|
|
7
|
+
AlertDialogCancel,
|
|
8
|
+
AlertDialogContent,
|
|
9
|
+
AlertDialogDescription,
|
|
10
|
+
AlertDialogFooter,
|
|
11
|
+
AlertDialogHeader,
|
|
12
|
+
AlertDialogTitle,
|
|
13
|
+
} from '@/components/ui/alert-dialog';
|
|
14
|
+
import {useTranslations} from 'next-intl';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Hook that provides a confirmation gate for actions that would invalidate
|
|
18
|
+
* a prior approval.
|
|
19
|
+
*
|
|
20
|
+
* @param requiresReapproval - Static boolean (from server component props) or
|
|
21
|
+
* async function that checks at action time (for components that don't know upfront).
|
|
22
|
+
*/
|
|
23
|
+
export function useReapprovalConfirm(requiresReapproval?: boolean | (() => Promise<boolean>)) {
|
|
24
|
+
const t = useTranslations('Cart');
|
|
25
|
+
const [open, setOpen] = useState(false);
|
|
26
|
+
const [isChecking, setIsChecking] = useState(false);
|
|
27
|
+
const pendingActionRef = useRef<(() => void) | null>(null);
|
|
28
|
+
|
|
29
|
+
const guardCartChange = useCallback(async (action: () => void) => {
|
|
30
|
+
setIsChecking(true);
|
|
31
|
+
try {
|
|
32
|
+
const needsConfirmation = typeof requiresReapproval === 'function'
|
|
33
|
+
? await requiresReapproval()
|
|
34
|
+
: requiresReapproval;
|
|
35
|
+
|
|
36
|
+
if (needsConfirmation) {
|
|
37
|
+
pendingActionRef.current = action;
|
|
38
|
+
setOpen(true);
|
|
39
|
+
} else {
|
|
40
|
+
action();
|
|
41
|
+
}
|
|
42
|
+
} finally {
|
|
43
|
+
setIsChecking(false);
|
|
44
|
+
}
|
|
45
|
+
}, [requiresReapproval]);
|
|
46
|
+
|
|
47
|
+
const handleConfirm = useCallback(() => {
|
|
48
|
+
setOpen(false);
|
|
49
|
+
pendingActionRef.current?.();
|
|
50
|
+
pendingActionRef.current = null;
|
|
51
|
+
}, []);
|
|
52
|
+
|
|
53
|
+
const handleCancel = useCallback(() => {
|
|
54
|
+
setOpen(false);
|
|
55
|
+
pendingActionRef.current = null;
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
const dialog = (
|
|
59
|
+
<AlertDialog open={open} onOpenChange={setOpen}>
|
|
60
|
+
<AlertDialogContent>
|
|
61
|
+
<AlertDialogHeader>
|
|
62
|
+
<AlertDialogTitle>{t('reapprovalTitle')}</AlertDialogTitle>
|
|
63
|
+
<AlertDialogDescription>
|
|
64
|
+
{t('reapprovalMessage')}
|
|
65
|
+
</AlertDialogDescription>
|
|
66
|
+
</AlertDialogHeader>
|
|
67
|
+
<AlertDialogFooter>
|
|
68
|
+
<AlertDialogCancel onClick={handleCancel}>{t('cancel')}</AlertDialogCancel>
|
|
69
|
+
<AlertDialogAction onClick={handleConfirm}>{t('continue')}</AlertDialogAction>
|
|
70
|
+
</AlertDialogFooter>
|
|
71
|
+
</AlertDialogContent>
|
|
72
|
+
</AlertDialog>
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return { guardCartChange, isChecking, dialog };
|
|
76
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Button } from '@/components/ui/button';
|
|
5
|
+
import {
|
|
6
|
+
Dialog,
|
|
7
|
+
DialogContent,
|
|
8
|
+
DialogHeader,
|
|
9
|
+
DialogTitle,
|
|
10
|
+
} from '@/components/ui/dialog';
|
|
11
|
+
import { FileText } from 'lucide-react';
|
|
12
|
+
import { QuoteRequestForm, type QuoteLineItemDraft } from '@/components/commerce/quote-request-form';
|
|
13
|
+
import { requestQuoteFromCartWithReview } from '@/app/[locale]/account/quotes/actions';
|
|
14
|
+
import {useTranslations} from 'next-intl';
|
|
15
|
+
|
|
16
|
+
interface CartLine {
|
|
17
|
+
id: string;
|
|
18
|
+
quantity: number;
|
|
19
|
+
unitPrice: number;
|
|
20
|
+
productVariant: {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
sku: string;
|
|
24
|
+
product: {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
slug: string;
|
|
28
|
+
featuredAsset?: { id: string; preview: string } | null;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface RequestQuoteButtonProps {
|
|
34
|
+
cartLines: CartLine[];
|
|
35
|
+
currencyCode: string;
|
|
36
|
+
sender: { name: string; email: string; company?: string };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function RequestQuoteButton({ cartLines, currencyCode, sender }: RequestQuoteButtonProps) {
|
|
40
|
+
const t = useTranslations('Cart');
|
|
41
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
42
|
+
|
|
43
|
+
const initialLineItems: QuoteLineItemDraft[] = cartLines.map(line => ({
|
|
44
|
+
productVariantId: line.productVariant.id,
|
|
45
|
+
productName: line.productVariant.product.name,
|
|
46
|
+
variantName: line.productVariant.name,
|
|
47
|
+
sku: line.productVariant.sku,
|
|
48
|
+
imageUrl: line.productVariant.product.featuredAsset?.preview,
|
|
49
|
+
quantity: line.quantity,
|
|
50
|
+
unitPrice: line.unitPrice,
|
|
51
|
+
currencyCode,
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
<Button
|
|
57
|
+
variant="outline"
|
|
58
|
+
className="w-full mt-2"
|
|
59
|
+
onClick={() => setDialogOpen(true)}
|
|
60
|
+
>
|
|
61
|
+
<FileText className="h-4 w-4 mr-2" />
|
|
62
|
+
{t('requestQuote')}
|
|
63
|
+
</Button>
|
|
64
|
+
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
|
|
65
|
+
<DialogContent className="sm:max-w-2xl max-h-[85vh] overflow-y-auto">
|
|
66
|
+
<DialogHeader>
|
|
67
|
+
<DialogTitle>{t('requestQuote')}</DialogTitle>
|
|
68
|
+
</DialogHeader>
|
|
69
|
+
<QuoteRequestForm
|
|
70
|
+
initialLineItems={initialLineItems}
|
|
71
|
+
sender={sender}
|
|
72
|
+
mode="from-cart"
|
|
73
|
+
onSubmit={requestQuoteFromCartWithReview}
|
|
74
|
+
onCancel={() => setDialogOpen(false)}
|
|
75
|
+
/>
|
|
76
|
+
</DialogContent>
|
|
77
|
+
</Dialog>
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
}
|