Skip to main content

d2fs.state.method

D2FSStateMethod : d2/sdk/controls/dialogs/generic/d2fs.state.method

D2FSStateMethod. A default, contextful implementation of state methods that makes it possible to retrieve and transition through different states of D2FS dialogs. To customize the default implementation with lesser amount of coding, this class can be extended into scenario specific subclass and added to state methods collection by means of extension with proper binding rules.

Also see DialogStateMethods

Extends: DialogStateMethod

d2FSStateMethod.execute(options, result) ⇒ Promise.<boolean>

Implements contextful state transition logic for D2FS dialog.

Kind: instance method of D2FSStateMethod
Returns: Promise.<boolean> - Resolve with false to stop executing any other matching state methods that are supposed to execute after it.

ParamTypeDescription
optionsMethodMetadata

holder for various current state related metadata

resultOutputFormData

Output parameter, should be filled in with metadata pertaining to next possible state of the dialog.

d2FSStateMethod.setDialogContextForm(dialogId, action, currentFormName) ⇒ void

Set the context before applying this method to current state of the dialog.

Kind: instance method of D2FSStateMethod

ParamTypeDescription
dialogIdstring

A unique identifier associated with current dialog.

actionstring

Name of the method getting applied

currentFormNamestring

Present state's metadata name for the dialog.

d2FSStateMethod.getDialogContextForm(dialogId, action) ⇒ string | null

Get context before applying this method to current state of the dialog.

Kind: instance method of D2FSStateMethod
Returns: string | null - Should return contextual state name, however can return null to implement a contextless flow.

ParamTypeDescription
dialogIdstring

A unique identifier associated with current dialog.

actionstring

Name of the method about to be applied.

d2FSStateMethod.clearDialogContextForm(dialogId) ⇒ void

Clears context for given dialog when the dialog has reached a terminal state.

Kind: instance method of D2FSStateMethod

ParamTypeDescription
dialogIdstring

A unique identifier associated with current dialog.

d2FSStateMethod.getDialogAdditonalParams(options) ⇒ object

Prepares the set of attributes (key-value pairs) to be sent to Backend(REST-API) as additional attributes

Kind: instance method of D2FSStateMethod
Returns: object - Should return a simple JSON object having key-value pairs. All the members of this object is serialized as additional parameter before they are sent to Backend.

ParamTypeDescription
optionsMethodMetadata

holder for various current state related metadata. It is the same options parameter passed to execute().

d2FSStateMethod.extractMergeableFormDataFromResponse(success) ⇒ object

Extracts flow-back properties from the success response of a Backend(REST-API) method execution such that those properties are saved as part of the input form data.

Kind: instance method of D2FSStateMethod
Returns: object - Should return a simple JSON object having key-value pairs. The members of the object is merged onto the same input form data that was earlier passed to Backend.

ParamTypeDescription
successobject

JSON converted success response received after Backend invocation.