@kalamba/sdk 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/errors-358575c3.cjs +5 -0
- package/dist/errors-afd9f527.js +90 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +90 -78
- package/dist/index.js +88 -91
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.d.ts +97 -69
- package/dist/plugins.js +1002 -1043
- package/dist/wrapper.cjs +1 -1
- package/dist/wrapper.d.ts +99 -69
- package/dist/wrapper.js +669 -629
- package/package.json +1 -1
- package/dist/errors-66b5612a.cjs +0 -5
- package/dist/errors-96eb18f7.js +0 -52
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BSD 3-Clause License
|
|
3
|
+
* Copyright (c) 2024, Kalamba Games Limited
|
|
4
|
+
*/
|
|
5
|
+
"use strict";var N=Object.defineProperty;var S=(_,E,O)=>E in _?N(_,E,{enumerable:!0,configurable:!0,writable:!0,value:O}):_[E]=O;var R=(_,E,O)=>(S(_,typeof E!="symbol"?E+"":E,O),O);const A={CONNECTION_ERROR:"CONNECTION_ERROR",INVALID_BET_CURRENCY:"INVALID_BET_CURRENCY",INVALID_BET:"INVALID_BET",INVALID_CAGE_CODE:"INVALID_CAGE_CODE",INVALID_CLIENT_TYPE:"INVALID_CLIENT_TYPE",INVALID_MESSAGE_FORMAT:"INVALID_MESSAGE_FORMAT",INVALID_SESSION:"INVALID_SESSION",TOO_HIGH_BET_FREQUENCY:"TOO_HIGH_BET_FREQUENCY",TOO_HIGH_ACTION_FREQUENCY:"TOO_HIGH_ACTION_FREQUENCY",USER_LOCK_INVALID_PARAMS:"USER_LOCK_INVALID_PARAMS",USER_ALREADY_LOCKED:"USER_ALREADY_LOCKED",GAME_SERVER_ERROR:"GAME_SERVER_ERROR",SESSION_MANAGEMENT_ERROR:"SESSION_MANAGEMENT_ERROR",MESSAGE_SENDER_ERROR:"MESSAGE_SENDER_ERROR",FREE_ROUNDS_PROCESSING_ERROR:"FREE_ROUNDS_PROCESSING_ERROR",WEB_SESSION_NOT_OPEN:"WEB_SESSION_NOT_OPEN",GAMING_LIMITS_REACHED:"GAMING_LIMITS_REACHED",OUT_OF_MONEY:"OUT_OF_MONEY",UNFINISHED_ROUND_IN_PROGRESS:"UNFINISHED_ROUND_IN_PROGRESS",ACCESS_DENIED:"ACCESS_DENIED",CREDENTIALS_NOT_FOUND:"CREDENTIALS_NOT_FOUND",ALREADY_LOGGED_IN:"ALREADY_LOGGED_IN",GAME_UNAVAILABLE:"GAME_UNAVAILABLE",BONUS_RESTRICTION:"BONUS_RESTRICTION",TOO_MANY_OPEN_GAMES:"TOO_MANY_OPEN_GAMES",GAME_FROZEN:"GAME_FROZEN",WALLET_PROCESSING_ERROR:"WALLET_PROCESSING_ERROR",FORCED_OUTCOMES_NOT_ALLOWED:"FORCED_OUTCOMES_NOT_ALLOWED",MISSING_GAME_STATE:"MISSING_GAME_STATE",DATA_ACCESS_ERROR:"DATA_ACCESS_ERROR",UNKNOWN:"UNKNOWN"},I={CONNECTION_ERROR:"RELOAD",INVALID_BET_CURRENCY:"CLOSE",INVALID_BET:"CONTINUE",INVALID_CAGE_CODE:"CLOSE",INVALID_CLIENT_TYPE:"CLOSE",INVALID_MESSAGE_FORMAT:"CLOSE",INVALID_SESSION:"CLOSE",TOO_HIGH_BET_FREQUENCY:"CONTINUE",TOO_HIGH_ACTION_FREQUENCY:"CONTINUE",USER_LOCK_INVALID_PARAMS:"CLOSE",USER_ALREADY_LOCKED:"CLOSE",GAME_SERVER_ERROR:"RELOAD",SESSION_MANAGEMENT_ERROR:"RELOAD",MESSAGE_SENDER_ERROR:"RELOAD",FREE_ROUNDS_PROCESSING_ERROR:"RELOAD",WEB_SESSION_NOT_OPEN:"RELOAD",GAMING_LIMITS_REACHED:"CLOSE",OUT_OF_MONEY:"CLOSE",UNFINISHED_ROUND_IN_PROGRESS:"CLOSE",ACCESS_DENIED:"CLOSE",CREDENTIALS_NOT_FOUND:"CLOSE",ALREADY_LOGGED_IN:"CLOSE",GAME_UNAVAILABLE:"CLOSE",BONUS_RESTRICTION:"CLOSE",TOO_MANY_OPEN_GAMES:"CLOSE",GAME_FROZEN:"CLOSE",WALLET_PROCESSING_ERROR:"CLOSE",FORCED_OUTCOMES_NOT_ALLOWED:"CONTINUE",MISSING_GAME_STATE:"RELOAD",DATA_ACCESS_ERROR:"RELOAD",UNKNOWN:"CLOSE"};class C extends Error{constructor(O){super();R(this,"data");this.name="RgsError",this.data=O}}class L extends Error{constructor(){super(),this.name="TimeoutError"}}exports.RgsError=C;exports.RgsErrorAction=I;exports.RgsErrorCode=A;exports.TimeoutError=L;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BSD 3-Clause License
|
|
3
|
+
* Copyright (c) 2024, Kalamba Games Limited
|
|
4
|
+
*/
|
|
5
|
+
var N = Object.defineProperty;
|
|
6
|
+
var S = (_, E, O) => E in _ ? N(_, E, { enumerable: !0, configurable: !0, writable: !0, value: O }) : _[E] = O;
|
|
7
|
+
var R = (_, E, O) => (S(_, typeof E != "symbol" ? E + "" : E, O), O);
|
|
8
|
+
const I = {
|
|
9
|
+
CONNECTION_ERROR: "CONNECTION_ERROR",
|
|
10
|
+
INVALID_BET_CURRENCY: "INVALID_BET_CURRENCY",
|
|
11
|
+
INVALID_BET: "INVALID_BET",
|
|
12
|
+
INVALID_CAGE_CODE: "INVALID_CAGE_CODE",
|
|
13
|
+
INVALID_CLIENT_TYPE: "INVALID_CLIENT_TYPE",
|
|
14
|
+
INVALID_MESSAGE_FORMAT: "INVALID_MESSAGE_FORMAT",
|
|
15
|
+
INVALID_SESSION: "INVALID_SESSION",
|
|
16
|
+
TOO_HIGH_BET_FREQUENCY: "TOO_HIGH_BET_FREQUENCY",
|
|
17
|
+
TOO_HIGH_ACTION_FREQUENCY: "TOO_HIGH_ACTION_FREQUENCY",
|
|
18
|
+
USER_LOCK_INVALID_PARAMS: "USER_LOCK_INVALID_PARAMS",
|
|
19
|
+
USER_ALREADY_LOCKED: "USER_ALREADY_LOCKED",
|
|
20
|
+
GAME_SERVER_ERROR: "GAME_SERVER_ERROR",
|
|
21
|
+
SESSION_MANAGEMENT_ERROR: "SESSION_MANAGEMENT_ERROR",
|
|
22
|
+
MESSAGE_SENDER_ERROR: "MESSAGE_SENDER_ERROR",
|
|
23
|
+
FREE_ROUNDS_PROCESSING_ERROR: "FREE_ROUNDS_PROCESSING_ERROR",
|
|
24
|
+
WEB_SESSION_NOT_OPEN: "WEB_SESSION_NOT_OPEN",
|
|
25
|
+
GAMING_LIMITS_REACHED: "GAMING_LIMITS_REACHED",
|
|
26
|
+
OUT_OF_MONEY: "OUT_OF_MONEY",
|
|
27
|
+
UNFINISHED_ROUND_IN_PROGRESS: "UNFINISHED_ROUND_IN_PROGRESS",
|
|
28
|
+
ACCESS_DENIED: "ACCESS_DENIED",
|
|
29
|
+
CREDENTIALS_NOT_FOUND: "CREDENTIALS_NOT_FOUND",
|
|
30
|
+
ALREADY_LOGGED_IN: "ALREADY_LOGGED_IN",
|
|
31
|
+
GAME_UNAVAILABLE: "GAME_UNAVAILABLE",
|
|
32
|
+
BONUS_RESTRICTION: "BONUS_RESTRICTION",
|
|
33
|
+
TOO_MANY_OPEN_GAMES: "TOO_MANY_OPEN_GAMES",
|
|
34
|
+
GAME_FROZEN: "GAME_FROZEN",
|
|
35
|
+
WALLET_PROCESSING_ERROR: "WALLET_PROCESSING_ERROR",
|
|
36
|
+
FORCED_OUTCOMES_NOT_ALLOWED: "FORCED_OUTCOMES_NOT_ALLOWED",
|
|
37
|
+
MISSING_GAME_STATE: "MISSING_GAME_STATE",
|
|
38
|
+
DATA_ACCESS_ERROR: "DATA_ACCESS_ERROR",
|
|
39
|
+
UNKNOWN: "UNKNOWN"
|
|
40
|
+
}, C = {
|
|
41
|
+
CONNECTION_ERROR: "RELOAD",
|
|
42
|
+
INVALID_BET_CURRENCY: "CLOSE",
|
|
43
|
+
INVALID_BET: "CONTINUE",
|
|
44
|
+
INVALID_CAGE_CODE: "CLOSE",
|
|
45
|
+
INVALID_CLIENT_TYPE: "CLOSE",
|
|
46
|
+
INVALID_MESSAGE_FORMAT: "CLOSE",
|
|
47
|
+
INVALID_SESSION: "CLOSE",
|
|
48
|
+
TOO_HIGH_BET_FREQUENCY: "CONTINUE",
|
|
49
|
+
TOO_HIGH_ACTION_FREQUENCY: "CONTINUE",
|
|
50
|
+
USER_LOCK_INVALID_PARAMS: "CLOSE",
|
|
51
|
+
USER_ALREADY_LOCKED: "CLOSE",
|
|
52
|
+
GAME_SERVER_ERROR: "RELOAD",
|
|
53
|
+
SESSION_MANAGEMENT_ERROR: "RELOAD",
|
|
54
|
+
MESSAGE_SENDER_ERROR: "RELOAD",
|
|
55
|
+
FREE_ROUNDS_PROCESSING_ERROR: "RELOAD",
|
|
56
|
+
WEB_SESSION_NOT_OPEN: "RELOAD",
|
|
57
|
+
GAMING_LIMITS_REACHED: "CLOSE",
|
|
58
|
+
OUT_OF_MONEY: "CLOSE",
|
|
59
|
+
UNFINISHED_ROUND_IN_PROGRESS: "CLOSE",
|
|
60
|
+
ACCESS_DENIED: "CLOSE",
|
|
61
|
+
CREDENTIALS_NOT_FOUND: "CLOSE",
|
|
62
|
+
ALREADY_LOGGED_IN: "CLOSE",
|
|
63
|
+
GAME_UNAVAILABLE: "CLOSE",
|
|
64
|
+
BONUS_RESTRICTION: "CLOSE",
|
|
65
|
+
TOO_MANY_OPEN_GAMES: "CLOSE",
|
|
66
|
+
GAME_FROZEN: "CLOSE",
|
|
67
|
+
WALLET_PROCESSING_ERROR: "CLOSE",
|
|
68
|
+
FORCED_OUTCOMES_NOT_ALLOWED: "CONTINUE",
|
|
69
|
+
MISSING_GAME_STATE: "RELOAD",
|
|
70
|
+
DATA_ACCESS_ERROR: "RELOAD",
|
|
71
|
+
UNKNOWN: "CLOSE"
|
|
72
|
+
};
|
|
73
|
+
class L extends Error {
|
|
74
|
+
constructor(O) {
|
|
75
|
+
super();
|
|
76
|
+
R(this, "data");
|
|
77
|
+
this.name = "RgsError", this.data = O;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
class T extends Error {
|
|
81
|
+
constructor() {
|
|
82
|
+
super(), this.name = "TimeoutError";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
L as R,
|
|
87
|
+
T,
|
|
88
|
+
I as a,
|
|
89
|
+
C as b
|
|
90
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* BSD 3-Clause License
|
|
3
3
|
* Copyright (c) 2024, Kalamba Games Limited
|
|
4
4
|
*/
|
|
5
|
-
"use strict";var
|
|
5
|
+
"use strict";var b=(r,i,t)=>{if(!i.has(r))throw TypeError("Cannot "+t)};var m=(r,i,t)=>(b(r,i,"read from private field"),t?t.call(r):i.get(r)),a=(r,i,t)=>{if(i.has(r))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(r):i.set(r,t)},u=(r,i,t,n)=>(b(r,i,"write to private field"),n?n.call(r,t):i.set(r,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("./errors-358575c3.cjs");function I(r){const i=Object.prototype.toString.call(r);return r instanceof Date||typeof r=="object"&&i==="[object Date]"?new r.constructor(+r):typeof r=="number"||i==="[object Number]"||typeof r=="string"||i==="[object String]"?new Date(r):new Date(NaN)}function B(r){const i=I(r);return i.setHours(23,59,59,999),i}function k(){return B(Date.now())}function P(r){const i=I(r);return i.setHours(0,0,0,0),i}function L(){return P(Date.now())}const $=3e4;var F,S;class _{constructor(i){a(this,F,void 0);a(this,S,$);u(this,F,i)}buildHeaders(){const i={};return m(this,F).token&&(i.Authorization=`Bearer ${m(this,F).token}`),i}async request(i,t){const n=new URL(i,m(this,F).apiUrl??window.location.origin);return n.search=new URLSearchParams({...t}).toString(),await(await fetch(n,{signal:AbortSignal.timeout(m(this,S)),headers:this.buildHeaders()})).json()}async getRounds(i){return this.request("/rounds",i)}async getRound(i,t){return this.request(`/rounds/${i}`,t)}}F=new WeakMap,S=new WeakMap;const N={limit:100,page:0};var s,l;class O{constructor({config:i}){a(this,s,void 0);a(this,l,void 0);u(this,s,i),u(this,l,new _({apiUrl:i.api.gameHistoryUrl}))}async getRound(i,{pagination:t=N}={}){return m(this,l).getRound(i,{gameCode:m(this,s).api.game,operatorCode:m(this,s).api.brand,username:m(this,s).api.user,...t})}async getLastRound(){return m(this,s).api.lastRoundId?this.getRound(m(this,s).api.lastRoundId):null}async getRounds({searchPeriod:i={fromDateTime:L(),toDateTime:k()},pagination:t=N}={}){const n=m(this,s).api.user.replace(/^user_/,"").replace(new RegExp(`_${m(this,s).api.integration}$`),"");return m(this,l).getRounds({gameCode:m(this,s).api.game,operatorCode:m(this,s).api.integration,username:n,fromDataTime:i.fromDateTime.toISOString(),toDateTime:i.toDateTime.toISOString(),...t})}}s=new WeakMap,l=new WeakMap;function G(r,i){return r*i/100}function A(r,i,t){if(!["string","number"].includes(typeof i))return"NaN";const{locales:n}=r;try{return new Intl.NumberFormat(n,{...t,numberingSystem:"latn",style:"decimal"}).format(+i)}catch{return`${i}`}}const w="XTS";var y=(r=>(r.Currency="Currency",r.Number="Number",r))(y||{}),f=(r=>(r.Coins="Coins",r.Money="Money",r))(f||{});const T={ARSB:{displayAs:"ARS",maximumFractionDigits:2,minimumFractionDigits:2},CHIPS:{maximumFractionDigits:0,minimumFractionDigits:0},BNB:{maximumFractionDigits:6,minimumFractionDigits:6},BUSD:{maximumFractionDigits:4,minimumFractionDigits:4},BTC:{maximumFractionDigits:8,minimumFractionDigits:2},mBTC:{maximumFractionDigits:5,minimumFractionDigits:2},uBTC:{maximumFractionDigits:2,minimumFractionDigits:2},BCH:{maximumFractionDigits:8,minimumFractionDigits:2},mBCH:{maximumFractionDigits:2,minimumFractionDigits:2},ETH:{maximumFractionDigits:8,minimumFractionDigits:2},mETH:{maximumFractionDigits:5,minimumFractionDigits:2},uETH:{maximumFractionDigits:2,minimumFractionDigits:2},SOC:{maximumFractionDigits:8,minimumFractionDigits:2},LTC:{maximumFractionDigits:8,minimumFractionDigits:2},mLTC:{maximumFractionDigits:5,minimumFractionDigits:2},uLTC:{maximumFractionDigits:2,minimumFractionDigits:2},DOG:{maximumFractionDigits:4,minimumFractionDigits:2},USDC:{maximumFractionDigits:4,minimumFractionDigits:4},USDT:{maximumFractionDigits:4,minimumFractionDigits:2},TRX:{maximumFractionDigits:2,minimumFractionDigits:2},TUSD:{maximumFractionDigits:2,minimumFractionDigits:2},DAI:{maximumFractionDigits:2,minimumFractionDigits:2},XMR:{maximumFractionDigits:4,minimumFractionDigits:4},CBET:{maximumFractionDigits:0,minimumFractionDigits:0},kCBET:{maximumFractionDigits:2,minimumFractionDigits:2},SHIB:{maximumFractionDigits:0,minimumFractionDigits:0},kSHIB:{maximumFractionDigits:4,minimumFractionDigits:2},NEO:{maximumFractionDigits:4,minimumFractionDigits:4},BSV:{maximumFractionDigits:4,minimumFractionDigits:4},EOS:{maximumFractionDigits:4,minimumFractionDigits:4},DASH:{maximumFractionDigits:4,minimumFractionDigits:4},XLM:{maximumFractionDigits:2,minimumFractionDigits:2},KRW:{maximumFractionDigits:2,minimumFractionDigits:2},kVND:{maximumFractionDigits:4,minimumFractionDigits:2},kIDR:{maximumFractionDigits:4,minimumFractionDigits:2},RSD:{maximumFractionDigits:2,minimumFractionDigits:2},STAKEGC:{displayAs:"GC",maximumFractionDigits:0,minimumFractionDigits:0},STAKESC:{displayAs:"SC",maximumFractionDigits:2,minimumFractionDigits:2},"FC.":{maximumFractionDigits:2,minimumFractionDigits:2},"GC.":{maximumFractionDigits:2,minimumFractionDigits:2},"SC.":{maximumFractionDigits:2,minimumFractionDigits:2},SVC:{maximumFractionDigits:2,minimumFractionDigits:2},DOT:{maximumFractionDigits:4,minimumFractionDigits:4},SOL:{maximumFractionDigits:4,minimumFractionDigits:4},XRP:{maximumFractionDigits:4,minimumFractionDigits:4},ADA:{maximumFractionDigits:4,minimumFractionDigits:4},TON:{maximumFractionDigits:4,minimumFractionDigits:4},FTN:{maximumFractionDigits:4,minimumFractionDigits:4}};function M(r){return r in T}function j(r){return M(r)?{...T[r],currency:w}:{currency:r}}function q(r,i,t){const n=i.format(+r);return M(t)?n.replace(w,T[t].displayAs??t):n}function V(r,i,t){const{maximumFractionDigits:n,minimumFractionDigits:o}=t.resolvedOptions();return A(r,i,{maximumFractionDigits:n,minimumFractionDigits:o})}function v(r,i,{as:t}={as:"Currency"}){const{canShowCurrency:n,currency:o}=r;return t==="Number"||!n?`${i}`:`${i} ${o}`}function K(r,i,{as:t,from:n}={as:"Currency",from:"Money"},o){if(!["string","number"].includes(typeof i))return"NaN";const{canShowCurrency:e=!0,coinValueInCents:g,currency:x,locales:R}=r;n==="Coins"&&(i=G(+i,g));try{const U=j(x),E=new Intl.NumberFormat(R,{...U,...o,currencyDisplay:"symbol",numberingSystem:"latn",style:"currency"});return t==="Number"||!e?V(r,i,E):q(i,E,x)}catch{return v(r,i,{as:t})}}var c;class H{constructor({config:i}){a(this,c,void 0);u(this,c,i)}formatNumber(i,t){const n={locales:[m(this,c).ui.language]};return A(n,i,t)}formatCurrency(i,t={as:y.Currency,from:f.Money},n){const o=m(this,c).ui.feature.showCurrency,e=m(this,c).api.coinValueInCents,g=m(this,c).api.currency||w,x=[m(this,c).ui.language];return K({canShowCurrency:o,coinValueInCents:e,currency:g,locales:x},i,t,n)}formatCoins(i,t){return this.formatCurrency(i,{as:y.Number,from:f.Coins},t)}formatCoinsWithCurrency(i,t){return this.formatCurrency(i,{as:y.Currency,from:f.Coins},t)}formatMoney(i,t){return this.formatCurrency(i,{as:y.Number,from:f.Money},t)}formatMoneyWithCurrency(i,t){return this.formatCurrency(i,{as:y.Currency,from:f.Money},t)}}c=new WeakMap;const X=()=>{};var h,d,p,C;class z{constructor({messagePort:i}){a(this,h,void 0);a(this,d,void 0);a(this,p,void 0);a(this,C,void 0);u(this,C,i),this.on("configured",t=>{u(this,h,t),u(this,p,new H({config:t})),u(this,d,new O({config:t}))}),this.on("playResponse",t=>{this.config.api.lastRoundId=t.contract.roundId})}get config(){if(!m(this,h))throw new Error("config is not initialized, you must open game first");return m(this,h)}get history(){if(!m(this,d))throw new Error("config is not initialized, you must open game first");return m(this,d)}get i18n(){if(!m(this,p))throw new Error("i18n is not initialized, you must open game first");return m(this,p)}request(i,...[t]){return new Promise(n=>{this.on(`${i}Response`,o=>n({type:"response",response:o}),{once:!0}),this.on(`${i}Error`,o=>n({type:"error",error:o}),{once:!0}),this.send(i,t)})}on(i,t,n){const o=function e(g){g.data.message===`kalamba:wrapper:${i}`&&(X("on",g.data.message.replace(/^kalamba:/,""),g.data.payload),t(g.data.payload),n!=null&&n.once&&window.removeEventListener("message",e))};window.addEventListener("message",o)}send(i,...[t]){m(this,C).postMessage({message:`kalamba:sdk:${i}`,payload:t},"*")}configure(i){this.send("configure",i)}async openGame(){const i=new Promise(n=>this.on("configured",n,{once:!0})),t=await this.request("openGame");if(t.type==="response")return await i,t.response;throw t.error.type==="timeout"?new D.TimeoutError:new D.RgsError(t.error.data)}async play(i,t,n="SPIN"){const o={contract:i,extra:t,actionType:n},e=await this.request("play",o);if(e.type==="response")return e.response;throw e.error.type==="timeout"?new D.TimeoutError:new D.RgsError(e.error.data)}}h=new WeakMap,d=new WeakMap,p=new WeakMap,C=new WeakMap;exports.RgsError=D.RgsError;exports.RgsErrorCode=D.RgsErrorCode;exports.TimeoutError=D.TimeoutError;exports.History=O;exports.I18n=H;exports.KalambaSdk=z;
|
package/dist/index.d.ts
CHANGED
|
@@ -83,13 +83,6 @@ export declare type DomainToMessagePayloadMap = {
|
|
|
83
83
|
telemetry: TelemetryOnlyMessagePayloadMap;
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
declare type Error_2 = {
|
|
87
|
-
message: string;
|
|
88
|
-
messageKey: string;
|
|
89
|
-
type: 'CLOSE' | 'RELOAD' | 'CONTINUE';
|
|
90
|
-
};
|
|
91
|
-
export { Error_2 as Error }
|
|
92
|
-
|
|
93
86
|
export { FormatCurrencyOptions }
|
|
94
87
|
|
|
95
88
|
export declare type ForwardToPluginsMessage<P extends PluginDomain> = keyof ForwardToPluginsMessageMap<'sdk'>[P] | keyof ForwardToPluginsMessageMap<'rgs'>[P] | keyof ForwardToPluginsMessageMap<'casino'>[P] | keyof ForwardToPluginsMessageMap<'telemetry'>[P];
|
|
@@ -154,7 +147,8 @@ export declare class KalambaSdk {
|
|
|
154
147
|
protected request<M extends DomainMessage<'sdk'>>(message: M, ...[payload]: DomainMessagePayload<'sdk', M> extends never ? [] : [payload: DomainMessagePayload<'sdk', M>]): Promise<RgsResponse<M>>;
|
|
155
148
|
on<M extends DomainMessage<'wrapper'> | ForwardToSdkMessage>(message: M, listener: (payload: M extends DomainMessage<'wrapper'> ? DomainMessagePayload<'wrapper', M> : M extends ForwardToSdkMessage ? ForwardToSdkMessagePayload<M> : never) => void, options?: AddEventListenerOptions_2): void;
|
|
156
149
|
send<M extends DomainMessage<'sdk'>>(message: M, ...[payload]: DomainMessagePayload<'sdk', M> extends never ? [] : [DomainMessagePayload<'sdk', M>]): void;
|
|
157
|
-
|
|
150
|
+
configure(payload: DomainMessagePayload<'sdk', 'configure'>): void;
|
|
151
|
+
openGame(): Promise<OpenGameResponse>;
|
|
158
152
|
play(contract: ContractPlayPayload, extra?: unknown, actionType?: string): Promise<PlayResponse>;
|
|
159
153
|
}
|
|
160
154
|
|
|
@@ -169,42 +163,6 @@ export declare type MessageMessageEvent<M extends Message> = MessageEvent<{
|
|
|
169
163
|
|
|
170
164
|
export declare type MessagePayload<M extends Message> = MessageMap[M];
|
|
171
165
|
|
|
172
|
-
export declare class OpenGameError extends Error {
|
|
173
|
-
data: {
|
|
174
|
-
code: keyof typeof OpenGameErrorCode;
|
|
175
|
-
};
|
|
176
|
-
constructor(data: {
|
|
177
|
-
code: keyof typeof OpenGameErrorCode;
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
declare type OpenGameError_2 = {
|
|
182
|
-
type: 'timeout';
|
|
183
|
-
} | {
|
|
184
|
-
type: 'error';
|
|
185
|
-
data: {
|
|
186
|
-
code: keyof typeof OpenGameErrorCode;
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
export declare const OpenGameErrorCode: {
|
|
191
|
-
readonly CONNECTION_ERROR: "CONNECTION_ERROR";
|
|
192
|
-
readonly ALREADY_LOGGED_IN: "ALREADY_LOGGED_IN";
|
|
193
|
-
readonly DENIED: "DENIED";
|
|
194
|
-
readonly NOT_FOUND: "NOT_FOUND";
|
|
195
|
-
readonly BONUS_RESTRICTION: "BONUS_RESTRICTION";
|
|
196
|
-
readonly ERROR: "ERROR";
|
|
197
|
-
readonly GAME_UNAVAILABLE: "GAME_UNAVAILABLE";
|
|
198
|
-
readonly RECONNECT_DATA_MISMATCH: "RECONNECT_DATA_MISMATCH";
|
|
199
|
-
readonly TOO_MANY_OPEN_GAMES: "TOO_MANY_OPEN_GAMES";
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
export declare type OpenGameRequest = {
|
|
203
|
-
gameName: string;
|
|
204
|
-
/** version of game client */
|
|
205
|
-
version: string;
|
|
206
|
-
};
|
|
207
|
-
|
|
208
166
|
export declare type OpenGameResponse = {
|
|
209
167
|
contract: {
|
|
210
168
|
bet: {
|
|
@@ -252,34 +210,6 @@ export declare interface Pagination {
|
|
|
252
210
|
page: number;
|
|
253
211
|
}
|
|
254
212
|
|
|
255
|
-
export declare class PlayError extends Error {
|
|
256
|
-
data: {
|
|
257
|
-
code: keyof typeof PlayErrorCode;
|
|
258
|
-
};
|
|
259
|
-
constructor(data: {
|
|
260
|
-
code: keyof typeof PlayErrorCode;
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
declare type PlayError_2 = {
|
|
265
|
-
type: 'timeout';
|
|
266
|
-
} | {
|
|
267
|
-
type: 'error';
|
|
268
|
-
data: {
|
|
269
|
-
code: keyof typeof PlayErrorCode;
|
|
270
|
-
};
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
export declare const PlayErrorCode: {
|
|
274
|
-
readonly ERROR: "ERROR";
|
|
275
|
-
readonly GAMING_LIMITS_REACHED: "GAMING_LIMITS_REACHED";
|
|
276
|
-
readonly INVALID_CURRENCY: "INVALID_CURRENCY";
|
|
277
|
-
readonly INVALID_SESSION: "INVALID_SESSION";
|
|
278
|
-
readonly OUT_OF_MONEY: "OUT_OF_MONEY";
|
|
279
|
-
readonly UNFINISHED_ROUND_IN_PROGRESS: "UNFINISHED_ROUND_IN_PROGRESS";
|
|
280
|
-
readonly WALLET_ERROR: "WALLET_ERROR";
|
|
281
|
-
};
|
|
282
|
-
|
|
283
213
|
export declare type PlayRequest = {
|
|
284
214
|
contract: ContractPlayPayload;
|
|
285
215
|
extra?: unknown;
|
|
@@ -344,10 +274,61 @@ export declare type RealityCheckConfig = {
|
|
|
344
274
|
showSumWins: boolean;
|
|
345
275
|
};
|
|
346
276
|
|
|
277
|
+
export declare class RgsError extends Error {
|
|
278
|
+
data: RgsErrorData;
|
|
279
|
+
constructor(data: RgsErrorData);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export declare const RgsErrorCode: {
|
|
283
|
+
readonly CONNECTION_ERROR: "CONNECTION_ERROR";
|
|
284
|
+
readonly INVALID_BET_CURRENCY: "INVALID_BET_CURRENCY";
|
|
285
|
+
readonly INVALID_BET: "INVALID_BET";
|
|
286
|
+
readonly INVALID_CAGE_CODE: "INVALID_CAGE_CODE";
|
|
287
|
+
readonly INVALID_CLIENT_TYPE: "INVALID_CLIENT_TYPE";
|
|
288
|
+
readonly INVALID_MESSAGE_FORMAT: "INVALID_MESSAGE_FORMAT";
|
|
289
|
+
readonly INVALID_SESSION: "INVALID_SESSION";
|
|
290
|
+
readonly TOO_HIGH_BET_FREQUENCY: "TOO_HIGH_BET_FREQUENCY";
|
|
291
|
+
readonly TOO_HIGH_ACTION_FREQUENCY: "TOO_HIGH_ACTION_FREQUENCY";
|
|
292
|
+
readonly USER_LOCK_INVALID_PARAMS: "USER_LOCK_INVALID_PARAMS";
|
|
293
|
+
readonly USER_ALREADY_LOCKED: "USER_ALREADY_LOCKED";
|
|
294
|
+
readonly GAME_SERVER_ERROR: "GAME_SERVER_ERROR";
|
|
295
|
+
readonly SESSION_MANAGEMENT_ERROR: "SESSION_MANAGEMENT_ERROR";
|
|
296
|
+
readonly MESSAGE_SENDER_ERROR: "MESSAGE_SENDER_ERROR";
|
|
297
|
+
readonly FREE_ROUNDS_PROCESSING_ERROR: "FREE_ROUNDS_PROCESSING_ERROR";
|
|
298
|
+
readonly WEB_SESSION_NOT_OPEN: "WEB_SESSION_NOT_OPEN";
|
|
299
|
+
readonly GAMING_LIMITS_REACHED: "GAMING_LIMITS_REACHED";
|
|
300
|
+
readonly OUT_OF_MONEY: "OUT_OF_MONEY";
|
|
301
|
+
readonly UNFINISHED_ROUND_IN_PROGRESS: "UNFINISHED_ROUND_IN_PROGRESS";
|
|
302
|
+
readonly ACCESS_DENIED: "ACCESS_DENIED";
|
|
303
|
+
readonly CREDENTIALS_NOT_FOUND: "CREDENTIALS_NOT_FOUND";
|
|
304
|
+
readonly ALREADY_LOGGED_IN: "ALREADY_LOGGED_IN";
|
|
305
|
+
readonly GAME_UNAVAILABLE: "GAME_UNAVAILABLE";
|
|
306
|
+
readonly BONUS_RESTRICTION: "BONUS_RESTRICTION";
|
|
307
|
+
readonly TOO_MANY_OPEN_GAMES: "TOO_MANY_OPEN_GAMES";
|
|
308
|
+
readonly GAME_FROZEN: "GAME_FROZEN";
|
|
309
|
+
readonly WALLET_PROCESSING_ERROR: "WALLET_PROCESSING_ERROR";
|
|
310
|
+
readonly FORCED_OUTCOMES_NOT_ALLOWED: "FORCED_OUTCOMES_NOT_ALLOWED";
|
|
311
|
+
readonly MISSING_GAME_STATE: "MISSING_GAME_STATE";
|
|
312
|
+
readonly DATA_ACCESS_ERROR: "DATA_ACCESS_ERROR";
|
|
313
|
+
readonly UNKNOWN: "UNKNOWN";
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export declare type RgsErrorData = {
|
|
317
|
+
code: keyof typeof RgsErrorCode;
|
|
318
|
+
details?: unknown;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
export declare type RgsErrorWithType = {
|
|
322
|
+
type: 'timeout';
|
|
323
|
+
} | {
|
|
324
|
+
type: 'error';
|
|
325
|
+
data: RgsErrorData;
|
|
326
|
+
};
|
|
327
|
+
|
|
347
328
|
export declare type RgsOnlyMessagePayloadMap = {
|
|
348
|
-
openGameError:
|
|
329
|
+
openGameError: RgsErrorWithType;
|
|
349
330
|
openGameResponse: OpenGameResponse;
|
|
350
|
-
playError:
|
|
331
|
+
playError: RgsErrorWithType;
|
|
351
332
|
playResponse: PlayResponse;
|
|
352
333
|
realityCheck: {
|
|
353
334
|
duration: number;
|
|
@@ -427,7 +408,17 @@ export declare interface SdkConfig {
|
|
|
427
408
|
};
|
|
428
409
|
}
|
|
429
410
|
|
|
411
|
+
export declare type SdkError = {
|
|
412
|
+
messageCode: string;
|
|
413
|
+
type: 'CLOSE' | 'RELOAD' | 'CONTINUE';
|
|
414
|
+
} & ({
|
|
415
|
+
message: string;
|
|
416
|
+
} | {
|
|
417
|
+
messageKey: string;
|
|
418
|
+
});
|
|
419
|
+
|
|
430
420
|
export declare type SdkOnlyMessagePayloadMap = {
|
|
421
|
+
configure: Partial<WrapperConfig>;
|
|
431
422
|
autoplay: {
|
|
432
423
|
action: 'start' | 'stop' | 'pause' | 'resume';
|
|
433
424
|
};
|
|
@@ -444,7 +435,7 @@ export declare type SdkOnlyMessagePayloadMap = {
|
|
|
444
435
|
}[];
|
|
445
436
|
};
|
|
446
437
|
close: never;
|
|
447
|
-
error:
|
|
438
|
+
error: SdkError;
|
|
448
439
|
fullscreen: {
|
|
449
440
|
lock?: OrientationLockType;
|
|
450
441
|
};
|
|
@@ -454,7 +445,7 @@ export declare type SdkOnlyMessagePayloadMap = {
|
|
|
454
445
|
progress: number;
|
|
455
446
|
};
|
|
456
447
|
loadStart: never;
|
|
457
|
-
openGame:
|
|
448
|
+
openGame: never;
|
|
458
449
|
play: PlayRequest;
|
|
459
450
|
playCycleEnd: PlayResponse;
|
|
460
451
|
playCycleStart: ContractPlayPayload;
|
|
@@ -463,6 +454,18 @@ export declare type SdkOnlyMessagePayloadMap = {
|
|
|
463
454
|
ready: boolean;
|
|
464
455
|
};
|
|
465
456
|
playStart: ContractPlayPayload;
|
|
457
|
+
/**
|
|
458
|
+
* ```typescript
|
|
459
|
+
* {
|
|
460
|
+
* en: {
|
|
461
|
+
* 'generic_error': 'Something went wrong',
|
|
462
|
+
* },
|
|
463
|
+
* pl: {
|
|
464
|
+
* 'generic_error': 'Coś poszło nie tak',
|
|
465
|
+
* }
|
|
466
|
+
* }
|
|
467
|
+
* ```
|
|
468
|
+
*/
|
|
466
469
|
translations: Record<string, Record<string, string>>;
|
|
467
470
|
settings: Settings;
|
|
468
471
|
'telemetry.click': {
|
|
@@ -518,10 +521,21 @@ export declare type ToTelemetryPluginsForwardedMessageMap = {
|
|
|
518
521
|
wrapper: undefined;
|
|
519
522
|
};
|
|
520
523
|
|
|
524
|
+
export declare type WrapperConfig = {
|
|
525
|
+
gameName: string;
|
|
526
|
+
gameVersion: string;
|
|
527
|
+
showFreeRounds: boolean;
|
|
528
|
+
showRealityCheck: boolean;
|
|
529
|
+
showErrors: boolean;
|
|
530
|
+
showBars: boolean;
|
|
531
|
+
skipErrors: ((typeof RgsErrorCode)[keyof typeof RgsErrorCode] | 'TIMEOUT')[];
|
|
532
|
+
};
|
|
533
|
+
|
|
521
534
|
export declare type WrapperOnlyMessagePayloadMap = {
|
|
522
535
|
bet: Bet;
|
|
523
536
|
close: never;
|
|
524
537
|
configured: SdkConfig;
|
|
538
|
+
error: SdkError;
|
|
525
539
|
freeze: never;
|
|
526
540
|
history: History_3;
|
|
527
541
|
resume: never;
|
|
@@ -533,8 +547,6 @@ export declare type WrapperOnlyMessagePayloadMap = {
|
|
|
533
547
|
export declare type WrapperState = {
|
|
534
548
|
balance: number;
|
|
535
549
|
bet: Bet;
|
|
536
|
-
gameName: string;
|
|
537
|
-
version: string;
|
|
538
550
|
};
|
|
539
551
|
|
|
540
552
|
export { }
|