@everymatrix/casino-wagering-bonuses-controller 1.30.0 → 1.31.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,11 +1,12 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-wagering-bonuses-controller",
3
- "version": "1.30.0",
3
+ "version": "1.31.0",
4
4
  "main": "dist/casino-wagering-bonuses-controller.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
7
7
  "start": "sirv public",
8
8
  "build": "cross-env NODE_ENV=production rollup -c",
9
+ "build:watch": "cross-env NODE_ENV=production rollup -c -w",
9
10
  "dev": "cross-env NODE_ENV=\"development\" rollup -c -w",
10
11
  "validate": "svelte-check",
11
12
  "test": "echo"
@@ -35,5 +36,5 @@
35
36
  "publishConfig": {
36
37
  "access": "public"
37
38
  },
38
- "gitHead": "b9795b320e7d96e10963f25cdea2d9300029d8d7"
39
+ "gitHead": "2cd63cac8a1345eb832337233e848d196c3d9a7b"
39
40
  }
@@ -13,13 +13,15 @@
13
13
  } from '@everymatrix/casino-wagering-bonus/src/message'
14
14
  import type { TEventSource } from '@everymatrix/casino-wagering-bonus/src/message'
15
15
  import { Bonus, BonusStatus, BonusStatusFilterType, Lang } from '@everymatrix/casino-wagering-bonus/src/types'
16
- import { setTranslations } from '@everymatrix/casino-wagering-bonus/src/svelte.i18n';
16
+ import { addNewMessages, setTranslations } from '@everymatrix/casino-wagering-bonus/src/svelte.i18n';
17
17
  import { TRANSLATIONS } from '@everymatrix/casino-wagering-bonus/src/translations';
18
18
  import { onMount } from 'svelte';
19
19
  import { classWithPart } from '@everymatrix/casino-wagering-bonus/src/util';
20
20
  import { infoParts } from '@everymatrix/casino-wagering-bonus/src/private.exportparts';
21
21
 
22
22
  import { _, setLocale } from '@everymatrix/casino-wagering-bonus/src/svelte.i18n';
23
+ import { findMaxIdSubset } from '@everymatrix/casino-wagering-bonus/src/api.apdater.util';
24
+ import { setClientStyling, setClientStylingURL, setTranslationUrl } from '@everymatrix/casino-wagering-bonus/src/util.custom';
23
25
 
24
26
  export let endpoint = ''
25
27
  export let lang = Lang.en
@@ -27,7 +29,18 @@
27
29
  export let currency: string = 'EUR';
28
30
  export let filter: BonusStatusFilterType = BonusStatusFilterType.claimable
29
31
  export let limit: string = ''
32
+ export let sortorder: string = 'desc'
30
33
 
34
+ export let clientstyling: string = ''
35
+ export let clientstylingurl: string = ''
36
+ export let translationurl: string = ''
37
+
38
+ let customStylingContainer: HTMLElement;
39
+
40
+ $: customStylingContainer && clientstyling && setClientStyling(customStylingContainer, clientstyling);
41
+ $: customStylingContainer && clientstylingurl && setClientStylingURL(customStylingContainer, clientstylingurl);
42
+ $: translationurl && setTranslationUrl(translationurl, addNewMessages);
43
+
31
44
  let isMounted = false
32
45
  $: isMounted && init()
33
46
  onMount(() => {
@@ -39,6 +52,7 @@
39
52
 
40
53
  let bonuses: any[] = []
41
54
  let eventSource: TEventSource
55
+ let bonusesProgress: any = {}
42
56
  let isLoading: boolean = true;
43
57
  let errorMessage: string = ''
44
58
  let abortController: AbortController
@@ -48,11 +62,14 @@
48
62
  const eventSourceHandler = composeEventSourceMessageHandler({
49
63
  "WageringProgressUpdate": (data: any) => {
50
64
  bonuses = bonuses.map(bonus => {
51
- let item = data?.items[bonus.bonusWalletID]
65
+ let progresses = data?.items[bonus.bonusWalletID]
52
66
 
53
- if(!item) return bonus
67
+ if(!progresses) return bonus
68
+
69
+ const { maxIdObj, maxId } = findMaxIdSubset(progresses)
70
+ let { status: _status, level, levelIncrement, gap } = maxIdObj
71
+ bonusesProgress[bonus.id] = maxId
54
72
 
55
- let { status: _status, level, levelIncrement, gap } = item
56
73
  let _bonus: any = {...bonus}
57
74
 
58
75
  _bonus = { ..._bonus, wageringProgress: {
@@ -84,6 +101,7 @@
84
101
  lang,
85
102
  status: filter === 'claimable' ? 'claimable' : getRequestStatusByStatusFilter(filter),
86
103
  limit,
104
+ sortOrder: sortorder || 'desc',
87
105
  })
88
106
 
89
107
  if(!response.success) {
@@ -93,10 +111,18 @@
93
111
 
94
112
  clearEventSource(eventSource, eventSourceHandler)
95
113
  if(filter === BonusStatusFilterType.active){
96
- eventSource = setWageringEventSource(endpoint, session, bonuses, eventSourceHandler)
114
+ updateEventSource()
97
115
  }
98
116
  }
99
117
  }
118
+
119
+ const updateEventSource = () => {
120
+ clearEventSource(eventSource, eventSourceHandler)
121
+ eventSource = setWageringEventSource(endpoint, session, bonuses, eventSourceHandler, bonusesProgress)
122
+ eventSource.onerror = () => {
123
+ updateEventSource()
124
+ }
125
+ }
100
126
 
101
127
  const init = async () => {
102
128
  if(!isMounted || !filter || !lang || !session || !endpoint) return;
@@ -115,6 +141,7 @@
115
141
  $: endpoint && init()
116
142
  $: lang && init()
117
143
  $: session && init()
144
+ $: sortorder && init()
118
145
 
119
146
  let innerWidth
120
147
  $: isMobileView = innerWidth <= 648
@@ -125,7 +152,7 @@
125
152
  $: locale = (key, values = {}) => $_('wageringBonuses.' + key, {values})
126
153
  </script>
127
154
 
128
- <div bind:clientWidth={innerWidth} {...classWithPartMatchMobile(`Root`)}>
155
+ <div bind:this={customStylingContainer} bind:clientWidth={innerWidth} {...classWithPartMatchMobile(`Root`)}>
129
156
  <section {...classWithPartMatchMobile(`WageringTabs`)}>
130
157
  {#each Object.values(BonusStatusFilterType) as statusFilter}
131
158
  <div
@@ -177,7 +204,6 @@
177
204
 
178
205
  <style lang="scss">
179
206
 
180
-
181
207
  *,
182
208
  *::before,
183
209
  *::after {
@@ -193,6 +219,12 @@
193
219
  margin-bottom: 30px;
194
220
  }
195
221
 
222
+ .Root {
223
+ background: var(--emfe-w-color-white, #FFFFFF);
224
+ padding: 20px;
225
+ color: var(--emfe-w-color-black, #000000);
226
+ }
227
+
196
228
  .Bonuses {
197
229
  display: flex;
198
230
  flex-wrap: wrap;