Developer home
VISWOO DOCUMENTATION
Panel bridge
The bridge the plugin’s panel tab uses to talk to the platform (`viswoo-panel.js`).
The bridge the plugin’s panel tab uses to talk to the platform (viswoo-panel.js).
window.Viswoo.panel: Every method returns a Promise; errors carry a BridgeError.
Methods
Section titled “Methods”| Method | Permission | Description |
|---|---|---|
Viswoo.panel.context(): Promise<PanelContext> |
— | The context is requested once when the bridge loads; the theme is applied automatically. |
Viswoo.panel.on(event: 'theme.changed', listener: (data: { theme: 'light' | 'dark' }) => void): void |
— | Panel events: theme.changed when the theme changes. |
Viswoo.panel.settings.get<T = Record<string, unknown>>(): Promise<T> |
settings |
The customer settings (server-only fields included). |
Viswoo.panel.settings.set<T = Record<string, unknown>>(settings: T): Promise<T> |
settings |
Saves settings; plugin.invalid_settings if they do not match the schema. Editor and above. |
Viswoo.panel.data.list<T = unknown>(collection: string, after?: string): Promise<PluginDocument<T>[]> |
data |
Documents in a collection, sorted by key, 100 per page (pass the last key for the next page). |
Viswoo.panel.data.get<T = unknown>(collection: string, key: string): Promise<PluginDocument<T>> |
data |
One document; plugin.data_not_found if missing. |
Viswoo.panel.data.put<T = unknown>(collection: string, key: string, data: T): Promise<PluginDocument<T>> |
data |
Writes a document (at most 64 KB). Editor and above. |
Viswoo.panel.data.delete(collection: string, key: string): Promise<void> |
data |
Deletes a document. Editor and above. |
Viswoo.panel.screens.list(): Promise<PluginScreen[]> |
screens:read |
The customer screens. |
Viswoo.panel.events.summary(days?: number): Promise<PluginEventCount[]> |
events |
Event counts for the last N days (at most 90). |
Viswoo.panel.draw.stock(pool?: string): Promise<PluginPoolPrize[]> |
draw |
Prizes of a draw pool defined from settings and their remaining stock. |
Viswoo.panel.codes.lookup<T = Record<string, unknown>>(value: string): Promise<PluginCode<T>> |
codes |
Looks up a code (every panel role; for the till). |
Viswoo.panel.codes.redeem<T = Record<string, unknown>>(value: string): Promise<PluginCode<T>> |
codes |
Redeems a code; plugin.code_redeemed the second time, plugin.code_expired when expired. |
Viswoo.panel.ui.resize(height: number): Promise<void> |
— | Reports the page height; the panel resizes the frame (at most 4000 px). |
PanelContext
Section titled “PanelContext”Context of the panel tab.
| Field | Type | Description |
|---|---|---|
code |
string |
The plugin code. |
version |
string |
Installed version. |
language |
'tr' | 'en' |
Panel language. |
theme |
'light' | 'dark' |
Panel theme; the bridge applies it to the page. |
role |
string |
Role of the panel user: owner, admin, editor, viewer. Writes require editor or above. |
setupComplete |
boolean |
Whether required settings are filled in; if not, the plugin does not play and server actions are rejected. |
permissions |
string[] |
Permissions granted by the customer. |
publicUrl |
string | null |
Address of the public page (public permission), otherwise null. The tab may show it as a QR code. |
PluginDocument
Section titled “PluginDocument”A document in plugin data (JSON, at most 64 KB).
| Field | Type | Description |
|---|---|---|
key |
string |
|
data |
T |
|
updatedAt |
string |
PluginScreen
Section titled “PluginScreen”A screen of the customer.
| Field | Type | Description |
|---|---|---|
id |
string |
|
name |
string |
|
orientation |
'landscape' | 'portrait' |
PluginEventCount
Section titled “PluginEventCount”Event count for one day.
| Field | Type | Description |
|---|---|---|
date |
string |
Day (YYYY-MM-DD, UTC). |
name |
string |
|
count |
number |
PluginPoolPrize
Section titled “PluginPoolPrize”A prize in the draw pool and its remaining stock (null when unlimited).
| Field | Type | Description |
|---|---|---|
id |
string |
|
label |
string |
|
winning |
boolean |
|
stock |
number | null |
|
remaining |
number | null |
PluginCode
Section titled “PluginCode”One-time code.
| Field | Type | Description |
|---|---|---|
value |
string |
The code (6 characters, upper-case letters and digits, no look-alikes). |
payload |
T |
Data attached when the code was issued (e.g. the prize). |
expiresAt |
string |
|
redeemedAt |
string | null |
|
status |
'valid' | 'redeemed' | 'expired' |
BridgeError
Section titled “BridgeError”| Field | Type | Description |
|---|---|---|
code |
string |
Machine-readable code (e.g. plugin.permission_denied, plugin.invalid_settings). |
message? |
string |