@opexa/portal-sdk 0.26.0 → 0.28.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/index.cjs +37 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1062,6 +1062,7 @@ var BONUSES_QUERY = gql`
|
|
|
1062
1062
|
turnoverRequirement
|
|
1063
1063
|
currentTurnoverRequirementContribution
|
|
1064
1064
|
currentTurnoverRequirementContributionPercentage
|
|
1065
|
+
enabledGameProviders
|
|
1065
1066
|
expiration
|
|
1066
1067
|
dateTimeCreated
|
|
1067
1068
|
dateTimeLastUpdated
|
|
@@ -4232,6 +4233,7 @@ function pollable(func, config) {
|
|
|
4232
4233
|
var SessionManager = class {
|
|
4233
4234
|
logger;
|
|
4234
4235
|
storageKey = "session";
|
|
4236
|
+
platformStorageKey = "session/platform";
|
|
4235
4237
|
authService;
|
|
4236
4238
|
walletService;
|
|
4237
4239
|
_refreshing = false;
|
|
@@ -4258,6 +4260,7 @@ var SessionManager = class {
|
|
|
4258
4260
|
};
|
|
4259
4261
|
}
|
|
4260
4262
|
if (input.type === "MAYA") {
|
|
4263
|
+
localStorage.setItem(this.platformStorageKey, "MAYA");
|
|
4261
4264
|
const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
|
|
4262
4265
|
const r0 = await pollable(f0, {
|
|
4263
4266
|
until: (r) => r.ok && r.data?.member != null,
|
|
@@ -4337,6 +4340,7 @@ var SessionManager = class {
|
|
|
4337
4340
|
return res2;
|
|
4338
4341
|
}
|
|
4339
4342
|
if (input.type === "CABINET") {
|
|
4343
|
+
localStorage.setItem(this.platformStorageKey, "CABINET");
|
|
4340
4344
|
const res2 = await this.authService.createSession(input);
|
|
4341
4345
|
if (res2.ok) {
|
|
4342
4346
|
const now2 = /* @__PURE__ */ new Date();
|
|
@@ -4507,6 +4511,20 @@ var SessionManager = class {
|
|
|
4507
4511
|
}
|
|
4508
4512
|
return v;
|
|
4509
4513
|
}
|
|
4514
|
+
get onMaya() {
|
|
4515
|
+
if (this.isServer) {
|
|
4516
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
4517
|
+
return false;
|
|
4518
|
+
}
|
|
4519
|
+
return localStorage.getItem(this.platformStorageKey) === "MAYA";
|
|
4520
|
+
}
|
|
4521
|
+
get onCabinet() {
|
|
4522
|
+
if (this.isServer) {
|
|
4523
|
+
this.logger.warn("'localStorage' is not available on the server.");
|
|
4524
|
+
return false;
|
|
4525
|
+
}
|
|
4526
|
+
return localStorage.getItem(this.platformStorageKey) === "CABINET";
|
|
4527
|
+
}
|
|
4510
4528
|
get isServer() {
|
|
4511
4529
|
return typeof window === "undefined";
|
|
4512
4530
|
}
|
|
@@ -5213,6 +5231,7 @@ var Transformer = class {
|
|
|
5213
5231
|
data.currentTurnoverRequirementContributionPercentage,
|
|
5214
5232
|
0
|
|
5215
5233
|
),
|
|
5234
|
+
enabledGameProviders: data.enabledGameProviders,
|
|
5216
5235
|
dateTimeCreated: new Date(data.dateTimeCreated),
|
|
5217
5236
|
dateTimeLastUpdated: new Date(data.dateTimeLastUpdated)
|
|
5218
5237
|
};
|
|
@@ -5467,6 +5486,7 @@ var Sdk = class {
|
|
|
5467
5486
|
transformer;
|
|
5468
5487
|
logger;
|
|
5469
5488
|
cache;
|
|
5489
|
+
config;
|
|
5470
5490
|
constructor(config) {
|
|
5471
5491
|
const {
|
|
5472
5492
|
/**/
|
|
@@ -5553,6 +5573,13 @@ var Sdk = class {
|
|
|
5553
5573
|
this.sessionManager = sessionManager;
|
|
5554
5574
|
this.cmsPortalService = cmsPortalService;
|
|
5555
5575
|
this.cache = new Cache();
|
|
5576
|
+
this.config = {
|
|
5577
|
+
environment,
|
|
5578
|
+
site,
|
|
5579
|
+
platform,
|
|
5580
|
+
sitePlatform,
|
|
5581
|
+
logs
|
|
5582
|
+
};
|
|
5556
5583
|
}
|
|
5557
5584
|
/*
|
|
5558
5585
|
*=============================================
|
|
@@ -5612,6 +5639,14 @@ var Sdk = class {
|
|
|
5612
5639
|
*/
|
|
5613
5640
|
get domainMiddleware() {
|
|
5614
5641
|
return async (request) => {
|
|
5642
|
+
if (this.sessionManager.onMaya) {
|
|
5643
|
+
request.headers.append("Domain", `maya/${this.config.platform}`);
|
|
5644
|
+
return request;
|
|
5645
|
+
}
|
|
5646
|
+
if (this.sessionManager.onCabinet) {
|
|
5647
|
+
request.headers.delete("Domain");
|
|
5648
|
+
return request;
|
|
5649
|
+
}
|
|
5615
5650
|
const domain = this.domainManager.domain;
|
|
5616
5651
|
if (domain) request.headers.append("Domain", domain);
|
|
5617
5652
|
return request;
|
|
@@ -5742,6 +5777,8 @@ var Sdk = class {
|
|
|
5742
5777
|
ok: true,
|
|
5743
5778
|
data: res.data ? {
|
|
5744
5779
|
id: res.data.session.id,
|
|
5780
|
+
maya: this.sessionManager.onMaya,
|
|
5781
|
+
cabinet: this.sessionManager.onCabinet,
|
|
5745
5782
|
dateTimeCreated: new Date(res.data.session.dateTimeCreated)
|
|
5746
5783
|
} : null
|
|
5747
5784
|
};
|