@40rty/ams-ui 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/dist/agent.js +148 -0
- package/dist/catalog-data.js +93 -0
- package/dist/catalog-entries.js +8 -0
- package/dist/chunk-432XYPDT.js +1012 -0
- package/dist/chunk-54QPRWEG.js +2800 -0
- package/dist/chunk-CKGGECAQ.js +239 -0
- package/dist/chunk-E3IJDSKY.js +173 -0
- package/dist/chunk-JQNZ5UUK.js +226 -0
- package/dist/chunk-LQLOG2V3.js +649 -0
- package/dist/chunk-MHUEIBJ3.js +117 -0
- package/dist/chunk-ORIOBWTD.js +112 -0
- package/dist/css/preset/motion.css +78 -0
- package/dist/css/preset/tailwind-theme.css +163 -0
- package/dist/css/shell/mobile/island.css +478 -0
- package/dist/hooks.js +25 -0
- package/dist/index.js +7165 -0
- package/dist/motion.js +113 -0
- package/dist/shell.js +5621 -0
- package/dist/types/agent/AgentStreamingState.d.ts +58 -0
- package/dist/types/agent/ProseSurface.d.ts +31 -0
- package/dist/types/agent/index.d.ts +8 -0
- package/dist/types/agent/phase-label.d.ts +13 -0
- package/dist/types/agent/presence/AgentPresenceWidget.d.ts +85 -0
- package/dist/types/agent/presence/BriefIdentity.d.ts +9 -0
- package/dist/types/agent/presence/CompactRead.d.ts +44 -0
- package/dist/types/agent/presence/CriteriaRail.d.ts +68 -0
- package/dist/types/agent/presence/DefaultNotch.d.ts +2 -0
- package/dist/types/agent/presence/FactChip.d.ts +10 -0
- package/dist/types/agent/presence/InlinePresenceRead.d.ts +25 -0
- package/dist/types/agent/presence/KnowledgePeek.d.ts +23 -0
- package/dist/types/agent/presence/LayoutMorphSkeleton.d.ts +59 -0
- package/dist/types/agent/presence/PresenceBrief.d.ts +29 -0
- package/dist/types/agent/presence/PresenceFiller.d.ts +24 -0
- package/dist/types/agent/presence/SourceSift.d.ts +48 -0
- package/dist/types/agent/presence/StreamRead.d.ts +50 -0
- package/dist/types/agent/presence/VoiceLine.d.ts +19 -0
- package/dist/types/agent/presence/band-beat.d.ts +40 -0
- package/dist/types/agent/presence/band-row.d.ts +188 -0
- package/dist/types/agent/presence/cite-image.d.ts +9 -0
- package/dist/types/agent/presence/class-names.d.ts +134 -0
- package/dist/types/agent/presence/element-view.d.ts +83 -0
- package/dist/types/agent/presence/fact-forms/baseline-forms.d.ts +20 -0
- package/dist/types/agent/presence/fact-forms/class-names.d.ts +14 -0
- package/dist/types/agent/presence/fact-forms/index.d.ts +3 -0
- package/dist/types/agent/presence/fact-forms/register.d.ts +9 -0
- package/dist/types/agent/presence/fact-rail.d.ts +76 -0
- package/dist/types/agent/presence/fact-slots.d.ts +97 -0
- package/dist/types/agent/presence/folded.d.ts +26 -0
- package/dist/types/agent/presence/forms.d.ts +5 -0
- package/dist/types/agent/presence/index.d.ts +39 -0
- package/dist/types/agent/presence/notch/PresenceNotch.d.ts +20 -0
- package/dist/types/agent/presence/parts.d.ts +29 -0
- package/dist/types/agent/presence/read-data.d.ts +48 -0
- package/dist/types/agent/presence/reads.d.ts +37 -0
- package/dist/types/agent/presence/sift-deck.d.ts +58 -0
- package/dist/types/agent/presence/source-cards/ArticleSourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/CollectionSourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/PolicySourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/ProductSourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/ReviewSourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/SourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/card-frame.d.ts +38 -0
- package/dist/types/agent/presence/source-cards/card-marks.d.ts +69 -0
- package/dist/types/agent/presence/source-cards/card-plate.d.ts +20 -0
- package/dist/types/agent/presence/source-cards/card-shell.d.ts +91 -0
- package/dist/types/agent/presence/source-cards/register.d.ts +6 -0
- package/dist/types/agent/presence/source-cards/review-passage.d.ts +53 -0
- package/dist/types/agent/presence/swatch.d.ts +4 -0
- package/dist/types/agent/presence/use-band-facts.d.ts +9 -0
- package/dist/types/agent/presence/use-forget-fact.d.ts +56 -0
- package/dist/types/agent/presence/use-measured-height.d.ts +11 -0
- package/dist/types/catalog-data/base.d.ts +2 -0
- package/dist/types/catalog-data/chat.d.ts +55 -0
- package/dist/types/catalog-data/content.d.ts +1129 -0
- package/dist/types/catalog-data/ecommerce.d.ts +4842 -0
- package/dist/types/catalog-data/index.d.ts +7 -0
- package/dist/types/catalog-data/social.d.ts +1552 -0
- package/dist/types/catalog-data/tokens.d.ts +20 -0
- package/dist/types/catalog-data/ugc.d.ts +50 -0
- package/dist/types/catalog-entries.d.ts +35 -0
- package/dist/types/catalog.d.ts +18 -0
- package/dist/types/components/SkeletonSwap.d.ts +27 -0
- package/dist/types/components/agentic/AgentText.d.ts +44 -0
- package/dist/types/components/agentic/Turn.d.ts +21 -0
- package/dist/types/components/browse/CanvasBootLoader.d.ts +16 -0
- package/dist/types/components/browse/ContinuationLoading.d.ts +22 -0
- package/dist/types/components/browse/canvas-booting.d.ts +37 -0
- package/dist/types/components/browse/constants.d.ts +2 -0
- package/dist/types/components/browse/index.d.ts +4 -0
- package/dist/types/components/chat/SuggestionCards.d.ts +2 -0
- package/dist/types/components/chat/index.d.ts +1 -0
- package/dist/types/components/content/FAQ.d.ts +12 -0
- package/dist/types/components/content/FeatureGrid.d.ts +11 -0
- package/dist/types/components/content/InfoCards.d.ts +16 -0
- package/dist/types/components/content/Reviews.d.ts +9 -0
- package/dist/types/components/content/RichText.d.ts +10 -0
- package/dist/types/components/content/article/ArticleDetail.d.ts +15 -0
- package/dist/types/components/content/article/BlogCard.d.ts +11 -0
- package/dist/types/components/content/article/BlogPosts.d.ts +19 -0
- package/dist/types/components/content/page/PageDetail.d.ts +13 -0
- package/dist/types/components/content/page/PolicyDetail.d.ts +23 -0
- package/dist/types/components/ecommerce/cart/AddToCartButton.d.ts +9 -0
- package/dist/types/components/ecommerce/cart/CartContent.d.ts +40 -0
- package/dist/types/components/ecommerce/cart/CartDrawer.d.ts +41 -0
- package/dist/types/components/ecommerce/cart/CartFoot.d.ts +30 -0
- package/dist/types/components/ecommerce/cart/CartLineItem.d.ts +13 -0
- package/dist/types/components/ecommerce/cart/CartLineRow.d.ts +17 -0
- package/dist/types/components/ecommerce/cart/CartPromoCode.d.ts +29 -0
- package/dist/types/components/ecommerce/cart/CartSummary.d.ts +7 -0
- package/dist/types/components/ecommerce/cart/CartWidget.d.ts +10 -0
- package/dist/types/components/ecommerce/cart/VariantPickerModal.d.ts +12 -0
- package/dist/types/components/ecommerce/cart/cart-format.d.ts +8 -0
- package/dist/types/components/ecommerce/cart/use-cart-view.d.ts +50 -0
- package/dist/types/components/ecommerce/collection/CollectionCard.d.ts +10 -0
- package/dist/types/components/ecommerce/collection/CollectionGrid.d.ts +8 -0
- package/dist/types/components/ecommerce/collection/CollectionList.d.ts +13 -0
- package/dist/types/components/ecommerce/collection/internal/CollectionListItem.d.ts +13 -0
- package/dist/types/components/ecommerce/product/AddToRegistry.d.ts +36 -0
- package/dist/types/components/ecommerce/product/ComparisonTable.d.ts +25 -0
- package/dist/types/components/ecommerce/product/ComparisonTableSkeleton.d.ts +11 -0
- package/dist/types/components/ecommerce/product/PresenceProductRail.d.ts +35 -0
- package/dist/types/components/ecommerce/product/ProductBadge.d.ts +9 -0
- package/dist/types/components/ecommerce/product/ProductCard.d.ts +27 -0
- package/dist/types/components/ecommerce/product/ProductDetail.d.ts +25 -0
- package/dist/types/components/ecommerce/product/ProductGallery.d.ts +19 -0
- package/dist/types/components/ecommerce/product/ProductGrid.d.ts +26 -0
- package/dist/types/components/ecommerce/product/ProductImage.d.ts +54 -0
- package/dist/types/components/ecommerce/product/ProductOption.d.ts +9 -0
- package/dist/types/components/ecommerce/product/ProductPrice.d.ts +8 -0
- package/dist/types/components/ecommerce/product/ProductVideoPlayer.d.ts +17 -0
- package/dist/types/components/ecommerce/product/comparison-table-parts.d.ts +41 -0
- package/dist/types/components/ecommerce/product/comparison-table-rows.d.ts +24 -0
- package/dist/types/components/ecommerce/product/image-trim.d.ts +35 -0
- package/dist/types/components/ecommerce/product/product-card-glyphs.d.ts +2 -0
- package/dist/types/components/ecommerce/product/registry-logos.d.ts +2 -0
- package/dist/types/components/ecommerce/product/trim-geometry.d.ts +45 -0
- package/dist/types/components/ecommerce/wishlist/WishlistDrawer.d.ts +16 -0
- package/dist/types/components/feedback/Skeleton.d.ts +13 -0
- package/dist/types/components/feedback/Thinking.d.ts +15 -0
- package/dist/types/components/layout/AspectRatio.d.ts +5 -0
- package/dist/types/components/layout/Backdrop.d.ts +32 -0
- package/dist/types/components/layout/Container.d.ts +6 -0
- package/dist/types/components/layout/Divider.d.ts +5 -0
- package/dist/types/components/layout/Drawer.d.ts +9 -0
- package/dist/types/components/layout/DrawerDockSlot.d.ts +40 -0
- package/dist/types/components/layout/Grid.d.ts +8 -0
- package/dist/types/components/layout/Modal.d.ts +25 -0
- package/dist/types/components/layout/Page.d.ts +11 -0
- package/dist/types/components/layout/Section.d.ts +6 -0
- package/dist/types/components/layout/Stack.d.ts +7 -0
- package/dist/types/components/marketing/AnnouncementBar.d.ts +15 -0
- package/dist/types/components/marketing/BrandStory.d.ts +19 -0
- package/dist/types/components/marketing/HeroBanner.d.ts +69 -0
- package/dist/types/components/marketing/HeroBannerFeatures.d.ts +10 -0
- package/dist/types/components/marketing/HeroBannerInline.d.ts +20 -0
- package/dist/types/components/marketing/PromoBanner.d.ts +11 -0
- package/dist/types/components/marketing/internal/AnnouncementLink.d.ts +5 -0
- package/dist/types/components/marketing/internal/AnnouncementMessage.d.ts +10 -0
- package/dist/types/components/navigation/Breadcrumbs.d.ts +10 -0
- package/dist/types/components/navigation/Footer.d.ts +15 -0
- package/dist/types/components/navigation/Header.d.ts +14 -0
- package/dist/types/components/navigation/internal/BreadcrumbLink.d.ts +5 -0
- package/dist/types/components/navigation/internal/FooterLink.d.ts +5 -0
- package/dist/types/components/navigation/internal/HeaderLink.d.ts +5 -0
- package/dist/types/components/shell/BaseMark.d.ts +11 -0
- package/dist/types/components/shell/CartPill.d.ts +13 -0
- package/dist/types/components/shell/ComposerDock.d.ts +9 -0
- package/dist/types/components/shell/ErrorBanner.d.ts +14 -0
- package/dist/types/components/shell/HistoryMenu.d.ts +15 -0
- package/dist/types/components/shell/MenuButton.d.ts +31 -0
- package/dist/types/components/shell/MountainRidges.d.ts +11 -0
- package/dist/types/components/shell/PendingTurn.d.ts +1 -0
- package/dist/types/components/shell/ShellTop.d.ts +35 -0
- package/dist/types/components/shell/brand-shell.d.ts +441 -0
- package/dist/types/components/shell/index.d.ts +9 -0
- package/dist/types/components/shell/marks/index.d.ts +5 -0
- package/dist/types/components/social/ReviewCard.d.ts +9 -0
- package/dist/types/components/social/ReviewSummary.d.ts +7 -0
- package/dist/types/components/social/TestimonialCard.d.ts +9 -0
- package/dist/types/components/social/TestimonialCarousel.d.ts +16 -0
- package/dist/types/components/social/UgcCard.d.ts +9 -0
- package/dist/types/components/social/UgcGallery.d.ts +8 -0
- package/dist/types/hooks/index.d.ts +8 -0
- package/dist/types/hooks/keyboard.d.ts +18 -0
- package/dist/types/hooks/use-container-width.d.ts +11 -0
- package/dist/types/hooks/use-dismiss-on-outside.d.ts +23 -0
- package/dist/types/hooks/use-focus-on-change.d.ts +8 -0
- package/dist/types/hooks/use-focus-trap.d.ts +12 -0
- package/dist/types/hooks/use-media-query.d.ts +12 -0
- package/dist/types/hooks/use-projection.d.ts +24 -0
- package/dist/types/hooks/use-reduced-motion.d.ts +1 -0
- package/dist/types/hooks/use-scroll-lock.d.ts +19 -0
- package/dist/types/hooks/use-scroll-threshold.d.ts +14 -0
- package/dist/types/hooks/use-textarea-autosize.d.ts +16 -0
- package/dist/types/index.d.ts +74 -0
- package/dist/types/labels-context.d.ts +18 -0
- package/dist/types/labels.d.ts +240 -0
- package/dist/types/motion/ease.d.ts +10 -0
- package/dist/types/motion/generation/ActiveBlockIndicator.d.ts +27 -0
- package/dist/types/motion/generation/BlurUpImage.d.ts +23 -0
- package/dist/types/motion/generation/ResolveEntrance.d.ts +22 -0
- package/dist/types/motion/generation/ShimmerSkeleton.d.ts +20 -0
- package/dist/types/motion/generation/WordReveal.d.ts +26 -0
- package/dist/types/motion/generation/index.d.ts +6 -0
- package/dist/types/motion/hooks/useInViewOnce.d.ts +14 -0
- package/dist/types/motion/hooks/useScrollDirection.d.ts +38 -0
- package/dist/types/motion/hooks/useScrollProgress.d.ts +23 -0
- package/dist/types/motion/hooks/useStableValue.d.ts +36 -0
- package/dist/types/motion/hooks/useSuccessFlash.d.ts +1 -0
- package/dist/types/motion/index.d.ts +18 -0
- package/dist/types/motion/presets.d.ts +335 -0
- package/dist/types/motion/primitives/Agent.d.ts +118 -0
- package/dist/types/motion/primitives/MorphRegion.d.ts +16 -0
- package/dist/types/motion/primitives/Parallax.d.ts +19 -0
- package/dist/types/motion/primitives/Pin.d.ts +26 -0
- package/dist/types/motion/primitives/Reveal.d.ts +29 -0
- package/dist/types/motion/primitives/RevealStagger.d.ts +16 -0
- package/dist/types/motion/primitives/StickyShelf.d.ts +18 -0
- package/dist/types/primitives/Badge/index.d.ts +12 -0
- package/dist/types/primitives/Button/index.d.ts +25 -0
- package/dist/types/primitives/Input/index.d.ts +5 -0
- package/dist/types/primitives/Money/index.d.ts +13 -0
- package/dist/types/primitives/Select/index.d.ts +5 -0
- package/dist/types/primitives/Skeleton/index.d.ts +4 -0
- package/dist/types/shell/AnimatedPlaceholder.d.ts +13 -0
- package/dist/types/shell/BottomSheet.d.ts +54 -0
- package/dist/types/shell/Button.d.ts +19 -0
- package/dist/types/shell/ChromeSurface.d.ts +33 -0
- package/dist/types/shell/Composer.d.ts +56 -0
- package/dist/types/shell/ComposerChipStrip.d.ts +9 -0
- package/dist/types/shell/ConversationTransition.d.ts +27 -0
- package/dist/types/shell/DictationButton.d.ts +24 -0
- package/dist/types/shell/DragSheet.d.ts +34 -0
- package/dist/types/shell/InlineCompletion.d.ts +38 -0
- package/dist/types/shell/LauncherDock.d.ts +40 -0
- package/dist/types/shell/ListeningWaveform.d.ts +18 -0
- package/dist/types/shell/MenuAccordionPanel.d.ts +26 -0
- package/dist/types/shell/MenuDrawer.d.ts +72 -0
- package/dist/types/shell/MenuFlyout.d.ts +22 -0
- package/dist/types/shell/MenuNav.d.ts +30 -0
- package/dist/types/shell/MenuNavBar.d.ts +22 -0
- package/dist/types/shell/ShellMenuChrome.d.ts +66 -0
- package/dist/types/shell/ShellScaffold.d.ts +92 -0
- package/dist/types/shell/SideDock.d.ts +75 -0
- package/dist/types/shell/Skeleton.d.ts +22 -0
- package/dist/types/shell/Spinner.d.ts +10 -0
- package/dist/types/shell/TypedPlaceholder.d.ts +11 -0
- package/dist/types/shell/VoiceControl.d.ts +23 -0
- package/dist/types/shell/VoiceIsland.d.ts +24 -0
- package/dist/types/shell/canvas-gutter-style.d.ts +15 -0
- package/dist/types/shell/composer/AttachButton.d.ts +14 -0
- package/dist/types/shell/composer/AttachmentStrip.d.ts +12 -0
- package/dist/types/shell/composer/ClearSessionButton.d.ts +16 -0
- package/dist/types/shell/composer/ConversationHistoryButton.d.ts +25 -0
- package/dist/types/shell/composer/ShareCanvasButton.d.ts +19 -0
- package/dist/types/shell/composer/ThreadJumpRail.d.ts +43 -0
- package/dist/types/shell/composer/composer-metrics.d.ts +6 -0
- package/dist/types/shell/composer/field-metrics.d.ts +97 -0
- package/dist/types/shell/composer/heic-convert.d.ts +6 -0
- package/dist/types/shell/composer/use-field-autosize.d.ts +26 -0
- package/dist/types/shell/composer/useComposerAttachments.d.ts +37 -0
- package/dist/types/shell/composer/usePromptComposer.d.ts +51 -0
- package/dist/types/shell/dock-context.d.ts +10 -0
- package/dist/types/shell/index.d.ts +36 -0
- package/dist/types/shell/menu-columns.d.ts +19 -0
- package/dist/types/shell/mobile/DefaultMobileShell.d.ts +88 -0
- package/dist/types/shell/mobile/IslandComposeGroup.d.ts +41 -0
- package/dist/types/shell/mobile/IslandInputBar.d.ts +61 -0
- package/dist/types/shell/mobile/IslandNavButtons.d.ts +20 -0
- package/dist/types/shell/mobile/IslandTrailingAction.d.ts +34 -0
- package/dist/types/shell/mobile/MobileChrome.d.ts +34 -0
- package/dist/types/shell/mobile/MobileVoiceConsole.d.ts +42 -0
- package/dist/types/shell/mobile/MorphIsland.d.ts +105 -0
- package/dist/types/shell/mobile/RestIsland.d.ts +41 -0
- package/dist/types/shell/mobile/constants.d.ts +26 -0
- package/dist/types/shell/mobile/document-scroll-ref.d.ts +22 -0
- package/dist/types/shell/mobile/hero-entry-point.d.ts +110 -0
- package/dist/types/shell/mobile/island-metrics.d.ts +131 -0
- package/dist/types/shell/mobile/sheet-detents.d.ts +49 -0
- package/dist/types/shell/mobile/turn-end-action.d.ts +44 -0
- package/dist/types/shell/mobile/use-blur-on-canvas-gesture.d.ts +31 -0
- package/dist/types/shell/mobile/use-island-fold-scroll.d.ts +28 -0
- package/dist/types/shell/mobile/use-keyboard-inset.d.ts +18 -0
- package/dist/types/shell/mobile/use-sheet-fold-gesture.d.ts +57 -0
- package/dist/types/shell/slots.d.ts +16 -0
- package/dist/types/shell/thread-reland.d.ts +22 -0
- package/dist/types/shell/use-dock-state.d.ts +54 -0
- package/dist/types/types/commerce.d.ts +1 -0
- package/dist/types/utils/cn.d.ts +2 -0
- package/dist/types/utils/format-money.d.ts +2 -0
- package/dist/types/utils/html-to-text.d.ts +8 -0
- package/dist/types/utils/sanitize-html.d.ts +12 -0
- package/dist/types/utils/use-backdrop-presence.d.ts +24 -0
- package/dist/types/utils/use-composer-mode.d.ts +26 -0
- package/dist/types/utils/use-is-seed-home.d.ts +13 -0
- package/dist/types/utils/use-safe-cart.d.ts +17 -0
- package/dist/types/utils/use-safe-facts.d.ts +9 -0
- package/dist/types/utils/use-safe-fourty-session.d.ts +15 -0
- package/package.json +80 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Cart } from '../../../types/commerce';
|
|
2
|
+
export interface CartPromoCodeProps {
|
|
3
|
+
/** Applied codes (from `cart.discountCodes`). */
|
|
4
|
+
discountCodes: Cart['discountCodes'];
|
|
5
|
+
/** Apply a new code. Backend validates; absent → the section is hidden. */
|
|
6
|
+
onApply?: (code: string) => void | Promise<unknown>;
|
|
7
|
+
/** Remove an applied code. */
|
|
8
|
+
onRemove?: (code: string) => void | Promise<unknown>;
|
|
9
|
+
/** True while an apply/remove round-trip is in flight. */
|
|
10
|
+
pending?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* CartPromoCode — the cart drawer's promo-code section.
|
|
14
|
+
*
|
|
15
|
+
* Three states, in the drawer-foot design language:
|
|
16
|
+
*
|
|
17
|
+
* collapsed "Promo code +" — one quiet row; the default. Visitors
|
|
18
|
+
* without a code never see an input.
|
|
19
|
+
* expanded bordered input + APPLY. Submits on Enter; rejected codes
|
|
20
|
+
* show an inline reason and keep the value for correction.
|
|
21
|
+
* applied code chips above the totals. A code the backend accepted
|
|
22
|
+
* but that doesn't qualify stays visible, struck through,
|
|
23
|
+
* with the reason — silent dropping reads as "broken input".
|
|
24
|
+
*
|
|
25
|
+
* Dumb component: parent supplies codes + apply/remove callbacks
|
|
26
|
+
* (typically from `useCart` / `useCartDrawer`). All visual styling lives
|
|
27
|
+
* in the theme CSS via `.cart-promo*` classes.
|
|
28
|
+
*/
|
|
29
|
+
export declare function CartPromoCode({ discountCodes, onApply, onRemove, pending }: CartPromoCodeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Cart } from '../../../types/commerce';
|
|
3
|
+
export interface CartSummaryProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
cart: Cart;
|
|
5
|
+
onCheckout?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const CartSummary: React.ForwardRefExoticComponent<CartSummaryProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CartWidget — small icon button with a quantity badge that opens the
|
|
3
|
+
* brand-styled CartDrawer. Surfaces "the cart" so a click on a `cart.add`
|
|
4
|
+
* action chip has visible consequence (badge ticks up + drawer can be
|
|
5
|
+
* inspected). Renders nothing when no CommerceProvider is mounted.
|
|
6
|
+
*
|
|
7
|
+
* Checkout / official-store exits are owned by the drawer's CartContent
|
|
8
|
+
* (shared framed/standalone navigation) — no override passed here.
|
|
9
|
+
*/
|
|
10
|
+
export default function CartWidget(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The one place in the app that resolves an ambiguous add-to-cart. Mounted
|
|
4
|
+
* once (`SpaceFront`) and driven by `usePendingVariantChoice()` —
|
|
5
|
+
* `commerce-signal-handlers.tsx`'s `cart.add` handler opens it whenever a
|
|
6
|
+
* product's purchasable variants genuinely differ on an axis the visitor
|
|
7
|
+
* hasn't resolved (no explicit pick, no unambiguous facts match). Every
|
|
8
|
+
* `cart.add` in the app routes through that same handler, so every surface
|
|
9
|
+
* (ComparisonTable, ProductCard, quick-add, …) gets this gate for free —
|
|
10
|
+
* no per-component wiring, and never a silent guess at a variant.
|
|
11
|
+
*/
|
|
12
|
+
export declare function VariantPickerModal(): React.ReactElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Price formatting shared by the cart surfaces (line rows, drawer foot
|
|
3
|
+
* totals). Locale-aware via Intl; falls back to a plain `{currency}
|
|
4
|
+
* {amount}` string when the currency code is unknown to the runtime. Drops
|
|
5
|
+
* the decimal part when the amount is a whole dollar figure ($49, not
|
|
6
|
+
* $49.00) — cents only render when they're non-zero.
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatPrice(amount: number, currency: string): string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Cart } from '../../../types/commerce';
|
|
2
|
+
import type { ExitPending } from './CartFoot';
|
|
3
|
+
/**
|
|
4
|
+
* useCartView — the cart drawer's LOGIC, extracted so any renderer (the base
|
|
5
|
+
* `CartContent`, a brand's own dumb cart markup) shares one implementation of the
|
|
6
|
+
* things that must never diverge: line/count/total derivation, discount-aware
|
|
7
|
+
* money, and the exit-navigation flows (checkout + official-store handoff, with
|
|
8
|
+
* their framed-vs-standalone behavior and the in-flight `exitPending` state).
|
|
9
|
+
*
|
|
10
|
+
* A brand package stays DUMB UI: it calls this hook and renders its own head /
|
|
11
|
+
* body / foot around the returned view-model — it never re-implements checkout,
|
|
12
|
+
* promo, or the money math. `onCheckout` is the host override (framed embeds);
|
|
13
|
+
* when absent the hook navigates `cart.checkoutUrl` itself.
|
|
14
|
+
*/
|
|
15
|
+
export interface CartViewModel {
|
|
16
|
+
lines: Cart['lines'];
|
|
17
|
+
count: number;
|
|
18
|
+
/**
|
|
19
|
+
* The backend's pre-discount subtotal — never a client re-derivation.
|
|
20
|
+
*
|
|
21
|
+
* This used to sum the line totals, and that is what let three unsettled
|
|
22
|
+
* lines quietly drag a cart's subtotal below the rows the visitor was
|
|
23
|
+
* looking at: a pending line contributes no money, so the footer showed a
|
|
24
|
+
* confident figure for a cart that did not exist. The adapter already
|
|
25
|
+
* returns `cart.cost.subtotalAmount`; the number the visitor is asked to
|
|
26
|
+
* pay comes from whoever will charge it.
|
|
27
|
+
*/
|
|
28
|
+
subtotal: number;
|
|
29
|
+
/**
|
|
30
|
+
* True while any line is still awaiting the backend. The money above
|
|
31
|
+
* describes the SETTLED cart only, so a surface showing totals must say they
|
|
32
|
+
* are still moving rather than present them as final.
|
|
33
|
+
*/
|
|
34
|
+
totalsPending: boolean;
|
|
35
|
+
currency: string;
|
|
36
|
+
discountCodes: Cart['discountCodes'];
|
|
37
|
+
/** Backend post-discount total; undefined when the backend doesn't distinguish it. */
|
|
38
|
+
backendTotal: number | undefined;
|
|
39
|
+
/** Discount the applied code actually removed (backend truth), else 0. */
|
|
40
|
+
discountAmount: number;
|
|
41
|
+
/** The real total to charge — backendTotal when present, else subtotal. */
|
|
42
|
+
effectiveTotal: number;
|
|
43
|
+
/** Which exit CTA is mid-navigation; both disable while set. */
|
|
44
|
+
exitPending: ExitPending;
|
|
45
|
+
/** Online-store cart handoff URL — undefined hides the store CTA. */
|
|
46
|
+
storeCartUrl: string | undefined;
|
|
47
|
+
handleCheckout: () => void;
|
|
48
|
+
handleGoToStore: () => void;
|
|
49
|
+
}
|
|
50
|
+
export declare function useCartView(cart: Cart | null, onCheckout?: () => void | Promise<void>): CartViewModel;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Collection } from '../../../types/commerce';
|
|
3
|
+
export interface CollectionCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
collection?: Collection;
|
|
5
|
+
title?: string;
|
|
6
|
+
imageSrc?: string;
|
|
7
|
+
imageAlt?: string;
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const CollectionCard: React.ForwardRefExoticComponent<CollectionCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type GridProps } from '../../layout/Grid';
|
|
3
|
+
import type { Collection } from '../../../types/commerce';
|
|
4
|
+
export interface CollectionGridProps extends Omit<GridProps, 'children'> {
|
|
5
|
+
collections: Collection[];
|
|
6
|
+
onCollectionClick?: (collection: Collection) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const CollectionGrid: React.ForwardRefExoticComponent<CollectionGridProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type SuggestionActionInput } from '@40rty/ams-sdk';
|
|
3
|
+
export interface CollectionListProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
/** `prose()`-marked — the boundary renders markdown before this lands. */
|
|
6
|
+
subtitle?: ReactNode;
|
|
7
|
+
eyebrow?: string;
|
|
8
|
+
/** Hydrated collections; legacy inline shapes are normalized at runtime. */
|
|
9
|
+
collections?: unknown[];
|
|
10
|
+
/** Per-collection click overrides, matched by position. */
|
|
11
|
+
actions?: SuggestionActionInput[];
|
|
12
|
+
}
|
|
13
|
+
export declare function CollectionList({ title, subtitle, eyebrow, collections: rawCollections, actions: rawActions, }: CollectionListProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SuggestionActionInput } from '@40rty/ams-sdk';
|
|
2
|
+
/**
|
|
3
|
+
* CollectionListItem — premium category card. Tall 4:5 image hero
|
|
4
|
+
* with subtle hover scale, serif title below in Cormorant, optional
|
|
5
|
+
* italic description. Click dispatches the supplied agent action
|
|
6
|
+
* (no `href` — agentic only).
|
|
7
|
+
*/
|
|
8
|
+
export declare function CollectionListItem({ title, description, imageUrl, action, }: {
|
|
9
|
+
title: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
imageUrl?: string;
|
|
12
|
+
action?: SuggestionActionInput;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single registry destination. `href` opens in a new tab; `id` selects the
|
|
3
|
+
* partner logo rendered in the menu row (`amazon`, `babylist`, …). Unknown ids
|
|
4
|
+
* fall back to the plain `label` text so a new partner never renders blank.
|
|
5
|
+
*/
|
|
6
|
+
export interface RegistryProvider {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
href: string;
|
|
10
|
+
}
|
|
11
|
+
interface AddToRegistryProps {
|
|
12
|
+
/** Toggle copy. Defaults to "Add to Registry". */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Ordered destinations shown in the expanded menu. */
|
|
15
|
+
providers: ReadonlyArray<RegistryProvider>;
|
|
16
|
+
/**
|
|
17
|
+
* The product this registry action is about, as an entity id.
|
|
18
|
+
*
|
|
19
|
+
* NULLABLE AND REQUIRED, not optional — the same discipline
|
|
20
|
+
* `commerce.cart_line_added` applies to its own `productId`. A registry
|
|
21
|
+
* action rendered outside a product detail genuinely has no product in
|
|
22
|
+
* scope, and `null` says that; `productId?: string` would let a call site
|
|
23
|
+
* that HAS one simply forget it, and a forgotten field and a deliberate null
|
|
24
|
+
* are indistinguishable once the row is written.
|
|
25
|
+
*/
|
|
26
|
+
productId: string | null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* "Add to Registry" — the third product-detail action. A full-width toggle that
|
|
30
|
+
* expands a menu of registry partners, each opening its destination in a new
|
|
31
|
+
* tab. Purely presentational: destinations arrive via `providers`; the brand
|
|
32
|
+
* supplies them (see the babysense ProductDetail wrapper). Renders nothing when
|
|
33
|
+
* `providers` is empty so it stays inert for spaces that don't opt in.
|
|
34
|
+
*/
|
|
35
|
+
export declare function AddToRegistry({ title, providers, productId }: AddToRegistryProps): import("react/jsx-runtime").JSX.Element | null;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Product } from '../../../types/commerce';
|
|
3
|
+
import { type ComparisonRow } from './comparison-table-rows';
|
|
4
|
+
export type { ComparisonRow };
|
|
5
|
+
export interface ComparisonTableProps {
|
|
6
|
+
products: Product[];
|
|
7
|
+
/** Agent JUDGMENT rows (heel height, material, "best for"), each optionally
|
|
8
|
+
* carrying a `winner` gid. Render ON TOP of the derived floor (price / sale
|
|
9
|
+
* / rating). */
|
|
10
|
+
attributeRows?: ComparisonRow[];
|
|
11
|
+
/** Gid of the recommended product — the "my pick" verdict highlight. */
|
|
12
|
+
highlightedProductId?: string;
|
|
13
|
+
/** The agent's one-line call, shown as the banner above the products. */
|
|
14
|
+
/** `prose()`-marked — the boundary renders markdown before this lands. */
|
|
15
|
+
verdict?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ComparisonTable — an AGENTIC head-to-head, not a spec sheet. The agent's
|
|
19
|
+
* `verdict` leads as a banner; the products sit as a duel with the pick marked
|
|
20
|
+
* "my pick"; a synthesised trade-off summary ("X leads on heel, breathability ·
|
|
21
|
+
* Y takes height") bridges into the detail rows, each axis adjudicated with a
|
|
22
|
+
* tick on the winning side. The derived floor (price / sale / rating) is only
|
|
23
|
+
* the safety net beneath the agent's judgment rows.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ComparisonTable: React.ForwardRefExoticComponent<ComparisonTableProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Swap-gap skeleton for `comparisonTable` — paints while the agent's
|
|
4
|
+
* type-stub line has landed but the products patch is still streaming.
|
|
5
|
+
*
|
|
6
|
+
* Shape matches `ComparisonTable`: a head row of N column cards (image +
|
|
7
|
+
* meta lines) over N spec rows (a label + per-column cells). Structural
|
|
8
|
+
* markup + `fourty-*` class hooks only — the shimmer + sizing live in
|
|
9
|
+
* `@fourty/ui`'s `base.css`. `aria-busy` marks it loading for AT.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ComparisonTableSkeleton: React.ForwardRefExoticComponent<React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A compact horizontal rail of product thumbnails for the agent-presence band —
|
|
4
|
+
* the set the agent is flipping through (scanning) or has assembled (saved set).
|
|
5
|
+
*
|
|
6
|
+
* Presentational + token-driven: real `ProductImage` tiles at the brand's
|
|
7
|
+
* product aspect ratio on the brand surface, sharp-cornered, no invented
|
|
8
|
+
* styling — it inherits whatever theme is active (Steve Madden: white tile,
|
|
9
|
+
* `--ar-product` 4/5, sharp). Image-only by design; titles/prices clutter a
|
|
10
|
+
* band this small. Tiles stream in with the editorial ease.
|
|
11
|
+
*/
|
|
12
|
+
export interface PresenceProductRailProps {
|
|
13
|
+
/** Thumbnails to show (already-resolved image urls). */
|
|
14
|
+
images: {
|
|
15
|
+
id: string;
|
|
16
|
+
url: string;
|
|
17
|
+
}[];
|
|
18
|
+
/** Cap visible tiles; the rest collapse into a "+N" tile. Default 7. */
|
|
19
|
+
max?: number;
|
|
20
|
+
/** Tile height in px (width derives from --ar-product). Default 48. */
|
|
21
|
+
tileHeight?: number;
|
|
22
|
+
/** `flow` = a continuously-drifting marquee (the agent SIFTING through a
|
|
23
|
+
* stream of candidates, edges faded); default is a settled static rail. */
|
|
24
|
+
flow?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function PresenceProductRail({ images, max, tileHeight, flow }: PresenceProductRailProps): React.ReactElement;
|
|
27
|
+
/**
|
|
28
|
+
* Saved set variant — hydrates entity ids (gids) into products via the shared
|
|
29
|
+
* commerce query (same cache as the grid/wishlist), then renders the rail from
|
|
30
|
+
* each product's first image. Renders nothing until at least one resolves.
|
|
31
|
+
*/
|
|
32
|
+
export declare function HydratedProductRail({ entityIds, tileHeight }: {
|
|
33
|
+
entityIds: string[];
|
|
34
|
+
tileHeight?: number;
|
|
35
|
+
}): React.ReactElement | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Product, Money } from '../../../types/commerce';
|
|
3
|
+
export interface ProductBadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
product?: Product;
|
|
5
|
+
type?: 'sale' | 'sold-out' | 'new';
|
|
6
|
+
compareAtPrice?: Money;
|
|
7
|
+
availableForSale?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const ProductBadge: React.ForwardRefExoticComponent<ProductBadgeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Product } from '../../../types/commerce';
|
|
3
|
+
export interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Full product object */
|
|
5
|
+
product?: Product;
|
|
6
|
+
/** Product data from catalog schema (resolved from products field) */
|
|
7
|
+
products?: Product;
|
|
8
|
+
/** Or use individual props */
|
|
9
|
+
title?: string;
|
|
10
|
+
price?: {
|
|
11
|
+
amount: number;
|
|
12
|
+
currencyCode: string;
|
|
13
|
+
};
|
|
14
|
+
compareAtPrice?: {
|
|
15
|
+
amount: number;
|
|
16
|
+
currencyCode: string;
|
|
17
|
+
};
|
|
18
|
+
imageSrc?: string;
|
|
19
|
+
imageAlt?: string;
|
|
20
|
+
vendor?: string;
|
|
21
|
+
availableForSale?: boolean;
|
|
22
|
+
/** Render as link wrapper */
|
|
23
|
+
asChild?: boolean;
|
|
24
|
+
/** Aspect ratio for image */
|
|
25
|
+
aspectRatio?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const ProductCard: React.ForwardRefExoticComponent<ProductCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Premium viewport-fit product detail. Two-column layout:
|
|
3
|
+
*
|
|
4
|
+
* ┌──────────────────┬──────────────────────┐
|
|
5
|
+
* │ │ vendor │
|
|
6
|
+
* │ │ TITLE (large) │
|
|
7
|
+
* │ gallery │ price │
|
|
8
|
+
* │ (dominant) │ rating │
|
|
9
|
+
* │ │ ────── │
|
|
10
|
+
* │ │ description (clip) │
|
|
11
|
+
* │ │ more → │
|
|
12
|
+
* │ │ ────── │
|
|
13
|
+
* │ │ tags │
|
|
14
|
+
* └──────────────────┴──────────────────────┘
|
|
15
|
+
* [reviews panel — auto-rendered below when the product has rating data]
|
|
16
|
+
*
|
|
17
|
+
* Info column uses flex distribution so the description region
|
|
18
|
+
* fills the natural mid-band; tags settle at the bottom rather
|
|
19
|
+
* than leaving dead vertical space. "More" opens a side sheet.
|
|
20
|
+
*
|
|
21
|
+
* Add to Cart + variant picker are embedded controls (see the actions
|
|
22
|
+
* block below). The follow-up chip rail is separate — the agent's,
|
|
23
|
+
* derived by `computeActiveChips`, never authored by this component.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ProductDetail(props: Record<string, unknown>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Image } from '../../../types/commerce';
|
|
3
|
+
export interface ProductGalleryProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
images: Image[];
|
|
5
|
+
/**
|
|
6
|
+
* Layout mode:
|
|
7
|
+
* - `aspect` (default): main image renders at a fixed aspect ratio
|
|
8
|
+
* (`aspectRatio` prop). Used for grids/cards where the host has no
|
|
9
|
+
* intrinsic height and the gallery defines its own footprint.
|
|
10
|
+
* - `fill`: gallery and image fill 100% of the host container. Used for
|
|
11
|
+
* PDP and other layouts where the host (e.g. a grid track) has a
|
|
12
|
+
* constrained height and we want the image to cover it edge-to-edge.
|
|
13
|
+
* Eliminates the "empty band below the image" failure mode that
|
|
14
|
+
* happens when the host column is taller than the aspect-locked image.
|
|
15
|
+
*/
|
|
16
|
+
mode?: 'aspect' | 'fill';
|
|
17
|
+
aspectRatio?: number;
|
|
18
|
+
}
|
|
19
|
+
export declare const ProductGallery: React.ForwardRefExoticComponent<ProductGalleryProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Product } from '../../../types/commerce';
|
|
3
|
+
export interface ProductGridProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
products: Product[];
|
|
5
|
+
title?: string;
|
|
6
|
+
/** May be a `prose()`-marked field (current-backyard passes `reason` here). */
|
|
7
|
+
subtitle?: React.ReactNode;
|
|
8
|
+
/** Optional uppercase eyebrow shown above the title — e.g. "FEATURED", "JUST IN". */
|
|
9
|
+
eyebrow?: string;
|
|
10
|
+
/**
|
|
11
|
+
* When set, the grid resolves its product list by fetching the
|
|
12
|
+
* Shopify collection with this handle and overriding `products`.
|
|
13
|
+
* Used by spacefront menu navigation flows where the layout is
|
|
14
|
+
* pushed before the agent has emitted any product gids.
|
|
15
|
+
*/
|
|
16
|
+
collectionSlug?: string;
|
|
17
|
+
onProductClick?: (product: Product) => void;
|
|
18
|
+
/** Custom render function for each product */
|
|
19
|
+
renderProduct?: (product: Product) => React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Premium product grid — full viewport section. Eyebrow + serif title at
|
|
23
|
+
* top, grid fills remaining space with internal scroll if rows overflow.
|
|
24
|
+
* Used for "Featured" on home, "Browse" on category pages.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ProductGrid: React.ForwardRefExoticComponent<ProductGridProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface ProductImageProps {
|
|
2
|
+
src?: string;
|
|
3
|
+
/** Responsive candidate set off the hydrated entity image (`image.srcSet`).
|
|
4
|
+
* When set, the browser picks the device-appropriate width and `src` is the
|
|
5
|
+
* fallback. Adapter-produced — components never build it themselves. */
|
|
6
|
+
srcSet?: string;
|
|
7
|
+
/** `sizes` hint describing the slot's rendered width across breakpoints, so
|
|
8
|
+
* the browser can choose the right `srcSet` candidate. Owned by the layout
|
|
9
|
+
* that renders the image, not the entity. */
|
|
10
|
+
sizes?: string;
|
|
11
|
+
alt?: string;
|
|
12
|
+
/** CSS aspect ratio for the wrapper. Defaults to a square. */
|
|
13
|
+
aspectRatio?: number | string;
|
|
14
|
+
/** className applied to the wrapper element. */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** className applied directly to the inner <img>. */
|
|
17
|
+
imgClassName?: string;
|
|
18
|
+
/** Lazy by default — opt in to eager for above-the-fold images. */
|
|
19
|
+
loading?: 'lazy' | 'eager';
|
|
20
|
+
/** Object fit. Defaults to `cover`. Governs the UNTRIMMED rendering — once a
|
|
21
|
+
* product box has been measured (see `trim`), placement is computed from
|
|
22
|
+
* that box instead, which neither crops the product nor distorts it. */
|
|
23
|
+
fit?: 'cover' | 'contain';
|
|
24
|
+
/**
|
|
25
|
+
* Frame the PRODUCT rather than the asset — for a surface showing ONE
|
|
26
|
+
* product large, and ONLY that.
|
|
27
|
+
*
|
|
28
|
+
* Catalog photography puts the product on a fixed studio sweep, so a flat
|
|
29
|
+
* sandal and a tall handbag ship in the same 4:5 frame and the sandal
|
|
30
|
+
* occupies 14% of it (see `image-trim.ts`). On a big solo plate that reads as
|
|
31
|
+
* an empty box, which is what this fixes.
|
|
32
|
+
*
|
|
33
|
+
* OFF by default, and that default is load-bearing: the shared frame is
|
|
34
|
+
* exactly what makes a GRID align. Trim each tile to its own product and
|
|
35
|
+
* every one zooms independently — a sandal renders as large as a boot, the
|
|
36
|
+
* floor line every asset shares is gone, and the row stops reading as a set.
|
|
37
|
+
* Never turn this on for a grid, a rail, or any surface whose tiles are
|
|
38
|
+
* compared side by side.
|
|
39
|
+
*/
|
|
40
|
+
trim?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* ProductImage — robust image primitive used by every catalog component
|
|
44
|
+
* that displays product imagery. Handles three failure modes that raw
|
|
45
|
+
* `<img>` doesn't:
|
|
46
|
+
* - Missing `src` → renders the no-image placeholder.
|
|
47
|
+
* - Load error → falls back to placeholder + warns once.
|
|
48
|
+
* - Loading state → skeleton background while the bytes arrive.
|
|
49
|
+
*
|
|
50
|
+
* Components should never render a raw `<img>` for product imagery —
|
|
51
|
+
* always go through this primitive so loading/error behavior is uniform
|
|
52
|
+
* across the catalog and brand pkg authors can swap it in one place.
|
|
53
|
+
*/
|
|
54
|
+
export declare function ProductImage({ src, srcSet, sizes, alt, aspectRatio, className, imgClassName, loading, fit, trim, }: ProductImageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ProductOptionProps extends Omit<React.HTMLAttributes<HTMLFieldSetElement>, 'onSelect'> {
|
|
3
|
+
name: string;
|
|
4
|
+
values: string[];
|
|
5
|
+
selected?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
onSelect?: (value: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const ProductOption: React.ForwardRefExoticComponent<ProductOptionProps & React.RefAttributes<HTMLFieldSetElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Money } from '../../../types/commerce';
|
|
3
|
+
export interface ProductPriceProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
price: Money;
|
|
5
|
+
compareAtPrice?: Money;
|
|
6
|
+
locale?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const ProductPrice: React.ForwardRefExoticComponent<ProductPriceProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ProductVideo } from '@40rty/ams-sdk';
|
|
2
|
+
export interface ProductVideoPlayerProps {
|
|
3
|
+
/** Hydrated product videos. Element 0 is rendered. */
|
|
4
|
+
videos: ProductVideo[];
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Presentational player for a single product video. Shopify-hosted
|
|
9
|
+
* (`kind: 'hosted'`) renders a native `<video>` with MP4 + HLS sources and
|
|
10
|
+
* the preview-image poster; external embeds (`kind: 'external'`,
|
|
11
|
+
* YouTube/Vimeo) render the iframe. Plays as live product imagery —
|
|
12
|
+
* autoplay, muted, looping, no controls.
|
|
13
|
+
*
|
|
14
|
+
* Renders nothing when there is no video or no playable source, so callers
|
|
15
|
+
* can mount it unconditionally and let it self-gate.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ProductVideoPlayer({ videos, className }: ProductVideoPlayerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Product } from '../../../types/commerce';
|
|
3
|
+
import { type ComparisonRow } from './comparison-table-rows';
|
|
4
|
+
/**
|
|
5
|
+
* comparison-table-parts — the presentational pieces of the agentic
|
|
6
|
+
* ComparisonTable. The orchestrator (ComparisonTable.tsx) owns data prep
|
|
7
|
+
* (floor merge, dedup, filtering); these render it. Kept separate so each
|
|
8
|
+
* file stays a single concern under the 300-line ceiling.
|
|
9
|
+
*/
|
|
10
|
+
/** The agent's one-line call, rendered as the banner above the products —
|
|
11
|
+
* the headline that turns a spec grid into a recommendation. */
|
|
12
|
+
export declare function ComparisonVerdict({ verdict }: {
|
|
13
|
+
verdict: React.ReactNode;
|
|
14
|
+
}): React.ReactElement;
|
|
15
|
+
/** One product column header — image + brand + name + price, with the pick
|
|
16
|
+
* marked "my pick". Click navigates to the product detail. */
|
|
17
|
+
export declare function ComparisonHeadCard({ product, isPick, clickable, onClick, }: {
|
|
18
|
+
product: Product;
|
|
19
|
+
isPick: boolean;
|
|
20
|
+
clickable: boolean;
|
|
21
|
+
onClick: (p: Product) => void;
|
|
22
|
+
}): React.ReactElement;
|
|
23
|
+
/** Per-product axis tally — "X leads on heel, breathability · Y takes height".
|
|
24
|
+
* Synthesised from the per-row `winner` adjudications. */
|
|
25
|
+
export interface TradeoffEntry {
|
|
26
|
+
index: number;
|
|
27
|
+
name: string;
|
|
28
|
+
isPick: boolean;
|
|
29
|
+
labels: string[];
|
|
30
|
+
}
|
|
31
|
+
export declare function computeTradeoff(rows: ComparisonRow[], products: Product[], recommendIndex: number): TradeoffEntry[];
|
|
32
|
+
export declare function ComparisonTradeoffRow({ entries }: {
|
|
33
|
+
entries: TradeoffEntry[];
|
|
34
|
+
}): React.ReactElement;
|
|
35
|
+
/** One detail row — label + a value cell per product, the winning cell ticked
|
|
36
|
+
* and emphasised. No magnitude bars; the adjudication carries the glance. */
|
|
37
|
+
export declare function ComparisonAttributeRow({ row, products, recommendIndex, }: {
|
|
38
|
+
row: ComparisonRow;
|
|
39
|
+
products: Product[];
|
|
40
|
+
recommendIndex: number;
|
|
41
|
+
}): React.ReactElement;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** One spec row in a comparison table. */
|
|
2
|
+
export interface ComparisonRow {
|
|
3
|
+
/** Stable slug for React keying ("heel-height", "material"). */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Mono-caps spec label ("flex 1–10", "weight"). */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Per-product values keyed by Product.id. Canonical wire shape — see
|
|
8
|
+
* `comparisonTableProps.attributeRows.values` in catalog-data. */
|
|
9
|
+
values: Record<string, string | number | boolean>;
|
|
10
|
+
/** gid of the product that WINS this axis (agent adjudication). When set,
|
|
11
|
+
* the renderer ticks the winning cell and folds the axis into the
|
|
12
|
+
* trade-off summary. Absent on derived-floor rows and true-wash axes. */
|
|
13
|
+
winner?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Project a row's gid-keyed `values` map to a per-column string array in
|
|
16
|
+
* `products` order. Missing keys become empty strings (rendered as "—"). */
|
|
17
|
+
export declare function projectRowValues(row: ComparisonRow, products: ReadonlyArray<{
|
|
18
|
+
id: string;
|
|
19
|
+
}>): string[];
|
|
20
|
+
/** Column index of the product the agent marked as winning this axis, or -1
|
|
21
|
+
* when the row carries no winner (derived-floor rows, true-wash axes). */
|
|
22
|
+
export declare function rowWinnerIndex(row: ComparisonRow, products: ReadonlyArray<{
|
|
23
|
+
id: string;
|
|
24
|
+
}>): number;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ImageTrimBox } from './trim-geometry';
|
|
2
|
+
export interface ImageTrimState {
|
|
3
|
+
/** The product's box once measured; null until then, and null forever for
|
|
4
|
+
* images that should render untrimmed. */
|
|
5
|
+
box: ImageTrimBox | null;
|
|
6
|
+
/** Natural size of the measured image, needed to place it without
|
|
7
|
+
* distortion. Null whenever `box` is. */
|
|
8
|
+
natural: {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
} | null;
|
|
12
|
+
/** What to put on the `<img>`'s `crossOrigin`. Undefined when the pixels are
|
|
13
|
+
* same-origin (no CORS needed) or the origin has already refused one. */
|
|
14
|
+
crossOrigin: 'anonymous' | undefined;
|
|
15
|
+
/** Call from the img's `onLoad`, with the element. */
|
|
16
|
+
measure: (img: HTMLImageElement) => void;
|
|
17
|
+
/** Call from the img's `onError`. Returns true when the failure was OUR
|
|
18
|
+
* CORS request — the hook has already dropped it, the element will reload
|
|
19
|
+
* plainly, and the caller must NOT show its error state. */
|
|
20
|
+
handleError: () => boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Measure `src`'s product box, once per URL, process-wide.
|
|
24
|
+
*
|
|
25
|
+
* The measurement reads the pixels of the element the component is ALREADY
|
|
26
|
+
* rendering rather than fetching a second copy — which is why the hook owns
|
|
27
|
+
* `crossOrigin`: a canvas can only be read when the bytes arrived under CORS.
|
|
28
|
+
* Asking for CORS is not free of risk (a host that does not send
|
|
29
|
+
* `Access-Control-Allow-Origin` fails the load outright rather than merely
|
|
30
|
+
* tainting), so `handleError` retries the load without it and remembers the
|
|
31
|
+
* refusal for every later image from that origin. One request in the normal
|
|
32
|
+
* case, one wasted request per origin in the worst case, and never a product
|
|
33
|
+
* image that fails to appear.
|
|
34
|
+
*/
|
|
35
|
+
export declare function useImageTrim(src: string | undefined, enabled: boolean): ImageTrimState;
|