Prize (beta)
Allows to handle Stagecast Prizes
Introduction
Some Moments can hand out prizes. In order to add support for prizes to your WebApp, you need to follow these steps:
add the plugin
prizes
to the list of plugins in yourmanifest.json
display the Help Popup and Prize Popup Components (see: https://github.com/stagecast/moment-components). Right now, we only support Vue.js
The Prizes API are currently in beta, and work only with Moments that support the Quiz/Quest API:s. We are actively working on a way to enable prizes for all types of Moments.
API calls
getPrize(prizeId:string): Promise<Prize>
getPrize(prizeId:string): Promise<Prize>
This is the first function you should call in order to initialize the prize service. All the following calls will not require the prizeId.
Params
prizeId: string
: the id of the prize to be fetched. You will find the quizId in the SDK config params.
claimPrize(instanceId:string): Promise<URL>
claimPrize(instanceId:string): Promise<URL>
In some cases the claimPrize workflow doesn't work. This happens when the Moment runs inside a Mobile App that can't keep track of the recently-opened window context. See below for the fix.
Params
instanceId: string
: the id of the prize instance to be fetched. The prize instance gets added automatically to the top N user profiles when a Quiz series ends.
claimPrizeUrl(instanceId:string): Promise<URL>
claimPrizeUrl(instanceId:string): Promise<URL>
There are cases where the simple claimPrize() workflow doesn't work. This often happens when the Moment is launched inside a Webview or the App rendering the Moment is itself rendered inside a Webview (see https://capacitorjs.com/).
The claimPrizeUrl offers a new workflow to work around the issue. The issue with this workaround is that the call will not return an error when the user has already claimed the prize.
Params
instanceId: string
: the id of the prize instance to be fetched. The prize instance gets added automatically to the top N user profiles when a Quiz series ends. You find the prize instance id in the user profile.
Last updated