@40rty/ams-sdk 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/index.js +11918 -0
- package/dist/types/ecommerce/src/attribute-buckets.d.ts +79 -0
- package/dist/types/ecommerce/src/base-attributes.d.ts +42 -0
- package/dist/types/ecommerce/src/bucket-labels.d.ts +37 -0
- package/dist/types/ecommerce/src/cart-line-selections.d.ts +24 -0
- package/dist/types/ecommerce/src/commerce-schemas.d.ts +1813 -0
- package/dist/types/ecommerce/src/format-variant-value.d.ts +1 -0
- package/dist/types/ecommerce/src/index.d.ts +13 -0
- package/dist/types/ecommerce/src/locale.d.ts +31 -0
- package/dist/types/ecommerce/src/optimistic-cart-line.d.ts +38 -0
- package/dist/types/ecommerce/src/pdp-companions.d.ts +21 -0
- package/dist/types/ecommerce/src/pick-product-card-action.d.ts +38 -0
- package/dist/types/ecommerce/src/product-lookup.d.ts +34 -0
- package/dist/types/ecommerce/src/projection-spec.d.ts +38 -0
- package/dist/types/ecommerce/src/review-schemas.d.ts +425 -0
- package/dist/types/sdk/src/analytics/consent.d.ts +52 -0
- package/dist/types/sdk/src/analytics/drops.d.ts +98 -0
- package/dist/types/sdk/src/analytics/emitting-scope.d.ts +2 -0
- package/dist/types/sdk/src/analytics/index.d.ts +12 -0
- package/dist/types/sdk/src/analytics/inert-scope.d.ts +2 -0
- package/dist/types/sdk/src/analytics/notify.d.ts +41 -0
- package/dist/types/sdk/src/analytics/outbox.d.ts +118 -0
- package/dist/types/sdk/src/analytics/scope-context.d.ts +24 -0
- package/dist/types/sdk/src/analytics/scope.d.ts +149 -0
- package/dist/types/sdk/src/analytics/surface.d.ts +77 -0
- package/dist/types/sdk/src/analytics/transport.d.ts +91 -0
- package/dist/types/sdk/src/animation/index.d.ts +2 -0
- package/dist/types/sdk/src/animation/useListTransition.d.ts +16 -0
- package/dist/types/sdk/src/animation/useUpdateTransition.d.ts +16 -0
- package/dist/types/sdk/src/canvas/ElementIdContext.d.ts +13 -0
- package/dist/types/sdk/src/canvas/GenerationStyleContext.d.ts +13 -0
- package/dist/types/sdk/src/canvas/ShimmerSweep.d.ts +18 -0
- package/dist/types/sdk/src/canvas/TransitionContext.d.ts +52 -0
- package/dist/types/sdk/src/canvas/canvas-arrangement.d.ts +20 -0
- package/dist/types/sdk/src/canvas/canvas-motion-style.d.ts +18 -0
- package/dist/types/sdk/src/canvas/canvas-outlet.d.ts +14 -0
- package/dist/types/sdk/src/canvas/canvas-tail.d.ts +31 -0
- package/dist/types/sdk/src/canvas/dom-targets.d.ts +140 -0
- package/dist/types/sdk/src/canvas/generation-entrance.d.ts +26 -0
- package/dist/types/sdk/src/canvas/generation-style.d.ts +62 -0
- package/dist/types/sdk/src/canvas/index.d.ts +21 -0
- package/dist/types/sdk/src/canvas/item-motion/ItemTransitionGroup.d.ts +72 -0
- package/dist/types/sdk/src/canvas/item-motion/classify-items.d.ts +24 -0
- package/dist/types/sdk/src/canvas/item-motion/index.d.ts +5 -0
- package/dist/types/sdk/src/canvas/item-motion/plugins/wipe.d.ts +11 -0
- package/dist/types/sdk/src/canvas/item-motion/profile.d.ts +77 -0
- package/dist/types/sdk/src/canvas/item-motion/wipe.d.ts +57 -0
- package/dist/types/sdk/src/canvas/nav-direction.d.ts +22 -0
- package/dist/types/sdk/src/canvas/runtime-context.d.ts +15 -0
- package/dist/types/sdk/src/canvas/runtime-hooks.d.ts +106 -0
- package/dist/types/sdk/src/canvas/runtime-types.d.ts +183 -0
- package/dist/types/sdk/src/canvas/scroll-event-target.d.ts +21 -0
- package/dist/types/sdk/src/canvas/turn-change-anchor.d.ts +34 -0
- package/dist/types/sdk/src/canvas/turn-edit.d.ts +8 -0
- package/dist/types/sdk/src/canvas/use-canvas-actions.d.ts +41 -0
- package/dist/types/sdk/src/canvas/use-fourty-layout.d.ts +19 -0
- package/dist/types/sdk/src/catalog/CatalogContext.d.ts +7 -0
- package/dist/types/sdk/src/catalog/DebugContext.d.ts +5 -0
- package/dist/types/sdk/src/catalog/HydrationStateContext.d.ts +45 -0
- package/dist/types/sdk/src/catalog/HydratorContext.d.ts +7 -0
- package/dist/types/sdk/src/catalog/component-library.d.ts +32 -0
- package/dist/types/sdk/src/catalog/define.d.ts +149 -0
- package/dist/types/sdk/src/catalog/hydrator-registry.d.ts +91 -0
- package/dist/types/sdk/src/catalog/index.d.ts +14 -0
- package/dist/types/sdk/src/catalog/interaction-contract.d.ts +78 -0
- package/dist/types/sdk/src/catalog/normalize-components.d.ts +17 -0
- package/dist/types/sdk/src/catalog/prose-value.d.ts +22 -0
- package/dist/types/sdk/src/catalog/registration/index.d.ts +4 -0
- package/dist/types/sdk/src/catalog/registration/register-component.d.ts +35 -0
- package/dist/types/sdk/src/catalog/registration/registry.d.ts +27 -0
- package/dist/types/sdk/src/catalog/registration/types.d.ts +83 -0
- package/dist/types/sdk/src/catalog/registry.d.ts +22 -0
- package/dist/types/sdk/src/catalog/render-inline.d.ts +39 -0
- package/dist/types/sdk/src/catalog/resolve-hydrators.d.ts +27 -0
- package/dist/types/sdk/src/chat/chat-context.d.ts +40 -0
- package/dist/types/sdk/src/chat/index.d.ts +1 -0
- package/dist/types/sdk/src/client-state/index.d.ts +2 -0
- package/dist/types/sdk/src/client-state/server-store.d.ts +38 -0
- package/dist/types/sdk/src/client-state/store.d.ts +20 -0
- package/dist/types/sdk/src/commerce/commerce-context.d.ts +62 -0
- package/dist/types/sdk/src/commerce/commerce-shapes.d.ts +170 -0
- package/dist/types/sdk/src/commerce/ecommerce/agentic-overlay.d.ts +27 -0
- package/dist/types/sdk/src/commerce/ecommerce/buy-now-exit.d.ts +36 -0
- package/dist/types/sdk/src/commerce/ecommerce/cart-action-failures.d.ts +54 -0
- package/dist/types/sdk/src/commerce/ecommerce/cart-drawer-store.d.ts +18 -0
- package/dist/types/sdk/src/commerce/ecommerce/checkout-handoff-reasons.d.ts +54 -0
- package/dist/types/sdk/src/commerce/ecommerce/checkout-handoff-shape.d.ts +73 -0
- package/dist/types/sdk/src/commerce/ecommerce/checkout-handoff-store.d.ts +39 -0
- package/dist/types/sdk/src/commerce/ecommerce/comparison-rows.d.ts +30 -0
- package/dist/types/sdk/src/commerce/ecommerce/index.d.ts +21 -0
- package/dist/types/sdk/src/commerce/ecommerce/normalize-collection.d.ts +17 -0
- package/dist/types/sdk/src/commerce/ecommerce/preselect-from-facts.d.ts +25 -0
- package/dist/types/sdk/src/commerce/ecommerce/product-filters.d.ts +40 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-buy-now.d.ts +33 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-cart-drawer.d.ts +35 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-cart-line-row.d.ts +30 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-comparison-table.d.ts +22 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-look-card.d.ts +80 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-product-card.d.ts +62 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-product-carousel-scroll.d.ts +13 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-product-detail.d.ts +48 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-product-grid-filter.d.ts +17 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-selected-variants-state.d.ts +8 -0
- package/dist/types/sdk/src/commerce/ecommerce/use-wishlist-drawer.d.ts +34 -0
- package/dist/types/sdk/src/commerce/ecommerce/variant-option-axes.d.ts +56 -0
- package/dist/types/sdk/src/commerce/ecommerce/variant-resolution.d.ts +83 -0
- package/dist/types/sdk/src/commerce/ecommerce/variant-selection.d.ts +22 -0
- package/dist/types/sdk/src/commerce/external-navigation.d.ts +41 -0
- package/dist/types/sdk/src/commerce/index.d.ts +9 -0
- package/dist/types/sdk/src/commerce/option-selection-store.d.ts +8 -0
- package/dist/types/sdk/src/commerce/pending-variant-choice-store.d.ts +20 -0
- package/dist/types/sdk/src/commerce/variant-selection-store.d.ts +7 -0
- package/dist/types/sdk/src/content/index.d.ts +2 -0
- package/dist/types/sdk/src/content/use-faq-accordion.d.ts +11 -0
- package/dist/types/sdk/src/content/use-newsletter-form.d.ts +16 -0
- package/dist/types/sdk/src/host/Spacefront.d.ts +11 -0
- package/dist/types/sdk/src/host/engine-loader.d.ts +14 -0
- package/dist/types/sdk/src/host/host-modules.d.ts +5833 -0
- package/dist/types/sdk/src/host/index.d.ts +4 -0
- package/dist/types/sdk/src/host/types.d.ts +52 -0
- package/dist/types/sdk/src/index.d.ts +21 -0
- package/dist/types/sdk/src/interaction/haptics.d.ts +8 -0
- package/dist/types/sdk/src/interaction/index.d.ts +3 -0
- package/dist/types/sdk/src/interaction/normalize-signals.d.ts +8 -0
- package/dist/types/sdk/src/interaction/withInteractionTracking.d.ts +48 -0
- package/dist/types/sdk/src/npm.d.ts +3 -0
- package/dist/types/sdk/src/projection/ProjectionSignalBridge.d.ts +5 -0
- package/dist/types/sdk/src/projection/index.d.ts +1 -0
- package/dist/types/sdk/src/projection/preferences.d.ts +12 -0
- package/dist/types/sdk/src/projection/transform.d.ts +7 -0
- package/dist/types/sdk/src/provider/AgentAsk.d.ts +16 -0
- package/dist/types/sdk/src/provider/index.d.ts +4 -0
- package/dist/types/sdk/src/provider/providers/handler-registry.d.ts +11 -0
- package/dist/types/sdk/src/provider/use-clamp-toggle.d.ts +22 -0
- package/dist/types/sdk/src/provider/use-timed-flag.d.ts +16 -0
- package/dist/types/sdk/src/rendering/index.d.ts +1 -0
- package/dist/types/sdk/src/rendering/post-hydration.d.ts +37 -0
- package/dist/types/sdk/src/session/FourtySessionContext.d.ts +228 -0
- package/dist/types/sdk/src/session/clear-registry.d.ts +6 -0
- package/dist/types/sdk/src/session/index.d.ts +4 -0
- package/dist/types/sdk/src/session/use-action.d.ts +25 -0
- package/dist/types/sdk/src/session/visitor-locale.d.ts +2 -0
- package/dist/types/sdk/src/shared/index.d.ts +2 -0
- package/dist/types/sdk/src/shared/use-expandable.d.ts +9 -0
- package/dist/types/sdk/src/shared/use-image-hover.d.ts +13 -0
- package/dist/types/sdk/src/shell/ScrollContainerContext.d.ts +25 -0
- package/dist/types/sdk/src/shell/ShellRegistry.d.ts +25 -0
- package/dist/types/sdk/src/shell/ShellRootContext.d.ts +15 -0
- package/dist/types/sdk/src/shell/dock-persistence.d.ts +49 -0
- package/dist/types/sdk/src/shell/exclusive-overlay.d.ts +16 -0
- package/dist/types/sdk/src/shell/index.d.ts +12 -0
- package/dist/types/sdk/src/shell/thread-scroll/ThreadHeadroom.d.ts +11 -0
- package/dist/types/sdk/src/shell/thread-scroll/headroom.d.ts +4 -0
- package/dist/types/sdk/src/shell/thread-scroll/index.d.ts +6 -0
- package/dist/types/sdk/src/shell/thread-scroll/pin-turn-head.d.ts +12 -0
- package/dist/types/sdk/src/shell/thread-scroll/settle-thread-row.d.ts +23 -0
- package/dist/types/sdk/src/shell/thread-scroll/thread-geometry.d.ts +27 -0
- package/dist/types/sdk/src/shell/thread-scroll/thread-row-attr.d.ts +4 -0
- package/dist/types/sdk/src/shell/thread-scroll/use-pin-turn-to-top.d.ts +22 -0
- package/dist/types/sdk/src/shell/thread-scroll/use-scroll-has-more-below.d.ts +19 -0
- package/dist/types/sdk/src/shell/thread-scroll/use-thread-jump-marks.d.ts +28 -0
- package/dist/types/sdk/src/shell/thread-scroll/use-thread-landing.d.ts +1 -0
- package/dist/types/sdk/src/shell/use-composer-chip-select.d.ts +21 -0
- package/dist/types/sdk/src/shell/use-go-home.d.ts +11 -0
- package/dist/types/sdk/src/shell/use-hydrated.d.ts +19 -0
- package/dist/types/sdk/src/shell/use-menu-item-select.d.ts +13 -0
- package/dist/types/sdk/src/shell/use-overridable-toggle.d.ts +24 -0
- package/dist/types/sdk/src/shell/use-thread-rows.d.ts +41 -0
- package/dist/types/sdk/src/social/index.d.ts +2 -0
- package/dist/types/sdk/src/social/use-review-helpful.d.ts +10 -0
- package/dist/types/sdk/src/social/use-testimonials-carousel.d.ts +15 -0
- package/dist/types/sdk/src/utils/core-utils/format-distance.d.ts +6 -0
- package/dist/types/sdk/src/utils/core-utils/format-price.d.ts +7 -0
- package/dist/types/sdk/src/utils/core-utils/index.d.ts +10 -0
- package/dist/types/sdk/src/utils/core-utils/inject-google-fonts.d.ts +17 -0
- package/dist/types/sdk/src/utils/core-utils/is-on-sale.d.ts +6 -0
- package/dist/types/sdk/src/utils/core-utils/is-video-url.d.ts +6 -0
- package/dist/types/sdk/src/utils/core-utils/maps-directions-url.d.ts +5 -0
- package/dist/types/sdk/src/utils/core-utils/mint-id.d.ts +10 -0
- package/dist/types/sdk/src/utils/core-utils/resolve-swatch-color.d.ts +2 -0
- package/dist/types/sdk/src/utils/core-utils/validate-all.d.ts +13 -0
- package/dist/types/sdk/src/utils/index.d.ts +10 -0
- package/dist/types/sdk/src/utils/storage.d.ts +9 -0
- package/dist/types/sdk/src/utils/use-document-visible.d.ts +9 -0
- package/dist/types/sdk/src/utils/use-form-factor.d.ts +24 -0
- package/dist/types/sdk/src/utils/use-inline-completion.d.ts +48 -0
- package/dist/types/sdk/src/utils/use-interval.d.ts +7 -0
- package/dist/types/sdk/src/utils/use-success-flash.d.ts +35 -0
- package/dist/types/sdk/src/utils/use-wake-lock.d.ts +15 -0
- package/dist/types/sdk/src/utils/viewport-window.d.ts +39 -0
- package/dist/types/sdk/src/voice/index.d.ts +2 -0
- package/dist/types/sdk/src/voice/use-dictation.d.ts +80 -0
- package/dist/types/sdk/src/voice/use-voice-capture.d.ts +65 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/fact-form-registry.d.ts +43 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/fact-shape.d.ts +70 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/form-registry.d.ts +28 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/knowledge.d.ts +18 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/presence-restore.d.ts +13 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/presence-stream.d.ts +64 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/source-form-registry.d.ts +129 -0
- package/dist/types/sdk/src/widgets/presence/core-presence/standing-signal-store.d.ts +19 -0
- package/dist/types/sdk/src/widgets/presence/flows/flow-store.d.ts +22 -0
- package/dist/types/sdk/src/widgets/presence/index.d.ts +17 -0
- package/dist/types/sdk/src/widgets/presence/runtime-context.d.ts +109 -0
- package/dist/types/sdk/src/widgets/presence/use-layout-entity-ids.d.ts +12 -0
- package/dist/types/sdk/src/widgets/presence/use-optimistic-facts.d.ts +43 -0
- package/dist/types/sdk/src/widgets/presence/use-optimistic-flow-set.d.ts +24 -0
- package/dist/types/sdk/src/widgets/presence/use-presence-notch.d.ts +75 -0
- package/dist/types/sdk/src/widgets/presence/use-presence.d.ts +45 -0
- package/dist/types/sdk/src/widgets/presence/use-standing-signal.d.ts +12 -0
- package/dist/types/spacestation/src/analytics/catalog.d.ts +89 -0
- package/dist/types/spacestation/src/analytics/ecommerce/events.d.ts +183 -0
- package/dist/types/spacestation/src/analytics/ecommerce/funnel.d.ts +22 -0
- package/dist/types/spacestation/src/analytics/ecommerce/index.d.ts +14 -0
- package/dist/types/spacestation/src/analytics/ecommerce/surfacing.d.ts +42 -0
- package/dist/types/spacestation/src/analytics/envelope.d.ts +222 -0
- package/dist/types/spacestation/src/analytics/index.d.ts +28 -0
- package/dist/types/spacestation/src/analytics/kind.d.ts +155 -0
- package/dist/types/spacestation/src/analytics/session.d.ts +35 -0
- package/dist/types/spacestation/src/attachment/attachment.d.ts +83 -0
- package/dist/types/spacestation/src/catalog/attribute-registry.d.ts +148 -0
- package/dist/types/spacestation/src/catalog/attribute-scope.d.ts +41 -0
- package/dist/types/spacestation/src/catalog/canvas-arrangement.d.ts +43 -0
- package/dist/types/spacestation/src/catalog/catalog-schemas.d.ts +264 -0
- package/dist/types/spacestation/src/catalog/config.d.ts +13 -0
- package/dist/types/spacestation/src/catalog/derive-props-doc.d.ts +11 -0
- package/dist/types/spacestation/src/catalog/element-filled.d.ts +77 -0
- package/dist/types/spacestation/src/catalog/entity-refs.d.ts +14 -0
- package/dist/types/spacestation/src/catalog/function-props.d.ts +23 -0
- package/dist/types/spacestation/src/catalog/hydration-paths.d.ts +19 -0
- package/dist/types/spacestation/src/catalog/prose.d.ts +60 -0
- package/dist/types/spacestation/src/catalog/ref-sites.d.ts +45 -0
- package/dist/types/spacestation/src/catalog/required-props.d.ts +31 -0
- package/dist/types/spacestation/src/catalog/resolved.d.ts +145 -0
- package/dist/types/spacestation/src/catalog/structural-baseline.d.ts +7 -0
- package/dist/types/spacestation/src/catalog/wire/catalog-wire.d.ts +191 -0
- package/dist/types/spacestation/src/catalog/wire/index.d.ts +5 -0
- package/dist/types/spacestation/src/catalog/wire/package-release.d.ts +351 -0
- package/dist/types/spacestation/src/catalog/wire/schema-from-wire.d.ts +7 -0
- package/dist/types/spacestation/src/catalog/wire/schema-to-wire.d.ts +8 -0
- package/dist/types/spacestation/src/catalog/wire/wire-schema.d.ts +78 -0
- package/dist/types/spacestation/src/commerce/cart-add-signal.d.ts +125 -0
- package/dist/types/spacestation/src/commerce/cart-state.d.ts +87 -0
- package/dist/types/spacestation/src/commerce/cart-verb-signals.d.ts +80 -0
- package/dist/types/spacestation/src/commerce/page-kinds.d.ts +40 -0
- package/dist/types/spacestation/src/commerce/selection-signal.d.ts +25 -0
- package/dist/types/spacestation/src/contracts/entry-context.d.ts +35 -0
- package/dist/types/spacestation/src/contracts/knowledge/index.d.ts +12 -0
- package/dist/types/spacestation/src/contracts/knowledge/types.d.ts +238 -0
- package/dist/types/spacestation/src/contracts/retrieval/core/knowledge-source.d.ts +36 -0
- package/dist/types/spacestation/src/contracts/retrieval/core/platform-connector.d.ts +49 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/articles/source.d.ts +3 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/articles/types.d.ts +29 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/client.d.ts +238 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/collections/source.d.ts +3 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/collections/types.d.ts +23 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/connector.d.ts +11 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/domains.d.ts +27 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/faq/source.d.ts +3 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/faq/types.d.ts +21 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/option-values.d.ts +71 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/policies/source.d.ts +3 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/policies/types.d.ts +18 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/products/source.d.ts +5 -0
- package/dist/types/spacestation/src/contracts/retrieval/ecommerce/products/types.d.ts +47 -0
- package/dist/types/spacestation/src/contracts/retrieval/index.d.ts +25 -0
- package/dist/types/spacestation/src/contracts/session-arrival-params.d.ts +32 -0
- package/dist/types/spacestation/src/contracts/session-arrival.d.ts +215 -0
- package/dist/types/spacestation/src/contracts/tools/definitions.d.ts +139 -0
- package/dist/types/spacestation/src/contracts/tools/execution-context.d.ts +135 -0
- package/dist/types/spacestation/src/contracts/tools/index.d.ts +9 -0
- package/dist/types/spacestation/src/contracts/tools/types.d.ts +163 -0
- package/dist/types/spacestation/src/focus/focus.d.ts +12 -0
- package/dist/types/spacestation/src/hydration/hydration.d.ts +46 -0
- package/dist/types/spacestation/src/index.d.ts +71 -0
- package/dist/types/spacestation/src/layout/apply-patch.d.ts +17 -0
- package/dist/types/spacestation/src/layout/conversation.d.ts +136 -0
- package/dist/types/spacestation/src/layout/layout-diff.d.ts +17 -0
- package/dist/types/spacestation/src/layout/layout.d.ts +275 -0
- package/dist/types/spacestation/src/layout/page.d.ts +244 -0
- package/dist/types/spacestation/src/layout/patch.d.ts +92 -0
- package/dist/types/spacestation/src/layout/reduce-patch.d.ts +19 -0
- package/dist/types/spacestation/src/layout/reserved-ids.d.ts +13 -0
- package/dist/types/spacestation/src/projection/projection.d.ts +249 -0
- package/dist/types/spacestation/src/shell/shell.d.ts +109 -0
- package/dist/types/spacestation/src/signal/agent-signals.d.ts +539 -0
- package/dist/types/spacestation/src/space/connector.d.ts +61 -0
- package/dist/types/spacestation/src/space/generation-job.d.ts +4 -0
- package/dist/types/spacestation/src/space/hosting.d.ts +36 -0
- package/dist/types/spacestation/src/space/manifest.d.ts +8 -0
- package/dist/types/spacestation/src/space/package-version.d.ts +18 -0
- package/dist/types/spacestation/src/space/package.d.ts +35 -0
- package/dist/types/spacestation/src/space/prompt-config.d.ts +17 -0
- package/dist/types/spacestation/src/space/session-activity.d.ts +71 -0
- package/dist/types/spacestation/src/space/session-queue.d.ts +2147 -0
- package/dist/types/spacestation/src/space/space-config.d.ts +96 -0
- package/dist/types/spacestation/src/space/space-otp.d.ts +18 -0
- package/dist/types/spacestation/src/space/space.d.ts +104 -0
- package/dist/types/spacestation/src/space/tool-manifest.d.ts +8 -0
- package/dist/types/spacestation/src/space/trace.d.ts +555 -0
- package/dist/types/spacestation/src/space/workspace-catalog.d.ts +112 -0
- package/dist/types/spacestation/src/tool-compression/compress.d.ts +88 -0
- package/dist/types/spacestation/src/tool-compression/index.d.ts +11 -0
- package/dist/types/spacestation/src/tool-compression/scoring.d.ts +38 -0
- package/dist/types/spacestation/src/tool-compression/tokenize.d.ts +29 -0
- package/dist/types/spacestation/src/trace/trace-data.d.ts +126 -0
- package/dist/types/spacestation/src/trace/trace-diagnostics.d.ts +224 -0
- package/dist/types/spacestation/src/trace/trace-envelopes.d.ts +144 -0
- package/dist/types/spacestation/src/trace/trace-events.d.ts +450 -0
- package/dist/types/spacestation/src/types.d.ts +253 -0
- package/dist/types/spacestation/src/view/continuation.d.ts +45 -0
- package/dist/types/spacestation/src/widgets/presence/element.d.ts +241 -0
- package/dist/types/spacestation/src/widgets/presence/frame.d.ts +56 -0
- package/dist/types/spacestation/src/widgets/presence/index.d.ts +4 -0
- package/dist/types/spacestation/src/widgets/presence/profile.d.ts +75 -0
- package/dist/types/spacestation/src/widgets/presence/scan.d.ts +45 -0
- package/package.json +43 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The inline markdown subset the agent is told it may emit — `**bold**` for
|
|
4
|
+
* visual anchors and `*italic*` for tonal emphasis (see
|
|
5
|
+
* `prompts/core/output/01-wire-format.md` and the VOICE section of `prompts/vertical/ecommerce/ecommerce.md`,
|
|
6
|
+
* which name exactly these two and rule out headings / links / code). Block
|
|
7
|
+
* constructs (paragraphs, bullet lists) are NOT handled here — `AgentText`'s
|
|
8
|
+
* `blockifyProse` splits those and delegates each line back to this function.
|
|
9
|
+
*
|
|
10
|
+
* PLUS bare-URL autolinking. The agent never EMITS link markdown, but
|
|
11
|
+
* `prose()`-marked DATA carries raw URLs — a FAQ answer or policy that says
|
|
12
|
+
* "verify at https://support.recallsecure.com/". Those are linkified here so
|
|
13
|
+
* they render as clickable anchors (new tab) instead of dead text.
|
|
14
|
+
*
|
|
15
|
+
* Link rendering is CUSTOMIZABLE two ways, so a brand can emphasize links how
|
|
16
|
+
* it wants without forking this renderer:
|
|
17
|
+
* 1. CSS — every autolink carries the stable class `fourty-inline-link`, and
|
|
18
|
+
* the default anchor colours off the `--fourty-color-link` token (falling
|
|
19
|
+
* back to `--fourty-color-accent`, then `currentColor`). A brand styles the
|
|
20
|
+
* class / sets the token in its own stylesheet.
|
|
21
|
+
* 2. A render seam — `setInlineLinkRenderer(fn)` swaps the entire anchor for a
|
|
22
|
+
* brand's own node (a branded `<a>`, an icon, a tracked link). Pass `null`
|
|
23
|
+
* to restore the default. The default already opens in a new tab.
|
|
24
|
+
*
|
|
25
|
+
* Returns an array of React nodes; safe as the children of any element.
|
|
26
|
+
*
|
|
27
|
+
* Lives in `@fourty/sdk` because the hydration boundary here calls it too — it
|
|
28
|
+
* applies this to every `prose()`-marked catalog field before a component ever
|
|
29
|
+
* sees the string. `@fourty/ui` re-exports it so brand components importing
|
|
30
|
+
* from there keep working.
|
|
31
|
+
*/
|
|
32
|
+
/** How a bare URL found in prose is turned into a node. */
|
|
33
|
+
export type InlineLinkRenderer = (href: string, key: string) => React.ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Override how autolinked URLs render (brand emphasis, icon, tracking). Pass
|
|
36
|
+
* `null` to restore the default new-tab anchor. Set once at app/brand startup.
|
|
37
|
+
*/
|
|
38
|
+
export declare function setInlineLinkRenderer(renderer: InlineLinkRenderer | null): void;
|
|
39
|
+
export declare function renderInline(text: string, keyPrefix: string): React.ReactNode[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HydratorMap } from './normalize-components';
|
|
2
|
+
import { type PlatformHydratorContext } from './hydrator-registry';
|
|
3
|
+
/**
|
|
4
|
+
* Everything hydrator construction can be given. `locale` rides into the
|
|
5
|
+
* platform factory so hydrated entity prices match the visitor's market;
|
|
6
|
+
* `apiUrl` + `spaceSlug` address the SPACE's own services, which resolve the
|
|
7
|
+
* keys no commerce platform owns (see `registerServiceHydrators`). Both halves
|
|
8
|
+
* are optional — an `id`-addressed admin/preview context has no slug and simply
|
|
9
|
+
* gets no service hydrators.
|
|
10
|
+
*/
|
|
11
|
+
export interface HydratorResolutionContext extends PlatformHydratorContext {
|
|
12
|
+
apiUrl?: string;
|
|
13
|
+
spaceSlug?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve hydrators for a space: the platform's map (from the platform
|
|
17
|
+
* registry) merged OVER the space-service maps (from the service registry).
|
|
18
|
+
*
|
|
19
|
+
* Vertical-agnostic: no `case 'shopify'` etc. — each platform ships
|
|
20
|
+
* its own registration side-effect (`@fourty/shopify/sdk-bindings`)
|
|
21
|
+
* that calls `registerPlatformHydrators()` once at module load.
|
|
22
|
+
*
|
|
23
|
+
* The platform wins on a key collision: a platform that natively resolves an
|
|
24
|
+
* entity is closer to the truth than a service standing in for it. An unknown
|
|
25
|
+
* platform still yields the service map — those keys never depended on it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveHydrators(platform: string, platformConfig: Record<string, unknown>, context?: HydratorResolutionContext): HydratorMap;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ThreadMessage } from '@assistant-ui/react';
|
|
2
|
+
import type { SuggestionActions, SuggestionAction, InteractionSignal, Spec } from '../../../spacestation/src/index';
|
|
3
|
+
/** One layout history snapshot (one per completed interaction). */
|
|
4
|
+
export interface LayoutTurn {
|
|
5
|
+
layout: Spec;
|
|
6
|
+
responseText?: string;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
}
|
|
9
|
+
/** Everything a custom chat UI gets from `<FourtyChatProvider>`. */
|
|
10
|
+
export interface FourtyChatContextValue {
|
|
11
|
+
/** Current thread messages. */
|
|
12
|
+
messages: readonly ThreadMessage[];
|
|
13
|
+
/** Whether the agent is currently running. */
|
|
14
|
+
isRunning: boolean;
|
|
15
|
+
/** Whether the thread has no messages. */
|
|
16
|
+
isEmpty: boolean;
|
|
17
|
+
/** Send a message through the adapter. */
|
|
18
|
+
send: (text: string) => void;
|
|
19
|
+
/** Layout history snapshots (one per completed interaction). */
|
|
20
|
+
history: LayoutTurn[];
|
|
21
|
+
/** Current history index (null = viewing latest). */
|
|
22
|
+
historyIndex: number | null;
|
|
23
|
+
/** Navigate to a history snapshot. */
|
|
24
|
+
navigateHistory: (index: number | null) => void;
|
|
25
|
+
/** Current layout. */
|
|
26
|
+
layout: Spec | null;
|
|
27
|
+
/** Active suggestions. */
|
|
28
|
+
suggestions: SuggestionActions | null;
|
|
29
|
+
/** Handle a suggestion action. */
|
|
30
|
+
handleSuggestionAction: (action: SuggestionAction) => void;
|
|
31
|
+
/** Positioning mode. */
|
|
32
|
+
positioning: 'fixed' | 'absolute';
|
|
33
|
+
/** Queue an interaction signal. */
|
|
34
|
+
queueSignal: (signal: Omit<InteractionSignal, 'timestamp'>) => void;
|
|
35
|
+
/** Current queued signals count. */
|
|
36
|
+
queuedSignalCount: number;
|
|
37
|
+
}
|
|
38
|
+
export declare const FourtyChatContext: import("react").Context<FourtyChatContextValue | null>;
|
|
39
|
+
/** Hook for building custom chat UIs on top of the SDK. */
|
|
40
|
+
export declare function useFourtyChat(): FourtyChatContextValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFourtyChat, FourtyChatContext, type FourtyChatContextValue, type LayoutTurn, } from './chat-context';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { publishClientState, clientStateVector, clientStateEntries, subscribeClientState, type ClientStateEntry } from './store';
|
|
2
|
+
export { applyServerState, serverState, serverStateVector, serverStateEntries, subscribeServerState, resetServerState, primedEntities, primedEntitiesFor, type ServerStateEntry, } from './server-store';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { EntityPrimePayload } from '../../../spacestation/src/index';
|
|
2
|
+
export interface ServerStateEntry {
|
|
3
|
+
payload: Record<string, unknown>;
|
|
4
|
+
rev: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Apply an inbound `<ns>.snapshot` frame.
|
|
8
|
+
*
|
|
9
|
+
* Returns false when the frame was DROPPED as stale — a rev at or below what
|
|
10
|
+
* is already held. That is the guard that makes reconnects safe: a straggler
|
|
11
|
+
* from a dead socket arriving after fresher state must not win. Callers can
|
|
12
|
+
* log the drop; the store stays silent about it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyServerState(namespace: string, rev: number, payload: Record<string, unknown>): boolean;
|
|
15
|
+
/** The payload currently held for a namespace, or undefined. */
|
|
16
|
+
export declare function serverState(namespace: string): Record<string, unknown> | undefined;
|
|
17
|
+
/** `{ namespace → rev }` — this client's view of server-led state. */
|
|
18
|
+
export declare function serverStateVector(): Record<string, number>;
|
|
19
|
+
/** Reactive read for `useSyncExternalStore`. Identity changes on content change. */
|
|
20
|
+
export declare function serverStateEntries(): ReadonlyMap<string, ServerStateEntry>;
|
|
21
|
+
export declare function subscribeServerState(listener: () => void): () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Drop everything. A new SESSION is a new visitor with new truths — carrying
|
|
24
|
+
* a previous session's primed entities into it would resolve refs against
|
|
25
|
+
* data that belongs to someone else.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resetServerState(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Entities the agent has already resolved, as `resolverKey → ref → entity`.
|
|
30
|
+
* Empty when nothing has been primed.
|
|
31
|
+
*/
|
|
32
|
+
export declare function primedEntities(): EntityPrimePayload;
|
|
33
|
+
/**
|
|
34
|
+
* Primed entities for one resolver key, as `ref → entity`. The hydration
|
|
35
|
+
* pass calls this before reaching for a hydrator, so a ref the agent already
|
|
36
|
+
* resolved costs no network at all.
|
|
37
|
+
*/
|
|
38
|
+
export declare function primedEntitiesFor(resolverKey: string): Record<string, unknown>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ClientStateEntry {
|
|
2
|
+
payload: Record<string, unknown>;
|
|
3
|
+
rev: number;
|
|
4
|
+
/** Serialized payload — the change-detection key (kept so the sync
|
|
5
|
+
* bridge never re-serializes to compare). */
|
|
6
|
+
key: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Publish a namespace's current payload. Bumps the revision ONLY when the
|
|
10
|
+
* serialized content changed — safe to call on every render/effect tick.
|
|
11
|
+
*/
|
|
12
|
+
export declare function publishClientState(namespace: string, payload: Record<string, unknown>): void;
|
|
13
|
+
/** The current version vector — `{ namespace → rev }` for every published
|
|
14
|
+
* namespace. Cached; stable reference between publishes. */
|
|
15
|
+
export declare function clientStateVector(): Record<string, number>;
|
|
16
|
+
/** All current entries (stable reference between publishes) — the sync
|
|
17
|
+
* bridge reads these to build snapshots. */
|
|
18
|
+
export declare function clientStateEntries(): ReadonlyMap<string, ClientStateEntry>;
|
|
19
|
+
/** Subscribe to any publish that changed content. */
|
|
20
|
+
export declare function subscribeClientState(listener: () => void): () => void;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Product } from '../../../ecommerce/src/index';
|
|
2
|
+
export type { AddToCartApi, CartAddHints, CartAddOptions, CartApi, ProductReviewHighlight, ProductReviewItem, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi, WishlistState, } from './commerce-shapes';
|
|
3
|
+
import type { AddToCartApi, CartAddHints, CartApi, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi } from './commerce-shapes';
|
|
4
|
+
/**
|
|
5
|
+
* FourtyCommerceRuntime — the commerce-hook surface the catalog
|
|
6
|
+
* consumes. Same dependency-inversion pattern as `FourtyRuntime`: these
|
|
7
|
+
* hooks bind to the SDK's `CommerceClient` + TanStack Query, which the
|
|
8
|
+
* catalog cannot import. The SDK supplies this object; `@fourty/ui`'s
|
|
9
|
+
* thin commerce hooks read it.
|
|
10
|
+
*
|
|
11
|
+
* The SDK mounts the provider at the `FourtyProvider` level so the
|
|
12
|
+
* context is present in every real render path. The supplied hooks
|
|
13
|
+
* handle a missing `<CommerceProvider>` INTERNALLY — `useCart` /
|
|
14
|
+
* `useCollectionByHandle` throw, the bound-action hooks (`useAddToCart`,
|
|
15
|
+
* `useToggleWishlist`, `useProducts`) degrade to inert results.
|
|
16
|
+
*
|
|
17
|
+
* Every entry is a React hook — call them unconditionally at the top
|
|
18
|
+
* level of a component.
|
|
19
|
+
*/
|
|
20
|
+
export interface FourtyCommerceRuntime {
|
|
21
|
+
useCart: () => CartApi;
|
|
22
|
+
useAddToCart: (variantId: string | undefined, hints: CartAddHints) => AddToCartApi;
|
|
23
|
+
useWishlist: () => WishlistApi;
|
|
24
|
+
useToggleWishlist: (productId: string | undefined) => ToggleWishlistApi;
|
|
25
|
+
useProducts: (ids: readonly string[] | undefined) => ProductsQuery;
|
|
26
|
+
useCollectionByHandle: (handle: string | undefined) => ProductsQuery;
|
|
27
|
+
/** Takes the resolved product (not just its id) — a product with no
|
|
28
|
+
* reviews yet is generated on demand server-side from its title +
|
|
29
|
+
* description, so the hook needs that context, not just the id. */
|
|
30
|
+
useProductReviews: (product: Product | undefined, intent?: string) => ProductReviewsResult;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Provider for the commerce-hook surface. Mounted by the SDK's
|
|
34
|
+
* `CommerceProvider`, which passes the SDK's real hook implementations.
|
|
35
|
+
*/
|
|
36
|
+
export declare const FourtyCommerceRuntimeProvider: import("react").Provider<FourtyCommerceRuntime>;
|
|
37
|
+
/**
|
|
38
|
+
* Read the commerce-hook surface. Returns the inert default runtime
|
|
39
|
+
* when no `<CommerceProvider>` is mounted — the inert strict reads
|
|
40
|
+
* still throw, so the prior "throws without a CommerceProvider"
|
|
41
|
+
* contract is preserved for `useCart` / `useWishlist` /
|
|
42
|
+
* `useCollectionByHandle`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function useCommerceRuntime(): FourtyCommerceRuntime;
|
|
45
|
+
/** TanStack-Query-backed cart hook. Throws without a `<CommerceProvider>`. */
|
|
46
|
+
export declare function useCart(): CartApi;
|
|
47
|
+
/** Bound add-to-cart action for a single variant id. Inert without commerce.
|
|
48
|
+
* `hints` pre-paint the optimistic line (title / image / unit price) so the
|
|
49
|
+
* cart drawer never flashes a blank `$0.00` row before the round-trip lands. */
|
|
50
|
+
export declare function useAddToCart(variantId: string | undefined, hints: CartAddHints): AddToCartApi;
|
|
51
|
+
/** Wishlist (heart) hook. Throws without a `<CommerceProvider>`. */
|
|
52
|
+
export declare function useWishlist(): WishlistApi;
|
|
53
|
+
/** Bound heart action for a single product id. Inert without commerce. */
|
|
54
|
+
export declare function useToggleWishlist(productId: string | undefined): ToggleWishlistApi;
|
|
55
|
+
/** Batch product fetch. Returns an empty list without a `<CommerceProvider>`. */
|
|
56
|
+
export declare function useProducts(ids: readonly string[] | undefined): ProductsQuery;
|
|
57
|
+
/** Fetch a collection's products by handle. Throws without a provider. */
|
|
58
|
+
export declare function useCollectionByHandle(handle: string | undefined): ProductsQuery;
|
|
59
|
+
/** Fetch a product's reviews + aggregate rating from the review store —
|
|
60
|
+
* a separate, third-party-shaped system, independent of the active
|
|
61
|
+
* commerce platform. Degrades to empty without a `<CommerceProvider>`. */
|
|
62
|
+
export declare function useProductReviews(product: Product | undefined, intent?: string): ProductReviewsResult;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The commerce hook SHAPES — what each hook returns, and what `addLine` takes.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `commerce-context.tsx` so that file holds the React seam (the
|
|
5
|
+
* runtime context, the inert default, the thin catalog-facing hooks) and this
|
|
6
|
+
* one holds the contract. They change for different reasons: a new hook edits
|
|
7
|
+
* the seam, a new field on an add edits the contract, and the 300-line ceiling
|
|
8
|
+
* is enforced for this package.
|
|
9
|
+
*
|
|
10
|
+
* Every name here is re-exported from `@fourty/sdk/commerce`; nothing imports
|
|
11
|
+
* this path directly from outside the SDK.
|
|
12
|
+
*/
|
|
13
|
+
import type { CartOrigin } from '../../../spacestation/src/analytics/ecommerce/index';
|
|
14
|
+
import type { Cart, OptimisticCartLine, Product, ProductReviewItem, ProductReviewHighlight } from '../../../ecommerce/src/index';
|
|
15
|
+
/**
|
|
16
|
+
* One review / one intent-matched review. Both are `z.infer` of the review
|
|
17
|
+
* schemas in `@fourty/ecommerce` — the single source of truth for the shape,
|
|
18
|
+
* shared with the `productReviews` hydration entity. Re-exported here so the
|
|
19
|
+
* commerce-hook surface stays one import.
|
|
20
|
+
*/
|
|
21
|
+
export type { ProductReviewItem, ProductReviewHighlight };
|
|
22
|
+
/**
|
|
23
|
+
* The display half of an add — what the drawer paints before the round-trip.
|
|
24
|
+
*
|
|
25
|
+
* Shared by both shapes below, so the one genuinely optional field is declared
|
|
26
|
+
* once.
|
|
27
|
+
*/
|
|
28
|
+
interface CartAddPaint {
|
|
29
|
+
/**
|
|
30
|
+
* Complete optimistic line, built at the add site from the product/variant
|
|
31
|
+
* it already holds (`buildOptimisticCartLine`). The cart drawer paints this
|
|
32
|
+
* row — real title, image, price — the instant the visitor adds, and its
|
|
33
|
+
* `merchandiseId` lets the mutation merge into an existing same-variant line
|
|
34
|
+
* instead of flashing a duplicate. Absent on the agent path (variant
|
|
35
|
+
* unresolved); the row then paints minimally and reconciles on success.
|
|
36
|
+
*/
|
|
37
|
+
optimisticLine?: OptimisticCartLine;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Everything `addLine` needs, as ONE REQUIRED OBJECT.
|
|
41
|
+
*
|
|
42
|
+
* ── WHY THIS IS AN OBJECT AND WHY IT IS REQUIRED ───────────────────────────
|
|
43
|
+
*
|
|
44
|
+
* `addLine` used to read `(spec, quantity = 1, opts?)`, and a required `opts`
|
|
45
|
+
* cannot follow an optional `quantity?` — `error TS1016`. Collapsing the two
|
|
46
|
+
* into one required object also removes the positional-arity trap permanently:
|
|
47
|
+
* there is no argument a call site can forget to move along.
|
|
48
|
+
*
|
|
49
|
+
* `origin` and `attemptId` are the two fields the metrics cannot be computed
|
|
50
|
+
* without, and neither has an honest default. A defaulted `origin` does not
|
|
51
|
+
* mean "we are not sure" — it silently answers the one question the event
|
|
52
|
+
* exists to answer. A defaulted `attemptId` collapses metric #5a from
|
|
53
|
+
* `count(distinct (session_id, attempt_id))` back into `count(*)`, which
|
|
54
|
+
* double-counts every signal whose fast path throws and recovers.
|
|
55
|
+
*/
|
|
56
|
+
export interface CartAddOptions extends CartAddPaint {
|
|
57
|
+
quantity: number;
|
|
58
|
+
/** WHO caused this write. Three actors, no default anywhere in the chain. */
|
|
59
|
+
origin: CartOrigin;
|
|
60
|
+
/**
|
|
61
|
+
* NULLABLE AND REQUIRED. A quick-add from a batch CTA knows the variant and
|
|
62
|
+
* not always the product, so writing `null` is a decision the call site has
|
|
63
|
+
* to make — a forgotten field and a deliberate null are indistinguishable
|
|
64
|
+
* afterwards.
|
|
65
|
+
*/
|
|
66
|
+
productId: string | null;
|
|
67
|
+
/**
|
|
68
|
+
* ONE visitor/agent INTENT, minted once with `mintId('add')` and shared by
|
|
69
|
+
* every `addLine` call that intent produces.
|
|
70
|
+
*
|
|
71
|
+
* One `cart.add` signal can reach `addLine` TWICE: the explicit-variant fast
|
|
72
|
+
* path sits in a `try` whose `catch` falls through to a second call via
|
|
73
|
+
* product resolution. That fallback recovers a stale variant id and is not
|
|
74
|
+
* being deleted to make a count easier, so the count is made honest instead.
|
|
75
|
+
*/
|
|
76
|
+
attemptId: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* What `useAddToCart` needs from its caller — deliberately NOT `CartAddOptions`.
|
|
80
|
+
*
|
|
81
|
+
* The hook owns `quantity` (always 1), `origin` (always the visitor — it is
|
|
82
|
+
* bound to a button they tap) and `attemptId` (minted per click). Sharing one
|
|
83
|
+
* interface would advertise three fields the hook throws away, and a prop a
|
|
84
|
+
* caller can set but that has no effect is worse than one that does not exist.
|
|
85
|
+
*/
|
|
86
|
+
export interface CartAddHints extends CartAddPaint {
|
|
87
|
+
/** Nullable and required, same reason as `CartAddOptions.productId`. */
|
|
88
|
+
productId: string | null;
|
|
89
|
+
}
|
|
90
|
+
/** Return shape of the commerce `useCart` hook. */
|
|
91
|
+
export interface CartApi {
|
|
92
|
+
cart: Cart | null;
|
|
93
|
+
isLoading: boolean;
|
|
94
|
+
error: Error | null;
|
|
95
|
+
/**
|
|
96
|
+
* Add a RESOLVED variant. The lazy `{productId, resolveMerchandiseId}` spec
|
|
97
|
+
* form is gone: nothing ever constructed one, and it was the single add shape
|
|
98
|
+
* that reached this facade with no variant id — a required field on
|
|
99
|
+
* `commerce.cart_line_added`. Keeping it would have forced either a nullable
|
|
100
|
+
* variant on the wire or an emit that quietly skips a path.
|
|
101
|
+
*/
|
|
102
|
+
addLine: (merchandiseId: string, opts: CartAddOptions) => Promise<unknown>;
|
|
103
|
+
updateLine: (lineId: string, quantity: number) => Promise<unknown>;
|
|
104
|
+
/** `origin` is a REQUIRED second parameter, not an option bag: a removal has
|
|
105
|
+
* nothing else to carry, and a required positional is what makes an
|
|
106
|
+
* un-threaded call site TS2554 instead of a silent misattribution. */
|
|
107
|
+
removeLine: (lineId: string, origin: CartOrigin) => Promise<unknown>;
|
|
108
|
+
/**
|
|
109
|
+
* Apply a promo / discount code. The backend validates it — read
|
|
110
|
+
* `cart.discountCodes[].applicable` after settle to know whether it
|
|
111
|
+
* qualified. No optimistic update (money must never be guessed).
|
|
112
|
+
*/
|
|
113
|
+
applyDiscountCode: (code: string) => Promise<unknown>;
|
|
114
|
+
/** Remove a previously applied discount code. */
|
|
115
|
+
removeDiscountCode: (code: string) => Promise<unknown>;
|
|
116
|
+
/** True while a discount apply/remove round-trip is in flight. */
|
|
117
|
+
isDiscountPending: boolean;
|
|
118
|
+
totalQuantity: number;
|
|
119
|
+
}
|
|
120
|
+
/** Return shape of the commerce `useAddToCart` hook. */
|
|
121
|
+
export interface AddToCartApi {
|
|
122
|
+
addToCart: () => void;
|
|
123
|
+
added: boolean;
|
|
124
|
+
available: boolean;
|
|
125
|
+
}
|
|
126
|
+
export interface WishlistState {
|
|
127
|
+
productIds: string[];
|
|
128
|
+
}
|
|
129
|
+
/** Return shape of the commerce `useWishlist` hook. */
|
|
130
|
+
export interface WishlistApi {
|
|
131
|
+
wishlist: WishlistState;
|
|
132
|
+
totalQuantity: number;
|
|
133
|
+
has: (productId: string) => boolean;
|
|
134
|
+
toggleLine: (productId: string) => Promise<WishlistState>;
|
|
135
|
+
removeLine: (productId: string) => Promise<WishlistState>;
|
|
136
|
+
}
|
|
137
|
+
/** Return shape of the commerce `useToggleWishlist` hook. */
|
|
138
|
+
export interface ToggleWishlistApi {
|
|
139
|
+
toggle: () => void;
|
|
140
|
+
hearted: boolean;
|
|
141
|
+
available: boolean;
|
|
142
|
+
}
|
|
143
|
+
/** Return shape of the commerce `useProducts` batch hook. */
|
|
144
|
+
export interface ProductsQuery {
|
|
145
|
+
data: Product[];
|
|
146
|
+
isLoading: boolean;
|
|
147
|
+
error: Error | null;
|
|
148
|
+
}
|
|
149
|
+
/** Return shape of the commerce `useProductReviews` hook. Reviews are a
|
|
150
|
+
* THIRD-PARTY concern (today: our own review index) — nothing to do
|
|
151
|
+
* with the active commerce platform, which is why this fetches
|
|
152
|
+
* independently rather than riding on hydrated Product entities. */
|
|
153
|
+
export interface ProductReviewsResult {
|
|
154
|
+
/** The product's FULL retrieved set — what a review list renders. */
|
|
155
|
+
reviews: ProductReviewItem[];
|
|
156
|
+
aggregate: {
|
|
157
|
+
value: number;
|
|
158
|
+
count: number;
|
|
159
|
+
};
|
|
160
|
+
/** 5★→1★ star counts over the full set (index 0 = 5-star). */
|
|
161
|
+
distribution: number[];
|
|
162
|
+
/**
|
|
163
|
+
* The reviews that ANSWER the caller's `intent`, best first, each carrying
|
|
164
|
+
* the passage that matched so a surface can mark it in place. Empty when no
|
|
165
|
+
* intent was asked for.
|
|
166
|
+
*/
|
|
167
|
+
highlights: ProductReviewHighlight[];
|
|
168
|
+
isLoading: boolean;
|
|
169
|
+
error: Error | null;
|
|
170
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Cart } from '../../../../ecommerce/src/index';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a pending buy-now may leave for checkout yet.
|
|
4
|
+
*
|
|
5
|
+
* ── Why this is a function and not a condition inside the effect ───────────
|
|
6
|
+
*
|
|
7
|
+
* Because as a condition it is three subtle tests wearing one `if`, and every
|
|
8
|
+
* way of getting it wrong ships silently:
|
|
9
|
+
*
|
|
10
|
+
* * navigating as soon as a `checkoutUrl` EXISTS takes a visitor whose cart
|
|
11
|
+
* was already non-empty to a checkout WITHOUT the item they just chose to
|
|
12
|
+
* buy — and it does that only for returning visitors, so it looks fine to
|
|
13
|
+
* whoever tests it with an empty cart;
|
|
14
|
+
* * navigating as soon as the line APPEARS takes them to a checkout that
|
|
15
|
+
* does not have it either, because `buildOptimisticCartLine` paints the row
|
|
16
|
+
* before the mutation lands. The optimistic row is a promise about the
|
|
17
|
+
* future, and `checkoutUrl` points at the present;
|
|
18
|
+
* * waiting for a cart that never settles hangs the button forever, which is
|
|
19
|
+
* the one failure the visitor cannot diagnose or retry.
|
|
20
|
+
*
|
|
21
|
+
* So the rule is stated once, in one place, against a value a test can
|
|
22
|
+
* construct: the line must be ON the cart and NOT pending, and the cart must
|
|
23
|
+
* carry a usable exit.
|
|
24
|
+
*/
|
|
25
|
+
export type BuyNowExit =
|
|
26
|
+
/** Not yet — the cart has not settled this line. The caller keeps waiting
|
|
27
|
+
* (under its own timeout; this function has no opinion about time). */
|
|
28
|
+
{
|
|
29
|
+
readonly kind: 'wait';
|
|
30
|
+
}
|
|
31
|
+
/** Go. The url is the settled cart's own checkout exit. */
|
|
32
|
+
| {
|
|
33
|
+
readonly kind: 'exit';
|
|
34
|
+
readonly url: string;
|
|
35
|
+
};
|
|
36
|
+
export declare function resolveBuyNowExit(cart: Cart | null, pendingVariantId: string): BuyNowExit;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** What a failed action targeted — a product line or a discount code. */
|
|
2
|
+
export interface CartActionSubject {
|
|
3
|
+
productId?: string;
|
|
4
|
+
code?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface CartActionFailure {
|
|
7
|
+
/** The dotted action verb that failed (`cart.add`, `cart.discount.apply`). */
|
|
8
|
+
action: string;
|
|
9
|
+
productId?: string;
|
|
10
|
+
code?: string;
|
|
11
|
+
/**
|
|
12
|
+
* WHAT HAPPENED, in words safe to show the person it happened to — the
|
|
13
|
+
* drawer renders this verbatim.
|
|
14
|
+
*
|
|
15
|
+
* Nothing phrased AT the model belongs here, and nothing phrased at the
|
|
16
|
+
* model belongs anywhere else in this store either. A failure record is a
|
|
17
|
+
* report of fact; what the agent should DO about a failure is the agent
|
|
18
|
+
* layer's call, decided server-side against the sealed honesty boundary
|
|
19
|
+
* (architecture-invariants §VIII.4). The client does not write the model's
|
|
20
|
+
* instructions — a directive that rode this field once already reached a
|
|
21
|
+
* shopper's screen.
|
|
22
|
+
*/
|
|
23
|
+
reason: string;
|
|
24
|
+
/** Epoch ms — lets the store expire stale entries. */
|
|
25
|
+
at: number;
|
|
26
|
+
}
|
|
27
|
+
/** Record a failed cart write. Replaces any prior entry for the same
|
|
28
|
+
* action + subject (the latest attempt's outcome is the truth). */
|
|
29
|
+
export declare function recordCartActionFailure(action: string, subject: CartActionSubject, reason: string): void;
|
|
30
|
+
/** A later SUCCESSFUL write for the same subject retires its failure
|
|
31
|
+
* entries — the failure is no longer the current truth. */
|
|
32
|
+
export declare function clearCartActionFailures(subject: CartActionSubject): void;
|
|
33
|
+
/**
|
|
34
|
+
* The non-React read. Exported because a WebMCP tool's `execute` runs outside
|
|
35
|
+
* the render cycle and has to know whether the write it just dispatched FAILED
|
|
36
|
+
* — without it, the only way to await a cart mutation is to wait for a line
|
|
37
|
+
* that may never arrive and then report a timeout instead of the reason.
|
|
38
|
+
*/
|
|
39
|
+
export declare function readCartActionFailures(): readonly CartActionFailure[];
|
|
40
|
+
/** Reactive read for the state-report bridge. Expired entries are pruned on
|
|
41
|
+
* write, not read (reads must stay referentially stable for
|
|
42
|
+
* useSyncExternalStore). */
|
|
43
|
+
export declare function useCartActionFailures(): CartActionFailure[];
|
|
44
|
+
/**
|
|
45
|
+
* The visitor-facing read: failures that belong to a cart LINE, for a drawer to
|
|
46
|
+
* show next to (or in place of) the rows they were meant to become.
|
|
47
|
+
*
|
|
48
|
+
* Discount-code failures are excluded — those belong to the promo field that
|
|
49
|
+
* submitted them, not to the line list. Pass the productIds currently in the
|
|
50
|
+
* cart and a failure for a product that IS in the cart is filtered out too: the
|
|
51
|
+
* visitor can see it landed, so a stale record from an earlier attempt is noise
|
|
52
|
+
* rather than news.
|
|
53
|
+
*/
|
|
54
|
+
export declare function useCartActionFailuresFor(productIdsInCart: readonly string[]): CartActionFailure[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The line the drawer should momentarily spotlight — set when a cart WRITE
|
|
2
|
+
* opened the drawer (the visitor's or the agent's), so the row that changed
|
|
3
|
+
* visibly announces itself instead of relying on the badge tick. `at` keys
|
|
4
|
+
* the one-shot animation; consumers decide their own recency window. */
|
|
5
|
+
export interface CartDrawerFocus {
|
|
6
|
+
productId: string;
|
|
7
|
+
at: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function openCartDrawer(): void;
|
|
10
|
+
/** Open the drawer spotlighting the product whose line just changed. Always
|
|
11
|
+
* notifies (even when already open) — a fresh write means a fresh pulse. */
|
|
12
|
+
export declare function openCartDrawerFocusedOn(productId: string): void;
|
|
13
|
+
/** React hook — the drawer's current spotlight target (null when none). */
|
|
14
|
+
export declare function useCartDrawerFocus(): CartDrawerFocus | null;
|
|
15
|
+
export declare function closeCartDrawer(): void;
|
|
16
|
+
export declare function toggleCartDrawer(): void;
|
|
17
|
+
/** React hook — whether the cart drawer is open. */
|
|
18
|
+
export declare function useCartDrawerOpen(): boolean;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHY a checkout handoff went nowhere — every sentence, in one file.
|
|
3
|
+
*
|
|
4
|
+
* ── THESE ARE READ ALOUD TO THE VISITOR ────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* The store's `reason` is narrated by the agent and rendered VERBATIM in the
|
|
7
|
+
* drawer (`commerce-state-report-bridge.tsx`), so each one has to survive being
|
|
8
|
+
* repeated to the person it happened to. Nothing phrased at the model belongs
|
|
9
|
+
* here.
|
|
10
|
+
*
|
|
11
|
+
* ── ONE FILE BECAUSE FIVE SENTENCES IN TWO PACKAGES DRIFTED ────────────────
|
|
12
|
+
*
|
|
13
|
+
* `CHECKOUT_CANCELLED_REASON` used to live in `@fourty/react`'s
|
|
14
|
+
* `checkout-handoff-bridge.tsx`, which meant the reasons for a handoff going
|
|
15
|
+
* nowhere were written across two packages and the read layer could only tell
|
|
16
|
+
* them apart by exact-matching prose. `REFUSAL_REASON` below is the fix: the
|
|
17
|
+
* mutators take the machine DISCRIMINATOR and derive the sentence from it, and
|
|
18
|
+
* a fourth `CheckoutRefusal` with no sentence is a compile error.
|
|
19
|
+
*/
|
|
20
|
+
import type { CheckoutRefusal } from '../../../../spacestation/src/analytics/ecommerce/index';
|
|
21
|
+
import type { ExternalNavigationResult } from '../external-navigation';
|
|
22
|
+
/** The sentence the agent narrates when the browser refused the tab. It says
|
|
23
|
+
* what is TRUE (they never left) and points at the bag, without asserting
|
|
24
|
+
* what is on screen: this outcome is only reachable in embedded contexts,
|
|
25
|
+
* and the embed shell has no cart drawer to promise them — measured in the
|
|
26
|
+
* admin playground, 2026-08-02. A reason the agent repeats verbatim must not
|
|
27
|
+
* describe a control that may not be there. */
|
|
28
|
+
export declare const CHECKOUT_BLOCKED_REASON = "the browser blocked the checkout tab, so the visitor has NOT reached checkout and is still on the page. Tell them plainly and point them at their bag to check out from there; never imply they arrived.";
|
|
29
|
+
export declare const CHECKOUT_NO_URL_REASON = "nothing happened \u2014 the cart carried no checkout link by the time the handoff fired.";
|
|
30
|
+
/** Refused before arming: there is nothing to check out. */
|
|
31
|
+
export declare const CHECKOUT_EMPTY_CART_REASON = "nothing happened \u2014 the cart is empty, so there is nothing to check out. Say so and help them add something first.";
|
|
32
|
+
/** Refused before arming: the cart exists but carries no checkout link yet. */
|
|
33
|
+
export declare const CHECKOUT_NO_LINK_REASON = "nothing happened \u2014 this cart carries no checkout link yet. Tell them plainly and point them at their bag to check out from there.";
|
|
34
|
+
/**
|
|
35
|
+
* The armed exit was dropped because the visitor cancelled the turn.
|
|
36
|
+
*
|
|
37
|
+
* It used to live in `checkout-handoff-bridge.tsx` in the engine, which meant
|
|
38
|
+
* the four reasons for a handoff going nowhere were written in two packages.
|
|
39
|
+
* Here, beside its three siblings and inside the map below, the discriminator
|
|
40
|
+
* and the prose cannot drift.
|
|
41
|
+
*/
|
|
42
|
+
export declare const CHECKOUT_CANCELLED_REASON = "the visitor cancelled that turn before the checkout handoff fired \u2014 no navigation happened.";
|
|
43
|
+
/**
|
|
44
|
+
* Discriminator → the sentence the agent narrates.
|
|
45
|
+
*
|
|
46
|
+
* Exhaustive by type: a fourth `CheckoutRefusal` with no sentence is TS2741,
|
|
47
|
+
* which is the whole reason the mutators take the discriminator and derive the
|
|
48
|
+
* prose rather than accepting a string.
|
|
49
|
+
*/
|
|
50
|
+
export declare const REFUSAL_REASON: Record<CheckoutRefusal, string>;
|
|
51
|
+
/** The agent-facing WHY for a navigation result, or null when it carried them
|
|
52
|
+
* through. One mapping, shared by every exit call site (the agent's bridge
|
|
53
|
+
* and both visitor CTAs) so the same outcome can't be explained two ways. */
|
|
54
|
+
export declare function checkoutHandoffReasonFor(result: ExternalNavigationResult): string | null;
|