Events
TaskOnEmbed extends EventEmitter.
Use embed.on(eventName, handler) to subscribe.
Event List
| Event | Payload | Trigger |
|---|---|---|
loginRequired | none | Guest user performs action requiring login |
routeChanged | fullPath: string | Iframe internal route changed |
taskCompleted | TaskCompletedData | User completes a task |
bindConflict | BindConflictData | SNS/address is already bound to another email |
Usage Example
embed.on("loginRequired", () => {
openLoginModal();
});
embed.on("routeChanged", (fullPath) => {
console.log("Route:", fullPath);
});
embed.on("taskCompleted", (data) => {
console.log("Task:", data.taskId, data.taskName);
console.log("Rewards:", data.rewards);
});
embed.on("bindConflict", (data) => {
console.log("Bind conflict email:", data.email);
});taskCompleted Payload
| Field | Type | Description |
|---|---|---|
taskId | string | Completed task ID |
taskName | string | Completed task name |
templateId | string | Task template ID |
rewards | TaskReward[] | Rewards list (may be empty for review-based tasks) |
TaskReward fields:
| Field | Type | Description |
|---|---|---|
rewardType | "Token" | "GTCPoints" | Reward category |
rewardAmount | string | Reward amount |
rewardDescription | string | Human-readable text |
pointName | string | undefined | Points name (for points reward) |
tokenAddress | string | undefined | Token contract address |
tokenNetwork | string | undefined | Token network |
bindConflict Payload
| Field | Type | Description |
|---|---|---|
email | string | Existing bound email |
bindType | "sns" | "address" | Conflict type |
snsType | "twitter" | "discord" | "telegram" | "reddit" | undefined | Present when bindType is sns |
address | string | undefined | Present when bindType is address |
Last updated on