@everymatrix/casino-betslip-indicator 0.0.309 → 0.0.312

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": "0.0.309",
3
+ "version": "0.0.312",
4
4
  "main": "index.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": "5d3dd3ff57c483ac2d7f6526cd70f1a7746af0cf"
39
+ "gitHead": "3e54fa72cbaa902ca36dd055a72f90fd4f74a816"
40
40
  }
@@ -1,13 +1,17 @@
1
1
  <svelte:options tag={null} />
2
2
 
3
3
  <script lang="ts">
4
- import { onMount } from "svelte";
4
+ import {
5
+ onMount,
6
+ get_current_component
7
+ } from "svelte/internal";
5
8
  import { isMobile } from 'rvhelper';
6
9
 
7
10
  let userAgent:String = window.navigator.userAgent;
8
11
  let betNumber: number = null;
9
12
  let mobileView:Boolean = false;
10
13
  let isLoading = true;
14
+ const thisComponent = get_current_component(); // dispatching events
11
15
 
12
16
  const getInitialBetSlipContent = () => {
13
17
  window.postMessage({
@@ -15,8 +19,14 @@
15
19
  }, '*');
16
20
  };
17
21
 
18
- const handleClick = () => {
19
- window.postMessage({type: 'EMFE:goToBetslip',}, '*');
22
+ const dispatchWcEvent = (name, detail) => {
23
+ thisComponent.dispatchEvent(
24
+ new CustomEvent(name, {
25
+ detail,
26
+ composed: true,
27
+ bubbles: true // propagate across the shadow DOM
28
+ })
29
+ );
20
30
  };
21
31
 
22
32
  const messageHandler = (e:any) => {
@@ -49,7 +59,7 @@
49
59
 
50
60
 
51
61
  {#if mobileView && betNumber > 0}
52
- <div on:click={() => handleClick()} class="betslipIndicator">
62
+ <button on:click={(e) => dispatchWcEvent("betslipClick", {})} class="betslipIndicator">
53
63
  <small class="betslipIndicator__number">
54
64
  {#if isLoading}
55
65
  <div class="loader">Loading...</div>
@@ -70,7 +80,7 @@
70
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"/>
71
81
  </g>
72
82
  </svg>
73
- </div>
83
+ </button>
74
84
  {/if}
75
85
 
76
86