@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,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who caused a cart write. THREE actors, not two.
|
|
3
|
+
*
|
|
4
|
+
* The visitor, the site's own agent, and an EXTERNAL WebMCP client —
|
|
5
|
+
* `packages/react/src/provider/webmcp/tools-commerce.ts` fires `cart.add` from
|
|
6
|
+
* outside the page entirely. Folding that into either of the other two is a lie
|
|
7
|
+
* about which surface earned the add, and it is the surface a merchant is most
|
|
8
|
+
* likely to be asking about.
|
|
9
|
+
*
|
|
10
|
+
* REQUIRED on every cart event, with NO DEFAULT anywhere in the chain. A
|
|
11
|
+
* defaulted origin does not mean "we are not sure" — it silently answers the
|
|
12
|
+
* one question the event exists to answer, and the answer it gives is that
|
|
13
|
+
* whichever value we defaulted to did all the work. `selection-signal.ts:22`
|
|
14
|
+
* shows the shape to avoid: a one-member union where ABSENCE means agent.
|
|
15
|
+
*/
|
|
16
|
+
export declare const CART_ORIGINS: readonly ["visitor", "agent", "webmcp"];
|
|
17
|
+
export type CartOrigin = (typeof CART_ORIGINS)[number];
|
|
18
|
+
/**
|
|
19
|
+
* Who took (or was refused) a checkout exit. TWO values, and deliberately not
|
|
20
|
+
* `CartOrigin`: `CheckoutHandoffOrigin` in the SDK's store is `agent | visitor`,
|
|
21
|
+
* and a WebMCP-driven arm books as `agent` there because the arm is performed by
|
|
22
|
+
* the agent's own handoff path. The two unions do not line up, they are not made
|
|
23
|
+
* to line up, and the metric dictionary carries that as a row.
|
|
24
|
+
*/
|
|
25
|
+
export declare const CHECKOUT_ORIGINS: readonly ["visitor", "agent"];
|
|
26
|
+
export type CheckoutOrigin = (typeof CHECKOUT_ORIGINS)[number];
|
|
27
|
+
/**
|
|
28
|
+
* What the exit did. Mirrors `CheckoutHandoffOutcome` in
|
|
29
|
+
* `packages/sdk/src/commerce/ecommerce/checkout-handoff-store.ts:49`
|
|
30
|
+
* (`'armed' | 'unavailable' | ExternalNavigationResult`). Listed here rather
|
|
31
|
+
* than imported because `apps/api` cannot reach `@fourty/sdk`; the SDK's own
|
|
32
|
+
* type is expected to derive FROM this one when the emit sites are threaded, so
|
|
33
|
+
* the two cannot drift.
|
|
34
|
+
*/
|
|
35
|
+
export declare const CHECKOUT_OUTCOMES: readonly ["armed", "unavailable", "redirected", "new-tab", "blocked", "no-url"];
|
|
36
|
+
export type CheckoutOutcome = (typeof CHECKOUT_OUTCOMES)[number];
|
|
37
|
+
/**
|
|
38
|
+
* The outcomes where the visitor actually REACHED the store's checkout.
|
|
39
|
+
*
|
|
40
|
+
* Named once, here, beside the union it narrows. `armed` is a commitment that
|
|
41
|
+
* may never fire, `unavailable` and `no-url` are refusals, and `blocked` is the
|
|
42
|
+
* browser refusing the tab — none of them put a visitor in front of a payment
|
|
43
|
+
* form. Every reader that asks "did this session leave for checkout" asks it
|
|
44
|
+
* through this set, so the answer cannot drift between two of them.
|
|
45
|
+
*/
|
|
46
|
+
export declare const CHECKOUT_REACHED_OUTCOMES: readonly ["redirected", "new-tab"];
|
|
47
|
+
export type CheckoutReachedOutcome = (typeof CHECKOUT_REACHED_OUTCOMES)[number];
|
|
48
|
+
/**
|
|
49
|
+
* WHY an `unavailable` outcome was unavailable — a machine discriminator, so
|
|
50
|
+
* the read layer never has to exact-match a prose reason string.
|
|
51
|
+
*
|
|
52
|
+
* Three different things land on `unavailable` today and the third is not a
|
|
53
|
+
* checkout attempt at all: the visitor CANCELLED THE TURN before the exit
|
|
54
|
+
* fired. Counting it as an attempt understates the reach rate of every checkout
|
|
55
|
+
* the agent actually offered. Metric #9 excludes `cancelled-turn` from its
|
|
56
|
+
* attempt count entirely.
|
|
57
|
+
*/
|
|
58
|
+
export declare const CHECKOUT_REFUSALS: readonly ["empty-cart", "no-link", "cancelled-turn"];
|
|
59
|
+
export type CheckoutRefusal = (typeof CHECKOUT_REFUSALS)[number];
|
|
60
|
+
/** What produced a cart settlement. */
|
|
61
|
+
export declare const CART_SETTLE_TRIGGERS: readonly ["mutation", "restore"];
|
|
62
|
+
export type CartSettleTrigger = (typeof CART_SETTLE_TRIGGERS)[number];
|
|
63
|
+
/**
|
|
64
|
+
* One add-to-cart ATTEMPT.
|
|
65
|
+
*
|
|
66
|
+
* ATTEMPT, not landed line, and the dictionary says so: the emit sits ABOVE the
|
|
67
|
+
* mutation, and the add's `onError` only reverts the optimistic paint, so a
|
|
68
|
+
* refused merchandise id still emits. That is the honest place for it — the
|
|
69
|
+
* alternative counts adds and removes by different rules, and two numbers that
|
|
70
|
+
* cannot be reconciled with each other are worse than one that is explicit
|
|
71
|
+
* about what it counts.
|
|
72
|
+
*/
|
|
73
|
+
export declare const CART_LINE_ADDED: import("..").EventKind<"commerce.cart_line_added", {
|
|
74
|
+
productId: string | null;
|
|
75
|
+
quantity: number;
|
|
76
|
+
attemptId: string;
|
|
77
|
+
variantId: string;
|
|
78
|
+
origin: "visitor" | "agent" | "webmcp";
|
|
79
|
+
}, "client">;
|
|
80
|
+
/**
|
|
81
|
+
* One cart line removed.
|
|
82
|
+
*
|
|
83
|
+
* Ships with the add because #5a's denominator is dishonest without it: a
|
|
84
|
+
* session that adds and then removes is not the same session as one that adds
|
|
85
|
+
* and keeps, and a rail that can only see adds cannot tell them apart.
|
|
86
|
+
*/
|
|
87
|
+
export declare const CART_LINE_REMOVED: import("..").EventKind<"commerce.cart_line_removed", {
|
|
88
|
+
productId: string | null;
|
|
89
|
+
origin: "visitor" | "agent" | "webmcp";
|
|
90
|
+
lineId: string;
|
|
91
|
+
}, "client">;
|
|
92
|
+
/**
|
|
93
|
+
* The cart, as it stands after it settled. Metric #7 reads the LATEST of these
|
|
94
|
+
* per session (`DISTINCT ON (session_id) ORDER BY occurred_at DESC`), which is
|
|
95
|
+
* why there is deliberately no unload cart beacon: an unload beacon is the least
|
|
96
|
+
* reliable delivery in the browser, and the last settled state is already the
|
|
97
|
+
* answer.
|
|
98
|
+
*
|
|
99
|
+
* ── THE MONEY IS SHIPPED AS THE CLIENT SEES IT, AND THE SERVER CONVERTS ────
|
|
100
|
+
*
|
|
101
|
+
* `subtotalAmount` is a float and `currencyCode` is a string, verbatim, because
|
|
102
|
+
* that is genuinely all the SDK holds: `MoneySchema.amount` is a bare
|
|
103
|
+
* `z.number()`, already a float by the time the Shopify mapper's `parseFloat`
|
|
104
|
+
* is done with it. Building minor units here would mean a `*100` at the emit
|
|
105
|
+
* site — 100× wrong for JPY, 10× for KWD, plus IEEE-754 rounding — and there is
|
|
106
|
+
* no currency-exponent source in this repo to read. The ingest route converts to
|
|
107
|
+
* `amount_minor` + `currency_exponent` against a checked-in ISO-4217 table, one
|
|
108
|
+
* place to be right; a currency that table does not know becomes a
|
|
109
|
+
* `client_event_exceptions` row, never a silent zero.
|
|
110
|
+
*/
|
|
111
|
+
export declare const CART_SETTLED: import("..").EventKind<"commerce.cart_settled", {
|
|
112
|
+
trigger: "mutation" | "restore";
|
|
113
|
+
lineCount: number;
|
|
114
|
+
totalQuantity: number;
|
|
115
|
+
subtotalAmount: number;
|
|
116
|
+
currencyCode: string;
|
|
117
|
+
totalsPending: boolean;
|
|
118
|
+
backOfficeRef: string | null;
|
|
119
|
+
}, "client">;
|
|
120
|
+
/**
|
|
121
|
+
* One checkout exit — taken, refused, or armed and never fired.
|
|
122
|
+
*
|
|
123
|
+
* ── `attempt` IS LOAD-BEARING, NOT DECORATION ──────────────────────────────
|
|
124
|
+
*
|
|
125
|
+
* Metric #9 is `count(distinct (session_id, attempt))`. `count(*)` reads the
|
|
126
|
+
* agent's number roughly 2× high, by the store's own construction: arming does
|
|
127
|
+
* `attempt + 1` and settling does `attempt` — two emits, ONE attempt — while
|
|
128
|
+
* the visitor's exit is one emit, one attempt. So agent attempts inflate by a
|
|
129
|
+
* non-constant 1–2× while visitor attempts do not, and `reached / attempts` is
|
|
130
|
+
* structurally halved for the agent.
|
|
131
|
+
*
|
|
132
|
+
* And do NOT substitute `count(*) WHERE outcome <> 'armed'`: it looks
|
|
133
|
+
* equivalent and drops a dangling arm (tab closed while armed), which the
|
|
134
|
+
* distinct form counts. An implementer who deletes `attempt` as "an internal
|
|
135
|
+
* counter" breaks the metric.
|
|
136
|
+
*/
|
|
137
|
+
export declare const CHECKOUT_CLICKED: import("..").EventKind<"commerce.checkout_clicked", {
|
|
138
|
+
origin: "visitor" | "agent";
|
|
139
|
+
outcome: "armed" | "unavailable" | "redirected" | "new-tab" | "blocked" | "no-url";
|
|
140
|
+
refusal: "empty-cart" | "no-link" | "cancelled-turn" | null;
|
|
141
|
+
attempt: number;
|
|
142
|
+
}, "client">;
|
|
143
|
+
/**
|
|
144
|
+
* One click on a registry destination — Amazon, Babylist, or whatever partner a
|
|
145
|
+
* space wires next.
|
|
146
|
+
*
|
|
147
|
+
* ── WHY THIS IS A CART EVENT'S SIBLING AND NOT ITS OWN FAMILY ──────────────
|
|
148
|
+
*
|
|
149
|
+
* For a brand that does not close the sale on its own storefront, the registry
|
|
150
|
+
* click IS the conversion action: the visitor has chosen the product and left
|
|
151
|
+
* to acquire it. `client_sessions_scoped` therefore counts it INTO the
|
|
152
|
+
* add-to-cart numerator alongside `cart_line_added`, so one number answers "did
|
|
153
|
+
* this session convert" however the space's visitors actually convert.
|
|
154
|
+
*
|
|
155
|
+
* The KIND stays distinct even though the metric merges, and that is the whole
|
|
156
|
+
* design. An outbound click to Amazon and an on-site cart write are not the
|
|
157
|
+
* same act — one of them we can still observe afterwards and one of them we
|
|
158
|
+
* cannot — so the row keeps its own name, its own payload and its own partner.
|
|
159
|
+
* The merge lives in ONE `WHERE e_kind IN (...)` in the read layer, which means
|
|
160
|
+
* splitting them back apart later is a query change and not an archaeology
|
|
161
|
+
* project. A shared `cart_line_added` kind with a `partner` field would have
|
|
162
|
+
* thrown that away permanently on the first write.
|
|
163
|
+
*
|
|
164
|
+
* ── `attemptId` AND `origin` ───────────────────────────────────────────────
|
|
165
|
+
*
|
|
166
|
+
* Both are here so this kind slots into the `adds` CTE with no special case:
|
|
167
|
+
* that CTE counts `DISTINCT attemptId` and splits by `origin`, and a kind that
|
|
168
|
+
* carried neither would need its own branch in a query whose whole point is
|
|
169
|
+
* that the two arrive already comparable.
|
|
170
|
+
*
|
|
171
|
+
* `origin` is `CART_ORIGINS` and is always written `visitor` TODAY — not as a
|
|
172
|
+
* default, but because the only emit site is an anchor's `onClick` and an
|
|
173
|
+
* anchor cannot be clicked by an agent. If a registry hand-off ever becomes
|
|
174
|
+
* something the agent performs, that site writes `agent` and every split
|
|
175
|
+
* downstream is already correct. This is the opposite of the one-member-union
|
|
176
|
+
* trap: the union is honest and wide, and the emit site asserts its value.
|
|
177
|
+
*/
|
|
178
|
+
export declare const REGISTRY_CLICKED: import("..").EventKind<"commerce.registry_clicked", {
|
|
179
|
+
productId: string | null;
|
|
180
|
+
attemptId: string;
|
|
181
|
+
origin: "visitor" | "agent" | "webmcp";
|
|
182
|
+
partnerId: string;
|
|
183
|
+
}, "client">;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The commerce funnel's steps and their names — ONE definition for the
|
|
3
|
+
* dashboard's schema, the dashboard's "Reached" filter and the session log's
|
|
4
|
+
* funnel filter.
|
|
5
|
+
*
|
|
6
|
+
* The ids are the ones the database readers switch on
|
|
7
|
+
* (`client_sessions_scoped.p_funnel_step`, `session_queue_base.funnel_steps`).
|
|
8
|
+
* The labels live HERE, in the vertical, and not in console chrome: two of the
|
|
9
|
+
* steps are named after acts only commerce has, and the console prints what the
|
|
10
|
+
* vertical calls them the same way it prints an event kind verbatim
|
|
11
|
+
* (architecture-invariants §XIII.4).
|
|
12
|
+
*/
|
|
13
|
+
export declare const FUNNEL_STEPS: readonly ["started", "engaged", "surfaced", "cart", "handoff"];
|
|
14
|
+
export type FunnelStep = (typeof FUNNEL_STEPS)[number];
|
|
15
|
+
export declare const FUNNEL_STEP_LABELS: Record<FunnelStep, string>;
|
|
16
|
+
/**
|
|
17
|
+
* What each ACQUIRING event kind is called where a person reads it — the cart
|
|
18
|
+
* step's detail ("Cart ×2 · Registry ×1"). Keyed by event kind; a kind with no
|
|
19
|
+
* entry is printed by its own name, so a new one is never hidden.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ACQUISITION_KIND_LABELS: Readonly<Record<string, string>>;
|
|
22
|
+
export declare function isFunnelStep(value: string): value is FunnelStep;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@fourty/spacestation/analytics/ecommerce` — the commerce half of the
|
|
3
|
+
* analytics contract.
|
|
4
|
+
*
|
|
5
|
+
* Imported by `apps/api` to assemble the server catalog, and re-exported
|
|
6
|
+
* through `@fourty/sdk/commerce` for the browser — never imported directly by a
|
|
7
|
+
* package that already depends on `@fourty/sdk`
|
|
8
|
+
* (`docs/architecture-invariants.md:90-96`).
|
|
9
|
+
*/
|
|
10
|
+
export { CART_LINE_ADDED, CART_LINE_REMOVED, CART_ORIGINS, CART_SETTLED, CART_SETTLE_TRIGGERS, CHECKOUT_CLICKED, CHECKOUT_ORIGINS, CHECKOUT_OUTCOMES, CHECKOUT_REACHED_OUTCOMES, CHECKOUT_REFUSALS, REGISTRY_CLICKED, } from './events';
|
|
11
|
+
export { PRODUCTS_SURFACED } from './surfacing';
|
|
12
|
+
export { ACQUISITION_KIND_LABELS, FUNNEL_STEPS, FUNNEL_STEP_LABELS, isFunnelStep } from './funnel';
|
|
13
|
+
export type { FunnelStep } from './funnel';
|
|
14
|
+
export type { CartOrigin, CartSettleTrigger, CheckoutOrigin, CheckoutOutcome, CheckoutReachedOutcome, CheckoutRefusal, } from './events';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What ONE turn put on the canvas — the event the dead-end rate is built on.
|
|
3
|
+
*
|
|
4
|
+
* ── IT FIRES ON EVERY TURN, INCLUDING THE ONES THAT SURFACED NOTHING ───────
|
|
5
|
+
*
|
|
6
|
+
* That is the entire reason it exists. Without it, "the visitor asked and got
|
|
7
|
+
* nothing back" and "the visitor never asked" are the same absence of rows, and
|
|
8
|
+
* a dead-end rate computed from absence is a rate whose numerator is silence.
|
|
9
|
+
* So `productCount` is `nonnegative`, not `positive`: a ZERO is the row that
|
|
10
|
+
* carries the information, and a call site that skips the emit when it has
|
|
11
|
+
* nothing to report deletes the metric.
|
|
12
|
+
*
|
|
13
|
+
* ── `productCount` IS WHAT THIS TURN ADDED, NOT WHAT IS ON SCREEN ──────────
|
|
14
|
+
*
|
|
15
|
+
* The canvas accumulates. A visitor who was shown a grid on turn 1 and then
|
|
16
|
+
* asks two questions the catalog cannot answer is still looking at that grid,
|
|
17
|
+
* so "entities visible now" reads three surfacing turns where there was one.
|
|
18
|
+
* The count is therefore the entity refs the turn PLACED that were not placed
|
|
19
|
+
* before it — the same `resolved()`-walk `collectLayoutGids` already does,
|
|
20
|
+
* diffed across the turn.
|
|
21
|
+
*
|
|
22
|
+
* ── WHY THIS IS `client` TRUST AND NOT `server` ────────────────────────────
|
|
23
|
+
*
|
|
24
|
+
* The agent naming an entity id and the visitor SEEING one are different facts,
|
|
25
|
+
* and the gap between them is exactly the failure this metric is meant to catch:
|
|
26
|
+
* a hallucinated ref, a hydration that resolved below its minimum, a component
|
|
27
|
+
* that dropped the array. A server-asserted count would report those turns as
|
|
28
|
+
* successful surfacings. The browser is the only party that knows what landed.
|
|
29
|
+
*
|
|
30
|
+
* ── WHAT IT DELIBERATELY DOES NOT CLAIM ────────────────────────────────────
|
|
31
|
+
*
|
|
32
|
+
* A zero-product turn is not automatically a failed turn: "what is your returns
|
|
33
|
+
* policy" is answered in prose and surfaces nothing, correctly. This kind
|
|
34
|
+
* reports the OBSERVATION; deciding which zeroes are dead ends is the read
|
|
35
|
+
* layer's job, and it makes that call at SESSION grain (a session that never
|
|
36
|
+
* surfaced anything across any of its turns) precisely because no single turn's
|
|
37
|
+
* zero is conclusive on its own.
|
|
38
|
+
*/
|
|
39
|
+
export declare const PRODUCTS_SURFACED: import("..").EventKind<"commerce.products_surfaced", {
|
|
40
|
+
turnId: string;
|
|
41
|
+
productCount: number;
|
|
42
|
+
}, "client">;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The batch wire shape, and the three closed vocabularies it carries.
|
|
3
|
+
*
|
|
4
|
+
* ONE definition: constructed by the transport in `@fourty/react`, parsed by
|
|
5
|
+
* the ingest route in `apps/api`. Neither side redeclares it, because two
|
|
6
|
+
* declarations of a wire format is how a producer and a consumer end up
|
|
7
|
+
* disagreeing about a field nobody changed.
|
|
8
|
+
*
|
|
9
|
+
* ── WHY THE VOCABULARIES LIVE HERE AND NOT IN THE SDK ──────────────────────
|
|
10
|
+
*
|
|
11
|
+
* `apps/api` does not depend on `@fourty/sdk` (`apps/api/package.json` lists
|
|
12
|
+
* agent, agent-tools, the brand packages, ecommerce, logger, platform, shopify,
|
|
13
|
+
* spacestation, ui — and no sdk). The ingest route has to validate `surface` and
|
|
14
|
+
* `consent` against the same closed sets the browser emits, so those sets must
|
|
15
|
+
* live in the package both sides already depend on. The SDK keeps what is
|
|
16
|
+
* genuinely SDK-side: the exhaustive `Record<AnalyticsSurface, …>` disposition
|
|
17
|
+
* tables that decide what each surface DOES, which is behaviour, not wire.
|
|
18
|
+
*
|
|
19
|
+
* ── WHY THE ENVELOPE STRIPS UNKNOWN KEYS AND THE PAYLOADS REFUSE THEM ──────
|
|
20
|
+
*
|
|
21
|
+
* Opposite rules, on purpose, because the failure modes are opposite. A payload
|
|
22
|
+
* lands in a `jsonb` column verbatim, so an unknown key is an unreviewed field
|
|
23
|
+
* arriving on a public endpoint and `.strict()` refuses it (`kind.ts`). Envelope
|
|
24
|
+
* fields are mapped to typed COLUMNS, so an unknown key reaches nothing — while
|
|
25
|
+
* a strict envelope would mean a browser holding yesterday's bundle loses its
|
|
26
|
+
* whole batch the day a field is added. Zod's default strip is right here.
|
|
27
|
+
*/
|
|
28
|
+
import { z } from 'zod';
|
|
29
|
+
/**
|
|
30
|
+
* Where the assistant was mounted, as the CLIENT declares it. Eight values,
|
|
31
|
+
* one per real mount in this repo.
|
|
32
|
+
*
|
|
33
|
+
* This is the EMIT GATE and an ingest cross-check input. It is NEVER what a
|
|
34
|
+
* metric filters on — that is `sessions.surface`, five values, derived
|
|
35
|
+
* server-side at session creation and never client-asserted. A rate whose
|
|
36
|
+
* numerator filters on one column and whose denominator on the other is not a
|
|
37
|
+
* rate, and the two vocabularies are deliberately different sizes so that
|
|
38
|
+
* mistake cannot be made silently.
|
|
39
|
+
*
|
|
40
|
+
* An unrecognised surface is REFUSED at ingest rather than accepted as unknown:
|
|
41
|
+
* a surface we cannot name is one we cannot decide about, and the six
|
|
42
|
+
* non-emitting mounts below are exactly the traffic that must never reach a
|
|
43
|
+
* space owner's numbers.
|
|
44
|
+
*/
|
|
45
|
+
export declare const ANALYTICS_SURFACES: readonly ["spacefront", "embed", "replay", "lab", "static-canvas", "packages-preview", "console-preview", "operator-preview"];
|
|
46
|
+
export type AnalyticsSurface = (typeof ANALYTICS_SURFACES)[number];
|
|
47
|
+
export declare const AnalyticsSurfaceSchema: z.ZodEnum<["spacefront", "embed", "replay", "lab", "static-canvas", "packages-preview", "console-preview", "operator-preview"]>;
|
|
48
|
+
/**
|
|
49
|
+
* The visitor's analytics consent, as of this batch.
|
|
50
|
+
*
|
|
51
|
+
* `pending` is a real state with a real exit, not a shrug: rows emitted under it
|
|
52
|
+
* are HELD by the scope and delivered only if consent later resolves to
|
|
53
|
+
* `granted`. It appears on the wire because a batch sent while consent is
|
|
54
|
+
* pending is a batch of rows the visitor has already permitted by some other
|
|
55
|
+
* route, and the server should be able to see which regime a row arrived under.
|
|
56
|
+
*/
|
|
57
|
+
export declare const ANALYTICS_CONSENTS: readonly ["granted", "pending", "withheld"];
|
|
58
|
+
export type AnalyticsConsent = (typeof ANALYTICS_CONSENTS)[number];
|
|
59
|
+
export declare const AnalyticsConsentSchema: z.ZodEnum<["granted", "pending", "withheld"]>;
|
|
60
|
+
/**
|
|
61
|
+
* The largest batch the wire accepts, and the SDK's outbox ceiling. One number
|
|
62
|
+
* on purpose: a drain of a full outbox must fit in one batch, or the first
|
|
63
|
+
* flush after a long offline stretch is refused wholesale and the accounting
|
|
64
|
+
* that was supposed to survive it dies with it.
|
|
65
|
+
*/
|
|
66
|
+
export declare const ANALYTICS_MAX_QUEUED = 500;
|
|
67
|
+
/**
|
|
68
|
+
* Per-reason drop totals for the emitting scope's whole life — MONOTONE TOTALS,
|
|
69
|
+
* never deltas, so a batch lost in flight loses no accounting and the server can
|
|
70
|
+
* take `max()` per (space, day, scope).
|
|
71
|
+
*
|
|
72
|
+
* DELIBERATELY OPEN, where every other vocabulary in this file is closed. The
|
|
73
|
+
* producer is exhaustive by type (`DropCounts = Record<DropReason, number>` in
|
|
74
|
+
* the SDK: a new reason with no counter is a compile error there). The WIRE must
|
|
75
|
+
* additionally survive version skew in both directions — a tab holding
|
|
76
|
+
* yesterday's bundle sends a reason set with one key missing, and a tab holding
|
|
77
|
+
* tomorrow's sends one with a key added. A closed object schema refuses both and
|
|
78
|
+
* throws away the batch, which would make "no silent drop" fail exactly when the
|
|
79
|
+
* drops matter most. An unrecognised reason lands in the coverage rollup as a
|
|
80
|
+
* named bucket instead.
|
|
81
|
+
*/
|
|
82
|
+
export declare const AnalyticsDropCountsSchema: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
83
|
+
export type AnalyticsDropCounts = z.infer<typeof AnalyticsDropCountsSchema>;
|
|
84
|
+
/**
|
|
85
|
+
* One event on the wire.
|
|
86
|
+
*
|
|
87
|
+
* `kind` and `payload` are carried UNRESOLVED here: this schema proves the
|
|
88
|
+
* shape, and the catalog (`catalog.ts`) proves the kind is registered, is
|
|
89
|
+
* emittable, and that its payload matches. Splitting the two is what lets one
|
|
90
|
+
* malformed event in a batch of five become a `client_event_exceptions` row
|
|
91
|
+
* instead of a 400 that discards the other four.
|
|
92
|
+
*/
|
|
93
|
+
export declare const AnalyticsWireEventSchema: z.ZodObject<{
|
|
94
|
+
/**
|
|
95
|
+
* The idempotency key, minted at EMIT and byte-identical on retry — which is
|
|
96
|
+
* what the row's `ON CONFLICT DO NOTHING` absorption needs to make a re-sent
|
|
97
|
+
* batch a no-op rather than a double count.
|
|
98
|
+
*/
|
|
99
|
+
eventId: z.ZodString;
|
|
100
|
+
/**
|
|
101
|
+
* Wall-clock epoch milliseconds, stamped at EMIT and not at flush. A row can
|
|
102
|
+
* sit in the pre-session holding area for the reconnect budget's ~94 seconds,
|
|
103
|
+
* so a flush-time stamp would be that far wrong.
|
|
104
|
+
*
|
|
105
|
+
* VALIDATED AT INGEST, NEVER CLAMPED: the route refuses a timestamp outside a
|
|
106
|
+
* window around `received_at` with an exception row naming it. Clamping would
|
|
107
|
+
* turn a broken clock into a plausible number, which is worse than a gap.
|
|
108
|
+
*/
|
|
109
|
+
occurredAt: z.ZodNumber;
|
|
110
|
+
/**
|
|
111
|
+
* Never null on the wire. The scope holds unattributed rows until
|
|
112
|
+
* `bindSession`, so a row without a session is a row that was never sent.
|
|
113
|
+
*/
|
|
114
|
+
sessionId: z.ZodString;
|
|
115
|
+
kind: z.ZodString;
|
|
116
|
+
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
kind: string;
|
|
119
|
+
payload: Record<string, unknown>;
|
|
120
|
+
eventId: string;
|
|
121
|
+
occurredAt: number;
|
|
122
|
+
sessionId: string;
|
|
123
|
+
}, {
|
|
124
|
+
kind: string;
|
|
125
|
+
payload: Record<string, unknown>;
|
|
126
|
+
eventId: string;
|
|
127
|
+
occurredAt: number;
|
|
128
|
+
sessionId: string;
|
|
129
|
+
}>;
|
|
130
|
+
export type AnalyticsWireEvent = z.infer<typeof AnalyticsWireEventSchema>;
|
|
131
|
+
/**
|
|
132
|
+
* One flush from one mount.
|
|
133
|
+
*
|
|
134
|
+
* Deliberately absent, each for a reason:
|
|
135
|
+
* `spaceId` — the client holds a polymorphic `spaceKey`, and a space id
|
|
136
|
+
* asserted on a public endpoint is attacker-supplied anyway.
|
|
137
|
+
* The route resolves slug → uuid server-side.
|
|
138
|
+
* `visitorId` — derivable from `sessions`, and it means different things on
|
|
139
|
+
* the spacefront and the embed. A dictionary problem, not a
|
|
140
|
+
* queue problem.
|
|
141
|
+
* `source` — asserted BY the route ('client' here, by construction).
|
|
142
|
+
* A browser claiming to be the server is the one thing this
|
|
143
|
+
* contract exists to make impossible.
|
|
144
|
+
* `receivedAt` — the server's own clock, the only one it can trust.
|
|
145
|
+
* `sampleRate` — there is no sampling. A sampled count is a count nobody can
|
|
146
|
+
* reconcile against the merchant's own dashboard.
|
|
147
|
+
*/
|
|
148
|
+
export declare const AnalyticsBatchSchema: z.ZodObject<{
|
|
149
|
+
/** One mount's whole life. Lets the server see a mount's batches as one
|
|
150
|
+
* stream, and is the tiebreaker for any `(session_id, …)` dedupe key if a
|
|
151
|
+
* host ever moves from session storage to local storage. */
|
|
152
|
+
scopeId: z.ZodString;
|
|
153
|
+
surface: z.ZodEnum<["spacefront", "embed", "replay", "lab", "static-canvas", "packages-preview", "console-preview", "operator-preview"]>;
|
|
154
|
+
/** A SLUG, never an id — see `spaceId` above. */
|
|
155
|
+
spaceSlug: z.ZodString;
|
|
156
|
+
consent: z.ZodEnum<["granted", "pending", "withheld"]>;
|
|
157
|
+
drops: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
158
|
+
events: z.ZodArray<z.ZodObject<{
|
|
159
|
+
/**
|
|
160
|
+
* The idempotency key, minted at EMIT and byte-identical on retry — which is
|
|
161
|
+
* what the row's `ON CONFLICT DO NOTHING` absorption needs to make a re-sent
|
|
162
|
+
* batch a no-op rather than a double count.
|
|
163
|
+
*/
|
|
164
|
+
eventId: z.ZodString;
|
|
165
|
+
/**
|
|
166
|
+
* Wall-clock epoch milliseconds, stamped at EMIT and not at flush. A row can
|
|
167
|
+
* sit in the pre-session holding area for the reconnect budget's ~94 seconds,
|
|
168
|
+
* so a flush-time stamp would be that far wrong.
|
|
169
|
+
*
|
|
170
|
+
* VALIDATED AT INGEST, NEVER CLAMPED: the route refuses a timestamp outside a
|
|
171
|
+
* window around `received_at` with an exception row naming it. Clamping would
|
|
172
|
+
* turn a broken clock into a plausible number, which is worse than a gap.
|
|
173
|
+
*/
|
|
174
|
+
occurredAt: z.ZodNumber;
|
|
175
|
+
/**
|
|
176
|
+
* Never null on the wire. The scope holds unattributed rows until
|
|
177
|
+
* `bindSession`, so a row without a session is a row that was never sent.
|
|
178
|
+
*/
|
|
179
|
+
sessionId: z.ZodString;
|
|
180
|
+
kind: z.ZodString;
|
|
181
|
+
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
kind: string;
|
|
184
|
+
payload: Record<string, unknown>;
|
|
185
|
+
eventId: string;
|
|
186
|
+
occurredAt: number;
|
|
187
|
+
sessionId: string;
|
|
188
|
+
}, {
|
|
189
|
+
kind: string;
|
|
190
|
+
payload: Record<string, unknown>;
|
|
191
|
+
eventId: string;
|
|
192
|
+
occurredAt: number;
|
|
193
|
+
sessionId: string;
|
|
194
|
+
}>, "many">;
|
|
195
|
+
}, "strip", z.ZodTypeAny, {
|
|
196
|
+
scopeId: string;
|
|
197
|
+
surface: "spacefront" | "embed" | "replay" | "lab" | "static-canvas" | "packages-preview" | "console-preview" | "operator-preview";
|
|
198
|
+
spaceSlug: string;
|
|
199
|
+
consent: "granted" | "pending" | "withheld";
|
|
200
|
+
drops: Record<string, number>;
|
|
201
|
+
events: {
|
|
202
|
+
kind: string;
|
|
203
|
+
payload: Record<string, unknown>;
|
|
204
|
+
eventId: string;
|
|
205
|
+
occurredAt: number;
|
|
206
|
+
sessionId: string;
|
|
207
|
+
}[];
|
|
208
|
+
}, {
|
|
209
|
+
scopeId: string;
|
|
210
|
+
surface: "spacefront" | "embed" | "replay" | "lab" | "static-canvas" | "packages-preview" | "console-preview" | "operator-preview";
|
|
211
|
+
spaceSlug: string;
|
|
212
|
+
consent: "granted" | "pending" | "withheld";
|
|
213
|
+
drops: Record<string, number>;
|
|
214
|
+
events: {
|
|
215
|
+
kind: string;
|
|
216
|
+
payload: Record<string, unknown>;
|
|
217
|
+
eventId: string;
|
|
218
|
+
occurredAt: number;
|
|
219
|
+
sessionId: string;
|
|
220
|
+
}[];
|
|
221
|
+
}>;
|
|
222
|
+
export type AnalyticsBatch = z.infer<typeof AnalyticsBatchSchema>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@fourty/spacestation/analytics` — the visitor-analytics WIRE CONTRACT.
|
|
3
|
+
*
|
|
4
|
+
* What a client may assert, what the payload of each kind is, and what a batch
|
|
5
|
+
* of them looks like on the wire. Both sides of the rail import it: the emit
|
|
6
|
+
* surface in `@fourty/sdk` and the ingest route in `apps/api`, which cannot
|
|
7
|
+
* reach the SDK at all.
|
|
8
|
+
*
|
|
9
|
+
* ── NO VERTICAL VOCABULARY IN THIS BARREL ──────────────────────────────────
|
|
10
|
+
*
|
|
11
|
+
* No cart, no product, no checkout, no order, no price. Ecommerce is one
|
|
12
|
+
* connector, not the product — its kinds live in `./ecommerce` and are exported
|
|
13
|
+
* from their own subpath, so a second vertical is a new directory rather than
|
|
14
|
+
* an edit here.
|
|
15
|
+
*
|
|
16
|
+
* ── WHAT THIS CONTRACT IS NOT ──────────────────────────────────────────────
|
|
17
|
+
*
|
|
18
|
+
* Not an aggregation, not a rollup, not a read path. Every number a merchant
|
|
19
|
+
* reads is derived server-side from rows, where the denominator is knowable. A
|
|
20
|
+
* rate computed in a browser is a rate computed over one browser.
|
|
21
|
+
*/
|
|
22
|
+
export { defineEventKind } from './kind';
|
|
23
|
+
export type { AnyEventKind, ClientEventKind, EventKind, EventTrust, Identical, NameOf, PayloadGuard, PayloadOf, } from './kind';
|
|
24
|
+
export { ENGAGEMENT_DWELL_MS, SESSION_ENGAGED } from './session';
|
|
25
|
+
export { catalogEmittableSchema, catalogEventSchema, eventCatalog } from './catalog';
|
|
26
|
+
export type { CatalogEmittable, CatalogEvent, EmittableOf, EventCatalog, EventOf, } from './catalog';
|
|
27
|
+
export { ANALYTICS_CONSENTS, ANALYTICS_MAX_QUEUED, ANALYTICS_SURFACES, AnalyticsBatchSchema, AnalyticsConsentSchema, AnalyticsDropCountsSchema, AnalyticsSurfaceSchema, AnalyticsWireEventSchema, } from './envelope';
|
|
28
|
+
export type { AnalyticsBatch, AnalyticsConsent, AnalyticsDropCounts, AnalyticsSurface, AnalyticsWireEvent, } from './envelope';
|