Struct FunnelSession

Source
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

Source

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.

Source

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.

Source

pub fn current(&self) -> FunnelStep

The screen to draw right now, with no effects.

Source

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.

Source

pub fn select_package(&self, identifier: String) -> FunnelStep

Record which offering package a package list tap selected.

Source

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.

Source

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.

Source

pub fn back(&self) -> FunnelStep

Return to the previous screen. A no-op when there is no history.

Source

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).

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more