pub struct FunnelSession { /* private fields */ }Expand description
A running funnel, owned by the façade for the life of the presentation.
No Debug: the queue and clock behind it don’t implement it, and a
debug dump of a live session would be noise anyway.
Opened through RovenueCore::open_funnel (emitting) or the
open_preview_funnel namespace function (never emitting), never
constructed directly: a live session holds the durable event queue and
stamps every event with the presentation id, so emission lives here
once (W10) rather than in each façade.
Implementations§
Source§impl FunnelSession
impl FunnelSession
Sourcepub fn open(
funnel: CoreFunnel,
locale: String,
today: Option<String>,
restored_state_json: Option<String>,
queue: Arc<EventQueue>,
rovenue_id: String,
clock: Arc<dyn Clock>,
) -> RovenueResult<Self>
pub fn open( funnel: CoreFunnel, locale: String, today: Option<String>, restored_state_json: Option<String>, queue: Arc<EventQueue>, rovenue_id: String, clock: Arc<dyn Clock>, ) -> RovenueResult<Self>
Open a funnel presentation on funnel’s published document.
The offering comes from funnel.offering (see map_offering); an
empty funnel_id — a cached or bundled response predating the
field — is refused loudly rather than emitted unattributable.
A fresh open emits funnel_view plus funnel_screen_view for the
first screen. A restored open emits nothing and keeps the stored
presentation id.
Sourcepub fn open_preview(
payload_json: String,
locale: String,
today: Option<String>,
) -> RovenueResult<Self>
pub fn open_preview( payload_json: String, locale: String, today: Option<String>, ) -> RovenueResult<Self>
Open a NON-EMITTING preview of a funnel, for preview tools (the operator apps’ “Test on device”).
payload_json is exactly the object GET /v1/placements serves
under its funnel key (identifier, id, revision,
configFormatVersion, config, offering), decoded by the same
wire type the placements client uses, so a preview consumes the
production input. The dashboard’s preview-document route serves the
same shape for a draft.
The session resolves, navigates, evaluates conditions and variables
and produces effects exactly like one from open — it is the same
machine and the same conversion — but it is built without an
EventQueue, so it holds no EventRecorder and cannot emit: no
funnel_* event, no experiment exposure (no variant is drawn; the
payload is one funnel). It needs no configured core and no API key.
A preview always starts fresh: there is nothing to restore.
An empty id is accepted here (nothing is attributed). A payload
that does not decode, or whose config is not a funnel document,
is FunnelInvalid; a config format newer than this build is
FunnelConfigUnsupported. A payload with no offering opens fine —
its package lists simply draw empty, as in production.
Sourcepub fn current(&self) -> FunnelStep
pub fn current(&self) -> FunnelStep
The screen to draw right now, with no effects.
Sourcepub fn submit(&self, block_id: String, answer_json: String) -> FunnelStep
pub fn submit(&self, block_id: String, answer_json: String) -> FunnelStep
Record an answer and re-resolve, so a visibleWhen keyed on it
takes effect on the same screen.
Sourcepub fn select_package(&self, identifier: String) -> FunnelStep
pub fn select_package(&self, identifier: String) -> FunnelStep
Record which offering package a package list tap selected.
Sourcepub fn set_package_prices(&self, prices: Vec<FunnelPackagePrice>) -> FunnelStep
pub fn set_package_prices(&self, prices: Vec<FunnelPackagePrice>) -> FunnelStep
Hand in store-fetched prices for the current offering’s packages
(D13). Façades call this once their async StoreKit / Play Billing
lookup resolves — open cannot wait on it, so it draws first
without a price. Forwarded to the machine, which keeps them on its
offering (so every later draw carries them) and re-resolves: copy
reading {{product.*}} and the computed savings see the prices.
identifier matches the package SLOT identifier (what
select_package also takes); one the offering lacks is ignored.
Does not advance the session or emit anything.
Sourcepub fn tap(&self, action_path: String) -> FunnelStep
pub fn tap(&self, action_path: String) -> FunnelStep
Run the action chain at action_path (cta, el.<blockId> or
opt.<urlEncodedValue>). An address nothing answers to is a no-op.
Sourcepub fn back(&self) -> FunnelStep
pub fn back(&self) -> FunnelStep
Return to the previous screen. A no-op when there is no history.
Sourcepub fn state_json(&self) -> String
pub fn state_json(&self) -> String
The persisted session: machine state plus the presentation id. The
façade stores this string and hands it back to open_funnel on the
next launch (spec D7).
Sourcepub fn dismiss(&self)
pub fn dismiss(&self)
Emit funnel_dismiss. The façade calls it when the host closes the
view or on a Dismiss effect. Once only: a close handler firing
twice must not double-count the dismissal — and never after the
funnel completed.
A preview session has no recorder, so this is a no-op there.
Sourcepub fn take_pending_attributes(&self) -> Vec<(String, Value)>
pub fn take_pending_attributes(&self) -> Vec<(String, Value)>
Attributes the funnel asked to write, drained for the owning core to flush. Not part of the FFI surface.