@rb-games/core 0.1.5 → 0.2.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/CHANGELOG.md +13 -0
- package/dist/helpers/index.js +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +2 -515
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/language/I18NextPlugin.types.d.ts +2 -2
- package/dist/state-machine/StateMachine.d.ts +18 -0
- package/dist/state-machine/StateMachine.d.ts.map +1 -1
- package/dist/state-machine/index.js +37 -10
- package/dist/state-machine/index.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/dist/plugins/service/ServiceAdapter.d.ts +0 -88
- package/dist/plugins/service/ServiceAdapter.d.ts.map +0 -1
- package/dist/plugins/service/ServiceEventHelper.d.ts +0 -6
- package/dist/plugins/service/ServiceEventHelper.d.ts.map +0 -1
- package/dist/plugins/service/ServicePlugin.d.ts +0 -135
- package/dist/plugins/service/ServicePlugin.d.ts.map +0 -1
- package/dist/plugins/service/ServicePlugin.types.d.ts +0 -14
- package/dist/plugins/service/ServicePlugin.types.d.ts.map +0 -1
- package/dist/plugins/service/adapters/DevAuthAdapter.d.ts +0 -56
- package/dist/plugins/service/adapters/DevAuthAdapter.d.ts.map +0 -1
- package/dist/plugins/service/adapters/RGSAdapter.d.ts +0 -82
- package/dist/plugins/service/adapters/RGSAdapter.d.ts.map +0 -1
- package/dist/plugins/service/adapters/index.d.ts +0 -7
- package/dist/plugins/service/adapters/index.d.ts.map +0 -1
- package/dist/plugins/service/adapters/resolvePublicIp.d.ts +0 -10
- package/dist/plugins/service/adapters/resolvePublicIp.d.ts.map +0 -1
- package/dist/plugins/service/index.d.ts +0 -10
- package/dist/plugins/service/index.d.ts.map +0 -1
- package/dist/plugins/service/types/api.types.d.ts +0 -299
- package/dist/plugins/service/types/api.types.d.ts.map +0 -1
- package/dist/plugins/service/types/index.d.ts +0 -6
- package/dist/plugins/service/types/index.d.ts.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @rb-games/core
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6130bcf: Move the RGS client out of core: ServicePlugin, adapters, wire contract and presentation now live on `@rb-games/slot` (`/service`, `/wire`, `/presentation`). `@rb-games/core/plugins` no longer re-exports those types; `@rb-games/precomputed` is removed.
|
|
8
|
+
|
|
9
|
+
## 0.1.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- added changeset
|
package/dist/helpers/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { resolvePublicPath } from '../chunk-NQMORMNP.js';
|
|
2
2
|
import { darkenColor, lightenColor } from '../chunk-XHUPUPPW.js';
|
|
3
|
-
import '../chunk-C45KDREE.js';
|
|
4
3
|
import '../chunk-5BLUF2HG.js';
|
|
5
4
|
import { require_lodash } from '../chunk-NAQG7TMS.js';
|
|
5
|
+
import '../chunk-C45KDREE.js';
|
|
6
6
|
import { __toESM } from '../chunk-G3PMV62Z.js';
|
|
7
7
|
import { ExtensionType, Assets, Color, Cache, Texture, TextureSource } from 'pixi.js';
|
|
8
8
|
import { minimatch } from 'minimatch';
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { EnginePlugin, PluginConfig } from './Plugin.types';
|
|
1
2
|
export * from './device';
|
|
2
3
|
export * from './resource';
|
|
3
4
|
export * from './display';
|
|
@@ -7,7 +8,6 @@ export * from './input';
|
|
|
7
8
|
export * from './language';
|
|
8
9
|
export * from './scene';
|
|
9
10
|
export * from './sentry';
|
|
10
|
-
export * from './service';
|
|
11
11
|
export * from './skin';
|
|
12
12
|
export * from './sound';
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../plugins/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjE,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { initSlotI18n, t, changeLanguage, getCurrentLanguage, isI18nReady, getI18nInstance } from '../chunk-P4GCINNA.js';
|
|
2
2
|
import { ENGINE_HOOKS } from '../chunk-MI6BP7A6.js';
|
|
3
3
|
import { resolvePublicPath } from '../chunk-NQMORMNP.js';
|
|
4
|
-
import { getLogger } from '../chunk-C45KDREE.js';
|
|
5
4
|
import { require_lodash } from '../chunk-NAQG7TMS.js';
|
|
5
|
+
import { getLogger } from '../chunk-C45KDREE.js';
|
|
6
6
|
import { __toESM } from '../chunk-G3PMV62Z.js';
|
|
7
7
|
import { EventEmitter, detectWebp, isMobile, Assets, Container, VERSION } from 'pixi.js';
|
|
8
8
|
import '@esotericsoftware/spine-pixi-v8';
|
|
@@ -2743,519 +2743,6 @@ var SentryPlugin = class {
|
|
|
2743
2743
|
}
|
|
2744
2744
|
};
|
|
2745
2745
|
|
|
2746
|
-
// plugins/service/types/api.types.ts
|
|
2747
|
-
var ServiceActions = /* @__PURE__ */ ((ServiceActions2) => {
|
|
2748
|
-
ServiceActions2["SESSION"] = "service:session";
|
|
2749
|
-
ServiceActions2["GAMEPLAY"] = "service:gameplay";
|
|
2750
|
-
ServiceActions2["HISTORY"] = "service:history";
|
|
2751
|
-
ServiceActions2["ERROR"] = "service:error";
|
|
2752
|
-
ServiceActions2["TIMEOUT"] = "service:timeout";
|
|
2753
|
-
ServiceActions2["BALANCE_UPDATE"] = "service:balance";
|
|
2754
|
-
return ServiceActions2;
|
|
2755
|
-
})(ServiceActions || {});
|
|
2756
|
-
|
|
2757
|
-
// plugins/service/ServicePlugin.ts
|
|
2758
|
-
var ServicePlugin = class extends EventEmitter {
|
|
2759
|
-
constructor(config) {
|
|
2760
|
-
super();
|
|
2761
|
-
this.name = "servicePlugin";
|
|
2762
|
-
this.priority = 15;
|
|
2763
|
-
this.dependencies = ["eventBusPlugin"];
|
|
2764
|
-
/** Cached session response */
|
|
2765
|
-
this._session = null;
|
|
2766
|
-
/** Cached game config */
|
|
2767
|
-
this._gameConfig = null;
|
|
2768
|
-
this.config = {
|
|
2769
|
-
priority: 15,
|
|
2770
|
-
enabled: true,
|
|
2771
|
-
...config
|
|
2772
|
-
};
|
|
2773
|
-
this.adapter = config.adapter;
|
|
2774
|
-
this.adapter.on("service:session" /* SESSION */, this.onAdapterEvent.bind(this, "service:session" /* SESSION */));
|
|
2775
|
-
this.adapter.on(
|
|
2776
|
-
"service:gameplay" /* GAMEPLAY */,
|
|
2777
|
-
this.onAdapterEvent.bind(this, "service:gameplay" /* GAMEPLAY */)
|
|
2778
|
-
);
|
|
2779
|
-
this.adapter.on("service:history" /* HISTORY */, this.onAdapterEvent.bind(this, "service:history" /* HISTORY */));
|
|
2780
|
-
this.adapter.on("service:error" /* ERROR */, this.onAdapterEvent.bind(this, "service:error" /* ERROR */));
|
|
2781
|
-
this.adapter.on("service:timeout" /* TIMEOUT */, this.onAdapterEvent.bind(this, "service:timeout" /* TIMEOUT */));
|
|
2782
|
-
getLogger("ServicePlugin").info("ServicePlugin created");
|
|
2783
|
-
}
|
|
2784
|
-
/**
|
|
2785
|
-
* Initialize the plugin
|
|
2786
|
-
*/
|
|
2787
|
-
async initialize(engine) {
|
|
2788
|
-
this.engine = engine;
|
|
2789
|
-
getLogger("ServicePlugin").info("ServicePlugin initialized");
|
|
2790
|
-
}
|
|
2791
|
-
/**
|
|
2792
|
-
* Called when plugin is ready
|
|
2793
|
-
*/
|
|
2794
|
-
async onReady(_engine) {
|
|
2795
|
-
getLogger("ServicePlugin").info("ServicePlugin ready");
|
|
2796
|
-
}
|
|
2797
|
-
/**
|
|
2798
|
-
* Cleanup plugin resources
|
|
2799
|
-
*/
|
|
2800
|
-
cleanup() {
|
|
2801
|
-
this.removeAllListeners();
|
|
2802
|
-
this.adapter.removeAllListeners();
|
|
2803
|
-
this._session = null;
|
|
2804
|
-
this._gameConfig = null;
|
|
2805
|
-
getLogger("ServicePlugin").info("ServicePlugin cleaned up");
|
|
2806
|
-
}
|
|
2807
|
-
/**
|
|
2808
|
-
* Handle adapter events
|
|
2809
|
-
*/
|
|
2810
|
-
onAdapterEvent(action, data) {
|
|
2811
|
-
const serviceEvent = {
|
|
2812
|
-
target: this,
|
|
2813
|
-
data
|
|
2814
|
-
};
|
|
2815
|
-
this.emit(action, serviceEvent);
|
|
2816
|
-
getLogger("ServicePlugin").debug(`Event: ${action}`, data);
|
|
2817
|
-
}
|
|
2818
|
-
// ============================================================================
|
|
2819
|
-
// Public API Methods
|
|
2820
|
-
// ============================================================================
|
|
2821
|
-
/**
|
|
2822
|
-
* Get session info and game configuration
|
|
2823
|
-
* Fetches from backend and caches the result
|
|
2824
|
-
*
|
|
2825
|
-
* @returns Promise resolving to session response with gameConfig
|
|
2826
|
-
*/
|
|
2827
|
-
async getSession() {
|
|
2828
|
-
getLogger("ServicePlugin").info("Fetching session...");
|
|
2829
|
-
const response = await this.adapter.getSession();
|
|
2830
|
-
this._session = response;
|
|
2831
|
-
this._gameConfig = response.gameConfig;
|
|
2832
|
-
getLogger("ServicePlugin").info("Session fetched", {
|
|
2833
|
-
sessionId: response.sessionId,
|
|
2834
|
-
state: response.state,
|
|
2835
|
-
gameState: response.gameState
|
|
2836
|
-
});
|
|
2837
|
-
return response;
|
|
2838
|
-
}
|
|
2839
|
-
/**
|
|
2840
|
-
* Execute a spin action
|
|
2841
|
-
*
|
|
2842
|
-
* @param totalBet - Total bet amount
|
|
2843
|
-
* @param clientSeed - Optional client seed for provably fair
|
|
2844
|
-
* @returns Promise resolving to gameplay response
|
|
2845
|
-
*/
|
|
2846
|
-
async spin(action, totalBet, clientSeed) {
|
|
2847
|
-
getLogger("ServicePlugin").info("Requesting spin...", { totalBet, clientSeed });
|
|
2848
|
-
const response = await this.adapter.spin({
|
|
2849
|
-
action: { type: action, totalBet },
|
|
2850
|
-
clientSeed
|
|
2851
|
-
});
|
|
2852
|
-
getLogger("ServicePlugin").info("Spin response received", response);
|
|
2853
|
-
return response;
|
|
2854
|
-
}
|
|
2855
|
-
/**
|
|
2856
|
-
* Get game history
|
|
2857
|
-
*
|
|
2858
|
-
* @param limit - Maximum number of entries to return
|
|
2859
|
-
* @param pointer - Pagination pointer for next page
|
|
2860
|
-
* @returns Promise resolving to history response
|
|
2861
|
-
*/
|
|
2862
|
-
async getHistory(limit, pointer) {
|
|
2863
|
-
getLogger("ServicePlugin").info("Fetching history...", { limit, pointer });
|
|
2864
|
-
const response = await this.adapter.getHistory(limit, pointer);
|
|
2865
|
-
getLogger("ServicePlugin").info("History fetched", {
|
|
2866
|
-
entries: response.entries.length,
|
|
2867
|
-
nextPointer: response.nextPointer
|
|
2868
|
-
});
|
|
2869
|
-
return response;
|
|
2870
|
-
}
|
|
2871
|
-
/**
|
|
2872
|
-
* Get a single round summary by round ID
|
|
2873
|
-
*
|
|
2874
|
-
* @param roundId - Round identifier
|
|
2875
|
-
* @returns Promise resolving to history entry (single or range)
|
|
2876
|
-
*/
|
|
2877
|
-
async getRound(roundId) {
|
|
2878
|
-
getLogger("ServicePlugin").info("Fetching round...", { roundId });
|
|
2879
|
-
const response = await this.adapter.getRound(roundId);
|
|
2880
|
-
getLogger("ServicePlugin").info("Round fetched", {
|
|
2881
|
-
roundId: response.roundId,
|
|
2882
|
-
kind: response.kind
|
|
2883
|
-
});
|
|
2884
|
-
return response;
|
|
2885
|
-
}
|
|
2886
|
-
/**
|
|
2887
|
-
* Get player balance
|
|
2888
|
-
*
|
|
2889
|
-
* @returns Promise resolving to platform response with balance
|
|
2890
|
-
*/
|
|
2891
|
-
async getBalance() {
|
|
2892
|
-
getLogger("ServicePlugin").info("Fetching balance...");
|
|
2893
|
-
const response = await this.adapter.getBalance();
|
|
2894
|
-
getLogger("ServicePlugin").info("Balance fetched", {
|
|
2895
|
-
balanceMinor: response.balanceMinor,
|
|
2896
|
-
currency: response.currency
|
|
2897
|
-
});
|
|
2898
|
-
return response;
|
|
2899
|
-
}
|
|
2900
|
-
/**
|
|
2901
|
-
* Replay a completed spin by nonce
|
|
2902
|
-
*
|
|
2903
|
-
* @param nonce - The nonce of the spin to replay
|
|
2904
|
-
* @returns Promise resolving to gameplay response
|
|
2905
|
-
*/
|
|
2906
|
-
async replay(nonce) {
|
|
2907
|
-
getLogger("ServicePlugin").info("Replaying spin...", { nonce });
|
|
2908
|
-
const response = await this.adapter.replay(nonce);
|
|
2909
|
-
getLogger("ServicePlugin").info("Replay response", {
|
|
2910
|
-
type: response.type,
|
|
2911
|
-
winAmount: response.winAmount
|
|
2912
|
-
});
|
|
2913
|
-
return response;
|
|
2914
|
-
}
|
|
2915
|
-
// ============================================================================
|
|
2916
|
-
// Getters
|
|
2917
|
-
// ============================================================================
|
|
2918
|
-
/**
|
|
2919
|
-
* Get session ID from adapter
|
|
2920
|
-
*/
|
|
2921
|
-
get sessionId() {
|
|
2922
|
-
return this.adapter.sessionId;
|
|
2923
|
-
}
|
|
2924
|
-
/**
|
|
2925
|
-
* Get cached session response
|
|
2926
|
-
*/
|
|
2927
|
-
get session() {
|
|
2928
|
-
return this._session;
|
|
2929
|
-
}
|
|
2930
|
-
/**
|
|
2931
|
-
* Get cached game config
|
|
2932
|
-
*/
|
|
2933
|
-
get gameConfig() {
|
|
2934
|
-
return this._gameConfig;
|
|
2935
|
-
}
|
|
2936
|
-
/**
|
|
2937
|
-
* Get the adapter instance
|
|
2938
|
-
*/
|
|
2939
|
-
get serviceAdapter() {
|
|
2940
|
-
return this.adapter;
|
|
2941
|
-
}
|
|
2942
|
-
};
|
|
2943
|
-
var ServiceAdapter = class extends EventEmitter {
|
|
2944
|
-
/**
|
|
2945
|
-
* Emit a service action event
|
|
2946
|
-
*
|
|
2947
|
-
* @param action - Service action type
|
|
2948
|
-
* @param data - Event data
|
|
2949
|
-
* @protected
|
|
2950
|
-
*/
|
|
2951
|
-
emitAction(action, data) {
|
|
2952
|
-
this.emit(action, data);
|
|
2953
|
-
}
|
|
2954
|
-
};
|
|
2955
|
-
|
|
2956
|
-
// plugins/service/adapters/RGSAdapter.ts
|
|
2957
|
-
var RGSAdapter = class extends ServiceAdapter {
|
|
2958
|
-
constructor(config) {
|
|
2959
|
-
super();
|
|
2960
|
-
this._sessionId = config.sessionId;
|
|
2961
|
-
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
2962
|
-
this.requestTimeout = config.requestTimeout || 3e4;
|
|
2963
|
-
getLogger("RGSAdapter").info("RGSAdapter initialized", {
|
|
2964
|
-
baseUrl: this.baseUrl,
|
|
2965
|
-
sessionId: this._sessionId
|
|
2966
|
-
});
|
|
2967
|
-
}
|
|
2968
|
-
/**
|
|
2969
|
-
* Get the current session ID
|
|
2970
|
-
*/
|
|
2971
|
-
get sessionId() {
|
|
2972
|
-
return this._sessionId;
|
|
2973
|
-
}
|
|
2974
|
-
/**
|
|
2975
|
-
* Get session info and game configuration
|
|
2976
|
-
* GET /session/{sessionId}
|
|
2977
|
-
*/
|
|
2978
|
-
async getSession() {
|
|
2979
|
-
getLogger("RGSAdapter").info("Fetching session...");
|
|
2980
|
-
const response = await this.request("GET", `/session/${this._sessionId}`);
|
|
2981
|
-
getLogger("RGSAdapter").info("Session fetched", response);
|
|
2982
|
-
this.emitAction("service:session" /* SESSION */, response);
|
|
2983
|
-
return response;
|
|
2984
|
-
}
|
|
2985
|
-
/**
|
|
2986
|
-
* Execute a gameplay action (spin)
|
|
2987
|
-
* POST /session/{sessionId}/play
|
|
2988
|
-
*/
|
|
2989
|
-
async spin(request) {
|
|
2990
|
-
getLogger("RGSAdapter").info("Executing spin...", request);
|
|
2991
|
-
const response = await this.request("POST", `/session/${this._sessionId}/play`, request);
|
|
2992
|
-
getLogger("RGSAdapter").info("Spin response", response);
|
|
2993
|
-
this.emitAction("service:gameplay" /* GAMEPLAY */, response);
|
|
2994
|
-
return response;
|
|
2995
|
-
}
|
|
2996
|
-
/**
|
|
2997
|
-
* Get game history
|
|
2998
|
-
* GET /session/{sessionId}/history
|
|
2999
|
-
*/
|
|
3000
|
-
async getHistory(limit, pointer) {
|
|
3001
|
-
getLogger("RGSAdapter").info("Fetching history...", { limit, pointer });
|
|
3002
|
-
const params = new URLSearchParams();
|
|
3003
|
-
if (limit !== void 0) params.set("pageSize", limit.toString());
|
|
3004
|
-
if (pointer !== void 0) params.set("pointer", pointer.toString());
|
|
3005
|
-
const queryString = params.toString();
|
|
3006
|
-
const url = queryString ? `/session/${this._sessionId}/history?${queryString}` : `/session/${this._sessionId}/history`;
|
|
3007
|
-
const response = await this.request("GET", url);
|
|
3008
|
-
getLogger("RGSAdapter").info("History fetched", response);
|
|
3009
|
-
this.emitAction("service:history" /* HISTORY */, response);
|
|
3010
|
-
return response;
|
|
3011
|
-
}
|
|
3012
|
-
/**
|
|
3013
|
-
* Get a single round summary by round ID
|
|
3014
|
-
* GET /session/{sessionId}/round/{roundId}
|
|
3015
|
-
*/
|
|
3016
|
-
async getRound(roundId) {
|
|
3017
|
-
getLogger("RGSAdapter").info("Fetching round...", { roundId });
|
|
3018
|
-
const response = await this.request(
|
|
3019
|
-
"GET",
|
|
3020
|
-
`/session/${this._sessionId}/round/${encodeURIComponent(roundId)}`
|
|
3021
|
-
);
|
|
3022
|
-
getLogger("RGSAdapter").info("Round fetched", response);
|
|
3023
|
-
this.emitAction("service:history" /* HISTORY */, response);
|
|
3024
|
-
return response;
|
|
3025
|
-
}
|
|
3026
|
-
/**
|
|
3027
|
-
* Get player balance
|
|
3028
|
-
* GET /session/{sessionId}/balance
|
|
3029
|
-
*/
|
|
3030
|
-
async getBalance() {
|
|
3031
|
-
getLogger("RGSAdapter").info("Fetching balance...");
|
|
3032
|
-
const response = await this.request("GET", `/session/${this._sessionId}/balance`);
|
|
3033
|
-
getLogger("RGSAdapter").info("Balance fetched", response);
|
|
3034
|
-
this.emitAction("service:balance" /* BALANCE_UPDATE */, response);
|
|
3035
|
-
return response;
|
|
3036
|
-
}
|
|
3037
|
-
/**
|
|
3038
|
-
* Replay a completed spin by nonce
|
|
3039
|
-
* GET /session/{sessionId}/replay/{nonce}
|
|
3040
|
-
*/
|
|
3041
|
-
async replay(nonce) {
|
|
3042
|
-
getLogger("RGSAdapter").info("Replaying spin...", { nonce });
|
|
3043
|
-
const response = await this.request("GET", `/session/${this._sessionId}/replay/${nonce}`);
|
|
3044
|
-
getLogger("RGSAdapter").info("Replay response", response);
|
|
3045
|
-
this.emitAction("service:gameplay" /* GAMEPLAY */, response);
|
|
3046
|
-
return response;
|
|
3047
|
-
}
|
|
3048
|
-
/**
|
|
3049
|
-
* Make an HTTP request to the backend API
|
|
3050
|
-
*/
|
|
3051
|
-
async request(method, path, body) {
|
|
3052
|
-
return new Promise((resolve, reject) => {
|
|
3053
|
-
const url = `${this.baseUrl}${path}`;
|
|
3054
|
-
const xhr = new XMLHttpRequest();
|
|
3055
|
-
xhr.open(method, url);
|
|
3056
|
-
xhr.setRequestHeader("Accept", "application/json");
|
|
3057
|
-
xhr.setRequestHeader("Content-Type", "application/json");
|
|
3058
|
-
xhr.timeout = this.requestTimeout;
|
|
3059
|
-
xhr.onload = () => {
|
|
3060
|
-
if (xhr.status >= 200 && xhr.status < 400) {
|
|
3061
|
-
try {
|
|
3062
|
-
const response = JSON.parse(xhr.responseText);
|
|
3063
|
-
getLogger("RGSAdapter").debug("Response received", { url, response });
|
|
3064
|
-
resolve(response);
|
|
3065
|
-
} catch (error) {
|
|
3066
|
-
const serviceError = {
|
|
3067
|
-
code: 500,
|
|
3068
|
-
message: "Failed to parse response",
|
|
3069
|
-
error: xhr.responseText
|
|
3070
|
-
};
|
|
3071
|
-
this.emitAction("service:error" /* ERROR */, serviceError);
|
|
3072
|
-
reject(new Error("Failed to parse response"));
|
|
3073
|
-
}
|
|
3074
|
-
} else {
|
|
3075
|
-
let serviceError;
|
|
3076
|
-
try {
|
|
3077
|
-
serviceError = JSON.parse(xhr.responseText);
|
|
3078
|
-
} catch {
|
|
3079
|
-
serviceError = {
|
|
3080
|
-
code: xhr.status,
|
|
3081
|
-
message: xhr.statusText,
|
|
3082
|
-
error: xhr.responseText
|
|
3083
|
-
};
|
|
3084
|
-
}
|
|
3085
|
-
this.emitAction("service:error" /* ERROR */, serviceError);
|
|
3086
|
-
reject(new Error(`HTTP ${xhr.status}: ${serviceError.message || xhr.statusText}`));
|
|
3087
|
-
}
|
|
3088
|
-
};
|
|
3089
|
-
xhr.onerror = () => {
|
|
3090
|
-
const reason = xhr.status === 0 ? "CORS" : "Network error";
|
|
3091
|
-
const serviceError = {
|
|
3092
|
-
code: 0,
|
|
3093
|
-
message: reason
|
|
3094
|
-
};
|
|
3095
|
-
this.emitAction("service:error" /* ERROR */, serviceError);
|
|
3096
|
-
reject(new Error(reason));
|
|
3097
|
-
};
|
|
3098
|
-
xhr.onabort = () => {
|
|
3099
|
-
const serviceError = {
|
|
3100
|
-
code: -1,
|
|
3101
|
-
message: "Request aborted"
|
|
3102
|
-
};
|
|
3103
|
-
this.emitAction("service:error" /* ERROR */, serviceError);
|
|
3104
|
-
reject(new Error("Request aborted"));
|
|
3105
|
-
};
|
|
3106
|
-
xhr.ontimeout = () => {
|
|
3107
|
-
const serviceError = {
|
|
3108
|
-
code: 408,
|
|
3109
|
-
message: "Request timeout"
|
|
3110
|
-
};
|
|
3111
|
-
this.emitAction("service:timeout" /* TIMEOUT */, serviceError);
|
|
3112
|
-
reject(new Error("Request timeout"));
|
|
3113
|
-
};
|
|
3114
|
-
try {
|
|
3115
|
-
const bodyString = body ? JSON.stringify(body) : void 0;
|
|
3116
|
-
getLogger("RGSAdapter").debug("Sending request", { url, method, body: bodyString });
|
|
3117
|
-
xhr.send(bodyString);
|
|
3118
|
-
} catch (error) {
|
|
3119
|
-
const serviceError = {
|
|
3120
|
-
code: 500,
|
|
3121
|
-
message: "Failed to send request",
|
|
3122
|
-
error: String(error)
|
|
3123
|
-
};
|
|
3124
|
-
this.emitAction("service:error" /* ERROR */, serviceError);
|
|
3125
|
-
reject(error);
|
|
3126
|
-
}
|
|
3127
|
-
});
|
|
3128
|
-
}
|
|
3129
|
-
};
|
|
3130
|
-
|
|
3131
|
-
// plugins/service/adapters/resolvePublicIp.ts
|
|
3132
|
-
var IPIFY_URL = "https://api.ipify.org?format=json";
|
|
3133
|
-
var LOOKUP_TIMEOUT_MS = 5e3;
|
|
3134
|
-
var cachedIp = null;
|
|
3135
|
-
async function resolvePublicIp(options = {}) {
|
|
3136
|
-
if (cachedIp) {
|
|
3137
|
-
return cachedIp;
|
|
3138
|
-
}
|
|
3139
|
-
const params = options.queryParams ?? new URLSearchParams(window.location.search);
|
|
3140
|
-
const fromQuery = params.get("clientIP") || params.get("ip");
|
|
3141
|
-
if (fromQuery) {
|
|
3142
|
-
cachedIp = fromQuery;
|
|
3143
|
-
return fromQuery;
|
|
3144
|
-
}
|
|
3145
|
-
if (options.configIp) {
|
|
3146
|
-
cachedIp = options.configIp;
|
|
3147
|
-
return options.configIp;
|
|
3148
|
-
}
|
|
3149
|
-
const controller = new AbortController();
|
|
3150
|
-
const timeoutId = setTimeout(() => controller.abort(), LOOKUP_TIMEOUT_MS);
|
|
3151
|
-
try {
|
|
3152
|
-
const response = await fetch(IPIFY_URL, { signal: controller.signal });
|
|
3153
|
-
if (!response.ok) {
|
|
3154
|
-
throw new Error(`HTTP ${response.status}`);
|
|
3155
|
-
}
|
|
3156
|
-
const data = await response.json();
|
|
3157
|
-
if (!data.ip) {
|
|
3158
|
-
throw new Error("Invalid ipify response");
|
|
3159
|
-
}
|
|
3160
|
-
cachedIp = data.ip;
|
|
3161
|
-
return data.ip;
|
|
3162
|
-
} catch (error) {
|
|
3163
|
-
if (error instanceof Error && error.name === "AbortError") {
|
|
3164
|
-
throw new Error("Public IP lookup timeout");
|
|
3165
|
-
}
|
|
3166
|
-
throw error;
|
|
3167
|
-
} finally {
|
|
3168
|
-
clearTimeout(timeoutId);
|
|
3169
|
-
}
|
|
3170
|
-
}
|
|
3171
|
-
|
|
3172
|
-
// plugins/service/adapters/DevAuthAdapter.ts
|
|
3173
|
-
var DevAdapter = class extends RGSAdapter {
|
|
3174
|
-
constructor(config) {
|
|
3175
|
-
super({
|
|
3176
|
-
...config,
|
|
3177
|
-
sessionId: ""
|
|
3178
|
-
});
|
|
3179
|
-
this._sessionCreated = false;
|
|
3180
|
-
this.configIp = config.ip;
|
|
3181
|
-
this.queryParams = new URLSearchParams(window.location.search);
|
|
3182
|
-
this.createSessionData = {
|
|
3183
|
-
operatorId: this.queryParams.get("operatorId") || config.operatorId || "00000000-0000-0000-0000-000000000001",
|
|
3184
|
-
playerId: this.queryParams.get("playerId") || config.playerId || "web-client-2",
|
|
3185
|
-
gameId: this.queryParams.get("gameId") || config.gameId || "b0a60930-82b4-4097-99c8-78299cef6e80",
|
|
3186
|
-
userAgent: window.navigator.userAgent,
|
|
3187
|
-
currency: this.queryParams.get("currency") || config.currency || "USD"
|
|
3188
|
-
};
|
|
3189
|
-
getLogger("DevAdapter").info("DevAdapter initialized", this.createSessionData);
|
|
3190
|
-
}
|
|
3191
|
-
/**
|
|
3192
|
-
* Get session - creates session if not exists, then fetches session info
|
|
3193
|
-
*/
|
|
3194
|
-
async getSession() {
|
|
3195
|
-
if (!this._sessionCreated) {
|
|
3196
|
-
await this.createSession();
|
|
3197
|
-
}
|
|
3198
|
-
return super.getSession();
|
|
3199
|
-
}
|
|
3200
|
-
/**
|
|
3201
|
-
* Create a new session via POST /session
|
|
3202
|
-
*/
|
|
3203
|
-
async createSession() {
|
|
3204
|
-
const ip = await resolvePublicIp({
|
|
3205
|
-
configIp: this.configIp,
|
|
3206
|
-
queryParams: this.queryParams
|
|
3207
|
-
});
|
|
3208
|
-
const sessionPayload = {
|
|
3209
|
-
...this.createSessionData,
|
|
3210
|
-
ip
|
|
3211
|
-
};
|
|
3212
|
-
const url = `${this["baseUrl"]}/session`;
|
|
3213
|
-
getLogger("DevAdapter").info("Creating session...", { url, data: sessionPayload });
|
|
3214
|
-
return new Promise((resolve, reject) => {
|
|
3215
|
-
const request = new XMLHttpRequest();
|
|
3216
|
-
request.open("POST", url);
|
|
3217
|
-
request.setRequestHeader("Content-Type", "application/json");
|
|
3218
|
-
request.timeout = this["requestTimeout"];
|
|
3219
|
-
request.onload = () => {
|
|
3220
|
-
if (request.status >= 200 && request.status < 300) {
|
|
3221
|
-
try {
|
|
3222
|
-
const response = JSON.parse(request.responseText);
|
|
3223
|
-
this["_sessionId"] = response.sessionId;
|
|
3224
|
-
this._sessionCreated = true;
|
|
3225
|
-
getLogger("DevAdapter").info("Session created", {
|
|
3226
|
-
sessionId: response.sessionId,
|
|
3227
|
-
state: response.state
|
|
3228
|
-
});
|
|
3229
|
-
resolve(response);
|
|
3230
|
-
} catch (error) {
|
|
3231
|
-
getLogger("DevAdapter").error("Failed to parse session response", error);
|
|
3232
|
-
reject(error);
|
|
3233
|
-
}
|
|
3234
|
-
} else {
|
|
3235
|
-
const errorMsg = `HTTP ${request.status}: ${request.responseText}`;
|
|
3236
|
-
getLogger("DevAdapter").error("Failed to create session", errorMsg);
|
|
3237
|
-
reject(new Error(errorMsg));
|
|
3238
|
-
}
|
|
3239
|
-
};
|
|
3240
|
-
request.onerror = () => {
|
|
3241
|
-
const reason = request.status === 0 ? "CORS" : "Network error";
|
|
3242
|
-
getLogger("DevAdapter").error(`Network error creating session (${reason})`);
|
|
3243
|
-
reject(new Error(reason));
|
|
3244
|
-
};
|
|
3245
|
-
request.ontimeout = () => {
|
|
3246
|
-
getLogger("DevAdapter").error("Timeout creating session");
|
|
3247
|
-
reject(new Error("Request timeout"));
|
|
3248
|
-
};
|
|
3249
|
-
try {
|
|
3250
|
-
request.send(JSON.stringify(sessionPayload));
|
|
3251
|
-
} catch (error) {
|
|
3252
|
-
getLogger("DevAdapter").error("Failed to send create session request", error);
|
|
3253
|
-
reject(error);
|
|
3254
|
-
}
|
|
3255
|
-
});
|
|
3256
|
-
}
|
|
3257
|
-
};
|
|
3258
|
-
|
|
3259
2746
|
// plugins/skin/Skin.ts
|
|
3260
2747
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
3261
2748
|
var Skin = class extends EventEmitter {
|
|
@@ -12244,6 +11731,6 @@ tweakpane/dist/tweakpane.js:
|
|
|
12244
11731
|
(*! Tweakpane 4.0.5 (c) 2016 cocopon, licensed under the MIT license. *)
|
|
12245
11732
|
*/
|
|
12246
11733
|
|
|
12247
|
-
export {
|
|
11734
|
+
export { DeviceOptimizerPlugin, DisplayPlugin, EventBusPlugin, GsapPlugin, I18NextPlugin, INPUT_EVENTS, InputPlugin, KEY_EVENTS, MOUSE_EVENTS, ResourcePlugin, Scene, ScenePlugin, SentryPlugin, Skin, SkinPlugin, SoundPlugin, SoundTestGUI, TOUCH_EVENTS, computeDesignViewportRect };
|
|
12248
11735
|
//# sourceMappingURL=index.js.map
|
|
12249
11736
|
//# sourceMappingURL=index.js.map
|