@opexa/portal-sdk 0.44.4 → 0.44.6

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 CHANGED
@@ -2229,6 +2229,32 @@ var DAILY_CHECKIN_FRAGMENT = gql`
2229
2229
  }
2230
2230
  `;
2231
2231
  var WAGERING_FRAGMENT = gql`
2232
+ fragment WageringQuestFragment on WageringQuest {
2233
+ bonus
2234
+ id
2235
+ name
2236
+ type
2237
+ description
2238
+ program {
2239
+ ...QuestProgramFragment
2240
+ }
2241
+ status
2242
+ progressPercentage
2243
+ turnover
2244
+ targetTurnover
2245
+ endDateTime
2246
+ dateTimeCreated
2247
+ dateTimeCompleted
2248
+ stages{
2249
+ targetTurnover
2250
+ bonusTurnoverRequirementMultiplier
2251
+ bonusAmount
2252
+ cleared
2253
+ dateTimeCleared
2254
+ }
2255
+ }
2256
+ `;
2257
+ var WAGERING_FRAGMENT_NEXT = gql`
2232
2258
  fragment WageringQuestFragment on WageringQuest {
2233
2259
  bonus
2234
2260
  id
@@ -2246,6 +2272,14 @@ var WAGERING_FRAGMENT = gql`
2246
2272
  dateTimeCreated
2247
2273
  stage
2248
2274
  dateTimeCompleted
2275
+ stages{
2276
+ targetTurnover
2277
+ bonusTurnoverRequirementMultiplier
2278
+ bonusAmount
2279
+ cleared
2280
+ dateTimeCleared
2281
+ }
2282
+ stage
2249
2283
  }
2250
2284
  `;
2251
2285
  var ONBOARDING_QUEST_FRAGMENT = gql`
@@ -2317,6 +2351,30 @@ var AVAILABLE_QUESTS_QUERY = gql`
2317
2351
  }
2318
2352
  }
2319
2353
  `;
2354
+ var AVAILABLE_QUESTS_QUERY_NEXT = gql`
2355
+ ${WAGERING_FRAGMENT_NEXT}
2356
+ ${DAILY_CHECKIN_FRAGMENT}
2357
+ ${ONBOARDING_QUEST_FRAGMENT}
2358
+ ${JOURNEY_QUEST_FRAGMENT}
2359
+ query AvailableQuests {
2360
+ availableQuests {
2361
+ ... on Quest {
2362
+ ... on WageringQuest {
2363
+ ...WageringQuestFragment
2364
+ }
2365
+ ... on DailyCheckInQuest {
2366
+ ...DailyCheckinQuestFragment
2367
+ }
2368
+ ... on OnboardingQuest {
2369
+ ...OnboardingQuestFragment
2370
+ }
2371
+ ... on JourneyQuest {
2372
+ ...JourneyQuestFragment
2373
+ }
2374
+ }
2375
+ }
2376
+ }
2377
+ `;
2320
2378
  var CHECK_IN_DAILY_QUEST_MUTATION = gql`
2321
2379
  mutation checkInDailyCheckInQuest($input: CheckInDailyCheckInQuestInput!) {
2322
2380
  checkInDailyCheckInQuest(input: $input)
@@ -3868,6 +3926,16 @@ var TriggerService = class {
3868
3926
  data: res.data.availableQuests
3869
3927
  };
3870
3928
  }
3929
+ async availableQuests_next() {
3930
+ const res = await this.client.request(
3931
+ AVAILABLE_QUESTS_QUERY_NEXT
3932
+ );
3933
+ if (!res.ok) return res;
3934
+ return {
3935
+ ok: true,
3936
+ data: res.data.availableQuests
3937
+ };
3938
+ }
3871
3939
  async checkInDailyQuest(variables) {
3872
3940
  const res = await this.client.request(
3873
3941
  CHECK_IN_DAILY_QUEST_MUTATION,
@@ -5034,8 +5102,8 @@ function pollable(func, config) {
5034
5102
  };
5035
5103
  }
5036
5104
 
5037
- // src/sdk/session-manager.ts
5038
- var SessionManager = class {
5105
+ // src/sdk/session-manager-cookie.ts
5106
+ var SessionManagerCookie = class {
5039
5107
  logger;
5040
5108
  storageKey = "session";
5041
5109
  platformStorageKey = "session/platform";
@@ -5046,10 +5114,6 @@ var SessionManager = class {
5046
5114
  this.authService = config.authService;
5047
5115
  this.walletService = config.walletService;
5048
5116
  this.logger = config.logger;
5049
- if (config.sessionPrefix) {
5050
- this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
5051
- this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
5052
- }
5053
5117
  }
5054
5118
  get refreshing() {
5055
5119
  return this._refreshing;
@@ -5058,16 +5122,6 @@ var SessionManager = class {
5058
5122
  this._refreshing = value;
5059
5123
  }
5060
5124
  async create(input) {
5061
- if (this.isServer) {
5062
- this.logger.warn("'localStorage' is not available on the server.");
5063
- return {
5064
- ok: false,
5065
- error: {
5066
- name: "UnknownError",
5067
- message: "Server sign in is not supported."
5068
- }
5069
- };
5070
- }
5071
5125
  if (input.type === "MAYA") {
5072
5126
  localStorage.setItem(this.platformStorageKey, "MAYA");
5073
5127
  const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
@@ -5094,13 +5148,14 @@ var SessionManager = class {
5094
5148
  })();
5095
5149
  if (!r1.ok) return r1;
5096
5150
  const now2 = /* @__PURE__ */ new Date();
5097
- localStorage.setItem(
5151
+ cookies__default.default.set(
5098
5152
  this.storageKey,
5099
5153
  JSON.stringify({
5100
5154
  ...r1.data,
5101
5155
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5102
5156
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5103
- })
5157
+ }),
5158
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
5104
5159
  );
5105
5160
  return {
5106
5161
  ok: true,
@@ -5111,13 +5166,16 @@ var SessionManager = class {
5111
5166
  const res2 = await this.authService.createSession(input);
5112
5167
  if (res2.ok) {
5113
5168
  const now2 = /* @__PURE__ */ new Date();
5114
- localStorage.setItem(
5169
+ cookies__default.default.set(
5115
5170
  this.storageKey,
5116
5171
  JSON.stringify({
5117
5172
  ...res2.data,
5118
5173
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5119
5174
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5120
- })
5175
+ }),
5176
+ {
5177
+ expires: subMinutes(addDays(now2, 30), 2).getTime()
5178
+ }
5121
5179
  );
5122
5180
  return {
5123
5181
  ok: true,
@@ -5129,18 +5187,18 @@ var SessionManager = class {
5129
5187
  if (input.type === "SOCIALS" || input.type === "TOKEN") {
5130
5188
  const res2 = await this.authService.createSession({
5131
5189
  type: "SOCIALS",
5132
- token: input.token,
5133
- channel: input.channel
5190
+ token: input.token
5134
5191
  });
5135
5192
  if (res2.ok) {
5136
5193
  const now2 = /* @__PURE__ */ new Date();
5137
- localStorage.setItem(
5194
+ cookies__default.default.set(
5138
5195
  this.storageKey,
5139
5196
  JSON.stringify({
5140
5197
  ...res2.data,
5141
5198
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5142
5199
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5143
- })
5200
+ }),
5201
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
5144
5202
  );
5145
5203
  return {
5146
5204
  ok: true,
@@ -5154,13 +5212,14 @@ var SessionManager = class {
5154
5212
  const res2 = await this.authService.createSession(input);
5155
5213
  if (res2.ok) {
5156
5214
  const now2 = /* @__PURE__ */ new Date();
5157
- localStorage.setItem(
5215
+ cookies__default.default.set(
5158
5216
  this.storageKey,
5159
5217
  JSON.stringify({
5160
5218
  ...res2.data,
5161
5219
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5162
5220
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5163
- })
5221
+ }),
5222
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
5164
5223
  );
5165
5224
  return {
5166
5225
  ok: true,
@@ -5180,13 +5239,14 @@ var SessionManager = class {
5180
5239
  };
5181
5240
  }
5182
5241
  const now = /* @__PURE__ */ new Date();
5183
- localStorage.setItem(
5242
+ cookies__default.default.set(
5184
5243
  this.storageKey,
5185
5244
  JSON.stringify({
5186
5245
  ...res.data,
5187
5246
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5188
5247
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5189
- })
5248
+ }),
5249
+ {}
5190
5250
  );
5191
5251
  return {
5192
5252
  ok: true,
@@ -5198,15 +5258,18 @@ var SessionManager = class {
5198
5258
  if (res.ok) {
5199
5259
  const now = /* @__PURE__ */ new Date();
5200
5260
  if (this.isServer) {
5201
- this.logger.warn("'localStorage' is not available on the server.");
5261
+ this.logger.warn("'client cookies' is not available on the server.");
5202
5262
  } else {
5203
- localStorage.setItem(
5263
+ cookies__default.default.set(
5204
5264
  this.storageKey,
5205
5265
  JSON.stringify({
5206
5266
  ...res.data,
5207
5267
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5208
5268
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5209
- })
5269
+ }),
5270
+ {
5271
+ expires: subMinutes(addDays(now, 30), 2).getTime()
5272
+ }
5210
5273
  );
5211
5274
  }
5212
5275
  return { ok: true };
@@ -5216,7 +5279,7 @@ var SessionManager = class {
5216
5279
  }
5217
5280
  async get() {
5218
5281
  if (this.isServer) {
5219
- this.logger.warn("'localStorage' is not available on the server.");
5282
+ this.logger.warn("'client cookies' is not available on the server.");
5220
5283
  return {
5221
5284
  ok: true,
5222
5285
  data: null
@@ -5226,7 +5289,7 @@ var SessionManager = class {
5226
5289
  await sleep(1e3);
5227
5290
  return await this.get();
5228
5291
  }
5229
- const val = localStorage.getItem(this.storageKey);
5292
+ const val = cookies__default.default.get(this.storageKey);
5230
5293
  if (!val) {
5231
5294
  return {
5232
5295
  ok: true,
@@ -5240,7 +5303,7 @@ var SessionManager = class {
5240
5303
  const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
5241
5304
  if (isAfter(now, refreshTokenExpiresAt)) {
5242
5305
  this.logger.warn("Session expired. Logging out..");
5243
- localStorage.removeItem(this.storageKey);
5306
+ cookies__default.default.remove(this.storageKey);
5244
5307
  return {
5245
5308
  ok: false,
5246
5309
  error: {
@@ -5257,7 +5320,7 @@ var SessionManager = class {
5257
5320
  if (!res.ok) {
5258
5321
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
5259
5322
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
5260
- localStorage.removeItem(this.storageKey);
5323
+ cookies__default.default.remove(this.storageKey);
5261
5324
  return {
5262
5325
  ok: false,
5263
5326
  error: res.error
@@ -5278,7 +5341,9 @@ var SessionManager = class {
5278
5341
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5279
5342
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5280
5343
  };
5281
- localStorage.setItem(this.storageKey, JSON.stringify(obj));
5344
+ cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
5345
+ expires: subMinutes(addDays(now, 30), 2).getTime()
5346
+ });
5282
5347
  }
5283
5348
  return {
5284
5349
  ok: true,
@@ -5296,13 +5361,13 @@ var SessionManager = class {
5296
5361
  }
5297
5362
  async refresh() {
5298
5363
  if (this.isServer) {
5299
- this.logger.warn("'localStorage' is not available on the server.");
5364
+ this.logger.warn("'client cookies' is not available on the server.");
5300
5365
  return {
5301
5366
  ok: true,
5302
5367
  data: null
5303
5368
  };
5304
5369
  }
5305
- const val = localStorage.getItem(this.storageKey);
5370
+ const val = cookies__default.default.get(this.storageKey);
5306
5371
  if (!val) {
5307
5372
  return {
5308
5373
  ok: true,
@@ -5319,7 +5384,7 @@ var SessionManager = class {
5319
5384
  if (!res.ok) {
5320
5385
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
5321
5386
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
5322
- localStorage.removeItem(this.storageKey);
5387
+ cookies__default.default.remove(this.storageKey);
5323
5388
  return {
5324
5389
  ok: false,
5325
5390
  error: res.error
@@ -5340,7 +5405,9 @@ var SessionManager = class {
5340
5405
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5341
5406
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5342
5407
  };
5343
- localStorage.setItem(this.storageKey, JSON.stringify(obj));
5408
+ cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
5409
+ expires: subMinutes(addDays(now, 30), 2).getTime()
5410
+ });
5344
5411
  return {
5345
5412
  ok: true,
5346
5413
  data: obj
@@ -5357,18 +5424,18 @@ var SessionManager = class {
5357
5424
  }
5358
5425
  async destroy() {
5359
5426
  if (this.isServer) {
5360
- this.logger.warn("'localStorage' is not available on the server.");
5427
+ this.logger.warn("'client cookies' is not available on the server.");
5361
5428
  return;
5362
5429
  }
5363
5430
  const res = await this.get();
5364
5431
  if (res.data?.accessToken) {
5365
5432
  await this.authService.destroySession(res.data.accessToken);
5366
5433
  }
5367
- localStorage.removeItem(this.storageKey);
5434
+ cookies__default.default.remove(this.storageKey);
5368
5435
  }
5369
5436
  async verify() {
5370
5437
  if (this.isServer) {
5371
- this.logger.warn("'localStorage' is not available on the server.");
5438
+ this.logger.warn("'client cookies' is not available on the server.");
5372
5439
  return true;
5373
5440
  }
5374
5441
  const s = await this.get();
@@ -5378,13 +5445,13 @@ var SessionManager = class {
5378
5445
  if (!s.data) return true;
5379
5446
  const v = await this.authService.verifySession(s.data.accessToken);
5380
5447
  if (!v) {
5381
- localStorage.removeItem(this.storageKey);
5448
+ cookies__default.default.remove(this.storageKey);
5382
5449
  }
5383
5450
  return v;
5384
5451
  }
5385
5452
  get onMaya() {
5386
5453
  if (this.isServer) {
5387
- this.logger.warn("'localStorage' is not available on the server.");
5454
+ this.logger.warn("'client cookies' is not available on the server.");
5388
5455
  return false;
5389
5456
  }
5390
5457
  return localStorage.getItem(this.platformStorageKey) === "MAYA";
@@ -5400,7 +5467,9 @@ var SessionManager = class {
5400
5467
  return typeof window === "undefined";
5401
5468
  }
5402
5469
  };
5403
- var SessionManagerCookie = class {
5470
+
5471
+ // src/sdk/session-manager.ts
5472
+ var SessionManager = class {
5404
5473
  logger;
5405
5474
  storageKey = "session";
5406
5475
  platformStorageKey = "session/platform";
@@ -5411,6 +5480,10 @@ var SessionManagerCookie = class {
5411
5480
  this.authService = config.authService;
5412
5481
  this.walletService = config.walletService;
5413
5482
  this.logger = config.logger;
5483
+ if (config.sessionPrefix) {
5484
+ this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
5485
+ this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
5486
+ }
5414
5487
  }
5415
5488
  get refreshing() {
5416
5489
  return this._refreshing;
@@ -5419,6 +5492,16 @@ var SessionManagerCookie = class {
5419
5492
  this._refreshing = value;
5420
5493
  }
5421
5494
  async create(input) {
5495
+ if (this.isServer) {
5496
+ this.logger.warn("'localStorage' is not available on the server.");
5497
+ return {
5498
+ ok: false,
5499
+ error: {
5500
+ name: "UnknownError",
5501
+ message: "Server sign in is not supported."
5502
+ }
5503
+ };
5504
+ }
5422
5505
  if (input.type === "MAYA") {
5423
5506
  localStorage.setItem(this.platformStorageKey, "MAYA");
5424
5507
  const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
@@ -5445,14 +5528,13 @@ var SessionManagerCookie = class {
5445
5528
  })();
5446
5529
  if (!r1.ok) return r1;
5447
5530
  const now2 = /* @__PURE__ */ new Date();
5448
- cookies__default.default.set(
5531
+ localStorage.setItem(
5449
5532
  this.storageKey,
5450
5533
  JSON.stringify({
5451
5534
  ...r1.data,
5452
5535
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5453
5536
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5454
- }),
5455
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
5537
+ })
5456
5538
  );
5457
5539
  return {
5458
5540
  ok: true,
@@ -5463,16 +5545,13 @@ var SessionManagerCookie = class {
5463
5545
  const res2 = await this.authService.createSession(input);
5464
5546
  if (res2.ok) {
5465
5547
  const now2 = /* @__PURE__ */ new Date();
5466
- cookies__default.default.set(
5548
+ localStorage.setItem(
5467
5549
  this.storageKey,
5468
5550
  JSON.stringify({
5469
5551
  ...res2.data,
5470
5552
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5471
5553
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5472
- }),
5473
- {
5474
- expires: subMinutes(addDays(now2, 30), 2).getTime()
5475
- }
5554
+ })
5476
5555
  );
5477
5556
  return {
5478
5557
  ok: true,
@@ -5484,18 +5563,18 @@ var SessionManagerCookie = class {
5484
5563
  if (input.type === "SOCIALS" || input.type === "TOKEN") {
5485
5564
  const res2 = await this.authService.createSession({
5486
5565
  type: "SOCIALS",
5487
- token: input.token
5566
+ token: input.token,
5567
+ channel: input.channel
5488
5568
  });
5489
5569
  if (res2.ok) {
5490
5570
  const now2 = /* @__PURE__ */ new Date();
5491
- cookies__default.default.set(
5571
+ localStorage.setItem(
5492
5572
  this.storageKey,
5493
5573
  JSON.stringify({
5494
5574
  ...res2.data,
5495
5575
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5496
5576
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5497
- }),
5498
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
5577
+ })
5499
5578
  );
5500
5579
  return {
5501
5580
  ok: true,
@@ -5509,14 +5588,13 @@ var SessionManagerCookie = class {
5509
5588
  const res2 = await this.authService.createSession(input);
5510
5589
  if (res2.ok) {
5511
5590
  const now2 = /* @__PURE__ */ new Date();
5512
- cookies__default.default.set(
5591
+ localStorage.setItem(
5513
5592
  this.storageKey,
5514
5593
  JSON.stringify({
5515
5594
  ...res2.data,
5516
5595
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
5517
5596
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
5518
- }),
5519
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
5597
+ })
5520
5598
  );
5521
5599
  return {
5522
5600
  ok: true,
@@ -5536,14 +5614,13 @@ var SessionManagerCookie = class {
5536
5614
  };
5537
5615
  }
5538
5616
  const now = /* @__PURE__ */ new Date();
5539
- cookies__default.default.set(
5617
+ localStorage.setItem(
5540
5618
  this.storageKey,
5541
5619
  JSON.stringify({
5542
5620
  ...res.data,
5543
5621
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5544
5622
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5545
- }),
5546
- {}
5623
+ })
5547
5624
  );
5548
5625
  return {
5549
5626
  ok: true,
@@ -5555,18 +5632,15 @@ var SessionManagerCookie = class {
5555
5632
  if (res.ok) {
5556
5633
  const now = /* @__PURE__ */ new Date();
5557
5634
  if (this.isServer) {
5558
- this.logger.warn("'client cookies' is not available on the server.");
5635
+ this.logger.warn("'localStorage' is not available on the server.");
5559
5636
  } else {
5560
- cookies__default.default.set(
5637
+ localStorage.setItem(
5561
5638
  this.storageKey,
5562
5639
  JSON.stringify({
5563
5640
  ...res.data,
5564
5641
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5565
5642
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5566
- }),
5567
- {
5568
- expires: subMinutes(addDays(now, 30), 2).getTime()
5569
- }
5643
+ })
5570
5644
  );
5571
5645
  }
5572
5646
  return { ok: true };
@@ -5576,7 +5650,7 @@ var SessionManagerCookie = class {
5576
5650
  }
5577
5651
  async get() {
5578
5652
  if (this.isServer) {
5579
- this.logger.warn("'client cookies' is not available on the server.");
5653
+ this.logger.warn("'localStorage' is not available on the server.");
5580
5654
  return {
5581
5655
  ok: true,
5582
5656
  data: null
@@ -5586,7 +5660,7 @@ var SessionManagerCookie = class {
5586
5660
  await sleep(1e3);
5587
5661
  return await this.get();
5588
5662
  }
5589
- const val = cookies__default.default.get(this.storageKey);
5663
+ const val = localStorage.getItem(this.storageKey);
5590
5664
  if (!val) {
5591
5665
  return {
5592
5666
  ok: true,
@@ -5600,7 +5674,7 @@ var SessionManagerCookie = class {
5600
5674
  const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
5601
5675
  if (isAfter(now, refreshTokenExpiresAt)) {
5602
5676
  this.logger.warn("Session expired. Logging out..");
5603
- cookies__default.default.remove(this.storageKey);
5677
+ localStorage.removeItem(this.storageKey);
5604
5678
  return {
5605
5679
  ok: false,
5606
5680
  error: {
@@ -5617,7 +5691,7 @@ var SessionManagerCookie = class {
5617
5691
  if (!res.ok) {
5618
5692
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
5619
5693
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
5620
- cookies__default.default.remove(this.storageKey);
5694
+ localStorage.removeItem(this.storageKey);
5621
5695
  return {
5622
5696
  ok: false,
5623
5697
  error: res.error
@@ -5638,9 +5712,7 @@ var SessionManagerCookie = class {
5638
5712
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5639
5713
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5640
5714
  };
5641
- cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
5642
- expires: subMinutes(addDays(now, 30), 2).getTime()
5643
- });
5715
+ localStorage.setItem(this.storageKey, JSON.stringify(obj));
5644
5716
  }
5645
5717
  return {
5646
5718
  ok: true,
@@ -5658,13 +5730,13 @@ var SessionManagerCookie = class {
5658
5730
  }
5659
5731
  async refresh() {
5660
5732
  if (this.isServer) {
5661
- this.logger.warn("'client cookies' is not available on the server.");
5733
+ this.logger.warn("'localStorage' is not available on the server.");
5662
5734
  return {
5663
5735
  ok: true,
5664
5736
  data: null
5665
5737
  };
5666
5738
  }
5667
- const val = cookies__default.default.get(this.storageKey);
5739
+ const val = localStorage.getItem(this.storageKey);
5668
5740
  if (!val) {
5669
5741
  return {
5670
5742
  ok: true,
@@ -5681,7 +5753,7 @@ var SessionManagerCookie = class {
5681
5753
  if (!res.ok) {
5682
5754
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
5683
5755
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
5684
- cookies__default.default.remove(this.storageKey);
5756
+ localStorage.removeItem(this.storageKey);
5685
5757
  return {
5686
5758
  ok: false,
5687
5759
  error: res.error
@@ -5702,9 +5774,7 @@ var SessionManagerCookie = class {
5702
5774
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
5703
5775
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
5704
5776
  };
5705
- cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
5706
- expires: subMinutes(addDays(now, 30), 2).getTime()
5707
- });
5777
+ localStorage.setItem(this.storageKey, JSON.stringify(obj));
5708
5778
  return {
5709
5779
  ok: true,
5710
5780
  data: obj
@@ -5721,18 +5791,18 @@ var SessionManagerCookie = class {
5721
5791
  }
5722
5792
  async destroy() {
5723
5793
  if (this.isServer) {
5724
- this.logger.warn("'client cookies' is not available on the server.");
5794
+ this.logger.warn("'localStorage' is not available on the server.");
5725
5795
  return;
5726
5796
  }
5727
5797
  const res = await this.get();
5728
5798
  if (res.data?.accessToken) {
5729
5799
  await this.authService.destroySession(res.data.accessToken);
5730
5800
  }
5731
- cookies__default.default.remove(this.storageKey);
5801
+ localStorage.removeItem(this.storageKey);
5732
5802
  }
5733
5803
  async verify() {
5734
5804
  if (this.isServer) {
5735
- this.logger.warn("'client cookies' is not available on the server.");
5805
+ this.logger.warn("'localStorage' is not available on the server.");
5736
5806
  return true;
5737
5807
  }
5738
5808
  const s = await this.get();
@@ -5742,13 +5812,13 @@ var SessionManagerCookie = class {
5742
5812
  if (!s.data) return true;
5743
5813
  const v = await this.authService.verifySession(s.data.accessToken);
5744
5814
  if (!v) {
5745
- cookies__default.default.remove(this.storageKey);
5815
+ localStorage.removeItem(this.storageKey);
5746
5816
  }
5747
5817
  return v;
5748
5818
  }
5749
5819
  get onMaya() {
5750
5820
  if (this.isServer) {
5751
- this.logger.warn("'client cookies' is not available on the server.");
5821
+ this.logger.warn("'localStorage' is not available on the server.");
5752
5822
  return false;
5753
5823
  }
5754
5824
  return localStorage.getItem(this.platformStorageKey) === "MAYA";
@@ -5877,6 +5947,7 @@ var Transformer = class {
5877
5947
  instapayBank: this.instapayBank.bind(this),
5878
5948
  promoByCode: this.promoByCode.bind(this),
5879
5949
  quest: this.quest.bind(this),
5950
+ quest_next: this.quest.bind(this),
5880
5951
  topWin: this.topWin.bind(this),
5881
5952
  jackpots: this.jackpots.bind(this),
5882
5953
  jackpotPayouts: this.jackpotPayouts.bind(this),
@@ -6952,6 +7023,62 @@ var Transformer = class {
6952
7023
  };
6953
7024
  }
6954
7025
  quest(data) {
7026
+ return {
7027
+ id: data.id,
7028
+ name: data.name,
7029
+ description: data.description,
7030
+ status: data.status,
7031
+ bonus: parseDecimal(data.bonus, 0),
7032
+ dateTimeCreated: new Date(data.dateTimeCreated),
7033
+ endDateTime: new Date(data.endDateTime),
7034
+ program: {
7035
+ type: data.program.type,
7036
+ name: data.program.name,
7037
+ description: data.program.description,
7038
+ status: data.program.status
7039
+ },
7040
+ progressPercentage: parseDecimal(data.progressPercentage, 0),
7041
+ turnover: parseDecimal(data.turnover, 0),
7042
+ targetTurnover: data?.targetTurnover ? parseDecimal(data.targetTurnover, 0) : void 0,
7043
+ checkInStreak: data?.checkInStreak ?? void 0,
7044
+ lastCheckInDate: data?.lastCheckInDate ? new Date(data.lastCheckInDate) : void 0,
7045
+ startDateTime: data?.startDateTime ? new Date(data.startDateTime) : void 0,
7046
+ type: data.type,
7047
+ dateTimeCompleted: data.dateTimeCompleted ? new Date(data.dateTimeCompleted) : void 0,
7048
+ ...data.type === "WAGERING" && data?.stages?.length && {
7049
+ stages: data.stages.map((stage) => ({
7050
+ bonusAmount: parseDecimal(stage.bonusAmount, 0),
7051
+ cleared: stage.cleared ?? false,
7052
+ targetTurnover: parseDecimal(stage.targetTurnover, 0),
7053
+ bonusTurnoverRequirementMultiplier: parseDecimal(
7054
+ stage.bonusTurnoverRequirementMultiplier,
7055
+ 0
7056
+ ),
7057
+ dateTimeCleared: new Date(stage.dateTimeCleared)
7058
+ }))
7059
+ },
7060
+ ...data.type === "DAILY_CHECKIN" && {
7061
+ seventhDayBonusAmount: parseDecimal(data.seventhDayBonusAmount, 0),
7062
+ sixthDayBonusAmount: parseDecimal(data.sixthDayBonusAmount, 0),
7063
+ thirdDayBonusAmount: parseDecimal(data.thirdDayBonusAmount, 0)
7064
+ },
7065
+ ...data.type === "ONBOARDING" && {
7066
+ firstDepositCompleted: data.firstDepositCompleted,
7067
+ accountVerificationCompleted: data.accountVerificationCompleted
7068
+ },
7069
+ ...data.type === "JOURNEY" && {
7070
+ milestones: data.milestones?.map((milestone) => ({
7071
+ id: milestone.id,
7072
+ type: milestone.type,
7073
+ name: milestone.name,
7074
+ bonusAmount: parseDecimal(milestone.bonusAmount, 0),
7075
+ cleared: milestone.cleared ?? false,
7076
+ description: milestone?.description ?? void 0
7077
+ }))
7078
+ }
7079
+ };
7080
+ }
7081
+ quest_next(data) {
6955
7082
  return {
6956
7083
  id: data.id,
6957
7084
  name: data.name,
@@ -8534,7 +8661,11 @@ var Sdk = class {
8534
8661
  const res1 = NEW_GAME_PROVIDERS.includes(provider) ? await this.walletService.createGameSession({
8535
8662
  input: { id, game: reference }
8536
8663
  }) : await this.gameService.createGameSession({
8537
- input: { id, game: reference }
8664
+ input: {
8665
+ id,
8666
+ game: reference,
8667
+ homepageUrl: typeof window === "undefined" ? void 0 : window.location.origin
8668
+ }
8538
8669
  });
8539
8670
  return res1.ok ? { ok: true, data: { id } } : res1;
8540
8671
  }
@@ -8826,6 +8957,14 @@ var Sdk = class {
8826
8957
  data: res.data.map(this.transformer.transform.quest)
8827
8958
  };
8828
8959
  }
8960
+ async availableQuests_next() {
8961
+ const res = await this.triggerService.availableQuests_next();
8962
+ if (!res.ok) return res;
8963
+ return {
8964
+ ok: true,
8965
+ data: res.data.map(this.transformer.transform.quest_next)
8966
+ };
8967
+ }
8829
8968
  async checkInDailyQuest(id) {
8830
8969
  return await this.triggerService.checkInDailyQuest({ input: { id } });
8831
8970
  }