MonetizationOS Docs
Workflows ReferenceType Definitions

WorkflowOfferEngineUtils

type WorkflowOfferEngineUtils = {
  offers: {
     generate: Promise<WorkflowOffering>;
     mapToElement: Promise<ComponentElement<Record<string, unknown>>>;
     redeemOfferToken: Promise<WorkflowRedeemAttemptResult>;
  };
};

Properties

offers

offers: {
  generate: Promise<WorkflowOffering>;
  mapToElement: Promise<ComponentElement<Record<string, unknown>>>;
  redeemOfferToken: Promise<WorkflowRedeemAttemptResult>;
};
  • generate()

    generate(args): Promise<WorkflowOffering>;

    Generate an offering

    An offering is generated by finding offers to fill each slot of the specified offer group. The offering contains information on how to present the offers and a token for each offer that can be redeemed later.

    Parameters

    ParameterTypeDescription
    argsWorkflowOfferGenerateArgumentsArguments to generate the offering

    Returns

    Promise<WorkflowOffering>

    The generated offering

  • mapToElement()

    mapToElement(offering): Promise<ComponentElement<Record<string, unknown>>>;

    Map an offering to a ComponentElement, for use in web-content surface behaviors.

    Parameters

    ParameterType
    offeringWorkflowOffering

    Returns

    Promise<ComponentElement<Record<string, unknown>>>

  • redeemOfferToken()

    redeemOfferToken(token, identity): Promise<WorkflowRedeemAttemptResult>;

    Redeem an offer token.

    Redeeming an offer token confirms its validity and reveals the private redemption instructions contained within the token. If the redemption attempt fails, this method will not throw but will instead return a result with "success: false".

    Parameters

    ParameterTypeDescription
    tokenstringThe offer token to redeem
    identityWorkflowUserIdentifierThe user identity redeeming the offer

    Returns

    Promise<WorkflowRedeemAttemptResult>

    The result of the redeem attempt