@everymatrix/player-bonus-card 1.0.15 → 1.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-bonus-card",
3
- "version": "1.0.15",
3
+ "version": "1.1.0",
4
4
  "main": "dist/player-bonus-card",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "0ee1d4bccc4964628711251119148f0a04ba10df"
39
+ "gitHead": "62036ada223f2b4f7b64d99a81ab2229ecba3cf1"
40
40
  }
@@ -16,8 +16,11 @@
16
16
  export let bonusremainingamount:string = '';
17
17
  export let bonuscurrency:string = '';
18
18
  export let lang:string = 'en';
19
+ export let clientstyling:string = '';
20
+ export let clientstylingurl:string = '';
19
21
  export let translationUrl:string = '';
20
22
 
23
+ let customStylingContainer:HTMLElement;
21
24
  let userAgent:string = window.navigator.userAgent;
22
25
  let isMobile:boolean = (getDevice(userAgent) === 'PC') ? false : true;
23
26
 
@@ -60,12 +63,33 @@
60
63
  setLocale(lang);
61
64
  }
62
65
 
66
+ const setClientStyling = ():void => {
67
+ let sheet:HTMLElement = document.createElement('style');
68
+ sheet.innerHTML = clientstyling;
69
+ customStylingContainer.appendChild(sheet);
70
+ }
71
+
72
+ const setClientStylingURL = ():void => {
73
+ let url:URL = new URL(clientstylingurl);
74
+ let cssFile:HTMLElement = document.createElement('style');
75
+
76
+ fetch(url.href)
77
+ .then((res:any) => res.text())
78
+ .then((data:any) => {
79
+ cssFile.innerHTML = data
80
+
81
+ setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
82
+ });
83
+ }
84
+
63
85
  $: lang && initialLoad();
64
86
  $: bonustype && bonusTypeRewrite();
87
+ $: clientstylingurl && customStylingContainer && setClientStylingURL();
88
+ $: clientstyling && customStylingContainer && setClientStyling();
65
89
  $: translationUrl && setTranslationUrl();
66
90
  </script>
67
91
 
68
- <div class="BonusCard" part="BonusCard">
92
+ <div class="BonusCard" part="BonusCard" bind:this={customStylingContainer}>
69
93
  <div class="BonusCardInfo" part="BonusCardInfo">
70
94
  <div class="BonusCardRow" part="BonusCardRow">
71
95
  <p class="BonusCardRowTitle" part="BonusCardRowTitle">{$_('bonusCard.date')} <span>{moment(bonusdate).format('DD/MM/YYYY h:mm A')}</span></p>