@40rty/ams-sdk 0.3.2 → 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 (109) hide show
  1. package/dist/index.js +6625 -6178
  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 +211 -122
  21. package/dist/types/sdk/src/host/types.d.ts +3 -1
  22. package/dist/types/sdk/src/index.d.ts +2 -5
  23. package/dist/types/sdk/src/projection/index.d.ts +1 -0
  24. package/dist/types/sdk/src/projection/transform.d.ts +12 -0
  25. package/dist/types/sdk/src/projection/use-projection.d.ts +24 -0
  26. package/dist/types/sdk/src/provider/agent-ask-signal.d.ts +4 -0
  27. package/dist/types/sdk/src/provider/index.d.ts +1 -1
  28. package/dist/types/sdk/src/session/FourtySessionContext.d.ts +1 -1
  29. package/dist/types/sdk/src/shell/composer-attachments/heic-convert.d.ts +6 -0
  30. package/dist/types/sdk/src/shell/composer-attachments/use-composer-attachments.d.ts +37 -0
  31. package/dist/types/sdk/src/shell/conversation/answer-text.d.ts +15 -0
  32. package/dist/types/sdk/src/shell/conversation/index.d.ts +4 -0
  33. package/dist/types/sdk/src/shell/conversation/turn-pages.d.ts +16 -0
  34. package/dist/types/sdk/src/shell/conversation/use-conversation-page.d.ts +65 -0
  35. package/dist/types/sdk/src/shell/conversation/use-conversation-presence.d.ts +31 -0
  36. package/dist/types/sdk/src/shell/index.d.ts +6 -0
  37. package/dist/types/sdk/src/shell/turn-ask-placement.d.ts +17 -0
  38. package/dist/types/sdk/src/shell/use-dock-state.d.ts +58 -0
  39. package/dist/types/sdk/src/shell/use-prompt-composer.d.ts +51 -0
  40. package/dist/types/sdk/src/shell/use-thread-rows.d.ts +3 -1
  41. package/dist/types/sdk/src/shell/use-turn-ask-reply.d.ts +5 -0
  42. package/dist/types/sdk/src/utils/core-utils/index.d.ts +0 -6
  43. package/dist/types/sdk/src/utils/index.d.ts +1 -1
  44. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/cart}/use-cart-drawer.d.ts +1 -1
  45. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/cart}/use-cart-line-row.d.ts +1 -1
  46. package/dist/types/sdk/src/verticals/commerce/cart/use-cart-view.d.ts +51 -0
  47. package/dist/types/sdk/src/verticals/commerce/cart/use-safe-cart.d.ts +16 -0
  48. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/buy-now-exit.d.ts +1 -1
  49. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/checkout-handoff-reasons.d.ts +2 -2
  50. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/checkout-handoff-shape.d.ts +1 -1
  51. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/checkout-handoff-store.d.ts +3 -3
  52. package/dist/types/sdk/src/verticals/commerce/chip-relevance.d.ts +1 -0
  53. package/dist/types/sdk/src/{commerce → verticals/commerce}/commerce-context.d.ts +1 -1
  54. package/dist/types/sdk/src/{commerce → verticals/commerce}/commerce-shapes.d.ts +2 -2
  55. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/comparison}/comparison-rows.d.ts +1 -1
  56. package/dist/types/sdk/src/verticals/commerce/index.d.ts +35 -0
  57. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/normalize-collection.d.ts +2 -2
  58. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/product-filters.d.ts +1 -1
  59. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/use-look-card.d.ts +4 -4
  60. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/use-product-card.d.ts +2 -2
  61. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/use-product-detail.d.ts +3 -3
  62. package/dist/types/sdk/src/verticals/commerce/use-commerce-actions.d.ts +18 -0
  63. package/dist/types/sdk/src/{commerce → verticals/commerce/variant}/pending-variant-choice-store.d.ts +2 -2
  64. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/preselect-from-facts.d.ts +1 -1
  65. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/use-selected-variants-state.d.ts +1 -1
  66. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/variant-option-axes.d.ts +1 -1
  67. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/variant-resolution.d.ts +1 -1
  68. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/variant-selection.d.ts +1 -1
  69. package/dist/types/sdk/src/verticals/content/index.d.ts +1 -0
  70. package/dist/types/sdk/src/verticals/content/use-content-actions.d.ts +12 -0
  71. package/dist/types/sdk/src/widgets/presence/index.d.ts +1 -0
  72. package/dist/types/sdk/src/widgets/presence/runtime-context.d.ts +1 -1
  73. package/dist/types/sdk/src/widgets/presence/use-forget-fact.d.ts +35 -0
  74. package/dist/types/spacestation/src/analytics/ecommerce/events.d.ts +1 -1
  75. package/dist/types/spacestation/src/catalog/wire/package-release.d.ts +8 -1
  76. package/dist/types/spacestation/src/index.d.ts +1 -0
  77. package/dist/types/spacestation/src/layout/conversation.d.ts +5 -0
  78. package/dist/types/spacestation/src/signal/turn-ask.d.ts +94 -0
  79. package/dist/types/spacestation/src/widgets/presence/profile.d.ts +2 -2
  80. package/package.json +2 -1
  81. package/dist/types/sdk/src/animation/index.d.ts +0 -2
  82. package/dist/types/sdk/src/animation/useListTransition.d.ts +0 -16
  83. package/dist/types/sdk/src/animation/useUpdateTransition.d.ts +0 -16
  84. package/dist/types/sdk/src/commerce/ecommerce/agentic-overlay.d.ts +0 -27
  85. package/dist/types/sdk/src/commerce/ecommerce/index.d.ts +0 -21
  86. package/dist/types/sdk/src/commerce/ecommerce/use-product-carousel-scroll.d.ts +0 -13
  87. package/dist/types/sdk/src/commerce/index.d.ts +0 -9
  88. package/dist/types/sdk/src/content/index.d.ts +0 -2
  89. package/dist/types/sdk/src/content/use-faq-accordion.d.ts +0 -11
  90. package/dist/types/sdk/src/content/use-newsletter-form.d.ts +0 -16
  91. package/dist/types/sdk/src/provider/AgentAsk.d.ts +0 -16
  92. package/dist/types/sdk/src/shared/index.d.ts +0 -2
  93. package/dist/types/sdk/src/social/index.d.ts +0 -2
  94. package/dist/types/sdk/src/social/use-review-helpful.d.ts +0 -10
  95. package/dist/types/sdk/src/social/use-testimonials-carousel.d.ts +0 -15
  96. package/dist/types/sdk/src/utils/core-utils/format-distance.d.ts +0 -6
  97. package/dist/types/sdk/src/utils/core-utils/maps-directions-url.d.ts +0 -5
  98. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/cart}/cart-action-failures.d.ts +0 -0
  99. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/cart}/cart-drawer-store.d.ts +0 -0
  100. /package/dist/types/sdk/src/{commerce → verticals/commerce/checkout}/external-navigation.d.ts +0 -0
  101. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/use-buy-now.d.ts +0 -0
  102. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/comparison}/use-comparison-table.d.ts +0 -0
  103. /package/dist/types/sdk/src/{utils/core-utils → verticals/commerce/price}/format-price.d.ts +0 -0
  104. /package/dist/types/sdk/src/{utils/core-utils → verticals/commerce/price}/is-on-sale.d.ts +0 -0
  105. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/use-product-grid-filter.d.ts +0 -0
  106. /package/dist/types/sdk/src/{commerce → verticals/commerce/variant}/option-selection-store.d.ts +0 -0
  107. /package/dist/types/sdk/src/{utils/core-utils → verticals/commerce/variant}/resolve-swatch-color.d.ts +0 -0
  108. /package/dist/types/sdk/src/{commerce → verticals/commerce/variant}/variant-selection-store.d.ts +0 -0
  109. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/wishlist}/use-wishlist-drawer.d.ts +0 -0
@@ -0,0 +1,35 @@
1
+ import './chip-relevance';
2
+ export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
3
+ export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
4
+ export { navigateToExternalCommerceUrl } from './checkout/external-navigation';
5
+ export type { ExternalNavigationResult } from './checkout/external-navigation';
6
+ export { recordVariantSelection, getVariantSelection, useVariantSelections, } from './variant/variant-selection-store';
7
+ export { requestVariantChoice, clearVariantChoice, usePendingVariantChoice, type PendingVariantChoice, } from './variant/pending-variant-choice-store';
8
+ export { recordOptionSelections, getOptionSelections, useOptionSelections, } from './variant/option-selection-store';
9
+ export * from '../../../../spacestation/src/analytics/ecommerce/index';
10
+ export { useProductGridFilter } from './product/use-product-grid-filter';
11
+ export { pickProductCardAction, pickCartAddAction } from '../../../../ecommerce/src/index';
12
+ export { isPendingCartLine, settledCart } from '../../../../ecommerce/src/index';
13
+ export { useProductDetail, type ProductDetailVariantGroup, } from './product/use-product-detail';
14
+ export { classifyComparisonValue, useComparisonHighlight, type ComparisonCellRender, } from './comparison/use-comparison-table';
15
+ export { useCartDrawer } from './cart/use-cart-drawer';
16
+ export { useCartView, type CartViewModel, type ExitPending } from './cart/use-cart-view';
17
+ export { useSafeCart, type SafeCart } from './cart/use-safe-cart';
18
+ export { recordCartActionFailure, readCartActionFailures, clearCartActionFailures, useCartActionFailures, useCartActionFailuresFor, type CartActionFailure, type CartActionSubject, } from './cart/cart-action-failures';
19
+ export { useCartLineRow, type CartLineRowState, type CartLineInteraction, } from './cart/use-cart-line-row';
20
+ export { openCartDrawer, openCartDrawerFocusedOn, closeCartDrawer, toggleCartDrawer, useCartDrawerOpen, useCartDrawerFocus, type CartDrawerFocus, } from './cart/cart-drawer-store';
21
+ 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/checkout-handoff-store';
22
+ export { useWishlistDrawer } from './wishlist/use-wishlist-drawer';
23
+ export { useProductCard, type ProductCardData, type ProductCardBadge, } from './product/use-product-card';
24
+ export { useLookCard, type LookCardData, type LookCardTile } from './product/use-look-card';
25
+ export { resolveProductVariant, variantForSelections, type VariantResolution, type VariantGap, type UnavailableSelection, type VariantOptionChoice, type VariantOptionValue, } from './variant/variant-resolution';
26
+ export { canonicalOptionValue } from '../../../../spacestation/src/index';
27
+ export { preselectFromFacts } from './variant/preselect-from-facts';
28
+ export { matchesProductFilter, pruneFilterChips, type ProductFilterChip, type ProductFilterPredicate, } from './product/product-filters';
29
+ export { normalizeCollectionLegacy, pickCollectionAction } from './product/normalize-collection';
30
+ export { useCommerceActions, type CommerceActions } from './use-commerce-actions';
31
+ export { buildComparisonRows, formatProductPrice, type ComparisonAttributeRow, } from './comparison/comparison-rows';
32
+ export { formatPrice } from './price/format-price';
33
+ export { isOnSale } from './price/is-on-sale';
34
+ export { resolveSwatchColor } from './variant/resolve-swatch-color';
35
+ export { formatVariantValue } from '../../../../ecommerce/src/index';
@@ -1,5 +1,5 @@
1
- import type { Collection } from '../../../../ecommerce/src/index';
2
- import { type SuggestionActionInput } from '../../../../spacestation/src/index';
1
+ import type { Collection } from '../../../../../ecommerce/src/index';
2
+ import { type SuggestionActionInput } from '../../../../../spacestation/src/index';
3
3
  /**
4
4
  * Adapt either the canonical {handle, title, …} Collection shape OR the
5
5
  * legacy {slug, name, imageSrc, productCount} shape to a Collection.
@@ -1,4 +1,4 @@
1
- import type { Product } from '../../../../ecommerce/src/index';
1
+ import type { Product } from '../../../../../ecommerce/src/index';
2
2
  /**
3
3
  * Agent-supplied filter chip. Wire shape mirrors the canonical
4
4
  * `productGridProps.filters` schema in `@fourty/ui/catalog-data`. The
@@ -1,7 +1,7 @@
1
- import { type Product } from '../../../../ecommerce/src/index';
2
- import { type SuggestionAction } from '../../../../spacestation/src/index';
3
- import { useSuccessFlash } from '../../utils/use-success-flash';
4
- import { type VariantGap } from './variant-resolution';
1
+ import { type Product } from '../../../../../ecommerce/src/index';
2
+ import { type SuggestionAction } from '../../../../../spacestation/src/index';
3
+ import { useSuccessFlash } from '../../../utils/use-success-flash';
4
+ import { type VariantGap } from '../variant/variant-resolution';
5
5
  interface Options {
6
6
  /** Raw product list as emitted by the agent. Validated; malformed entries dropped. */
7
7
  products: Product[];
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { type Product } from '../../../../ecommerce/src/index';
2
+ import { type Product } from '../../../../../ecommerce/src/index';
3
3
  type ProductImageData = Product['images'][number];
4
- import { useImageHover } from '../../shared/use-image-hover';
4
+ import { useImageHover } from '../../../shared/use-image-hover';
5
5
  export type ProductCardBadge = 'NEW' | 'SALE' | 'BEST SELLER';
6
6
  export interface ProductCardData {
7
7
  /** The product to render. Always present — the hydration boundary
@@ -1,6 +1,6 @@
1
- import type { Product, SiblingProduct } from '../../../../ecommerce/src/index';
2
- import { preselectFromFacts } from './preselect-from-facts';
3
- import { type ProductVariant } from './variant-selection';
1
+ import type { Product, SiblingProduct } from '../../../../../ecommerce/src/index';
2
+ import { preselectFromFacts } from '../variant/preselect-from-facts';
3
+ import { type ProductVariant } from '../variant/variant-selection';
4
4
  export { preselectFromFacts };
5
5
  export interface ProductDetailVariantGroup {
6
6
  name: string;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The commerce vertical's click→action verbs, built on the platform's
3
+ * `useCanvasActions()`. Same contract: a catalog component consumes these
4
+ * handlers and never encodes the action itself. `null` outside a
5
+ * `<FourtyProvider>`.
6
+ */
7
+ export interface CommerceActions {
8
+ /** Navigate to a product's detail view (`{page:{kind:'product'}}`). */
9
+ navigateToProduct: (productId: string, title: string) => void;
10
+ /** Show a collection. A storefront `Collection` tile doesn't carry
11
+ * productIds, so this round-trips through the agent as a `message` — the
12
+ * agent resolves the collection and composes its grid. */
13
+ showCollection: (collectionTitle: string) => void;
14
+ /** Navigate to a synthetic collection of explicit product ids — the
15
+ * "view all hearted" wishlist affordance. */
16
+ navigateToProductSet: (handle: string, title: string, productIds: string[]) => void;
17
+ }
18
+ export declare function useCommerceActions(): CommerceActions | null;
@@ -1,5 +1,5 @@
1
- import { type Product } from '../../../ecommerce/src/index';
2
- import { type VariantGap } from './ecommerce/variant-resolution';
1
+ import { type Product } from '../../../../../ecommerce/src/index';
2
+ import { type VariantGap } from './variant-resolution';
3
3
  export interface PendingVariantChoice {
4
4
  /** The full product — needed to resolve a variant id once the visitor
5
5
  * has picked every open axis (`variantForSelections`/`resolveProductVariant`
@@ -1,4 +1,4 @@
1
- import type { Product } from '../../../../ecommerce/src/index';
1
+ import type { Product } from '../../../../../ecommerce/src/index';
2
2
  /**
3
3
  * Pre-select variant axes from (a) forced single-value choices and
4
4
  * (b) the visitor's known facts.
@@ -1,4 +1,4 @@
1
- import type { Product } from '../../../../ecommerce/src/index';
1
+ import type { Product } from '../../../../../ecommerce/src/index';
2
2
  export declare function useSelectedVariantsState(product: Product, facts: Readonly<Record<string, unknown>>): {
3
3
  selectedVariants: Record<string, string>;
4
4
  setSelectedVariants: React.Dispatch<React.SetStateAction<Record<string, string>>>;
@@ -1,4 +1,4 @@
1
- import type { Product, ProductVariant } from '../../../../ecommerce/src/index';
1
+ import type { Product, ProductVariant } from '../../../../../ecommerce/src/index';
2
2
  /** One selectable value on an option axis, with its purchasability. */
3
3
  export interface VariantOptionValue {
4
4
  value: string;
@@ -1,4 +1,4 @@
1
- import { type AvailabilityStatus, type Product, type ProductVariant } from '../../../../ecommerce/src/index';
1
+ import { type AvailabilityStatus, type Product, type ProductVariant } from '../../../../../ecommerce/src/index';
2
2
  import { type VariantOptionChoice } from './variant-option-axes';
3
3
  export type { VariantOptionChoice, VariantOptionValue } from './variant-option-axes';
4
4
  /** A product whose variant can't be resolved without the visitor choosing. */
@@ -1,4 +1,4 @@
1
- import type { Product } from '../../../../ecommerce/src/index';
1
+ import type { Product } from '../../../../../ecommerce/src/index';
2
2
  export type ProductVariant = Product['variants'][number];
3
3
  /**
4
4
  * Pure variant-selection logic over a Product — the derivations
@@ -0,0 +1 @@
1
+ export { useContentActions, type ContentActions } from './use-content-actions';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The content vertical's click→action verbs (editorial articles, newsletter
3
+ * sign-up), built on the platform's `useCanvasActions()`. `null` outside a
4
+ * `<FourtyProvider>`.
5
+ */
6
+ export interface ContentActions {
7
+ /** Navigate to an article's detail view (`{page:{kind:'article'}}`). */
8
+ navigateToArticle: (articleId: string, title: string) => void;
9
+ /** Submit a `newsletter.subscribe` sign-up. */
10
+ subscribeNewsletter: (email: string, buttonLabel: string) => void;
11
+ }
12
+ export declare function useContentActions(): ContentActions | null;
@@ -10,6 +10,7 @@ export { registerPresenceFactForm, resolvePresenceFactForm, registeredPresenceFa
10
10
  export { presenceFactShape, colorHexOf, factFigureParts, FACT_SHAPE, type FactFigureParts, } from './core-presence/fact-shape';
11
11
  export { useAgentFlow, useAgentFlowFresh, setFlowOutput, getFlowOutput, subscribeFlowOutputs, } from './flows/flow-store';
12
12
  export { useOptimisticFlowSet, useReconcileFlowSet, type OptimisticFlowSet, } from './use-optimistic-flow-set';
13
+ export { useForgetFact, useVisibleFactList, useUndismissedFacts, useReconcileDismissed, useDismissedLabels, type ForgetFactApi, } from './use-forget-fact';
13
14
  export { useOptimisticFactOverlay, useReconcileOptimisticFacts, type OptimisticFact, type OptimisticFactOverlay, } from './use-optimistic-facts';
14
15
  export { useLayoutEntityIds } from './use-layout-entity-ids';
15
16
  export { type AgentPresenceFrame, type PresenceFact, SCANNING_FORM, deriveSourceElement, type SourceElementInput, type PresenceElement, type PresenceElementKind, type PresenceSourceElement, type PresenceSourceRef, type PresenceFactArtifact, type PresenceFactElement, type PresenceVoiceElement, type PresenceConcessionElement, type PresenceAskElement, type PresenceStreamArtifact, isPresenceStreamArtifact, type PresenceProfile, DEFAULT_PRESENCE_PROFILE, PRESENCE_LIFECYCLE, } from '../../../../spacestation/src/widgets/presence/index';
@@ -21,7 +21,7 @@ export interface ScanningState {
21
21
  * `FourtyProvider` provides this object through the context below, and the
22
22
  * thin `useScanning` hook reads it. Same dependency-inversion pattern as
23
23
  * `FourtyRuntime` (see `canvas/runtime-context.tsx`) and `FourtyCommerceRuntime`
24
- * (see `commerce/commerce-context.tsx`).
24
+ * (see `verticals/commerce/commerce-context.tsx`).
25
25
  */
26
26
  export interface PresenceRuntime {
27
27
  useScanning: () => ScanningState | null;
@@ -0,0 +1,35 @@
1
+ import type { PresenceFactRender } from './core-presence/fact-form-registry';
2
+ /**
3
+ * The facts to render: the agent's list, minus what the visitor dismissed. ONE
4
+ * rule, ONE list, every surface — `@fourty/ui`'s frame path (`useVisibleFacts`)
5
+ * and the ELEMENT-stream path both go through it, so a dismissed chip can never
6
+ * vanish from one surface and linger on another.
7
+ */
8
+ export declare function useVisibleFactList<T extends Pick<PresenceFactRender, 'label'>>(facts: T[]): T[];
9
+ /** The brief's set — identical to the band's, now that neither carries a bridge.
10
+ * Kept as its own name because the two surfaces ASK different questions ("what
11
+ * may I draw" vs "what will the drawer show") and the `+N` is derived from the
12
+ * difference; collapsing the names would hide that the count has a source. */
13
+ export declare const useUndismissedFacts: typeof useVisibleFactList;
14
+ export interface ForgetFactApi {
15
+ forget: (f: Pick<PresenceFactRender, 'label' | 'value'>) => void;
16
+ }
17
+ export declare function useForgetFact(): ForgetFactApi;
18
+ /**
19
+ * Retire optimistic dismissals once the agent's held read no longer shows them.
20
+ * Pass the read's CURRENT (unfiltered) fact labels, or `null` while there's no
21
+ * held read so the optimism survives the gap. Call once where the frame is known.
22
+ */
23
+ export declare function useReconcileDismissed(presentLabels: string[] | null): void;
24
+ /**
25
+ * What the visitor has forgotten, by label.
26
+ *
27
+ * The slot registry needs this explicitly (`fact-slots.ts`): it retains a chip
28
+ * through the projection's silences, so "gone from the list" no longer means
29
+ * "gone". A dismissal is the one departure the visitor authors, and it has to be
30
+ * able to say so rather than be inferred from an absence that now means
31
+ * something else.
32
+ */
33
+ export declare function useDismissedLabels(): {
34
+ has: (label: string) => boolean;
35
+ };
@@ -26,7 +26,7 @@ export declare const CHECKOUT_ORIGINS: readonly ["visitor", "agent"];
26
26
  export type CheckoutOrigin = (typeof CHECKOUT_ORIGINS)[number];
27
27
  /**
28
28
  * What the exit did. Mirrors `CheckoutHandoffOutcome` in
29
- * `packages/sdk/src/commerce/ecommerce/checkout-handoff-store.ts:49`
29
+ * `packages/sdk/src/verticals/commerce/checkout/checkout-handoff-store.ts:49`
30
30
  * (`'armed' | 'unavailable' | ExternalNavigationResult`). Listed here rather
31
31
  * than imported because `apps/api` cannot reach `@fourty/sdk`; the SDK's own
32
32
  * type is expected to derive FROM this one when the emit sites are threaded, so
@@ -112,17 +112,22 @@ export declare const PackageReleaseSchema: z.ZodObject<{
112
112
  * The brand's components, built — present when the PLATFORM hosts this
113
113
  * brand's spacefront, absent when the brand hosts it in its own app. One
114
114
  * ES module (exporting `renderers`, and optionally `shells`) and its
115
- * stylesheet. It is served to browsers; the platform's servers never run it.
115
+ * stylesheet, plus the files that stylesheet points at (`assets`: fonts,
116
+ * images — base64, keyed by the path the stylesheet's `url()` names, beside
117
+ * it). It is served to browsers; the platform's servers never run it.
116
118
  */
117
119
  bundle: z.ZodOptional<z.ZodObject<{
118
120
  js: z.ZodString;
119
121
  css: z.ZodString;
122
+ assets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
120
123
  }, "strict", z.ZodTypeAny, {
121
124
  js: string;
122
125
  css: string;
126
+ assets?: Record<string, string> | undefined;
123
127
  }, {
124
128
  js: string;
125
129
  css: string;
130
+ assets?: Record<string, string> | undefined;
126
131
  }>>;
127
132
  /**
128
133
  * The class the spacefront root carries while this package is the space's.
@@ -259,6 +264,7 @@ export declare const PackageReleaseSchema: z.ZodObject<{
259
264
  bundle?: {
260
265
  js: string;
261
266
  css: string;
267
+ assets?: Record<string, string> | undefined;
262
268
  } | undefined;
263
269
  theme?: {
264
270
  themeClass: string;
@@ -322,6 +328,7 @@ export declare const PackageReleaseSchema: z.ZodObject<{
322
328
  bundle?: {
323
329
  js: string;
324
330
  css: string;
331
+ assets?: Record<string, string> | undefined;
325
332
  } | undefined;
326
333
  theme?: {
327
334
  themeClass: string;
@@ -13,6 +13,7 @@ export { type ChatMessage, type ConversationSummary, type StreamRecord, type Rea
13
13
  export { type StepName, type TraceEvent, type EmitFn, type TraceStartInfo, type StepConfig, type SystemPromptSnapshot, type VisitorIdentity, type PhaseProgress, type PhaseProgressPreview, } from './trace/trace-events';
14
14
  export { type TraceDiagnostic, type DiagnosticKind, type TraceStage, } from './trace/trace-diagnostics';
15
15
  export { type SuggestionAction, type SuggestionActions, type SuggestionRendererProps, SuggestionActionSchema, SuggestionActionsSchema, SIGNAL_PATCH_PREFIX, type SuggestionActionInput, type AgentSignal, type AgentSignalInput, AgentSignalSchema, InteractionSignalSchema, MAX_VISITOR_PROMPT_CHARS, type ToolCallHint, ToolCallHintSchema, type ActionDefinition, type ActionConfirmation, type ActionGuardEntities, type ActionManifest, type AskDefinition, type AskManifest, NAVIGATE_SIGNAL, FLOW_OUTPUT_SIGNAL, PRESENCE_FLOW, PRESENCE_OPTIMISTIC_FACTS_FLOW, EXTEND_FLOW, DIRECTION_FLOW, EPHEMERAL_FACT_FLOWS, type FlowSpec, type FacultyFlowSpec, } from './signal/agent-signals';
16
+ export { TURN_ASK_SIGNAL, TurnAskSchema, turnAskFromSignal, turnAskSegments, turnAskAnswers, turnAskPlainText, type TurnAsk, type TurnAskSegment } from './signal/turn-ask';
16
17
  export { type TraceSpanData, type TraceData, type Trace, type TraceLatency, type TraceEventLogEntry, type LayoutChangeEntry, } from './trace/trace-data';
17
18
  export { type TraceSnapshotEnvelope, type SystemPromptSnapshotEnvelope, type LayoutSnapshotEnvelope, type SuggestionsSnapshotEnvelope, type TurnSnapshotEnvelope, type AssemblyInputsEnvelope, type AssemblyInputComponent, type AssemblyInputTool, type AssemblyInputPrompt, } from './trace/trace-envelopes';
18
19
  export { type TimingInfo, type UsageInfo, type ToolCall, type SignalType, type InteractionSignal, PRESENCE_FACT_DISMISS_SIGNAL, PRESENCE_CANVAS_REFRESH_SIGNAL, VISITOR_NAME_SIGNAL, VISITOR_CONTEXT_SIGNAL, CLIENT_STATE_HELLO_SIGNAL, stateSnapshotSignal, namespaceFromSnapshotSignal, ENTITY_PRIME_NAMESPACE, StateSnapshotFrameSchema, type StateNamespacePolicy, type StateSnapshotFrame, type EntityPrimePayload, type EntityKind, type EntityRegistryEntry, type VisitorLocation, } from './types';
@@ -1,4 +1,5 @@
1
1
  import type { AgentSignal } from '../signal/agent-signals';
2
+ import type { TurnAsk } from '../signal/turn-ask';
2
3
  import type { View } from './page';
3
4
  import type { AttachmentRef } from '../attachment/attachment';
4
5
  /**
@@ -30,6 +31,8 @@ export interface ChatMessage {
30
31
  * persisted before turn ids shipped.
31
32
  */
32
33
  id?: string;
34
+ /** The question an assistant row closed on (`TurnAsk`). Absent when the turn asked nothing. */
35
+ ask?: TurnAsk;
33
36
  }
34
37
  /**
35
38
  * ConversationSummary — one entry in the visitor's between-conversation
@@ -51,6 +54,8 @@ export interface StreamRecord {
51
54
  prose: string;
52
55
  actions: AgentSignal[];
53
56
  signals: AgentSignal[];
57
+ /** The question the turn closed on — set apart from `prose`, never inside it. */
58
+ ask?: TurnAsk;
54
59
  }
55
60
  /**
56
61
  * A single visitor-facing reasoning beat. Generic by design — `id` +
@@ -0,0 +1,94 @@
1
+ import { z } from 'zod';
2
+ import type { AgentSignal } from './agent-signals';
3
+ /**
4
+ * The question a turn closes on, as data — never as the last line of the prose.
5
+ *
6
+ * The model writes it as one fence line, `/signals/turn.ask`, in typed parts:
7
+ *
8
+ * {"kind":"choice","parts":["Are you getting ",{"answer":"arch cramping"}," or ",{"answer":"heel lift"},"?"]}
9
+ * {"kind":"open","parts":["What climate do you ride in?"]}
10
+ *
11
+ * `kind` comes first so the model decides either/or vs open before it writes a
12
+ * word. A `choice` carries 2-4 `{answer}` parts, an `open` none; a choice
13
+ * that came out without them reads as open (`ModelTurnAskSchema`). Each `{answer}` is a reply the visitor
14
+ * sends with one tap, in place in the sentence — so a shell renders the
15
+ * clickable words without matching anything back into text. Read it through
16
+ * `turnAskSegments` (render), `turnAskAnswers` (the replies) and
17
+ * `turnAskPlainText` (anything that shows or feeds it as text: the prose fold,
18
+ * the model's own history).
19
+ *
20
+ * It is persisted on the assistant row, so a restored turn shows it too.
21
+ */
22
+ export declare const TURN_ASK_SIGNAL = "turn.ask";
23
+ declare const PartSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
24
+ answer: z.ZodString;
25
+ }, "strip", z.ZodTypeAny, {
26
+ answer: string;
27
+ }, {
28
+ answer: string;
29
+ }>]>;
30
+ export type TurnAskPart = z.infer<typeof PartSchema>;
31
+ /** The question in canonical form: a `choice` always carries 2-4 answers, an `open` none. */
32
+ export interface TurnAsk {
33
+ kind: 'choice' | 'open';
34
+ parts: TurnAskPart[];
35
+ }
36
+ export declare const TurnAskSchema: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodObject<{
37
+ kind: z.ZodEnum<["choice", "open"]>;
38
+ parts: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
39
+ answer: z.ZodString;
40
+ }, "strip", z.ZodTypeAny, {
41
+ answer: string;
42
+ }, {
43
+ answer: string;
44
+ }>]>, "many">;
45
+ }, "strip", z.ZodTypeAny, {
46
+ kind: "choice" | "open";
47
+ parts: (string | {
48
+ answer: string;
49
+ })[];
50
+ }, {
51
+ kind: "choice" | "open";
52
+ parts: (string | {
53
+ answer: string;
54
+ })[];
55
+ }>, {
56
+ kind: "choice" | "open";
57
+ parts: (string | {
58
+ answer: string;
59
+ })[];
60
+ }, {
61
+ kind: "choice" | "open";
62
+ parts: (string | {
63
+ answer: string;
64
+ })[];
65
+ }>, TurnAsk, {
66
+ kind: "choice" | "open";
67
+ parts: (string | {
68
+ answer: string;
69
+ })[];
70
+ }>, z.ZodEffects<z.ZodObject<{
71
+ question: z.ZodString;
72
+ }, "strip", z.ZodTypeAny, {
73
+ question: string;
74
+ }, {
75
+ question: string;
76
+ }>, TurnAsk, {
77
+ question: string;
78
+ }>]>;
79
+ export type TurnAskSegment = {
80
+ kind: 'text';
81
+ text: string;
82
+ } | {
83
+ kind: 'answer';
84
+ text: string;
85
+ };
86
+ /** The question as plain runs and tappable answers, in reading order. */
87
+ export declare function turnAskSegments(ask: TurnAsk): TurnAskSegment[];
88
+ /** The replies the visitor can tap, in order. `[]` for an open question. */
89
+ export declare function turnAskAnswers(ask: TurnAsk): string[];
90
+ /** The question as it reads aloud. */
91
+ export declare function turnAskPlainText(ask: TurnAsk): string;
92
+ /** The ask a `turn.ask` signal carries; `null` for any other signal or a malformed payload. */
93
+ export declare function turnAskFromSignal(signal: AgentSignal): TurnAsk | null;
94
+ export {};
@@ -42,12 +42,12 @@ export declare const PresenceProfileSchema: z.ZodObject<{
42
42
  facts: z.ZodEnum<["inferred-only", "all"]>;
43
43
  }, "strip", z.ZodTypeAny, {
44
44
  sources: string[] | "all";
45
- facts: "all" | "inferred-only";
46
45
  voice: "full" | "off" | "terse";
46
+ facts: "all" | "inferred-only";
47
47
  }, {
48
48
  sources: string[] | "all";
49
- facts: "all" | "inferred-only";
50
49
  voice: "full" | "off" | "terse";
50
+ facts: "all" | "inferred-only";
51
51
  }>;
52
52
  export type PresenceProfile = z.infer<typeof PresenceProfileSchema>;
53
53
  /**
package/package.json CHANGED
@@ -19,13 +19,14 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "framer-motion": "^12.34.5",
22
+ "heic2any": "^0.0.4",
22
23
  "zod": "^3.25.0"
23
24
  },
24
25
  "peerDependencies": {
25
26
  "react": "^18.3.0 || ^19.0.0",
26
27
  "react-dom": "^18.3.0 || ^19.0.0"
27
28
  },
28
- "version": "0.3.2",
29
+ "version": "0.4.2",
29
30
  "homepage": "https://docs.40rty.ai",
30
31
  "license": "UNLICENSED",
31
32
  "engines": {
@@ -1,2 +0,0 @@
1
- export { useListTransition } from './useListTransition';
2
- export { useUpdateTransition } from './useUpdateTransition';
@@ -1,16 +0,0 @@
1
- interface ListTransitionResult<T> {
2
- /** Keys of items that are newly entering */
3
- enteringKeys: Set<string>;
4
- /** Items that have been removed but should still render for exit animation */
5
- exitingItems: T[];
6
- /** All items to render (current + exiting) */
7
- renderItems: T[];
8
- }
9
- /**
10
- * Tracks list item enter/exit for animated list components.
11
- * Returns entering/exiting sets so the component can apply AnimatePresence on individual items.
12
- *
13
- * Exiting items stay in the render list for `exitDuration` ms, then are cleaned up.
14
- */
15
- export declare function useListTransition<T>(items: T[], keyFn: (item: T) => string, exitDuration?: number): ListTransitionResult<T>;
16
- export {};
@@ -1,16 +0,0 @@
1
- interface UpdateTransitionResult<T> {
2
- displayValue: T;
3
- isTransitioning: boolean;
4
- transitionStyle: {
5
- opacity: number;
6
- transition: string;
7
- };
8
- }
9
- /**
10
- * Smoothly transitions between old and new values with a crossfade effect.
11
- * Uses CSS transitions (not Framer Motion) to stay lightweight.
12
- *
13
- * When `value` changes: fade out (1→0) → swap displayValue → fade in (0→1)
14
- */
15
- export declare function useUpdateTransition<T>(value: T, duration?: number): UpdateTransitionResult<T>;
16
- export {};
@@ -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';