@everymatrix/casino-betslip-indicator 1.8.4 → 1.9.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/casino-betslip-indicator",
3
- "version": "1.8.4",
3
+ "version": "1.9.0",
4
4
  "main": "dist/casino-betslip-indicator.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "58b0374c9527cbfb3a070ac6fb1744bc670aba27"
39
+ "gitHead": "931b121e18fe00e97d089fdc4f642515337a7091"
40
40
  }
@@ -7,6 +7,10 @@
7
7
  } from "svelte/internal";
8
8
  import { isMobile } from 'rvhelper';
9
9
 
10
+ export let clientstyling:string = '';
11
+ export let clientstylingurl:string = '';
12
+
13
+ let customStylingContainer:HTMLElement;
10
14
  let userAgent:String = window.navigator.userAgent;
11
15
  let betNumber: number = null;
12
16
  let mobileView:Boolean = false;
@@ -42,6 +46,25 @@
42
46
  }
43
47
  }
44
48
 
49
+ const setClientStyling = ():void => {
50
+ let sheet:HTMLElement = document.createElement('style');
51
+ sheet.innerHTML = clientstyling;
52
+ customStylingContainer.appendChild(sheet);
53
+ }
54
+
55
+ const setClientStylingURL = ():void => {
56
+ let url:URL = new URL(clientstylingurl);
57
+ let cssFile:HTMLElement = document.createElement('style');
58
+
59
+ fetch(url.href)
60
+ .then((res:any) => res.text())
61
+ .then((data:any) => {
62
+ cssFile.innerHTML = data
63
+
64
+ setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
65
+ });
66
+ }
67
+
45
68
  onMount(() => {
46
69
  getInitialBetSlipContent();
47
70
 
@@ -55,33 +78,37 @@
55
78
  window.removeEventListener('message', messageHandler);
56
79
  }
57
80
  });
58
- </script>
59
81
 
82
+ $: clientstylingurl && customStylingContainer && setClientStylingURL();
83
+ $: clientstyling && customStylingContainer && setClientStyling();
84
+ </script>
60
85
 
61
- {#if mobileView && betNumber > 0}
62
- <button on:click={(e) => dispatchWcEvent("betslipClick", {})} class="betslipIndicator">
63
- <small class="betslipIndicator__number">
64
- {#if isLoading}
65
- <div class="loader">Loading...</div>
66
- {:else}
67
- {betNumber}
68
- {/if}
69
- </small>
70
- <svg version="1.1" id="Layer_1" class="betslipIndicator__icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
71
- viewBox="0 0 64 100" style="enable-background:new 0 0 64 100;" xml:space="preserve">
72
- <g>
73
- <path d="M45,95c0,1.1,0.9,2,2,2h11c3.3,0,6-2.7,6-6V9c0-3.3-2.7-6-6-6H47c-1.1,0-2,0.9-2,2c0,7.2-5.8,13-13,13S19,12.2,19,5
74
- c0-1.1-0.9-2-2-2H6C2.7,3,0,5.7,0,9v82c0,3.3,2.7,6,6,6h11c1.1,0,2-0.9,2-2c0-7.2,5.8-13,13-13S45,87.8,45,95z M32,78
75
- c-8.6,0-15.9,6.4-16.9,15H6c-1.1,0-2-0.9-2-2V9c0-1.1,0.9-2,2-2h9.1c1.2,9.3,9.7,15.9,19,14.8c7.7-1,13.8-7,14.8-14.8H58
76
- c1.1,0,2,0.9,2,2v82c0,1.1-0.9,2-2,2h-9.1C47.9,84.4,40.6,78,32,78z"/>
77
- <path d="M50.9,29.5H13.1c-0.8,0-1.5,0.9-1.5,2c0,1.1,0.7,2,1.5,2h37.8c0.8,0,1.5-0.9,1.5-2C52.4,30.4,51.7,29.5,50.9,29.5z"/>
78
- <path d="M50.9,41.5H13.1c-0.8,0-1.5,0.9-1.5,2s0.7,2,1.5,2h37.8c0.8,0,1.5-0.9,1.5-2S51.7,41.5,50.9,41.5z"/>
79
- <path d="M50.9,53.5H13.1c-0.8,0-1.5,0.9-1.5,2s0.7,2,1.5,2h37.8c0.8,0,1.5-0.9,1.5-2S51.7,53.5,50.9,53.5z"/>
80
- <path d="M50.9,66.5H13.1c-0.8,0-1.5,0.9-1.5,2s0.7,2,1.5,2h37.8c0.8,0,1.5-0.9,1.5-2S51.7,66.5,50.9,66.5z"/>
81
- </g>
82
- </svg>
83
- </button>
84
- {/if}
86
+ <div bind:this={customStylingContainer}>
87
+ {#if mobileView && betNumber > 0}
88
+ <button on:click={(e) => dispatchWcEvent("betslipClick", {})} class="betslipIndicator">
89
+ <small class="betslipIndicator__number">
90
+ {#if isLoading}
91
+ <div class="loader">Loading...</div>
92
+ {:else}
93
+ {betNumber}
94
+ {/if}
95
+ </small>
96
+ <svg version="1.1" id="Layer_1" class="betslipIndicator__icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
97
+ viewBox="0 0 64 100" style="enable-background:new 0 0 64 100;" xml:space="preserve">
98
+ <g>
99
+ <path d="M45,95c0,1.1,0.9,2,2,2h11c3.3,0,6-2.7,6-6V9c0-3.3-2.7-6-6-6H47c-1.1,0-2,0.9-2,2c0,7.2-5.8,13-13,13S19,12.2,19,5
100
+ c0-1.1-0.9-2-2-2H6C2.7,3,0,5.7,0,9v82c0,3.3,2.7,6,6,6h11c1.1,0,2-0.9,2-2c0-7.2,5.8-13,13-13S45,87.8,45,95z M32,78
101
+ c-8.6,0-15.9,6.4-16.9,15H6c-1.1,0-2-0.9-2-2V9c0-1.1,0.9-2,2-2h9.1c1.2,9.3,9.7,15.9,19,14.8c7.7-1,13.8-7,14.8-14.8H58
102
+ c1.1,0,2,0.9,2,2v82c0,1.1-0.9,2-2,2h-9.1C47.9,84.4,40.6,78,32,78z"/>
103
+ <path d="M50.9,29.5H13.1c-0.8,0-1.5,0.9-1.5,2c0,1.1,0.7,2,1.5,2h37.8c0.8,0,1.5-0.9,1.5-2C52.4,30.4,51.7,29.5,50.9,29.5z"/>
104
+ <path d="M50.9,41.5H13.1c-0.8,0-1.5,0.9-1.5,2s0.7,2,1.5,2h37.8c0.8,0,1.5-0.9,1.5-2S51.7,41.5,50.9,41.5z"/>
105
+ <path d="M50.9,53.5H13.1c-0.8,0-1.5,0.9-1.5,2s0.7,2,1.5,2h37.8c0.8,0,1.5-0.9,1.5-2S51.7,53.5,50.9,53.5z"/>
106
+ <path d="M50.9,66.5H13.1c-0.8,0-1.5,0.9-1.5,2s0.7,2,1.5,2h37.8c0.8,0,1.5-0.9,1.5-2S51.7,66.5,50.9,66.5z"/>
107
+ </g>
108
+ </svg>
109
+ </button>
110
+ {/if}
111
+ </div>
85
112
 
86
113
 
87
114
  <style lang="scss">