@kalamba/sdk 0.7.0 → 0.8.1

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.
@@ -2,4 +2,4 @@
2
2
  * BSD 3-Clause License
3
3
  * Copyright (c) 2024, Kalamba Games Limited
4
4
  */
5
- "use strict";var O=Object.defineProperty;var A=(_,E,R)=>E in _?O(_,E,{enumerable:!0,configurable:!0,writable:!0,value:R}):_[E]=R;var N=(_,E,R)=>(A(_,typeof E!="symbol"?E+"":E,R),R);const S={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"};class I extends Error{constructor(R){super();N(this,"data");this.name="RgsError",this.data=R}}class T extends Error{constructor(){super(),this.name="TimeoutError"}}exports.RgsError=I;exports.RgsErrorCode=S;exports.TimeoutError=T;
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;
@@ -2,9 +2,9 @@
2
2
  * BSD 3-Clause License
3
3
  * Copyright (c) 2024, Kalamba Games Limited
4
4
  */
5
- var O = Object.defineProperty;
6
- var A = (_, E, R) => E in _ ? O(_, E, { enumerable: !0, configurable: !0, writable: !0, value: R }) : _[E] = R;
7
- var N = (_, E, R) => (A(_, typeof E != "symbol" ? E + "" : E, R), R);
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
8
  const I = {
9
9
  CONNECTION_ERROR: "CONNECTION_ERROR",
10
10
  INVALID_BET_CURRENCY: "INVALID_BET_CURRENCY",
@@ -37,21 +37,54 @@ const I = {
37
37
  MISSING_GAME_STATE: "MISSING_GAME_STATE",
38
38
  DATA_ACCESS_ERROR: "DATA_ACCESS_ERROR",
39
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"
40
72
  };
41
- class T extends Error {
42
- constructor(R) {
73
+ class L extends Error {
74
+ constructor(O) {
43
75
  super();
44
- N(this, "data");
45
- this.name = "RgsError", this.data = R;
76
+ R(this, "data");
77
+ this.name = "RgsError", this.data = O;
46
78
  }
47
79
  }
48
- class D extends Error {
80
+ class T extends Error {
49
81
  constructor() {
50
82
  super(), this.name = "TimeoutError";
51
83
  }
52
84
  }
53
85
  export {
54
- T as R,
55
- D as T,
56
- I as a
86
+ L as R,
87
+ T,
88
+ I as a,
89
+ C as b
57
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 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-c5948a4a.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},"*")}async openGame(i){const t=new Promise(o=>this.on("configured",o,{once:!0})),n=await this.request("openGame",i);if(n.type==="response")return await t,n.response;throw n.error.type==="timeout"?new D.TimeoutError:new D.RgsError(n.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;
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)),e=(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 U(r){const i=I(r);return i.setHours(23,59,59,999),i}function k(){return U(Date.now())}function L(r){const i=I(r);return i.setHours(0,0,0,0),i}function P(){return L(Date.now())}const $=3e4;var F,S;class G{constructor(i){e(this,F,void 0);e(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 A{constructor({config:i}){e(this,s,void 0);e(this,l,void 0);u(this,s,i),u(this,l,new G({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:P(),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 _(r,i){return r*i/100}function O(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},"BK.":{maximumFractionDigits:2,minimumFractionDigits:2},"BT.":{maximumFractionDigits:2,minimumFractionDigits:2},"FC.":{maximumFractionDigits:2,minimumFractionDigits:2},"GC.":{maximumFractionDigits:2,minimumFractionDigits:2},"SC.":{maximumFractionDigits:2,minimumFractionDigits:2},GLD:{displayAs:"GC.",maximumFractionDigits:2,minimumFractionDigits:2},SS1:{displayAs:"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 K(r,i,t){const{maximumFractionDigits:n,minimumFractionDigits:o}=t.resolvedOptions();return O(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 v(r,i,{as:t,from:n}={as:"Currency",from:"Money"},o){if(!["string","number"].includes(typeof i))return"NaN";const{canShowCurrency:a=!0,coinValueInCents:g,currency:x,locales:R}=r;n==="Coins"&&(i=_(+i,g));try{const H=j(x),E=new Intl.NumberFormat(R,{...H,...o,currencyDisplay:"symbol",numberingSystem:"latn",style:"currency"});return t==="Number"||!a?K(r,i,E):q(i,E,x)}catch{return V(r,i,{as:t})}}var c;class B{constructor({config:i}){e(this,c,void 0);u(this,c,i)}formatNumber(i,t){const n={locales:[m(this,c).ui.language]};return O(n,i,t)}formatCurrency(i,t={as:y.Currency,from:f.Money},n){const o=m(this,c).ui.feature.showCurrency,a=m(this,c).api.coinValueInCents,g=m(this,c).api.currency||w,x=[m(this,c).ui.language];return v({canShowCurrency:o,coinValueInCents:a,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 d,h,p,C;class z{constructor({messagePort:i}){e(this,d,void 0);e(this,h,void 0);e(this,p,void 0);e(this,C,void 0);u(this,C,i),this.on("configured",t=>{u(this,d,t),u(this,p,new B({config:t})),u(this,h,new A({config:t}))}),this.on("playResponse",t=>{this.config.api.lastRoundId=t.contract.roundId})}get config(){if(!m(this,d))throw new Error("config is not initialized, you must open game first");return m(this,d)}get history(){if(!m(this,h))throw new Error("config is not initialized, you must open game first");return m(this,h)}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 a(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",a))};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},a=await this.request("play",o);if(a.type==="response")return a.response;throw a.error.type==="timeout"?new D.TimeoutError:new D.RgsError(a.error.data)}}d=new WeakMap,h=new WeakMap,p=new WeakMap,C=new WeakMap;exports.RgsError=D.RgsError;exports.RgsErrorCode=D.RgsErrorCode;exports.TimeoutError=D.TimeoutError;exports.History=A;exports.I18n=B;exports.KalambaSdk=z;
package/dist/index.d.ts CHANGED
@@ -147,7 +147,8 @@ export declare class KalambaSdk {
147
147
  protected request<M extends DomainMessage<'sdk'>>(message: M, ...[payload]: DomainMessagePayload<'sdk', M> extends never ? [] : [payload: DomainMessagePayload<'sdk', M>]): Promise<RgsResponse<M>>;
148
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;
149
149
  send<M extends DomainMessage<'sdk'>>(message: M, ...[payload]: DomainMessagePayload<'sdk', M> extends never ? [] : [DomainMessagePayload<'sdk', M>]): void;
150
- openGame(payload: DomainMessagePayload<'sdk', 'openGame'>): Promise<OpenGameResponse>;
150
+ configure(payload: DomainMessagePayload<'sdk', 'configure'>): void;
151
+ openGame(): Promise<OpenGameResponse>;
151
152
  play(contract: ContractPlayPayload, extra?: unknown, actionType?: string): Promise<PlayResponse>;
152
153
  }
153
154
 
@@ -162,12 +163,6 @@ export declare type MessageMessageEvent<M extends Message> = MessageEvent<{
162
163
 
163
164
  export declare type MessagePayload<M extends Message> = MessageMap[M];
164
165
 
165
- export declare type OpenGameRequest = {
166
- gameName: string;
167
- /** version of game client */
168
- version: string;
169
- };
170
-
171
166
  export declare type OpenGameResponse = {
172
167
  contract: {
173
168
  bet: {
@@ -284,13 +279,6 @@ export declare class RgsError extends Error {
284
279
  constructor(data: RgsErrorData);
285
280
  }
286
281
 
287
- declare type RgsError_2 = {
288
- type: 'timeout';
289
- } | {
290
- type: 'error';
291
- data: RgsErrorData;
292
- };
293
-
294
282
  export declare const RgsErrorCode: {
295
283
  readonly CONNECTION_ERROR: "CONNECTION_ERROR";
296
284
  readonly INVALID_BET_CURRENCY: "INVALID_BET_CURRENCY";
@@ -330,10 +318,17 @@ export declare type RgsErrorData = {
330
318
  details?: unknown;
331
319
  };
332
320
 
321
+ export declare type RgsErrorWithType = {
322
+ type: 'timeout';
323
+ } | {
324
+ type: 'error';
325
+ data: RgsErrorData;
326
+ };
327
+
333
328
  export declare type RgsOnlyMessagePayloadMap = {
334
- openGameError: RgsError_2;
329
+ openGameError: RgsErrorWithType;
335
330
  openGameResponse: OpenGameResponse;
336
- playError: RgsError_2;
331
+ playError: RgsErrorWithType;
337
332
  playResponse: PlayResponse;
338
333
  realityCheck: {
339
334
  duration: number;
@@ -407,6 +402,12 @@ export declare interface SdkConfig {
407
402
  maximumBet?: number;
408
403
  minimumSpinDuration: number;
409
404
  requestTimeoutMs: number;
405
+ incompleteGameResolution: {
406
+ type: 'NONE' | 'MANUAL';
407
+ } | {
408
+ daysToAutoResolution: number;
409
+ type: 'AUTOMATIC';
410
+ };
410
411
  realityCheck: RealityCheckConfig;
411
412
  skipInsufficientFundsCheck: boolean;
412
413
  skipSplash: boolean;
@@ -423,6 +424,7 @@ export declare type SdkError = {
423
424
  });
424
425
 
425
426
  export declare type SdkOnlyMessagePayloadMap = {
427
+ configure: Partial<WrapperConfig>;
426
428
  autoplay: {
427
429
  action: 'start' | 'stop' | 'pause' | 'resume';
428
430
  };
@@ -449,7 +451,7 @@ export declare type SdkOnlyMessagePayloadMap = {
449
451
  progress: number;
450
452
  };
451
453
  loadStart: never;
452
- openGame: OpenGameRequest;
454
+ openGame: never;
453
455
  play: PlayRequest;
454
456
  playCycleEnd: PlayResponse;
455
457
  playCycleStart: ContractPlayPayload;
@@ -477,6 +479,9 @@ export declare type SdkOnlyMessagePayloadMap = {
477
479
  name: string;
478
480
  };
479
481
  'telemetry.orientationChange': never;
482
+ freeRoundsOffer: any;
483
+ freeRoundsInfo: any;
484
+ freeRoundsComplete: any;
480
485
  };
481
486
 
482
487
  export declare interface SearchPeriod {
@@ -525,10 +530,21 @@ export declare type ToTelemetryPluginsForwardedMessageMap = {
525
530
  wrapper: undefined;
526
531
  };
527
532
 
533
+ export declare type WrapperConfig = {
534
+ gameName: string;
535
+ gameVersion: string;
536
+ showFreeRounds: boolean;
537
+ showRealityCheck: boolean;
538
+ showErrors: boolean;
539
+ showBars: boolean;
540
+ skipErrors: ((typeof RgsErrorCode)[keyof typeof RgsErrorCode] | 'TIMEOUT')[];
541
+ };
542
+
528
543
  export declare type WrapperOnlyMessagePayloadMap = {
529
544
  bet: Bet;
530
545
  close: never;
531
546
  configured: SdkConfig;
547
+ error: SdkError;
532
548
  freeze: never;
533
549
  history: History_3;
534
550
  resume: never;
@@ -540,8 +556,6 @@ export declare type WrapperOnlyMessagePayloadMap = {
540
556
  export declare type WrapperState = {
541
557
  balance: number;
542
558
  bet: Bet;
543
- gameName: string;
544
- version: string;
545
559
  };
546
560
 
547
561
  export { }
package/dist/index.js CHANGED
@@ -11,25 +11,25 @@ var m = (n, i, t) => (N(n, i, "read from private field"), t ? t.call(n) : i.get(
11
11
  throw TypeError("Cannot add the same private member more than once");
12
12
  i instanceof WeakSet ? i.add(n) : i.set(n, t);
13
13
  }, u = (n, i, t, r) => (N(n, i, "write to private field"), r ? r.call(n, t) : i.set(n, t), t);
14
- import { T as b, R as E } from "./errors-867a013a.js";
15
- import { a as ii } from "./errors-867a013a.js";
16
- function A(n) {
14
+ import { T as b, R as E } from "./errors-afd9f527.js";
15
+ import { a as ii } from "./errors-afd9f527.js";
16
+ function I(n) {
17
17
  const i = Object.prototype.toString.call(n);
18
18
  return n instanceof Date || typeof n == "object" && i === "[object Date]" ? new n.constructor(+n) : typeof n == "number" || i === "[object Number]" || typeof n == "string" || i === "[object String]" ? new Date(n) : /* @__PURE__ */ new Date(NaN);
19
19
  }
20
- function U(n) {
21
- const i = A(n);
20
+ function H(n) {
21
+ const i = I(n);
22
22
  return i.setHours(23, 59, 59, 999), i;
23
23
  }
24
- function B() {
25
- return U(Date.now());
24
+ function U() {
25
+ return H(Date.now());
26
26
  }
27
- function k(n) {
28
- const i = A(n);
27
+ function L(n) {
28
+ const i = I(n);
29
29
  return i.setHours(0, 0, 0, 0), i;
30
30
  }
31
- function L() {
32
- return k(Date.now());
31
+ function k() {
32
+ return L(Date.now());
33
33
  }
34
34
  const P = 3e4;
35
35
  var D, x;
@@ -60,12 +60,12 @@ class $ {
60
60
  }
61
61
  }
62
62
  D = new WeakMap(), x = new WeakMap();
63
- const I = {
63
+ const A = {
64
64
  limit: 100,
65
65
  page: 0
66
66
  };
67
67
  var s, y;
68
- class _ {
68
+ class G {
69
69
  constructor({
70
70
  config: i
71
71
  }) {
@@ -76,7 +76,7 @@ class _ {
76
76
  }));
77
77
  }
78
78
  async getRound(i, {
79
- pagination: t = I
79
+ pagination: t = A
80
80
  } = {}) {
81
81
  return m(this, y).getRound(i, {
82
82
  gameCode: m(this, s).api.game,
@@ -90,10 +90,10 @@ class _ {
90
90
  }
91
91
  async getRounds({
92
92
  searchPeriod: i = {
93
- fromDateTime: L(),
94
- toDateTime: B()
93
+ fromDateTime: k(),
94
+ toDateTime: U()
95
95
  },
96
- pagination: t = I
96
+ pagination: t = A
97
97
  } = {}) {
98
98
  const r = m(this, s).api.user.replace(/^user_/, "").replace(new RegExp(`_${m(this, s).api.integration}$`), "");
99
99
  return m(this, y).getRounds({
@@ -107,7 +107,7 @@ class _ {
107
107
  }
108
108
  }
109
109
  s = new WeakMap(), y = new WeakMap();
110
- function G(n, i) {
110
+ function _(n, i) {
111
111
  return n * i / 100;
112
112
  }
113
113
  function O(n, i, t) {
@@ -126,9 +126,9 @@ function O(n, i, t) {
126
126
  return `${i}`;
127
127
  }
128
128
  }
129
- const w = "XTS";
129
+ const S = "XTS";
130
130
  var F = /* @__PURE__ */ ((n) => (n.Currency = "Currency", n.Number = "Number", n))(F || {}), f = /* @__PURE__ */ ((n) => (n.Coins = "Coins", n.Money = "Money", n))(f || {});
131
- const S = {
131
+ const w = {
132
132
  /* eslint-disable sort-keys-fix/sort-keys-fix */
133
133
  // ARSB is the internal currency relevant for invoicing purposes, players should see it as ARS
134
134
  ARSB: { displayAs: "ARS", maximumFractionDigits: 2, minimumFractionDigits: 2 },
@@ -203,9 +203,13 @@ const S = {
203
203
  STAKEGC: { displayAs: "GC", maximumFractionDigits: 0, minimumFractionDigits: 0 },
204
204
  STAKESC: { displayAs: "SC", maximumFractionDigits: 2, minimumFractionDigits: 2 },
205
205
  // Social currency on Relax
206
+ "BK.": { maximumFractionDigits: 2, minimumFractionDigits: 2 },
207
+ "BT.": { maximumFractionDigits: 2, minimumFractionDigits: 2 },
206
208
  "FC.": { maximumFractionDigits: 2, minimumFractionDigits: 2 },
207
209
  "GC.": { maximumFractionDigits: 2, minimumFractionDigits: 2 },
208
210
  "SC.": { maximumFractionDigits: 2, minimumFractionDigits: 2 },
211
+ GLD: { displayAs: "GC.", maximumFractionDigits: 2, minimumFractionDigits: 2 },
212
+ SS1: { displayAs: "SC.", maximumFractionDigits: 2, minimumFractionDigits: 2 },
209
213
  // Silvercash
210
214
  SVC: { maximumFractionDigits: 2, minimumFractionDigits: 2 },
211
215
  // Polkadot
@@ -222,33 +226,33 @@ const S = {
222
226
  FTN: { maximumFractionDigits: 4, minimumFractionDigits: 4 }
223
227
  /* eslint-enable sort-keys-fix/sort-keys-fix */
224
228
  };
225
- function M(n) {
226
- return n in S;
229
+ function B(n) {
230
+ return n in w;
227
231
  }
228
232
  function j(n) {
229
- return M(n) ? {
230
- ...S[n],
231
- currency: w
233
+ return B(n) ? {
234
+ ...w[n],
235
+ currency: S
232
236
  } : {
233
237
  currency: n
234
238
  };
235
239
  }
236
240
  function q(n, i, t) {
237
241
  const r = i.format(+n);
238
- return M(t) ? r.replace(w, S[t].displayAs ?? t) : r;
242
+ return B(t) ? r.replace(S, w[t].displayAs ?? t) : r;
239
243
  }
240
244
  function V(n, i, t) {
241
245
  const { maximumFractionDigits: r, minimumFractionDigits: o } = t.resolvedOptions();
242
246
  return O(n, i, { maximumFractionDigits: r, minimumFractionDigits: o });
243
247
  }
244
- function X(n, i, { as: t } = {
248
+ function K(n, i, { as: t } = {
245
249
  as: "Currency"
246
250
  /* Currency */
247
251
  }) {
248
252
  const { canShowCurrency: r, currency: o } = n;
249
253
  return t === "Number" || !r ? `${i}` : `${i} ${o}`;
250
254
  }
251
- function v(n, i, { as: t, from: r } = {
255
+ function X(n, i, { as: t, from: r } = {
252
256
  as: "Currency",
253
257
  from: "Money"
254
258
  /* Money */
@@ -256,10 +260,10 @@ function v(n, i, { as: t, from: r } = {
256
260
  if (!["string", "number"].includes(typeof i))
257
261
  return "NaN";
258
262
  const { canShowCurrency: a = !0, coinValueInCents: g, currency: C, locales: T } = n;
259
- r === "Coins" && (i = G(+i, g));
263
+ r === "Coins" && (i = _(+i, g));
260
264
  try {
261
- const H = j(C), R = new Intl.NumberFormat(T, {
262
- ...H,
265
+ const M = j(C), R = new Intl.NumberFormat(T, {
266
+ ...M,
263
267
  ...o,
264
268
  currencyDisplay: "symbol",
265
269
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -269,11 +273,11 @@ function v(n, i, { as: t, from: r } = {
269
273
  });
270
274
  return t === "Number" || !a ? V(n, i, R) : q(i, R, C);
271
275
  } catch {
272
- return X(n, i, { as: t });
276
+ return K(n, i, { as: t });
273
277
  }
274
278
  }
275
279
  var c;
276
- class z {
280
+ class v {
277
281
  constructor({ config: i }) {
278
282
  e(this, c, void 0);
279
283
  u(this, c, i);
@@ -283,8 +287,8 @@ class z {
283
287
  return O(r, i, t);
284
288
  }
285
289
  formatCurrency(i, t = { as: F.Currency, from: f.Money }, r) {
286
- const o = m(this, c).ui.feature.showCurrency, a = m(this, c).api.coinValueInCents, g = m(this, c).api.currency || w, C = [m(this, c).ui.language];
287
- return v({
290
+ const o = m(this, c).ui.feature.showCurrency, a = m(this, c).api.coinValueInCents, g = m(this, c).api.currency || S, C = [m(this, c).ui.language];
291
+ return X({
288
292
  canShowCurrency: o,
289
293
  coinValueInCents: a,
290
294
  currency: g,
@@ -305,7 +309,7 @@ class z {
305
309
  }
306
310
  }
307
311
  c = new WeakMap();
308
- const K = () => {
312
+ const z = () => {
309
313
  };
310
314
  var l, h, p, d;
311
315
  class Y {
@@ -315,7 +319,7 @@ class Y {
315
319
  e(this, p, void 0);
316
320
  e(this, d, void 0);
317
321
  u(this, d, i), this.on("configured", (t) => {
318
- u(this, l, t), u(this, p, new z({ config: t })), u(this, h, new _({ config: t }));
322
+ u(this, l, t), u(this, p, new v({ config: t })), u(this, h, new G({ config: t }));
319
323
  }), this.on("playResponse", (t) => {
320
324
  this.config.api.lastRoundId = t.contract.roundId;
321
325
  });
@@ -344,7 +348,7 @@ class Y {
344
348
  }
345
349
  on(i, t, r) {
346
350
  const o = function a(g) {
347
- g.data.message === `kalamba:wrapper:${i}` && (K("on", g.data.message.replace(/^kalamba:/, ""), g.data.payload), t(g.data.payload), r != null && r.once && window.removeEventListener("message", a));
351
+ g.data.message === `kalamba:wrapper:${i}` && (z("on", g.data.message.replace(/^kalamba:/, ""), g.data.payload), t(g.data.payload), r != null && r.once && window.removeEventListener("message", a));
348
352
  };
349
353
  window.addEventListener("message", o);
350
354
  }
@@ -358,11 +362,14 @@ class Y {
358
362
  "*"
359
363
  );
360
364
  }
361
- async openGame(i) {
362
- const t = new Promise((o) => this.on("configured", o, { once: !0 })), r = await this.request("openGame", i);
363
- if (r.type === "response")
364
- return await t, r.response;
365
- throw r.error.type === "timeout" ? new b() : new E(r.error.data);
365
+ configure(i) {
366
+ this.send("configure", i);
367
+ }
368
+ async openGame() {
369
+ const i = new Promise((r) => this.on("configured", r, { once: !0 })), t = await this.request("openGame");
370
+ if (t.type === "response")
371
+ return await i, t.response;
372
+ throw t.error.type === "timeout" ? new b() : new E(t.error.data);
366
373
  }
367
374
  async play(i, t, r = "SPIN") {
368
375
  const o = { contract: i, extra: t, actionType: r }, a = await this.request("play", o);
@@ -373,8 +380,8 @@ class Y {
373
380
  }
374
381
  l = new WeakMap(), h = new WeakMap(), p = new WeakMap(), d = new WeakMap();
375
382
  export {
376
- _ as History,
377
- z as I18n,
383
+ G as History,
384
+ v as I18n,
378
385
  Y as KalambaSdk,
379
386
  E as RgsError,
380
387
  ii as RgsErrorCode,