@kalamba/sdk 0.30.0 → 0.35.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/encoders-BdN6uQHH.js +282 -0
- package/dist/encoders-C-jSxC0Z.cjs +5 -0
- package/dist/errors-BZBs3Z5K.cjs +5 -0
- package/dist/{errors-NnLrKjTz.js → errors-CyJnvnOm.js} +12 -16
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +10 -11
- package/dist/index.js +47 -323
- package/dist/plugins.cjs +19 -19
- package/dist/plugins.d.ts +75 -10
- package/dist/plugins.js +2270 -2144
- package/dist/v4-BCq6Wm4W.js +49 -0
- package/dist/v4-BIWLDecr.cjs +5 -0
- package/dist/wrapper.cjs +2 -2
- package/dist/wrapper.d.ts +60 -11
- package/dist/wrapper.js +1908 -1879
- package/package.json +5 -4
- package/dist/encoders-BDr7fjKQ.js +0 -13
- package/dist/encoders-DVHzIpWT.cjs +0 -5
- package/dist/errors-BXO3dlhS.cjs +0 -5
- package/dist/v4-85TkMtXc.js +0 -50
- package/dist/v4-Cj9BnqmU.cjs +0 -5
package/dist/plugins.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { FormatCurrencyOptions } from '@kalamba/common/src/utils/format/currency';
|
|
2
|
+
import { StoreApi } from 'zustand';
|
|
3
|
+
|
|
4
|
+
declare interface Actions {
|
|
5
|
+
switchPlayMode: () => void;
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
declare type AuthenticateResponse = WebSocketResponse<'Authenticate', {
|
|
2
9
|
code: (typeof AuthenticateResponseCode)[keyof typeof AuthenticateResponseCode];
|
|
3
10
|
}, Record<string, unknown> & {
|
|
@@ -54,6 +61,13 @@ declare type Bet = {
|
|
|
54
61
|
multiplier: number;
|
|
55
62
|
};
|
|
56
63
|
|
|
64
|
+
export declare class BspotPlugin extends CasinoPlugin {
|
|
65
|
+
#private;
|
|
66
|
+
static store: StoreApi<Store>;
|
|
67
|
+
constructor(...args: ConstructorParameters<typeof CasinoPlugin>);
|
|
68
|
+
registerFromSdkEvents(): void;
|
|
69
|
+
}
|
|
70
|
+
|
|
57
71
|
declare type Cashier = {
|
|
58
72
|
type: 'ON_DEMAND' | 'BALANCE_LOW' | 'BALANCE_INSUFFICIENT';
|
|
59
73
|
};
|
|
@@ -87,12 +101,16 @@ declare type CasinoOnlyMessagePayloadMap = {
|
|
|
87
101
|
settings: Settings;
|
|
88
102
|
suspend: never;
|
|
89
103
|
unfreeze: never;
|
|
104
|
+
translations: NestedRecord<string, string>;
|
|
90
105
|
};
|
|
91
106
|
|
|
92
107
|
export declare abstract class CasinoPlugin {
|
|
93
108
|
config: WrapperConfig;
|
|
94
109
|
sdkConfig: SdkConfig;
|
|
95
|
-
|
|
110
|
+
state: WrapperState;
|
|
111
|
+
i18n: I18n;
|
|
112
|
+
injectPayload: (...[source, payload]: Parameters<PayloadInjectionManager['register']>) => () => void;
|
|
113
|
+
constructor(config: WrapperConfig, sdkConfig: SdkConfig, state: WrapperState, injectPayload: (...[source, payload]: Parameters<PayloadInjectionManager['register']>) => () => void);
|
|
96
114
|
protected on<M extends DomainMessage<'wrapper'> | ForwardToPluginsMessage<'casino'>>(message: M, listener: (payload: M extends DomainMessage<'wrapper'> ? DomainMessagePayload<'wrapper', M> : M extends ForwardToPluginsMessage<'casino'> ? ForwardToPluginsMessagePayload<'casino', M> : never) => void, options?: AddEventListenerOptions): void;
|
|
97
115
|
protected send<M extends DomainMessage<'casino'>>(message: M, ...[payload]: DomainMessagePayload<'casino', M> extends never ? [] : undefined extends DomainMessagePayload<'casino', M> ? [] | [DomainMessagePayload<'casino', M>] : [DomainMessagePayload<'casino', M>]): void;
|
|
98
116
|
}
|
|
@@ -149,7 +167,7 @@ export declare class EveryMatrixPlugin extends CasinoPlugin {
|
|
|
149
167
|
registerFromSdkEvents(): void;
|
|
150
168
|
}
|
|
151
169
|
|
|
152
|
-
declare type ForwardToPluginsMessage<P extends PluginDomain> = keyof ForwardToPluginsMessageMap<'sdk'>[P] | keyof ForwardToPluginsMessageMap<'rgs'>[P] | keyof ForwardToPluginsMessageMap<'casino'>[P] | keyof ForwardToPluginsMessageMap<'telemetry'>[P];
|
|
170
|
+
declare type ForwardToPluginsMessage<P extends PluginDomain> = keyof ForwardToPluginsMessageMap<'sdk'>[P] | keyof ForwardToPluginsMessageMap<'rgs'>[P] | keyof ForwardToPluginsMessageMap<'casino'>[P] | keyof ForwardToPluginsMessageMap<'telemetry'>[P] | keyof ForwardToPluginsMessageMap<'wrapper'>[P];
|
|
153
171
|
|
|
154
172
|
declare interface ForwardToPluginsMessageMap<SourceDomain extends DomainPrefix> {
|
|
155
173
|
casino: ToCasinoPluginsForwardedMessageMap[SourceDomain];
|
|
@@ -157,7 +175,7 @@ declare interface ForwardToPluginsMessageMap<SourceDomain extends DomainPrefix>
|
|
|
157
175
|
telemetry: ToTelemetryPluginsForwardedMessageMap[SourceDomain];
|
|
158
176
|
}
|
|
159
177
|
|
|
160
|
-
declare type ForwardToPluginsMessagePayload<P extends PluginDomain, M extends ForwardToPluginsMessage<P>> = ForwardToPluginsMessageMap<'sdk'>[P][M] & ForwardToPluginsMessageMap<'rgs'>[P][M] & ForwardToPluginsMessageMap<'casino'>[P][M] & ForwardToPluginsMessageMap<'telemetry'>[P][M];
|
|
178
|
+
declare type ForwardToPluginsMessagePayload<P extends PluginDomain, M extends ForwardToPluginsMessage<P>> = ForwardToPluginsMessageMap<'sdk'>[P][M] & ForwardToPluginsMessageMap<'rgs'>[P][M] & ForwardToPluginsMessageMap<'casino'>[P][M] & ForwardToPluginsMessageMap<'telemetry'>[P][M] & ForwardToPluginsMessageMap<'wrapper'>[P][M];
|
|
161
179
|
|
|
162
180
|
declare type FreeRound = {
|
|
163
181
|
conf: {
|
|
@@ -241,6 +259,19 @@ declare type History_2 = {
|
|
|
241
259
|
source: 'realityCheck' | 'settings' | 'casino';
|
|
242
260
|
};
|
|
243
261
|
|
|
262
|
+
declare class I18n {
|
|
263
|
+
#private;
|
|
264
|
+
constructor({ config }: {
|
|
265
|
+
config: SdkConfig;
|
|
266
|
+
});
|
|
267
|
+
formatNumber(number: string | number, formatOptions?: Intl.NumberFormatOptions): string;
|
|
268
|
+
formatCurrency(number: string | number, options?: FormatCurrencyOptions, formatOptions?: Intl.NumberFormatOptions): string;
|
|
269
|
+
formatCoins(amount: number | string, formatOptions?: Intl.NumberFormatOptions): string;
|
|
270
|
+
formatCoinsWithCurrency(amount: number | string, formatOptions?: Intl.NumberFormatOptions): string;
|
|
271
|
+
formatMoney(amount: number | string, formatOptions?: Intl.NumberFormatOptions): string;
|
|
272
|
+
formatMoneyWithCurrency(amount: number | string, formatOptions?: Intl.NumberFormatOptions): string;
|
|
273
|
+
}
|
|
274
|
+
|
|
244
275
|
export declare const KalambaBullseyeParsers: {
|
|
245
276
|
parseAuthenticateResponse: typeof parseAuthenticateResponse;
|
|
246
277
|
parseAuthenticateError: typeof parseAuthenticateError;
|
|
@@ -572,6 +603,37 @@ declare function parsePlayError(errorResponse: any): RgsErrorData;
|
|
|
572
603
|
|
|
573
604
|
declare function parsePlayResponse(playResponse: ResultGameEvent['body'], dataDecoder?: Decoder): PlayResponse;
|
|
574
605
|
|
|
606
|
+
declare type PayloadData = Record<string, unknown>;
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* PayloadInjectionManager manages payload injection from multiple sources.
|
|
610
|
+
* Each source can register either static payload data or async functions that will be merged together when creating the final payload for injection.
|
|
611
|
+
*/
|
|
612
|
+
declare class PayloadInjectionManager {
|
|
613
|
+
#private;
|
|
614
|
+
/**
|
|
615
|
+
* Register or update payload injector from a specific source
|
|
616
|
+
* @param source - Unique identifier for the payload source (e.g., 'bspot', 'freeRounds')
|
|
617
|
+
* @param payload - Payload data or async function that receives playPayload and returns payload data
|
|
618
|
+
*/
|
|
619
|
+
register(source: PayloadSource, payloadProvider: PayloadProvider): void;
|
|
620
|
+
/**
|
|
621
|
+
* Remove payload injector from a specific source
|
|
622
|
+
* @param source - Source identifier to remove
|
|
623
|
+
*/
|
|
624
|
+
unregister(source: PayloadSource): void;
|
|
625
|
+
/**
|
|
626
|
+
* Get merged payload from all registered injectors
|
|
627
|
+
* @param playPayload - The play payload that will be passed to registered functions
|
|
628
|
+
* @returns Promise resolving to merged payload object or undefined if no injectors registered
|
|
629
|
+
*/
|
|
630
|
+
getPayload(playPayload: ContractPlayPayload): Promise<PayloadData | undefined>;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
declare type PayloadProvider = PayloadData | ((playPayload: ContractPlayPayload) => PayloadData | Promise<PayloadData>);
|
|
634
|
+
|
|
635
|
+
declare type PayloadSource = string;
|
|
636
|
+
|
|
575
637
|
declare type PlayRequest = {
|
|
576
638
|
contract: ContractPlayPayload;
|
|
577
639
|
extra?: unknown;
|
|
@@ -836,9 +898,6 @@ declare type SdkOnlyMessagePayloadMap = {
|
|
|
836
898
|
autoplay: {
|
|
837
899
|
action: 'start' | 'stop' | 'pause' | 'resume';
|
|
838
900
|
};
|
|
839
|
-
balance: {
|
|
840
|
-
balance: number;
|
|
841
|
-
};
|
|
842
901
|
bet: Bet;
|
|
843
902
|
cashier: Cashier;
|
|
844
903
|
choice: {
|
|
@@ -899,6 +958,11 @@ export declare class SoftSwissPlugin extends CasinoPlugin {
|
|
|
899
958
|
registerFromSdkEvents(): void;
|
|
900
959
|
}
|
|
901
960
|
|
|
961
|
+
declare interface State {
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
declare type Store = State & Actions;
|
|
965
|
+
|
|
902
966
|
declare type TelemetryOnlyMessagePayloadMap = {
|
|
903
967
|
[key: string]: unknown;
|
|
904
968
|
};
|
|
@@ -913,9 +977,9 @@ export declare abstract class TelemetryPlugin {
|
|
|
913
977
|
}
|
|
914
978
|
|
|
915
979
|
declare type ToCasinoPluginsForwardedMessageMap = {
|
|
916
|
-
sdk: Pick<SdkOnlyMessagePayloadMap, 'autoplay' | '
|
|
980
|
+
sdk: Pick<SdkOnlyMessagePayloadMap, 'autoplay' | 'bet' | 'cashier' | 'choice' | 'close' | 'configure' | 'error' | 'history' | 'loadEnd' | 'loadProgress' | 'loadStart' | 'openGame' | 'play' | 'playCycleEnd' | 'playCycleStart' | 'playEnd' | 'playReady' | 'playStart' | 'settings' | 'fullscreen'>;
|
|
917
981
|
casino: undefined;
|
|
918
|
-
rgs: Pick<RgsOnlyMessagePayloadMap, 'playResponse' | 'playError' | 'openGameResponse'>;
|
|
982
|
+
rgs: Pick<RgsOnlyMessagePayloadMap, 'balance' | 'playResponse' | 'playError' | 'openGameResponse'>;
|
|
919
983
|
telemetry: undefined;
|
|
920
984
|
wrapper: undefined;
|
|
921
985
|
};
|
|
@@ -1002,6 +1066,7 @@ declare type WrapperConfig = {
|
|
|
1002
1066
|
|
|
1003
1067
|
declare type WrapperOnlyMessagePayloadMap = {
|
|
1004
1068
|
bet: Bet;
|
|
1069
|
+
cashier: Cashier;
|
|
1005
1070
|
close: never;
|
|
1006
1071
|
configured: SdkConfig;
|
|
1007
1072
|
error: SdkError;
|
|
@@ -1024,8 +1089,8 @@ declare type WrapperState = {
|
|
|
1024
1089
|
isSdkConfigured: boolean;
|
|
1025
1090
|
balance: number;
|
|
1026
1091
|
bet: Bet;
|
|
1027
|
-
openGameResponse?: OpenGameResponse;
|
|
1028
|
-
lastPlayResponse?: PlayResponse;
|
|
1092
|
+
openGameResponse?: OpenGameResponse['contract'];
|
|
1093
|
+
lastPlayResponse?: PlayResponse['contract'];
|
|
1029
1094
|
freeRoundId?: string;
|
|
1030
1095
|
};
|
|
1031
1096
|
|