@everymatrix/player-account-controller 0.0.159 → 0.0.163
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/player-account-controller.js +45126 -10588
- package/dist/player-account-controller.js.map +1 -1
- package/documentation.md +8 -0
- package/index.html +3 -2
- package/package.json +4 -4
- package/src/PlayerAccountController.svelte +104 -12
- package/src/i18n.js +27 -0
package/documentation.md
CHANGED
|
@@ -27,6 +27,10 @@ For example here is a list of the components used in order to display the Player
|
|
|
27
27
|
- Player Timeout
|
|
28
28
|
- Player Account Closure
|
|
29
29
|
- Player Gaming Limits
|
|
30
|
+
- Deposit
|
|
31
|
+
- Withdrawal
|
|
32
|
+
- Pending Withdrawals
|
|
33
|
+
- Transaction History
|
|
30
34
|
|
|
31
35
|
These components can also be used on their own, and they still can communicate to each other even if they are structurally placed in separate parts of your application (they still need to be on the same page).
|
|
32
36
|
|
|
@@ -131,6 +135,10 @@ The `customnotifications` is a string data that contains the background colors u
|
|
|
131
135
|
|GamingLimitsConfirmChanges|no extra data sent|intermediary step towards updating the data in which the user's acknowledgement to edit the limit values is confirmed|
|
|
132
136
|
|CancelGamingLimitsChanges|no extra data sent|intermediary step towards updating the data in which the user cancels the changes he has made to his gaming limits|
|
|
133
137
|
|PlayerAccountGamingLimitDelete|limit - the limit data to be deleted|intermediary step towards deleting data in which the user's acknowledgement to delete limit values is confirmed|
|
|
138
|
+
|Deposit|currency - send the user currency, amount - send "o" as amount|send POST to get the deposit iframe url
|
|
139
|
+
|Withdrawal|currency - send the user currency, amount - send "o" as amount|send POST to get the withdraw iframe url
|
|
140
|
+
|Pending Withdrawal|no extra data sent|get pending withdrawals iframe url
|
|
141
|
+
|Transaction History|no extra data sent|get transaction history iframe url
|
|
134
142
|
|CancelGamingLimitsRemove|no extra data sent|intermediary step towards deleting limits data in which the user cancels the changes he has made to his gaming limits|
|
|
135
143
|
|ModalClosed|no extra data sent|closes current confirmation modal|
|
|
136
144
|
|EnableScroll|no extra data sent|enables scroll after the used closes the modal|
|
package/index.html
CHANGED
|
@@ -33,11 +33,12 @@
|
|
|
33
33
|
<player-account-controller
|
|
34
34
|
endpoint="https://demo-api.stage.norway.everymatrix.com/v1"
|
|
35
35
|
cmsendpoint="https://wp-one-widgets.everymatrix.com/wp-json/wpone-rest/v1"
|
|
36
|
-
playerid="
|
|
37
|
-
session="
|
|
36
|
+
playerid="3685503"
|
|
37
|
+
session="32d59c64-3678-4635-96c1-ce220b8fbf3a"
|
|
38
38
|
accountpath="/menu-locations/profile-menu"
|
|
39
39
|
notificationpath="/support_information"
|
|
40
40
|
customnotifications="#58586B,#2687F6,#D0046C"
|
|
41
|
+
lang="en"
|
|
41
42
|
></player-account-controller>
|
|
42
43
|
<!--<player-account-controller cmsendpoint="https://wp-one-widgets.everymatrix.com/wp-json/wpone-rest/v1"
|
|
43
44
|
accountpath="/menu-locations/profile-menu"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/player-account-controller",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.163",
|
|
4
4
|
"main": "dist/player-account-controller.js",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"typescript": "^3.9.3"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@everymatrix/player-account-menu": "^0.0.
|
|
33
|
-
"@everymatrix/player-account-notifications": "^0.0.
|
|
32
|
+
"@everymatrix/player-account-menu": "^0.0.163",
|
|
33
|
+
"@everymatrix/player-account-notifications": "^0.0.163",
|
|
34
34
|
"cross-env": "^7.0.3",
|
|
35
35
|
"sirv-cli": "^1.0.0",
|
|
36
36
|
"svelte": "^3.0.0"
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "0987227fd54b268a6dedfb7687bc94ba10d87ea7"
|
|
42
42
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<script lang="typescript">
|
|
4
4
|
import { onMount, tick } from 'svelte';
|
|
5
5
|
import { getDevice } from 'rvhelper';
|
|
6
|
+
import { _, addNewMessages, setLocale, setupI18n } from './i18n';
|
|
6
7
|
|
|
7
8
|
import '@everymatrix/player-account-menu';
|
|
8
9
|
import '@everymatrix/player-account-notifications';
|
|
@@ -17,6 +18,11 @@
|
|
|
17
18
|
import '@everymatrix/player-account-gaming-limits';
|
|
18
19
|
import '@everymatrix/player-active-bonuses';
|
|
19
20
|
import '@everymatrix/player-bonus-history';
|
|
21
|
+
import '@everymatrix/player-deposit';
|
|
22
|
+
import '@everymatrix/player-withdrawal';
|
|
23
|
+
import '@everymatrix/player-pending-withdrawals';
|
|
24
|
+
import '@everymatrix/player-transaction-history';
|
|
25
|
+
import '@everymatrix/player-gaming-history';
|
|
20
26
|
|
|
21
27
|
export let cmsendpoint:string = '';
|
|
22
28
|
export let accountpath:string = '';
|
|
@@ -26,6 +32,9 @@
|
|
|
26
32
|
export let playerid:string = '';
|
|
27
33
|
export let session:string = '';
|
|
28
34
|
export let endpoint:string = '';
|
|
35
|
+
export let lang:string = 'en';
|
|
36
|
+
|
|
37
|
+
setupI18n({ withLocale: 'en', translations: {}});
|
|
29
38
|
|
|
30
39
|
let isLoading:boolean = false;
|
|
31
40
|
let userAgent:string = window.navigator.userAgent;
|
|
@@ -42,9 +51,25 @@
|
|
|
42
51
|
let losslimit:any;
|
|
43
52
|
let timelimit:any;
|
|
44
53
|
let showsuccessnotification:boolean = false;
|
|
45
|
-
let
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
let showdeletenotification:boolean = false;
|
|
55
|
+
let realityCheckData:any;
|
|
56
|
+
let storedRealityCheck:string = '';
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const widgetTitle = ['Profile Info',
|
|
60
|
+
'Change password',
|
|
61
|
+
'Reality Check',
|
|
62
|
+
'Timeout',
|
|
63
|
+
'Account Closure',
|
|
64
|
+
'Gaming Limits',
|
|
65
|
+
'Self Exclusion',
|
|
66
|
+
'Active Bonuses',
|
|
67
|
+
'Bonus History',
|
|
68
|
+
'Gaming History',
|
|
69
|
+
'Deposit',
|
|
70
|
+
'Withdrawal',
|
|
71
|
+
'Pending Withdrawals',
|
|
72
|
+
'Transaction History'];
|
|
48
73
|
const accountMenuEndpointURL:string = cmsendpoint + accountpath;
|
|
49
74
|
const notificationsEndpointURL:string = cmsendpoint + notificationpath;
|
|
50
75
|
|
|
@@ -266,6 +291,7 @@
|
|
|
266
291
|
}
|
|
267
292
|
let limitsCategoryTitle = e.data.name;
|
|
268
293
|
let limitName:string = '';
|
|
294
|
+
|
|
269
295
|
switch (limitsCategoryTitle) {
|
|
270
296
|
case 'depositLimits':
|
|
271
297
|
limitName = 'deposit';
|
|
@@ -306,8 +332,7 @@
|
|
|
306
332
|
fetch(url, deleteOptions)
|
|
307
333
|
.then((res:any) => {
|
|
308
334
|
if (res.status == 200) {
|
|
309
|
-
|
|
310
|
-
|
|
335
|
+
showdeletenotification = true;
|
|
311
336
|
getGamingLimits(`${endpoint}/player/${playerid}/limits`);
|
|
312
337
|
} else {
|
|
313
338
|
// ERROR
|
|
@@ -323,6 +348,10 @@
|
|
|
323
348
|
getGamingLimits(`${endpoint}/player/${playerid}/limits`);
|
|
324
349
|
break;
|
|
325
350
|
|
|
351
|
+
case 'SubmittedRealityCheck':
|
|
352
|
+
setRealityCheckValue(e.data.realityCheckUpdatedValue);
|
|
353
|
+
break;
|
|
354
|
+
|
|
326
355
|
default:
|
|
327
356
|
// do nothing
|
|
328
357
|
break;
|
|
@@ -371,12 +400,53 @@
|
|
|
371
400
|
});
|
|
372
401
|
}
|
|
373
402
|
|
|
403
|
+
const getRealityCheckData = (url:string) => {
|
|
404
|
+
let options = {
|
|
405
|
+
method: 'GET',
|
|
406
|
+
headers: {
|
|
407
|
+
'X-SessionID': sessionId,
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
fetch(url, options)
|
|
411
|
+
.then((res:any) => { return res.json(); })
|
|
412
|
+
.then((data:any) => {
|
|
413
|
+
realityCheckData = data.UserRealityCheckValue;
|
|
414
|
+
}, (err:any) => {
|
|
415
|
+
console.error(err);
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const setRealityCheckValue = (updatedData:string) => {
|
|
420
|
+
if(updatedData) {
|
|
421
|
+
storedRealityCheck = updatedData;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
let optionsRealityCheck = {
|
|
425
|
+
method: "POST",
|
|
426
|
+
headers: {
|
|
427
|
+
'X-SessionID': sessionId,
|
|
428
|
+
'Content-Type': "application/json",
|
|
429
|
+
'Accept': 'application/json',
|
|
430
|
+
'realityCheckValue': parseInt(storedRealityCheck, 10)
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
fetch(`${endpoint}/player/${userId}/realitycheck`, optionsRealityCheck)
|
|
435
|
+
.then((res:any) => {
|
|
436
|
+
if (res.status == 200) {
|
|
437
|
+
getRealityCheckData(`${endpoint}/player/${playerid}/realitycheck`);
|
|
438
|
+
window.postMessage({ type: 'RealityCheckValueUpdated' }, window.location.href);
|
|
439
|
+
}
|
|
440
|
+
}, (err:any) => {
|
|
441
|
+
console.error(err);
|
|
442
|
+
});
|
|
443
|
+
}
|
|
374
444
|
|
|
375
445
|
const getGamingLimits = (url:string) => {
|
|
376
446
|
if (showsuccessnotification === true) {
|
|
377
447
|
setTimeout(() => {showsuccessnotification = false; }, 3000);
|
|
378
|
-
} else if(
|
|
379
|
-
setTimeout(() => {
|
|
448
|
+
} else if(showdeletenotification === true) {
|
|
449
|
+
setTimeout(() => {showdeletenotification = false; }, 3000);
|
|
380
450
|
}
|
|
381
451
|
|
|
382
452
|
let options = {
|
|
@@ -441,9 +511,11 @@
|
|
|
441
511
|
getNotificationsDetails(cmsendpoint + notificationpath);
|
|
442
512
|
getUserProfileInfo();
|
|
443
513
|
getGamingLimits(`${endpoint}/player/${playerid}/limits`);
|
|
514
|
+
getRealityCheckData(`${endpoint}/player/${playerid}/realitycheck`);
|
|
444
515
|
}
|
|
445
516
|
|
|
446
517
|
const initialLoad = () => {
|
|
518
|
+
setLocale(lang);
|
|
447
519
|
userId = playerid;
|
|
448
520
|
sessionId = session;
|
|
449
521
|
pageName = widgetTitle[0];
|
|
@@ -463,7 +535,7 @@
|
|
|
463
535
|
}
|
|
464
536
|
});
|
|
465
537
|
|
|
466
|
-
$: cmsendpoint && endpoint && accountpath && notificationpath && customnotifications && playerid && session && initialLoad();
|
|
538
|
+
$: cmsendpoint && endpoint && accountpath && notificationpath && customnotifications && playerid && session && lang && initialLoad();
|
|
467
539
|
</script>
|
|
468
540
|
|
|
469
541
|
{#if isLoading}
|
|
@@ -482,19 +554,29 @@
|
|
|
482
554
|
{:else if switchContent && pageName === widgetTitle[1]}
|
|
483
555
|
<player-change-password></player-change-password>
|
|
484
556
|
{:else if switchContent && pageName === widgetTitle[2]}
|
|
485
|
-
<player-reality-check></player-reality-check>
|
|
557
|
+
<player-reality-check realitycheck={realityCheckData}></player-reality-check>
|
|
486
558
|
{:else if switchContent && pageName === widgetTitle[3]}
|
|
487
559
|
<player-account-timeout></player-account-timeout>
|
|
488
560
|
{:else if switchContent && pageName === widgetTitle[4]}
|
|
489
561
|
<player-account-closure></player-account-closure>
|
|
490
562
|
{:else if switchContent && pageName === widgetTitle[5]}
|
|
491
|
-
<player-account-gaming-limits {depositlimit} {wageringlimit} {losslimit} {timelimit} {showsuccessnotification} {
|
|
563
|
+
<player-account-gaming-limits {depositlimit} {wageringlimit} {losslimit} {timelimit} {showsuccessnotification} {showdeletenotification}></player-account-gaming-limits>
|
|
492
564
|
{:else if switchContent && pageName === widgetTitle[6]}
|
|
493
565
|
<player-account-self-exclusion></player-account-self-exclusion>
|
|
494
566
|
{:else if switchContent && pageName === widgetTitle[7]}
|
|
495
567
|
<player-active-bonuses {endpoint} {session} {playerid}></player-active-bonuses>
|
|
496
568
|
{:else if switchContent && pageName === widgetTitle[8]}
|
|
497
569
|
<player-bonus-history {endpoint} {session} {playerid}></player-bonus-history>
|
|
570
|
+
{:else if switchContent && pageName === widgetTitle[9]}
|
|
571
|
+
<player-gaming-history {endpoint} {session} {playerid}></player-gaming-history>
|
|
572
|
+
{:else if switchContent && pageName === widgetTitle[10]}
|
|
573
|
+
<player-deposit {endpoint} {session} {playerid}></player-deposit>
|
|
574
|
+
{:else if switchContent && pageName === widgetTitle[11]}
|
|
575
|
+
<player-withdrawal {endpoint} {session} {playerid}></player-withdrawal>
|
|
576
|
+
{:else if switchContent && pageName === widgetTitle[12]}
|
|
577
|
+
<player-pending-withdrawals {endpoint} {session} {playerid}></player-pending-withdrawals>
|
|
578
|
+
{:else if switchContent && pageName === widgetTitle[13]}
|
|
579
|
+
<player-transaction-history {endpoint} {session} {playerid}></player-transaction-history>
|
|
498
580
|
{/if}
|
|
499
581
|
{/if}
|
|
500
582
|
{:else}
|
|
@@ -507,19 +589,29 @@
|
|
|
507
589
|
{:else if switchContent && pageName === widgetTitle[1]}
|
|
508
590
|
<player-change-password></player-change-password>
|
|
509
591
|
{:else if switchContent && pageName === widgetTitle[2]}
|
|
510
|
-
<player-reality-check></player-reality-check>
|
|
592
|
+
<player-reality-check realitycheck={realityCheckData}></player-reality-check>
|
|
511
593
|
{:else if switchContent && pageName === widgetTitle[3]}
|
|
512
594
|
<player-account-timeout></player-account-timeout>
|
|
513
595
|
{:else if switchContent && pageName === widgetTitle[4]}
|
|
514
596
|
<player-account-closure></player-account-closure>
|
|
515
597
|
{:else if switchContent && pageName === widgetTitle[5]}
|
|
516
|
-
<player-account-gaming-limits {depositlimit} {wageringlimit} {losslimit} {timelimit} {showsuccessnotification} {
|
|
598
|
+
<player-account-gaming-limits {depositlimit} {wageringlimit} {losslimit} {timelimit} {showsuccessnotification} {showdeletenotification}></player-account-gaming-limits>
|
|
517
599
|
{:else if switchContent && pageName === widgetTitle[6]}
|
|
518
600
|
<player-account-self-exclusion></player-account-self-exclusion>
|
|
519
601
|
{:else if switchContent && pageName === widgetTitle[7]}
|
|
520
602
|
<player-active-bonuses {endpoint} {session} {playerid}></player-active-bonuses>
|
|
521
603
|
{:else if switchContent && pageName === widgetTitle[8]}
|
|
522
604
|
<player-bonus-history {endpoint} {session} {playerid}></player-bonus-history>
|
|
605
|
+
{:else if switchContent && pageName === widgetTitle[9]}
|
|
606
|
+
<player-gaming-history {endpoint} {session} {playerid}></player-gaming-history>
|
|
607
|
+
{:else if switchContent && pageName === widgetTitle[10]}
|
|
608
|
+
<player-deposit {endpoint} {session} {playerid}></player-deposit>
|
|
609
|
+
{:else if switchContent && pageName === widgetTitle[11]}
|
|
610
|
+
<player-withdrawal {endpoint} {session} {playerid}></player-withdrawal>
|
|
611
|
+
{:else if switchContent && pageName === widgetTitle[12]}
|
|
612
|
+
<player-pending-withdrawals {endpoint} {session} {playerid}></player-pending-withdrawals>
|
|
613
|
+
{:else if switchContent && pageName === widgetTitle[13]}
|
|
614
|
+
<player-transaction-history {endpoint} {session} {playerid}></player-transaction-history>
|
|
523
615
|
{/if}
|
|
524
616
|
</main>
|
|
525
617
|
<aside>
|
package/src/i18n.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dictionary,
|
|
3
|
+
locale,
|
|
4
|
+
addMessages,
|
|
5
|
+
_
|
|
6
|
+
} from 'svelte-i18n';
|
|
7
|
+
|
|
8
|
+
function setupI18n({ withLocale: _locale, translations }) {
|
|
9
|
+
locale.subscribe((data) => {
|
|
10
|
+
if (data == null) {
|
|
11
|
+
dictionary.set(translations);
|
|
12
|
+
locale.set(_locale);
|
|
13
|
+
}
|
|
14
|
+
}); // maybe we will need this to make sure that the i18n is set up only once
|
|
15
|
+
/*dictionary.set(translations);
|
|
16
|
+
locale.set(_locale);*/
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function addNewMessages(lang, dict) {
|
|
20
|
+
addMessages(lang, dict);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function setLocale(_locale) {
|
|
24
|
+
locale.set(_locale);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { _, setupI18n, addNewMessages, setLocale };
|