@everymatrix/lottery-program-wof 1.11.0 → 1.11.1

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.
@@ -0,0 +1,61 @@
1
+ <svelte:options tag={'wof-loader'} />
2
+ <div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div>
3
+ <style lang="scss">
4
+
5
+ .lds-ellipsis {
6
+ display: inline-block;
7
+ position: relative;
8
+ width: 80px;
9
+ height: 80px;
10
+ }
11
+ .lds-ellipsis div {
12
+ position: absolute;
13
+ top: 33px;
14
+ width: 13px;
15
+ height: 13px;
16
+ border-radius: 50%;
17
+ background: #fff;
18
+ animation-timing-function: cubic-bezier(0, 1, 1, 0);
19
+ }
20
+ .lds-ellipsis div:nth-child(1) {
21
+ left: 8px;
22
+ animation: lds-ellipsis1 0.6s infinite;
23
+ }
24
+ .lds-ellipsis div:nth-child(2) {
25
+ left: 8px;
26
+ animation: lds-ellipsis2 0.6s infinite;
27
+ }
28
+ .lds-ellipsis div:nth-child(3) {
29
+ left: 32px;
30
+ animation: lds-ellipsis2 0.6s infinite;
31
+ }
32
+ .lds-ellipsis div:nth-child(4) {
33
+ left: 56px;
34
+ animation: lds-ellipsis3 0.6s infinite;
35
+ }
36
+ @keyframes lds-ellipsis1 {
37
+ 0% {
38
+ transform: scale(0);
39
+ }
40
+ 100% {
41
+ transform: scale(1);
42
+ }
43
+ }
44
+ @keyframes lds-ellipsis3 {
45
+ 0% {
46
+ transform: scale(1);
47
+ }
48
+ 100% {
49
+ transform: scale(0);
50
+ }
51
+ }
52
+ @keyframes lds-ellipsis2 {
53
+ 0% {
54
+ transform: translate(0, 0);
55
+ }
56
+ 100% {
57
+ transform: translate(24px, 0);
58
+ }
59
+ }
60
+
61
+ </style>
@@ -4,8 +4,8 @@
4
4
  // @ts-ignore
5
5
  import giftSvg from './images/gift.svg'
6
6
  import { onMountMessageLifeCycle, _postMessage } from './message';
7
+ import { _ } from './i18n';
7
8
 
8
- export let h = 0
9
9
  export let r = 0
10
10
  export let id: string = undefined
11
11
 
@@ -61,7 +61,9 @@
61
61
 
62
62
  $: width = r*2 + 5
63
63
  $: left = r/2
64
- $: top = h / 2 - root?.clientHeight / 2
64
+ $: top = r
65
+
66
+ $: startTime = modeValue?.startTime && getTimeString(modeValue?.startTime)
65
67
 
66
68
  </script>
67
69
 
@@ -84,33 +86,29 @@
84
86
  {/if}
85
87
 
86
88
  {#if mode === 'spin-failed'}
87
- <p>We are sorry that you</p>
88
- <p>don't have any Wheels available, </p>
89
- <p>please <strong>check T&C</strong> here </p>
90
- <p>to get a chance!</p>
89
+ <p>{$_('wof.SpinFailed')}</p>
91
90
  {/if}
92
91
 
93
92
  {#if mode === 'show-next'}
94
- <p>The Wheel will be available on</p>
95
- <p>
96
- <strong>
97
- {getTimeString(modeValue?.startTime)}
98
- </strong>
99
- </p>
100
- <p>please wait till it is open</p>
93
+ <p>{@html $_('wof.ShowNext', {values: { startTime }})}</p>
101
94
  {/if}
102
95
 
103
96
  {#if mode === 'gift'}
104
97
  <p>
105
98
  <img src={giftSvg} alt="">
106
99
  </p>
107
- <p>Congratulations! You won a prize!</p>
100
+ <p>{$_('wof.Congratulation')}</p>
108
101
  <!-- <p>{modeValue}</p> -->
109
102
  {/if}
110
103
 
111
104
  {#if mode !== 'init-failed'}
112
105
  <div>
113
- <button class="MessagePanelButton" on:click={eventButton}>OK</button>
106
+ <button
107
+ class="MessagePanelButton"
108
+ on:click={eventButton}
109
+ >
110
+ {$_('wof.OK')}
111
+ </button>
114
112
  </div>
115
113
  {/if}
116
114
  </div>
@@ -6,6 +6,8 @@
6
6
  import { onMountMessageLifeCycle } from "./message";
7
7
  import type { LotteryProgramForPlayer } from "./types.business";
8
8
  import { classWithPart } from "./util";
9
+ import { _ } from './i18n';
10
+ import './private.loader.svelte'
9
11
 
10
12
  export let endpoint: string = ''
11
13
  export let session: string = ''
@@ -86,23 +88,23 @@
86
88
  <table>
87
89
  {#each outcomesAll as outcomesItem}
88
90
  {#if outcomesItem.isLoading}
89
- <div>Loading...</div>
91
+ <wof-loader />
90
92
  {:else}
91
93
  {#if !outcomesItem.outcomes || outcomesItem.outcomes.length === 0}
92
- <div {...classWithPart("OutcomeNoContent")}>No histories</div>
94
+ <div {...classWithPart("OutcomeNoContent")}>{$_('wof.NoHistories')}</div>
93
95
  {:else}
94
96
  <div>
95
97
  <tr>{getName(lotteryProgramsForPlayer.filter(l => l.program.id === outcomesItem.id)[0].program)}</tr>
96
98
  </div>
97
99
  <thead>
98
100
  <tr>
99
- <th>Rewards</th>
100
- <th>Status</th>
101
- <th>Time</th>
101
+ <th>{$_('wof.Rewards')}</th>
102
+ <th>{$_('wof.Status')}</th>
103
+ <th>{$_('wof.Time')}</th>
102
104
  </tr>
103
105
  </thead>
104
106
  <tbody>
105
- {#each outcomesItem.outcomes as outcome,index}
107
+ {#each outcomesItem.outcomes as outcome}
106
108
  <tr>
107
109
  <td>{getPrize(outcome, outcomesItem.id)}</td>
108
110
  <td>{outcome.draw.state}</td>
@@ -3,9 +3,9 @@
3
3
  <script lang="ts">
4
4
  import { _postMessage } from "./message";
5
5
  import { Tab } from "./types";
6
+ import { _ } from './i18n';
6
7
 
7
8
  let tab: Tab = Tab.Program;
8
-
9
9
  </script>
10
10
 
11
11
  <section id="TabBar" part="TabBar">
@@ -26,7 +26,7 @@
26
26
  tab = _tab
27
27
  }}
28
28
  >
29
- {_tab}
29
+ {$_(`wof.${_tab}`)}
30
30
  </span>
31
31
  </li>
32
32
  {/each}
@@ -0,0 +1,69 @@
1
+ import { pointPlus } from "./calc.point"
2
+
3
+ interface ImageSize {
4
+ width: number
5
+ height: number
6
+ }
7
+
8
+ export const renderSvgImageProps = (center: number, href: string, size: ImageSize, offset = {x: 0, y: 0}) => ({
9
+ x: center - size.width / 2 - offset.x,
10
+ y: center - size.height / 2 - offset.y,
11
+ width: size.width,
12
+ height: size.height,
13
+ href,
14
+ })
15
+
16
+ export const themedImagesUpdater = (
17
+ images, imagesData, imagesConfig, ratio, fn, offset?
18
+ ) => {
19
+
20
+ let centerImagesComposed = {}
21
+
22
+ Object.keys(images).map(k => {
23
+
24
+ let _offset = {
25
+ x: 0,
26
+ y: 0
27
+ }
28
+
29
+ if(imagesData[k].offset){
30
+ _offset = pointPlus(_offset, imagesData[k].offset)
31
+ }
32
+
33
+ if(offset){
34
+ _offset = pointPlus(_offset, offset)
35
+ }
36
+
37
+ const rationalize = (object) => {
38
+ let _object = JSON.parse(JSON.stringify(object))
39
+
40
+ Object.keys(object).map(_key => {
41
+ _object[_key] = object[_key] * ratio
42
+ })
43
+
44
+ return _object
45
+ }
46
+
47
+ centerImagesComposed[k] = {
48
+ src: images[k],
49
+ props: rationalize(imagesData[k].props),
50
+ ... ( _offset ? {
51
+ offset: rationalize(_offset)
52
+ } : {})
53
+ }
54
+ })
55
+
56
+ const themedCenterImagesList = imagesConfig.map(i => {
57
+ return i.map(j => centerImagesComposed[j])
58
+ })
59
+
60
+ fn(themedCenterImagesList)
61
+ }
62
+
63
+ export const themedImageProps = (center, themedImage) =>
64
+ renderSvgImageProps(
65
+ center,
66
+ themedImage.src,
67
+ themedImage.props,
68
+ themedImage.offset
69
+ )
@@ -0,0 +1,141 @@
1
+
2
+ // @ts-ignore
3
+ import spinSvg from './images/spin.svg'
4
+ // @ts-ignore
5
+ import centerArrowSvg from './images/centerArrow.svg'
6
+ // @ts-ignore
7
+ import centerArrow3Svg from './images/centerArrow3.svg'
8
+ // @ts-ignore
9
+ import centerPackSvg from './images/centerPack.svg'
10
+ // @ts-ignore
11
+ import centerText3Svg from './images/centerText3.svg'
12
+ // @ts-ignore
13
+ import centerBackground2Svg from './images/centerBackground2.svg'
14
+ // @ts-ignore
15
+ import centerBackground1Svg from './images/centerBackground1.svg'
16
+ // @ts-ignore
17
+ import centerCircleSvg from './images/centerCircle.svg'
18
+ // @ts-ignore
19
+ import centerArrowBgSvg from './images/centerArrowBg.svg'
20
+
21
+ import { themedImagesUpdater } from './themes.image.base'
22
+
23
+ export const centerImages = {
24
+ centerArrowSvg,
25
+ centerArrow3Svg,
26
+ centerText3Svg,
27
+ centerBackground2Svg,
28
+ centerPackSvg,
29
+ spinSvg,
30
+ centerArrowBgSvg,
31
+ centerCircleSvg,
32
+ centerBackground1Svg,
33
+ }
34
+
35
+ export const centerImagesData = {
36
+ centerArrow3Svg: {
37
+ props: {
38
+ width: 92,
39
+ height: 92
40
+ },
41
+ },
42
+ centerText3Svg: {
43
+ props: {
44
+ width: 42,
45
+ height: 25
46
+ },
47
+ },
48
+ centerBackground2Svg: {
49
+ props: {
50
+ width: 128,
51
+ height: 128
52
+ },
53
+ },
54
+ centerBackground1Svg: {
55
+ props: {
56
+ width: 128,
57
+ height: 128
58
+ },
59
+ },
60
+ centerPackSvg: {
61
+ props: {
62
+ width: 76,
63
+ height: 76
64
+ },
65
+ },
66
+ centerArrowSvg: {
67
+ props: {
68
+ width: 96,
69
+ height: 96
70
+ },
71
+ },
72
+ spinSvg: {
73
+ props: {
74
+ width: 1.3 * 42,
75
+ height: 1.3 * 25
76
+ },
77
+ },
78
+ centerArrowBgSvg: {
79
+ props: {
80
+ width: 28,
81
+ height: 24,
82
+ },
83
+ offset: {
84
+ x: 0,
85
+ y: 45
86
+ }
87
+ },
88
+ centerCircleSvg: {
89
+ props: {
90
+ width: 88,
91
+ height: 104,
92
+ },
93
+ offset: {
94
+ x: 0,
95
+ y: 6
96
+ }
97
+ }
98
+ }
99
+
100
+
101
+ export const centerImagesConfig = [
102
+ [ // 0
103
+ 'centerBackground1Svg',
104
+ 'centerArrowSvg',
105
+ 'spinSvg'
106
+ ],
107
+ [ // 1
108
+ 'centerBackground2Svg',
109
+ 'centerPackSvg'
110
+ ],
111
+ [ // 2
112
+ 'centerBackground1Svg',
113
+ 'centerArrow3Svg',
114
+ 'centerText3Svg'
115
+ ],
116
+ [ // 3
117
+ 'centerBackground1Svg',
118
+ 'centerArrowSvg',
119
+ 'spinSvg'
120
+ ],
121
+ [ // 4
122
+ 'centerBackground1Svg',
123
+ 'spinSvg',
124
+ 'centerArrowBgSvg',
125
+ 'centerCircleSvg',
126
+ ],
127
+ [ // 5
128
+ 'centerBackground1Svg',
129
+ 'spinSvg',
130
+ 'centerArrowBgSvg',
131
+ 'centerCircleSvg',
132
+ ]
133
+ ]
134
+
135
+ export const themedCenterImagesUpdater = (ratio, fn, offset?) =>
136
+ themedImagesUpdater(
137
+ centerImages,
138
+ centerImagesData,
139
+ centerImagesConfig,
140
+ ratio, fn, offset
141
+ )
@@ -0,0 +1,51 @@
1
+
2
+ // @ts-ignore
3
+ import pointerArrowSvg from './images/pointerArrow.svg'
4
+ // @ts-ignore
5
+ import pointerArrow3Svg from './images/pointerArrow3.svg'
6
+ import { themedImagesUpdater } from './themes.image.base'
7
+
8
+ export const pointerImages = {
9
+ pointerArrowSvg,
10
+ pointerArrow3Svg,
11
+ }
12
+
13
+ export const pointerImagesData = {
14
+ pointerArrowSvg: {
15
+ props: {
16
+ width: 60 / 2,
17
+ height: 60 / 2
18
+ },
19
+ },
20
+ pointerArrow3Svg: {
21
+ props: {
22
+ width: 2.8 * 32 / 2,
23
+ height: 2.8 * 48 / 2
24
+ },
25
+ }
26
+ }
27
+
28
+ export const pointerImagesConfig = [
29
+ [ // 0
30
+ ],
31
+ [ // 1
32
+ 'pointerArrowSvg',
33
+ ],
34
+ [ // 2
35
+ 'pointerArrow3Svg',
36
+ ],
37
+ [ // 3
38
+ ],
39
+ [ // 4
40
+ ],
41
+ [ // 5
42
+ ]
43
+ ]
44
+
45
+ export const themedPointerImagesUpdater = (ratio, fn, offset?) =>
46
+ themedImagesUpdater(
47
+ pointerImages,
48
+ pointerImagesData,
49
+ pointerImagesConfig,
50
+ ratio, fn, offset
51
+ )
@@ -1,3 +1,22 @@
1
+ export const partitionStrokeSteps = [
2
+ {
3
+ offset: "0",
4
+ color: "#F28F00",
5
+ },
6
+ {
7
+ offset: "0.27",
8
+ color: "#F5A318",
9
+ },
10
+ {
11
+ offset: "0.85",
12
+ color: "#FCD755",
13
+ },
14
+ {
15
+ offset: "1",
16
+ color: "#FFE767",
17
+ },
18
+ ]
19
+
1
20
  export const partitions1 = {
2
21
  colorSchema: [
3
22
  [
package/src/themes.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { partitions1, partitions2, partitions3 } from "./themes.partitions"
2
+ import { PointerMode } from "./types"
2
3
 
3
4
  const sizeSchema1 = {
4
5
  radius : 247,
@@ -177,30 +178,36 @@ export const themes = [
177
178
  size: sizeSchema1,
178
179
  background: backgroundSchema1,
179
180
  partitions: partitions1,
181
+ pointerMode: PointerMode.Partition,
180
182
  },
181
183
  {
182
184
  size: sizeSchema2,
183
185
  background: backgroundSchema2,
184
186
  partitions: partitions1,
187
+ pointerMode: PointerMode.Arrow,
185
188
  },
186
189
  {
187
190
  size: sizeSchema1,
188
191
  background: backgroundSchema3,
189
192
  partitions: partitions2,
193
+ pointerMode: PointerMode.Arrow,
190
194
  },
191
195
  {
192
196
  size: sizeSchema1,
193
197
  background: backgroundSchema1,
194
198
  partitions: partitions3,
199
+ pointerMode: PointerMode.Partition,
195
200
  },
196
201
  {
197
202
  size: sizeSchema1,
198
203
  background: backgroundSchema1,
199
204
  partitions: partitions3,
205
+ pointerMode: PointerMode.Arrow,
200
206
  },
201
207
  {
202
208
  size: sizeSchema2,
203
209
  background: backgroundSchema2,
204
210
  partitions: partitions3,
211
+ pointerMode: PointerMode.Arrow,
205
212
  },
206
213
  ]
@@ -0,0 +1,52 @@
1
+ export const translations = {
2
+ en: {
3
+ wof: {
4
+ NoContent: `You don't have any lottery programs available now.`,
5
+ NoNext: `You don't have any spins available. Please check T&C`,
6
+ NoHistories: `No histories`,
7
+ Program: `Program`,
8
+ History: `History`,
9
+ ActiveTickets: `Active Tickets`,
10
+ ImplicitTickets: `Implicit Tickets`,
11
+ RemainingTimes: `Remaining Times`,
12
+ ShowNext: `The Wheel will be available on <strong>{startTime}</strong>. please wait till it is open.`,
13
+ SpinFaild: `We are sorry that you don't have any Wheels available, please <strong>check T&C</strong> here to get a chance!`,
14
+ Congratulation: `Congratulations! You won a prize!`,
15
+ OK: `OK`,
16
+ Rewards: `Rewards`,
17
+ Status: `Status`,
18
+ Time: `Time`,
19
+ Loss: `OOPs! You are close to a prize!`,
20
+ }
21
+ },
22
+ zh: {
23
+ wof: {
24
+
25
+ }
26
+ },
27
+ fr: {
28
+ wof: {
29
+
30
+ }
31
+ },
32
+ ro: {
33
+ wof: {
34
+
35
+ }
36
+ },
37
+ es: {
38
+ wof: {
39
+
40
+ }
41
+ },
42
+ pt: {
43
+ wof: {
44
+
45
+ }
46
+ },
47
+ de: {
48
+ wof: {
49
+
50
+ }
51
+ }
52
+ };
package/src/calc.image.ts DELETED
@@ -1,13 +0,0 @@
1
-
2
- interface ImageSize {
3
- width: number
4
- height: number
5
- }
6
-
7
- export const renderSvgImageProps = (center: number, href: string, size: ImageSize, offset = {x: 0, y: 0}) => ({
8
- x: center - size.width / 2 - offset.x,
9
- y: center - size.height / 2 - offset.y,
10
- width: size.width,
11
- height: size.height,
12
- href,
13
- })