@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,107 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState, useCallback, type ReactNode } from 'react';
|
|
4
|
+
import { useSearchParams } from 'next/navigation';
|
|
5
|
+
import { usePathname, useRouter } from '@/i18n/navigation';
|
|
6
|
+
import { useTranslations } from 'next-intl';
|
|
7
|
+
import { LayoutGrid, List } from 'lucide-react';
|
|
8
|
+
import { cn } from '@/lib/utils';
|
|
9
|
+
import { FragmentOf, readFragment } from '@/graphql';
|
|
10
|
+
import { ProductCardFragment } from '@/lib/vendure/fragments';
|
|
11
|
+
import { ProductCard } from './product-card';
|
|
12
|
+
import { ProductListView } from './product-list-view';
|
|
13
|
+
|
|
14
|
+
const STORAGE_KEY = 'catalog-view-preference';
|
|
15
|
+
|
|
16
|
+
function getInitialView(urlView: string | undefined): 'grid' | 'list' {
|
|
17
|
+
if (urlView === 'grid' || urlView === 'list') return urlView;
|
|
18
|
+
if (typeof window !== 'undefined') {
|
|
19
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
20
|
+
if (stored === 'list') return 'list';
|
|
21
|
+
}
|
|
22
|
+
return 'grid';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface ProductViewSwitcherProps {
|
|
26
|
+
products: FragmentOf<typeof ProductCardFragment>[];
|
|
27
|
+
totalItems: number;
|
|
28
|
+
urlView?: string;
|
|
29
|
+
currentPage?: number;
|
|
30
|
+
take?: number;
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function ProductViewSwitcher({ products, totalItems, urlView, currentPage, take, children }: ProductViewSwitcherProps) {
|
|
35
|
+
const t = useTranslations('Product');
|
|
36
|
+
const pathname = usePathname();
|
|
37
|
+
const searchParams = useSearchParams();
|
|
38
|
+
const router = useRouter();
|
|
39
|
+
const [view, setViewState] = useState<'grid' | 'list'>(() => getInitialView(urlView));
|
|
40
|
+
|
|
41
|
+
const setView = useCallback((newView: 'grid' | 'list') => {
|
|
42
|
+
setViewState(newView);
|
|
43
|
+
localStorage.setItem(STORAGE_KEY, newView);
|
|
44
|
+
const params = new URLSearchParams(searchParams);
|
|
45
|
+
if (newView === 'grid') {
|
|
46
|
+
params.delete('view');
|
|
47
|
+
} else {
|
|
48
|
+
params.set('view', newView);
|
|
49
|
+
}
|
|
50
|
+
router.replace(`${pathname}?${params.toString()}`, { scroll: false });
|
|
51
|
+
}, [pathname, searchParams, router]);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<div className="flex items-center justify-between">
|
|
56
|
+
<p className="text-sm text-muted-foreground">
|
|
57
|
+
{t('productCount', {count: totalItems})}
|
|
58
|
+
</p>
|
|
59
|
+
<div className="flex items-center gap-2">
|
|
60
|
+
<div className="flex items-center border border-border rounded-md">
|
|
61
|
+
<button
|
|
62
|
+
onClick={() => setView('grid')}
|
|
63
|
+
className={cn(
|
|
64
|
+
'p-1.5 rounded-l-md transition-colors',
|
|
65
|
+
view === 'grid'
|
|
66
|
+
? 'bg-primary/10 text-primary'
|
|
67
|
+
: 'text-muted-foreground hover:text-foreground',
|
|
68
|
+
)}
|
|
69
|
+
aria-label="Grid view"
|
|
70
|
+
>
|
|
71
|
+
<LayoutGrid className="h-4 w-4" />
|
|
72
|
+
</button>
|
|
73
|
+
<button
|
|
74
|
+
onClick={() => setView('list')}
|
|
75
|
+
className={cn(
|
|
76
|
+
'p-1.5 rounded-r-md transition-colors',
|
|
77
|
+
view === 'list'
|
|
78
|
+
? 'bg-primary/10 text-primary'
|
|
79
|
+
: 'text-muted-foreground hover:text-foreground',
|
|
80
|
+
)}
|
|
81
|
+
aria-label="List view"
|
|
82
|
+
>
|
|
83
|
+
<List className="h-4 w-4" />
|
|
84
|
+
</button>
|
|
85
|
+
</div>
|
|
86
|
+
{children}
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
{view === 'list' ? (
|
|
91
|
+
<ProductListView products={products} currentPage={currentPage} take={take} />
|
|
92
|
+
) : (
|
|
93
|
+
<div className="grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
94
|
+
{products.map((product, i) => {
|
|
95
|
+
const { productId } = readFragment(ProductCardFragment, product);
|
|
96
|
+
const position = currentPage && take ? (currentPage - 1) * take + i + 1 : undefined;
|
|
97
|
+
return (
|
|
98
|
+
<div key={productId} data-search-product-id={productId} data-search-position={position}>
|
|
99
|
+
<ProductCard product={product} />
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
})}
|
|
103
|
+
</div>
|
|
104
|
+
)}
|
|
105
|
+
</>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {useState, useTransition, useCallback, useEffect, useRef} from 'react';
|
|
4
|
+
import {useRouter} from '@/i18n/navigation';
|
|
5
|
+
import {Button} from '@/components/ui/button';
|
|
6
|
+
import {Textarea} from '@/components/ui/textarea';
|
|
7
|
+
import {XCircle, MessageSquare, ShoppingCart, Send, Loader2, AlertTriangle} from 'lucide-react';
|
|
8
|
+
import {useTranslations} from 'next-intl';
|
|
9
|
+
import {
|
|
10
|
+
submitQuote,
|
|
11
|
+
acceptQuote,
|
|
12
|
+
rejectQuote,
|
|
13
|
+
requestQuoteChanges,
|
|
14
|
+
acceptAndConvertQuote,
|
|
15
|
+
checkQuoteStock,
|
|
16
|
+
} from '@/app/[locale]/account/quotes/actions';
|
|
17
|
+
|
|
18
|
+
const TERMINAL_STATUSES = new Set(['ACCEPTED', 'REJECTED', 'CANCELLED', 'EXPIRED']);
|
|
19
|
+
const POLL_INTERVAL_MS = 1000;
|
|
20
|
+
const MAX_POLLS = 10;
|
|
21
|
+
|
|
22
|
+
interface QuoteActionButtonsProps {
|
|
23
|
+
quoteId: string;
|
|
24
|
+
status: string;
|
|
25
|
+
convertedOrderId?: string | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function QuoteActionButtons({quoteId, status, convertedOrderId}: QuoteActionButtonsProps) {
|
|
29
|
+
const router = useRouter();
|
|
30
|
+
const t = useTranslations('Quotes');
|
|
31
|
+
const [reason, setReason] = useState('');
|
|
32
|
+
const [isPending, startTransition] = useTransition();
|
|
33
|
+
const [result, setResult] = useState<{success: boolean; message?: string} | null>(null);
|
|
34
|
+
const [polling, setPolling] = useState(false);
|
|
35
|
+
const pollCount = useRef(0);
|
|
36
|
+
const initialStatus = useRef(status);
|
|
37
|
+
const [stockWarning, setStockWarning] = useState<Array<{
|
|
38
|
+
sku: string;
|
|
39
|
+
productName: string;
|
|
40
|
+
requestedQuantity: number;
|
|
41
|
+
availableStock: number;
|
|
42
|
+
}> | null>(null);
|
|
43
|
+
|
|
44
|
+
// When status prop changes (page re-rendered with new data), stop polling
|
|
45
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect -- syncing local state to prop change
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (status !== initialStatus.current) {
|
|
48
|
+
setPolling(false);
|
|
49
|
+
setResult(null);
|
|
50
|
+
pollCount.current = 0;
|
|
51
|
+
initialStatus.current = status;
|
|
52
|
+
}
|
|
53
|
+
}, [status]);
|
|
54
|
+
|
|
55
|
+
// Poll for status change by refreshing the page data
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (!polling) return;
|
|
58
|
+
const timer = setInterval(() => {
|
|
59
|
+
pollCount.current++;
|
|
60
|
+
if (pollCount.current >= MAX_POLLS) {
|
|
61
|
+
setPolling(false);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
router.refresh();
|
|
65
|
+
}, POLL_INTERVAL_MS);
|
|
66
|
+
return () => clearInterval(timer);
|
|
67
|
+
}, [polling, router]);
|
|
68
|
+
|
|
69
|
+
const handleAction = useCallback((action: () => Promise<{success: boolean; message?: string; redirectTo?: string}>) => {
|
|
70
|
+
startTransition(async () => {
|
|
71
|
+
const res = await action();
|
|
72
|
+
setResult(res);
|
|
73
|
+
if (res.success && 'redirectTo' in res && res.redirectTo) {
|
|
74
|
+
router.push(res.redirectTo);
|
|
75
|
+
} else if (res.success) {
|
|
76
|
+
pollCount.current = 0;
|
|
77
|
+
setPolling(true);
|
|
78
|
+
router.refresh();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}, [router]);
|
|
82
|
+
|
|
83
|
+
if (TERMINAL_STATUSES.has(status) && status !== 'ACCEPTED') {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (status === 'ACCEPTED' && convertedOrderId) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (polling) {
|
|
92
|
+
return (
|
|
93
|
+
<div className="flex items-center gap-2 rounded-md border border-blue-200 bg-blue-50 p-3 text-sm text-blue-800">
|
|
94
|
+
<Loader2 className="h-4 w-4 animate-spin"/>
|
|
95
|
+
{t('actionProcessing')}
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<div className="space-y-3">
|
|
102
|
+
{status === 'DRAFT' && (
|
|
103
|
+
<Button
|
|
104
|
+
size="sm"
|
|
105
|
+
onClick={() => handleAction(() => submitQuote(quoteId))}
|
|
106
|
+
disabled={isPending}
|
|
107
|
+
className="w-full"
|
|
108
|
+
>
|
|
109
|
+
<Send className="h-4 w-4 mr-1"/>
|
|
110
|
+
{t('actionSubmitQuoteRequest')}
|
|
111
|
+
</Button>
|
|
112
|
+
)}
|
|
113
|
+
|
|
114
|
+
{(status === 'QUOTED' || (status === 'ACCEPTED' && !convertedOrderId)) && (
|
|
115
|
+
<>
|
|
116
|
+
{stockWarning && (
|
|
117
|
+
<div className="rounded-md border border-amber-200 bg-amber-50 p-4 space-y-3">
|
|
118
|
+
<div className="flex items-start gap-2">
|
|
119
|
+
<AlertTriangle className="h-4 w-4 text-amber-600 mt-0.5 shrink-0"/>
|
|
120
|
+
<div>
|
|
121
|
+
<p className="text-sm font-medium text-amber-900">{t('stockWarningTitle')}</p>
|
|
122
|
+
<ul className="text-xs text-amber-800 mt-1.5 space-y-1">
|
|
123
|
+
{stockWarning.map(item => (
|
|
124
|
+
<li key={item.sku}>
|
|
125
|
+
<span className="font-medium">{item.productName}</span>
|
|
126
|
+
<span className="text-amber-700"> — {t('stockWarningNeedAvailable', {needed: item.requestedQuantity, available: item.availableStock})}</span>
|
|
127
|
+
</li>
|
|
128
|
+
))}
|
|
129
|
+
</ul>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
<p className="text-xs text-amber-700">
|
|
133
|
+
{status === 'ACCEPTED'
|
|
134
|
+
? t('stockWarningAcceptedMessage')
|
|
135
|
+
: t('stockWarningQuotedMessage')}
|
|
136
|
+
</p>
|
|
137
|
+
<div className="flex flex-col gap-2">
|
|
138
|
+
{status === 'QUOTED' && (
|
|
139
|
+
<Button
|
|
140
|
+
size="sm"
|
|
141
|
+
variant="outline"
|
|
142
|
+
className="w-full"
|
|
143
|
+
disabled={isPending}
|
|
144
|
+
onClick={() => {
|
|
145
|
+
setStockWarning(null);
|
|
146
|
+
handleAction(() => acceptQuote(quoteId));
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
{t('actionAcceptQuote')}
|
|
150
|
+
</Button>
|
|
151
|
+
)}
|
|
152
|
+
<Button
|
|
153
|
+
size="sm"
|
|
154
|
+
variant="outline"
|
|
155
|
+
className="w-full border-amber-300 text-amber-900 hover:bg-amber-100"
|
|
156
|
+
onClick={() => setStockWarning(null)}
|
|
157
|
+
>
|
|
158
|
+
{t('actionDismiss')}
|
|
159
|
+
</Button>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
)}
|
|
163
|
+
{!stockWarning && (
|
|
164
|
+
<>
|
|
165
|
+
{status === 'QUOTED' && (
|
|
166
|
+
<Textarea
|
|
167
|
+
placeholder={t('changeRequestPlaceholder')}
|
|
168
|
+
value={reason}
|
|
169
|
+
onChange={(e) => setReason(e.target.value)}
|
|
170
|
+
rows={2}
|
|
171
|
+
disabled={isPending}
|
|
172
|
+
/>
|
|
173
|
+
)}
|
|
174
|
+
<div className="flex flex-col gap-2">
|
|
175
|
+
<Button
|
|
176
|
+
onClick={() => {
|
|
177
|
+
startTransition(async () => {
|
|
178
|
+
const stockResult = await checkQuoteStock(quoteId);
|
|
179
|
+
if (!stockResult.allInStock) {
|
|
180
|
+
setStockWarning(stockResult.outOfStockItems);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const res = await acceptAndConvertQuote(quoteId);
|
|
184
|
+
setResult(res);
|
|
185
|
+
if (res.success && 'redirectTo' in res && res.redirectTo) {
|
|
186
|
+
router.push(res.redirectTo);
|
|
187
|
+
} else if (res.success) {
|
|
188
|
+
pollCount.current = 0;
|
|
189
|
+
setPolling(true);
|
|
190
|
+
router.refresh();
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}}
|
|
194
|
+
disabled={isPending}
|
|
195
|
+
className="w-full"
|
|
196
|
+
>
|
|
197
|
+
<ShoppingCart className="h-4 w-4 mr-2"/>
|
|
198
|
+
{status === 'ACCEPTED' ? t('actionProceedToCheckout') : t('actionAcceptAndCheckout')}
|
|
199
|
+
</Button>
|
|
200
|
+
{status === 'QUOTED' && (
|
|
201
|
+
<>
|
|
202
|
+
<Button
|
|
203
|
+
variant="outline"
|
|
204
|
+
size="sm"
|
|
205
|
+
onClick={() => handleAction(() => requestQuoteChanges(quoteId, reason))}
|
|
206
|
+
disabled={isPending || !reason.trim()}
|
|
207
|
+
className="w-full"
|
|
208
|
+
>
|
|
209
|
+
<MessageSquare className="h-4 w-4 mr-1"/>
|
|
210
|
+
{t('actionRequestChanges')}
|
|
211
|
+
</Button>
|
|
212
|
+
<Button
|
|
213
|
+
variant="destructive"
|
|
214
|
+
size="sm"
|
|
215
|
+
onClick={() => handleAction(() => rejectQuote(quoteId, reason || undefined))}
|
|
216
|
+
disabled={isPending}
|
|
217
|
+
className="w-full"
|
|
218
|
+
>
|
|
219
|
+
<XCircle className="h-4 w-4 mr-1"/>
|
|
220
|
+
{t('actionRejectQuote')}
|
|
221
|
+
</Button>
|
|
222
|
+
</>
|
|
223
|
+
)}
|
|
224
|
+
</div>
|
|
225
|
+
</>
|
|
226
|
+
)}
|
|
227
|
+
</>
|
|
228
|
+
)}
|
|
229
|
+
|
|
230
|
+
{result && !result.success && (
|
|
231
|
+
<p className="text-sm text-red-600">{result.message || t('errorOccurred')}</p>
|
|
232
|
+
)}
|
|
233
|
+
</div>
|
|
234
|
+
);
|
|
235
|
+
}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {useState} from 'react';
|
|
4
|
+
import {useLocale} from 'next-intl';
|
|
5
|
+
import {Card, CardContent, CardHeader, CardTitle} from '@/components/ui/card';
|
|
6
|
+
import {Price} from '@/components/commerce/price';
|
|
7
|
+
import {formatDateTime} from '@/lib/format';
|
|
8
|
+
import {FileText, MessageSquare, Send, ArrowRight, Plus, Minus, ChevronDown, ChevronRight} from 'lucide-react';
|
|
9
|
+
import type {QuoteVersion, QuoteComment} from '@/lib/vendure/queries';
|
|
10
|
+
|
|
11
|
+
type TimelineItem =
|
|
12
|
+
| { type: 'version'; version: QuoteVersion; timestamp: number }
|
|
13
|
+
| { type: 'comment'; comment: QuoteComment; timestamp: number; grouped: boolean };
|
|
14
|
+
|
|
15
|
+
/** Comments posted within 30s of a version are visually grouped under it (smaller dot, indented) */
|
|
16
|
+
const GROUP_THRESHOLD_MS = 30_000;
|
|
17
|
+
/** Diffs with more than this many changes start collapsed */
|
|
18
|
+
const COLLAPSE_THRESHOLD = 3;
|
|
19
|
+
|
|
20
|
+
interface QuoteActivityTimelineProps {
|
|
21
|
+
versions: QuoteVersion[];
|
|
22
|
+
comments: QuoteComment[];
|
|
23
|
+
currentVersionNumber?: number;
|
|
24
|
+
currencyCode: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function QuoteActivityTimeline({versions, comments, currentVersionNumber, currencyCode}: QuoteActivityTimelineProps) {
|
|
28
|
+
const locale = useLocale();
|
|
29
|
+
const sorted = [...versions].sort((a, b) => a.versionNumber - b.versionNumber);
|
|
30
|
+
|
|
31
|
+
// Build timeline items
|
|
32
|
+
const items: TimelineItem[] = [];
|
|
33
|
+
for (const version of sorted) {
|
|
34
|
+
items.push({type: 'version', version, timestamp: new Date(version.createdAt).getTime()});
|
|
35
|
+
}
|
|
36
|
+
for (const comment of comments) {
|
|
37
|
+
items.push({type: 'comment', comment, timestamp: new Date(comment.createdAt).getTime(), grouped: false});
|
|
38
|
+
}
|
|
39
|
+
items.sort((a, b) => a.timestamp - b.timestamp);
|
|
40
|
+
|
|
41
|
+
// Mark comments near a version as grouped
|
|
42
|
+
for (let i = 0; i < items.length; i++) {
|
|
43
|
+
const item = items[i];
|
|
44
|
+
if (item.type === 'comment') {
|
|
45
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
46
|
+
if (Math.abs(item.timestamp - items[j].timestamp) > GROUP_THRESHOLD_MS) break;
|
|
47
|
+
if (items[j].type === 'version') {item.grouped = true; break;}
|
|
48
|
+
}
|
|
49
|
+
if (!item.grouped) {
|
|
50
|
+
for (let j = i + 1; j < items.length; j++) {
|
|
51
|
+
if (Math.abs(items[j].timestamp - item.timestamp) > GROUP_THRESHOLD_MS) break;
|
|
52
|
+
if (items[j].type === 'version') {item.grouped = true; break;}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Compute diffs between consecutive versions
|
|
59
|
+
const versionDiffs = new Map<string, VersionDiff>();
|
|
60
|
+
for (let i = 1; i < sorted.length; i++) {
|
|
61
|
+
versionDiffs.set(sorted[i].id, computeDiff(sorted[i - 1], sorted[i]));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Card>
|
|
66
|
+
<CardHeader>
|
|
67
|
+
<CardTitle>Activity</CardTitle>
|
|
68
|
+
</CardHeader>
|
|
69
|
+
<CardContent>
|
|
70
|
+
<div className="relative">
|
|
71
|
+
{/* Vertical timeline line */}
|
|
72
|
+
<div className="absolute left-[11px] top-3 bottom-3 w-px bg-gradient-to-b from-border via-border/50 to-transparent" />
|
|
73
|
+
<div className="space-y-0">
|
|
74
|
+
{items.map((item) => {
|
|
75
|
+
if (item.type === 'version') {
|
|
76
|
+
return (
|
|
77
|
+
<VersionEntry
|
|
78
|
+
key={`v-${item.version.id}`}
|
|
79
|
+
version={item.version}
|
|
80
|
+
isCurrent={item.version.versionNumber === currentVersionNumber}
|
|
81
|
+
diff={versionDiffs.get(item.version.id)}
|
|
82
|
+
locale={locale}
|
|
83
|
+
currencyCode={currencyCode}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
return (
|
|
88
|
+
<CommentEntry
|
|
89
|
+
key={`c-${item.comment.id}`}
|
|
90
|
+
comment={item.comment}
|
|
91
|
+
grouped={item.grouped}
|
|
92
|
+
locale={locale}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
})}
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</CardContent>
|
|
99
|
+
</Card>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ── Version diff logic ──
|
|
104
|
+
|
|
105
|
+
interface VersionDiff {
|
|
106
|
+
addedItems: Array<{productName: string; sku: string; quantity: number; unitPrice: number}>;
|
|
107
|
+
removedItems: Array<{productName: string; sku: string}>;
|
|
108
|
+
changedItems: Array<{
|
|
109
|
+
productName: string;
|
|
110
|
+
sku: string;
|
|
111
|
+
prevPrice: number;
|
|
112
|
+
newPrice: number;
|
|
113
|
+
prevQty: number;
|
|
114
|
+
newQty: number;
|
|
115
|
+
priceChanged: boolean;
|
|
116
|
+
qtyChanged: boolean;
|
|
117
|
+
}>;
|
|
118
|
+
totalDelta: number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function computeDiff(prev: QuoteVersion, curr: QuoteVersion): VersionDiff {
|
|
122
|
+
const prevBySku = new Map(prev.lineItems.map(li => [li.sku, li]));
|
|
123
|
+
const currBySku = new Map(curr.lineItems.map(li => [li.sku, li]));
|
|
124
|
+
|
|
125
|
+
const addedItems: VersionDiff['addedItems'] = [];
|
|
126
|
+
const removedItems: VersionDiff['removedItems'] = [];
|
|
127
|
+
const changedItems: VersionDiff['changedItems'] = [];
|
|
128
|
+
|
|
129
|
+
for (const [sku, item] of currBySku) {
|
|
130
|
+
const prevItem = prevBySku.get(sku);
|
|
131
|
+
if (!prevItem) {
|
|
132
|
+
addedItems.push({productName: item.productName, sku, quantity: item.quantity, unitPrice: item.unitPrice});
|
|
133
|
+
} else {
|
|
134
|
+
const priceChanged = item.unitPrice !== prevItem.unitPrice;
|
|
135
|
+
const qtyChanged = item.quantity !== prevItem.quantity;
|
|
136
|
+
if (priceChanged || qtyChanged) {
|
|
137
|
+
changedItems.push({
|
|
138
|
+
productName: item.productName,
|
|
139
|
+
sku,
|
|
140
|
+
prevPrice: prevItem.unitPrice,
|
|
141
|
+
newPrice: item.unitPrice,
|
|
142
|
+
prevQty: prevItem.quantity,
|
|
143
|
+
newQty: item.quantity,
|
|
144
|
+
priceChanged,
|
|
145
|
+
qtyChanged,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
for (const [sku, item] of prevBySku) {
|
|
151
|
+
if (!currBySku.has(sku)) {
|
|
152
|
+
removedItems.push({productName: item.productName, sku});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return {addedItems, removedItems, changedItems, totalDelta: curr.total - prev.total};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function buildSummary(diff: VersionDiff): string {
|
|
160
|
+
const parts: string[] = [];
|
|
161
|
+
if (diff.addedItems.length > 0) parts.push(`+${diff.addedItems.length} item${diff.addedItems.length > 1 ? 's' : ''}`);
|
|
162
|
+
if (diff.removedItems.length > 0) parts.push(`-${diff.removedItems.length} item${diff.removedItems.length > 1 ? 's' : ''}`);
|
|
163
|
+
const priceChanges = diff.changedItems.filter(c => c.priceChanged).length;
|
|
164
|
+
const qtyChanges = diff.changedItems.filter(c => c.qtyChanged).length;
|
|
165
|
+
if (priceChanges > 0) parts.push(`${priceChanges} price change${priceChanges > 1 ? 's' : ''}`);
|
|
166
|
+
if (qtyChanges > 0) parts.push(`${qtyChanges} qty change${qtyChanges > 1 ? 's' : ''}`);
|
|
167
|
+
return parts.join(', ');
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// ── Timeline entries ──
|
|
171
|
+
|
|
172
|
+
function VersionEntry({version, isCurrent, diff, locale, currencyCode}: {version: QuoteVersion; isCurrent: boolean; diff?: VersionDiff; locale: string; currencyCode: string}) {
|
|
173
|
+
const isFirst = version.versionNumber === 1;
|
|
174
|
+
const summary = diff ? buildSummary(diff) : null;
|
|
175
|
+
const totalChanges = diff
|
|
176
|
+
? diff.addedItems.length + diff.removedItems.length + diff.changedItems.length
|
|
177
|
+
: 0;
|
|
178
|
+
const hasChanges = totalChanges > 0;
|
|
179
|
+
const [expanded, setExpanded] = useState(totalChanges <= COLLAPSE_THRESHOLD);
|
|
180
|
+
|
|
181
|
+
const allDiffRows = diff ? [
|
|
182
|
+
...diff.addedItems.map(item => ({type: 'added' as const, ...item})),
|
|
183
|
+
...diff.removedItems.map(item => ({type: 'removed' as const, ...item})),
|
|
184
|
+
...diff.changedItems.map(item => ({type: 'changed' as const, ...item})),
|
|
185
|
+
] : [];
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<div className="relative flex gap-3 py-3 group">
|
|
189
|
+
<div className="relative z-10 flex-shrink-0">
|
|
190
|
+
<div className={`h-6 w-6 rounded-full flex items-center justify-center shadow-sm ${
|
|
191
|
+
isFirst ? 'bg-muted text-muted-foreground' : 'bg-primary text-primary-foreground'
|
|
192
|
+
}`}>
|
|
193
|
+
{isFirst ? <FileText className="h-3 w-3" /> : <Send className="h-3 w-3" />}
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
<div className="flex-1 min-w-0">
|
|
197
|
+
<div className="flex items-start justify-between">
|
|
198
|
+
<div>
|
|
199
|
+
<div className="flex items-center gap-2">
|
|
200
|
+
<span className="text-sm font-medium">
|
|
201
|
+
{isFirst ? 'Quote Requested' : `Revision v${version.versionNumber}`}
|
|
202
|
+
</span>
|
|
203
|
+
{isCurrent && (
|
|
204
|
+
<span className="text-[10px] bg-primary/10 text-primary px-1.5 py-0.5 rounded font-medium">
|
|
205
|
+
Current
|
|
206
|
+
</span>
|
|
207
|
+
)}
|
|
208
|
+
</div>
|
|
209
|
+
{summary && (
|
|
210
|
+
<p className="text-xs text-muted-foreground mt-0.5">{summary}</p>
|
|
211
|
+
)}
|
|
212
|
+
</div>
|
|
213
|
+
<div className="text-right flex-shrink-0 ml-4">
|
|
214
|
+
<p className="text-xs text-muted-foreground">{formatDateTime(version.createdAt, locale)}</p>
|
|
215
|
+
<p className="text-sm font-medium">
|
|
216
|
+
<Price value={version.total} currencyCode={currencyCode} taxLabel="excl" />
|
|
217
|
+
</p>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
{hasChanges && (
|
|
221
|
+
<div className="mt-2">
|
|
222
|
+
{totalChanges > COLLAPSE_THRESHOLD && (
|
|
223
|
+
<button
|
|
224
|
+
type="button"
|
|
225
|
+
onClick={() => setExpanded(!expanded)}
|
|
226
|
+
className="flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors mb-1"
|
|
227
|
+
>
|
|
228
|
+
{expanded
|
|
229
|
+
? <ChevronDown className="h-3 w-3" />
|
|
230
|
+
: <ChevronRight className="h-3 w-3" />
|
|
231
|
+
}
|
|
232
|
+
{expanded ? 'Hide' : 'Show'} {totalChanges} changes
|
|
233
|
+
</button>
|
|
234
|
+
)}
|
|
235
|
+
{expanded && (
|
|
236
|
+
<div className="text-xs space-y-1 border-l-2 border-muted pl-3">
|
|
237
|
+
{allDiffRows.map(row => {
|
|
238
|
+
if (row.type === 'added') {
|
|
239
|
+
return (
|
|
240
|
+
<div key={row.sku} className="flex items-center gap-1.5 text-green-600 dark:text-green-400">
|
|
241
|
+
<Plus className="h-3 w-3" />
|
|
242
|
+
<span>{row.productName}</span>
|
|
243
|
+
<span className="text-muted-foreground">× {row.quantity}</span>
|
|
244
|
+
</div>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
if (row.type === 'removed') {
|
|
248
|
+
return (
|
|
249
|
+
<div key={row.sku} className="flex items-center gap-1.5 text-red-600 dark:text-red-400 line-through">
|
|
250
|
+
<Minus className="h-3 w-3" />
|
|
251
|
+
<span>{row.productName}</span>
|
|
252
|
+
</div>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
return (
|
|
256
|
+
<div key={row.sku} className="flex items-center gap-1.5">
|
|
257
|
+
<ArrowRight className="h-3 w-3 text-muted-foreground" />
|
|
258
|
+
<span>{row.productName}</span>
|
|
259
|
+
{row.priceChanged && (
|
|
260
|
+
<span>
|
|
261
|
+
<span className="text-muted-foreground line-through">
|
|
262
|
+
<Price value={row.prevPrice} currencyCode={currencyCode} />
|
|
263
|
+
</span>
|
|
264
|
+
{' '}
|
|
265
|
+
<span className={row.newPrice < row.prevPrice ? 'text-green-600' : 'text-red-600'}>
|
|
266
|
+
<Price value={row.newPrice} currencyCode={currencyCode} />
|
|
267
|
+
</span>
|
|
268
|
+
</span>
|
|
269
|
+
)}
|
|
270
|
+
{row.qtyChanged && (
|
|
271
|
+
<span className="text-muted-foreground">
|
|
272
|
+
qty {row.prevQty} → {row.newQty}
|
|
273
|
+
</span>
|
|
274
|
+
)}
|
|
275
|
+
</div>
|
|
276
|
+
);
|
|
277
|
+
})}
|
|
278
|
+
</div>
|
|
279
|
+
)}
|
|
280
|
+
</div>
|
|
281
|
+
)}
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function CommentEntry({comment, grouped, locale}: {comment: QuoteComment; grouped: boolean; locale: string}) {
|
|
288
|
+
const authorName = comment.authorCustomer
|
|
289
|
+
? `${comment.authorCustomer.firstName} ${comment.authorCustomer.lastName}`
|
|
290
|
+
: 'Seller';
|
|
291
|
+
|
|
292
|
+
return (
|
|
293
|
+
<div className="relative flex gap-3 py-2 group">
|
|
294
|
+
{/* Icon */}
|
|
295
|
+
<div className={`relative z-10 flex-shrink-0 ${grouped ? 'ml-2 mt-0.5' : ''}`}>
|
|
296
|
+
{grouped ? (
|
|
297
|
+
<div className="h-2 w-2 rounded-full border bg-background" />
|
|
298
|
+
) : (
|
|
299
|
+
<div className="h-6 w-6 rounded-full flex items-center justify-center shadow-sm bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300">
|
|
300
|
+
<MessageSquare className="h-3 w-3" />
|
|
301
|
+
</div>
|
|
302
|
+
)}
|
|
303
|
+
</div>
|
|
304
|
+
{/* Content */}
|
|
305
|
+
<div className="flex-1 min-w-0">
|
|
306
|
+
<div className="flex items-start justify-between">
|
|
307
|
+
<div>
|
|
308
|
+
<span className={`text-xs font-medium ${grouped ? 'text-muted-foreground' : ''}`}>
|
|
309
|
+
{authorName}
|
|
310
|
+
</span>
|
|
311
|
+
<p className="text-sm mt-0.5">{comment.text}</p>
|
|
312
|
+
</div>
|
|
313
|
+
<span className="text-xs text-muted-foreground flex-shrink-0 ml-4 whitespace-nowrap">
|
|
314
|
+
{formatDateTime(comment.createdAt, locale)}
|
|
315
|
+
</span>
|
|
316
|
+
</div>
|
|
317
|
+
</div>
|
|
318
|
+
</div>
|
|
319
|
+
);
|
|
320
|
+
}
|