@everymatrix/lottery-program-wof 1.28.0 → 1.28.2
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/lottery-program-wof",
|
|
3
|
-
"version": "1.28.
|
|
3
|
+
"version": "1.28.2",
|
|
4
4
|
"main": "dist/lottery-program-wof.js",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "d958fcf980942e498f37b94d506a1b27a5169aa4"
|
|
43
43
|
}
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
// types
|
|
14
14
|
import { ContentDirection, Lang } from './types';
|
|
15
|
-
import { api } from './business';
|
|
15
|
+
import { api, isBonusInvalid } from './business';
|
|
16
16
|
|
|
17
|
-
import { _postMessage } from './message';
|
|
17
|
+
import { _postMessage, onMountMessageLifeCycle } from './message';
|
|
18
18
|
import { CurrentInfo, LotteryProgramForPlayer } from './types.business';
|
|
19
19
|
import { setClientStyling, setClientStylingURL, setTranslationUrl } from './widget';
|
|
20
20
|
|
|
@@ -74,7 +74,18 @@
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
const fetcher = async () => {
|
|
77
|
-
|
|
77
|
+
const _bonuses = await api.lotteries(endpoint, session)
|
|
78
|
+
|
|
79
|
+
_postMessage({ type: 'wof-private-bonuses-outcomes', bonuses: _bonuses })
|
|
80
|
+
|
|
81
|
+
bonuses =
|
|
82
|
+
_bonuses
|
|
83
|
+
.map(_bonus => {
|
|
84
|
+
if(!isBonusInvalid(_bonus)){
|
|
85
|
+
return _bonus
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
.filter(_bonus => _bonus)
|
|
78
89
|
|
|
79
90
|
_postMessage({ type: 'WofStatus', avaliable: bonuses.length > 0 })
|
|
80
91
|
_postMessage({ type: 'wof-private-bonuses', bonuses })
|
|
@@ -95,6 +106,31 @@
|
|
|
95
106
|
init()
|
|
96
107
|
}
|
|
97
108
|
|
|
109
|
+
onMountMessageLifeCycle({
|
|
110
|
+
'wof-private-checking': (data) => {
|
|
111
|
+
if(isBonusInvalid(data.bonus)){
|
|
112
|
+
bonuses = bonuses.map(_bonus => {
|
|
113
|
+
if(_bonus.program.id === data.id){
|
|
114
|
+
return {..._bonus, hidden: true}
|
|
115
|
+
}else{
|
|
116
|
+
return _bonus
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let hidden = true
|
|
122
|
+
bonuses.map(_bonus => {
|
|
123
|
+
if(_bonus.hidden !== true){
|
|
124
|
+
hidden = false
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
if(hidden){
|
|
129
|
+
bonuses = []
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
|
|
98
134
|
$: session && init()
|
|
99
135
|
$: endpoint && init()
|
|
100
136
|
$: lang && setLangReactive()
|
package/src/business.ts
CHANGED
|
@@ -28,7 +28,7 @@ const fetcherApi = async <T extends Api>(api: Api, endpoint: string, config: Api
|
|
|
28
28
|
const { } = config || {} as ApiConfigs[Api.lotteries]
|
|
29
29
|
|
|
30
30
|
return {
|
|
31
|
-
path: '/
|
|
31
|
+
path: '/wof/lotteries',
|
|
32
32
|
params: {
|
|
33
33
|
},
|
|
34
34
|
options,
|
|
@@ -39,7 +39,7 @@ const fetcherApi = async <T extends Api>(api: Api, endpoint: string, config: Api
|
|
|
39
39
|
const { id } = config as ApiConfigs[Api.outcome]
|
|
40
40
|
|
|
41
41
|
return {
|
|
42
|
-
path: `/
|
|
42
|
+
path: `/wof/outcome/${id}`,
|
|
43
43
|
params: {
|
|
44
44
|
},
|
|
45
45
|
options,
|
|
@@ -50,7 +50,7 @@ const fetcherApi = async <T extends Api>(api: Api, endpoint: string, config: Api
|
|
|
50
50
|
const { id, guid } = config as ApiConfigs[Api.draw]
|
|
51
51
|
|
|
52
52
|
return {
|
|
53
|
-
path: `/
|
|
53
|
+
path: `/wof/draw/${id}`,
|
|
54
54
|
params: {
|
|
55
55
|
},
|
|
56
56
|
options: {
|
|
@@ -66,7 +66,7 @@ const fetcherApi = async <T extends Api>(api: Api, endpoint: string, config: Api
|
|
|
66
66
|
|
|
67
67
|
const args = getArgs[api]()
|
|
68
68
|
|
|
69
|
-
args.path = endpoint + args.path
|
|
69
|
+
args.path = endpoint + `/v1` + args.path
|
|
70
70
|
|
|
71
71
|
return await fetcher(args)
|
|
72
72
|
}
|
|
@@ -181,4 +181,6 @@ export const findDegWithPointerMode = (index: number, length: number, pointerMod
|
|
|
181
181
|
case PointerMode.Partition:
|
|
182
182
|
return findDeg(index, length)
|
|
183
183
|
}
|
|
184
|
-
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export const isBonusInvalid = (bonus) => bonus?.current.remainingTimes == 0 && !bonus?.next
|
package/src/private.item.svelte
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
// types
|
|
10
10
|
import { ContentDirection, Lang } from './types';
|
|
11
|
-
import { getCurrentInfo } from './business';
|
|
11
|
+
import { getCurrentInfo, isBonusInvalid } from './business';
|
|
12
12
|
import { api } from './business';
|
|
13
13
|
import { onMountMessageLifeCycle, _postMessage } from './message';
|
|
14
14
|
import { CurrentInfo, LotteryProgramForPlayer } from './types.business';
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
|
|
76
76
|
'wof-private-message-close': (data) => {
|
|
77
77
|
if(data.id !== id) return;
|
|
78
|
+
_postMessage({type: 'wof-private-checking', bonus, id })
|
|
78
79
|
setTimeout(() => {
|
|
79
80
|
checkableValid = true
|
|
80
81
|
}, 1000);
|
|
@@ -91,7 +92,7 @@
|
|
|
91
92
|
|
|
92
93
|
<div
|
|
93
94
|
class="LotteryItem"
|
|
94
|
-
class:Invalid={bonus
|
|
95
|
+
class:Invalid={isBonusInvalid(bonus) && checkableValid}
|
|
95
96
|
bind:this={rootContainer}
|
|
96
97
|
>
|
|
97
98
|
<lottery-program-wof-private-item-svg {...{
|