@40rty/ams-sdk 0.3.1 → 0.4.2

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.
Files changed (113) hide show
  1. package/dist/index.js +6655 -5934
  2. package/dist/types/ecommerce/src/review-schemas.d.ts +32 -0
  3. package/dist/types/sdk/src/analytics/scope-context.d.ts +2 -2
  4. package/dist/types/sdk/src/canvas/active-chips.d.ts +8 -0
  5. package/dist/types/sdk/src/canvas/chip-relevance.d.ts +41 -0
  6. package/dist/types/sdk/src/canvas/index.d.ts +6 -1
  7. package/dist/types/sdk/src/canvas/item-motion/index.d.ts +1 -1
  8. package/dist/types/sdk/src/canvas/item-motion/profile.d.ts +0 -3
  9. package/dist/types/sdk/src/canvas/layout-entity-refs.d.ts +12 -0
  10. package/dist/types/sdk/src/canvas/runtime-hooks.d.ts +2 -0
  11. package/dist/types/sdk/src/canvas/runtime-types.d.ts +2 -0
  12. package/dist/types/sdk/src/canvas/use-canvas-actions.d.ts +14 -24
  13. package/dist/types/sdk/src/canvas/use-is-seed-home.d.ts +17 -0
  14. package/dist/types/sdk/src/canvas/use-safe-facts.d.ts +9 -0
  15. package/dist/types/sdk/src/catalog/define.d.ts +1 -1
  16. package/dist/types/sdk/src/catalog/index.d.ts +1 -1
  17. package/dist/types/sdk/src/catalog/interaction-contract.d.ts +3 -3
  18. package/dist/types/sdk/src/catalog/registration/types.d.ts +7 -0
  19. package/dist/types/sdk/src/catalog/render-inline.d.ts +0 -37
  20. package/dist/types/sdk/src/host/host-modules.d.ts +217 -121
  21. package/dist/types/sdk/src/host/types.d.ts +3 -1
  22. package/dist/types/sdk/src/index.d.ts +3 -5
  23. package/dist/types/sdk/src/preview/SpacefrontPreviewProvider.d.ts +65 -0
  24. package/dist/types/sdk/src/preview/index.d.ts +1 -0
  25. package/dist/types/sdk/src/projection/index.d.ts +1 -0
  26. package/dist/types/sdk/src/projection/transform.d.ts +12 -0
  27. package/dist/types/sdk/src/projection/use-projection.d.ts +24 -0
  28. package/dist/types/sdk/src/provider/agent-ask-signal.d.ts +4 -0
  29. package/dist/types/sdk/src/provider/index.d.ts +1 -1
  30. package/dist/types/sdk/src/session/FourtySessionContext.d.ts +1 -1
  31. package/dist/types/sdk/src/shell/composer-attachments/heic-convert.d.ts +6 -0
  32. package/dist/types/sdk/src/shell/composer-attachments/use-composer-attachments.d.ts +37 -0
  33. package/dist/types/sdk/src/shell/conversation/answer-text.d.ts +15 -0
  34. package/dist/types/sdk/src/shell/conversation/index.d.ts +4 -0
  35. package/dist/types/sdk/src/shell/conversation/turn-pages.d.ts +16 -0
  36. package/dist/types/sdk/src/shell/conversation/use-conversation-page.d.ts +65 -0
  37. package/dist/types/sdk/src/shell/conversation/use-conversation-presence.d.ts +31 -0
  38. package/dist/types/sdk/src/shell/index.d.ts +6 -0
  39. package/dist/types/sdk/src/shell/turn-ask-placement.d.ts +17 -0
  40. package/dist/types/sdk/src/shell/use-dock-state.d.ts +58 -0
  41. package/dist/types/sdk/src/shell/use-prompt-composer.d.ts +51 -0
  42. package/dist/types/sdk/src/shell/use-thread-rows.d.ts +3 -1
  43. package/dist/types/sdk/src/shell/use-turn-ask-reply.d.ts +5 -0
  44. package/dist/types/sdk/src/utils/core-utils/index.d.ts +0 -6
  45. package/dist/types/sdk/src/utils/index.d.ts +1 -1
  46. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/cart}/use-cart-drawer.d.ts +1 -1
  47. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/cart}/use-cart-line-row.d.ts +1 -1
  48. package/dist/types/sdk/src/verticals/commerce/cart/use-cart-view.d.ts +51 -0
  49. package/dist/types/sdk/src/verticals/commerce/cart/use-safe-cart.d.ts +16 -0
  50. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/buy-now-exit.d.ts +1 -1
  51. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/checkout-handoff-reasons.d.ts +2 -2
  52. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/checkout-handoff-shape.d.ts +1 -1
  53. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/checkout-handoff-store.d.ts +3 -3
  54. package/dist/types/sdk/src/verticals/commerce/chip-relevance.d.ts +1 -0
  55. package/dist/types/sdk/src/{commerce → verticals/commerce}/commerce-context.d.ts +1 -1
  56. package/dist/types/sdk/src/{commerce → verticals/commerce}/commerce-shapes.d.ts +2 -2
  57. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/comparison}/comparison-rows.d.ts +1 -1
  58. package/dist/types/sdk/src/verticals/commerce/index.d.ts +35 -0
  59. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/normalize-collection.d.ts +2 -2
  60. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/product-filters.d.ts +1 -1
  61. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/use-look-card.d.ts +4 -4
  62. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/use-product-card.d.ts +2 -2
  63. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/use-product-detail.d.ts +3 -3
  64. package/dist/types/sdk/src/verticals/commerce/use-commerce-actions.d.ts +18 -0
  65. package/dist/types/sdk/src/{commerce → verticals/commerce/variant}/pending-variant-choice-store.d.ts +2 -2
  66. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/preselect-from-facts.d.ts +1 -1
  67. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/use-selected-variants-state.d.ts +1 -1
  68. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/variant-option-axes.d.ts +1 -1
  69. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/variant-resolution.d.ts +1 -1
  70. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/variant-selection.d.ts +1 -1
  71. package/dist/types/sdk/src/verticals/content/index.d.ts +1 -0
  72. package/dist/types/sdk/src/verticals/content/use-content-actions.d.ts +12 -0
  73. package/dist/types/sdk/src/widgets/presence/index.d.ts +1 -0
  74. package/dist/types/sdk/src/widgets/presence/runtime-context.d.ts +1 -1
  75. package/dist/types/sdk/src/widgets/presence/use-forget-fact.d.ts +35 -0
  76. package/dist/types/spacestation/src/analytics/ecommerce/events.d.ts +1 -1
  77. package/dist/types/spacestation/src/catalog/shape-tokens.d.ts +2 -0
  78. package/dist/types/spacestation/src/catalog/wire/index.d.ts +1 -1
  79. package/dist/types/spacestation/src/catalog/wire/package-release.d.ts +24 -1
  80. package/dist/types/spacestation/src/index.d.ts +3 -1
  81. package/dist/types/spacestation/src/layout/conversation.d.ts +5 -0
  82. package/dist/types/spacestation/src/signal/turn-ask.d.ts +94 -0
  83. package/dist/types/spacestation/src/widgets/presence/profile.d.ts +2 -2
  84. package/package.json +2 -1
  85. package/dist/types/sdk/src/animation/index.d.ts +0 -2
  86. package/dist/types/sdk/src/animation/useListTransition.d.ts +0 -16
  87. package/dist/types/sdk/src/animation/useUpdateTransition.d.ts +0 -16
  88. package/dist/types/sdk/src/commerce/ecommerce/agentic-overlay.d.ts +0 -27
  89. package/dist/types/sdk/src/commerce/ecommerce/index.d.ts +0 -21
  90. package/dist/types/sdk/src/commerce/ecommerce/use-product-carousel-scroll.d.ts +0 -13
  91. package/dist/types/sdk/src/commerce/index.d.ts +0 -9
  92. package/dist/types/sdk/src/content/index.d.ts +0 -2
  93. package/dist/types/sdk/src/content/use-faq-accordion.d.ts +0 -11
  94. package/dist/types/sdk/src/content/use-newsletter-form.d.ts +0 -16
  95. package/dist/types/sdk/src/provider/AgentAsk.d.ts +0 -16
  96. package/dist/types/sdk/src/shared/index.d.ts +0 -2
  97. package/dist/types/sdk/src/social/index.d.ts +0 -2
  98. package/dist/types/sdk/src/social/use-review-helpful.d.ts +0 -10
  99. package/dist/types/sdk/src/social/use-testimonials-carousel.d.ts +0 -15
  100. package/dist/types/sdk/src/utils/core-utils/format-distance.d.ts +0 -6
  101. package/dist/types/sdk/src/utils/core-utils/maps-directions-url.d.ts +0 -5
  102. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/cart}/cart-action-failures.d.ts +0 -0
  103. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/cart}/cart-drawer-store.d.ts +0 -0
  104. /package/dist/types/sdk/src/{commerce → verticals/commerce/checkout}/external-navigation.d.ts +0 -0
  105. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/use-buy-now.d.ts +0 -0
  106. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/comparison}/use-comparison-table.d.ts +0 -0
  107. /package/dist/types/sdk/src/{utils/core-utils → verticals/commerce/price}/format-price.d.ts +0 -0
  108. /package/dist/types/sdk/src/{utils/core-utils → verticals/commerce/price}/is-on-sale.d.ts +0 -0
  109. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/use-product-grid-filter.d.ts +0 -0
  110. /package/dist/types/sdk/src/{commerce → verticals/commerce/variant}/option-selection-store.d.ts +0 -0
  111. /package/dist/types/sdk/src/{utils/core-utils → verticals/commerce/variant}/resolve-swatch-color.d.ts +0 -0
  112. /package/dist/types/sdk/src/{commerce → verticals/commerce/variant}/variant-selection-store.d.ts +0 -0
  113. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/wishlist}/use-wishlist-drawer.d.ts +0 -0
@@ -1,27 +0,0 @@
1
- import type { Spec, SuggestionAction, SuggestionActions, ComponentCatalogStructural } from '../../../../spacestation/src/index';
2
- /**
3
- * Compute the chips to display given the current layout and the agent's
4
- * most recently emitted suggestion set.
5
- *
6
- * Pure projection of (layout × catalog × agent emission): filter the
7
- * agent's chips against the current layout — drop any whose target
8
- * entity is no longer on screen, or whose target IS the screen (a
9
- * redundant `navigate` to the product already shown). Chips are NOT
10
- * independent state and carry NO defaults: the rail shows exactly what
11
- * the agent emitted, minus what the current layout has invalidated.
12
- *
13
- * Returns null when the filtered set is empty.
14
- */
15
- export declare function computeActiveChips(layout: Spec | null, agentChips: SuggestionAction[], catalog: ComponentCatalogStructural): SuggestionActions | null;
16
- /**
17
- * Harvest every entity reference on the layout from catalog-declared
18
- * `resolved()` props. Catalog-driven, platform-agnostic: any non-empty
19
- * string at a resolved path counts as a ref, no matter the format
20
- * (Shopify `gid://shopify/...`, a WooCommerce post id, a Square object
21
- * id, a flat handle). The resolver decides what's resolvable.
22
- *
23
- * Used by `isStillRelevant` to drop chips whose target entity is no
24
- * longer on screen (e.g. cart.add for a product the visitor morphed
25
- * away from).
26
- */
27
- export declare function collectLayoutGids(layout: Spec | null, catalog: ComponentCatalogStructural): Set<string>;
@@ -1,21 +0,0 @@
1
- export { useProductGridFilter } from './use-product-grid-filter';
2
- export { pickProductCardAction, pickCartAddAction } from '../../../../ecommerce/src/index';
3
- export { isPendingCartLine, settledCart } from '../../../../ecommerce/src/index';
4
- export { useProductCarouselScroll } from './use-product-carousel-scroll';
5
- export { useProductDetail, type ProductDetailVariantGroup, } from './use-product-detail';
6
- export { classifyComparisonValue, useComparisonHighlight, type ComparisonCellRender, } from './use-comparison-table';
7
- export { useCartDrawer } from './use-cart-drawer';
8
- export { recordCartActionFailure, readCartActionFailures, clearCartActionFailures, useCartActionFailures, useCartActionFailuresFor, type CartActionFailure, type CartActionSubject, } from './cart-action-failures';
9
- export { useCartLineRow, type CartLineRowState, type CartLineInteraction, } from './use-cart-line-row';
10
- export { openCartDrawer, openCartDrawerFocusedOn, closeCartDrawer, toggleCartDrawer, useCartDrawerOpen, useCartDrawerFocus, type CartDrawerFocus, } from './cart-drawer-store';
11
- export { armCheckoutHandoff, refuseCheckoutHandoff, consumeArmedCheckoutHandoff, disarmCheckoutHandoff, settleArmedCheckoutHandoff, recordVisitorCheckoutExit, readCheckoutHandoff, useCheckoutHandoff, checkoutHandoffReasonFor, CHECKOUT_BLOCKED_REASON, CHECKOUT_NO_URL_REASON, CHECKOUT_EMPTY_CART_REASON, CHECKOUT_NO_LINK_REASON, type CheckoutHandoffOutcome, type CheckoutHandoffOrigin, type CheckoutHandoffState, } from './checkout-handoff-store';
12
- export { useWishlistDrawer } from './use-wishlist-drawer';
13
- export { useProductCard, type ProductCardData, type ProductCardBadge, } from './use-product-card';
14
- export { useLookCard, type LookCardData, type LookCardTile } from './use-look-card';
15
- export { resolveProductVariant, variantForSelections, type VariantResolution, type VariantGap, type UnavailableSelection, type VariantOptionChoice, type VariantOptionValue, } from './variant-resolution';
16
- export { canonicalOptionValue } from '../../../../spacestation/src/index';
17
- export { preselectFromFacts } from './preselect-from-facts';
18
- export { matchesProductFilter, pruneFilterChips, type ProductFilterChip, type ProductFilterPredicate, } from './product-filters';
19
- export { normalizeCollectionLegacy, pickCollectionAction } from './normalize-collection';
20
- export { computeActiveChips, collectLayoutGids } from './agentic-overlay';
21
- export { buildComparisonRows, formatProductPrice, type ComparisonAttributeRow, } from './comparison-rows';
@@ -1,13 +0,0 @@
1
- /**
2
- * useProductCarouselScroll — exposes a ref to attach to a horizontal
3
- * scroller plus enable/disable state for the chevron buttons. Tracks
4
- * scrollLeft live; refreshes whenever items change. Brands render the
5
- * buttons however they want.
6
- */
7
- export declare function useProductCarouselScroll(itemsKey: number, scrollDistance?: number): {
8
- scrollerRef: React.RefObject<HTMLDivElement | null>;
9
- canLeft: boolean;
10
- canRight: boolean;
11
- scrollBy: (dir: 1 | -1) => void;
12
- onScroll: () => void;
13
- };
@@ -1,9 +0,0 @@
1
- export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
2
- export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
3
- export { navigateToExternalCommerceUrl } from './external-navigation';
4
- export type { ExternalNavigationResult } from './external-navigation';
5
- export { recordVariantSelection, getVariantSelection, useVariantSelections, } from './variant-selection-store';
6
- export { requestVariantChoice, clearVariantChoice, usePendingVariantChoice, type PendingVariantChoice, } from './pending-variant-choice-store';
7
- export { recordOptionSelections, getOptionSelections, useOptionSelections, } from './option-selection-store';
8
- export * from './ecommerce';
9
- export * from '../../../spacestation/src/analytics/ecommerce/index';
@@ -1,2 +0,0 @@
1
- export { useFaqAccordion } from './use-faq-accordion';
2
- export { useNewsletterForm, type NewsletterFormState, } from './use-newsletter-form';
@@ -1,11 +0,0 @@
1
- /**
2
- * useFaqAccordion — single-open accordion. Returns the open index, a
3
- * predicate, and a toggle that closes the current item or opens a new
4
- * one (passing -1 = closed).
5
- */
6
- export declare function useFaqAccordion(defaultOpenIndex?: number): {
7
- openIndex: number;
8
- isOpen: (i: number) => boolean;
9
- toggle: (i: number) => void;
10
- close: () => void;
11
- };
@@ -1,16 +0,0 @@
1
- export type NewsletterFormState = 'idle' | 'loading' | 'success' | 'error';
2
- /**
3
- * useNewsletterForm — owns the email input value and submit lifecycle.
4
- * Brands wire `email`/`setEmail`/`submit` and read `state` to decide
5
- * which slot to render (idle form / loading dots / success message /
6
- * error string). Validation is built-in; the consumer-supplied
7
- * `submitFn` runs only after a syntactically valid email.
8
- */
9
- export declare function useNewsletterForm(submitFn: (email: string) => Promise<void> | void): {
10
- email: string;
11
- setEmail: (next: string) => void;
12
- state: NewsletterFormState;
13
- error: string;
14
- submit: () => Promise<void>;
15
- reset: () => void;
16
- };
@@ -1,16 +0,0 @@
1
- import * as React from 'react';
2
- /** The platform's GENERIC deciding-question signal. There is nothing
3
- * ask-special about it — a widget consumes this signal type like any other. */
4
- export declare const AGENT_ASK_SIGNAL = "agent_ask";
5
- /**
6
- * AgentAsk — the default widget that CONSUMES the `agent_ask` signal (a generic
7
- * deciding question + optional quick replies). It is a plain signal consumer:
8
- * `useConsumeStandingSignal('agent_ask')`, read `ask` / `suggestions` straight
9
- * off the payload, render. No ask store, no ask hook — `agent_ask` is just a
10
- * signal, and this is just the widget that happens to render it.
11
- *
12
- * UI-infra only — emits `fourty-ask*` class-hooked markup with ZERO skin; the
13
- * THEME stylesheet owns the look. Brand-specific prompts are their own signals
14
- * consumed by their own widgets (e.g. the wardrobe's keep-offer).
15
- */
16
- export declare function AgentAsk(): React.ReactElement | null;
@@ -1,2 +0,0 @@
1
- export { useImageHover } from './use-image-hover';
2
- export { useExpandable } from './use-expandable';
@@ -1,2 +0,0 @@
1
- export { useTestimonialsCarousel } from './use-testimonials-carousel';
2
- export { useReviewHelpful } from './use-review-helpful';
@@ -1,10 +0,0 @@
1
- /**
2
- * useReviewHelpful — tracks which reviews the visitor marked helpful in
3
- * this session. `countWith(idx, base)` returns the displayed total
4
- * (server count + this session's increment). Brands render the toggle.
5
- */
6
- export declare function useReviewHelpful(): {
7
- isHelpful: (idx: number) => boolean;
8
- toggle: (idx: number) => void;
9
- countWith: (idx: number, base: number) => number;
10
- };
@@ -1,15 +0,0 @@
1
- /**
2
- * useTestimonialsCarousel — autoplay-with-pause-on-hover state. Returns
3
- * the current index, manual setter, and `pauseProps` to spread onto the
4
- * tracked container so hover halts the autoplay timer. Disable autoplay
5
- * by passing `autoplayMs = 0`.
6
- */
7
- export declare function useTestimonialsCarousel(count: number, autoplayMs?: number): {
8
- index: number;
9
- setIndex: (next: number) => void;
10
- paused: boolean;
11
- pauseProps: {
12
- onMouseEnter: () => void;
13
- onMouseLeave: () => void;
14
- };
15
- };
@@ -1,6 +0,0 @@
1
- /**
2
- * Format a kilometre distance as a visitor-facing miles label.
3
- * Under 10 mi keeps one decimal ("3.4 mi"); beyond that rounds whole
4
- * ("18 mi"). Returns '' for a non-finite input.
5
- */
6
- export declare function formatDistance(km: number): string;
@@ -1,5 +0,0 @@
1
- /**
2
- * Build a Google Maps URL that drops a pin at the given coordinates —
3
- * used as the "Directions" link target for store / location listings.
4
- */
5
- export declare function mapsDirectionsUrl(latitude: number, longitude: number): string;