@everymatrix/casino-wagering-bonuses-controller 1.44.0 → 1.45.3

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/index.html DELETED
@@ -1,37 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset='utf-8'>
5
- <meta name='viewport' content='width=device-width,initial-scale=1'>
6
-
7
- <title>
8
- casino-wagering-bonuses-controller
9
- </title>
10
- <link rel="stylesheet" href="public/reset.css">
11
- <script src='dist/casino-wagering-bonuses-controller.js'></script>
12
- </head>
13
-
14
- <body>
15
- <style>
16
- html,body { margin: 0; padding: 0; height: 100%; font-family: "Helvetica Neue", "Helvetica", sans-serif; }
17
- .header { display: flex; justify-content: center; align-items: center; padding: 10px 20px; margin-bottom: 20px; background: #42a3e2; box-shadow: 3px 4px 5px 0px rgba(0,0,0, .2); }
18
- .header__logo svg { height: 50px; width: 50px; margin-right: 5px; }
19
- .header__name { color: #fff; }
20
- .header__name span { margin-right: 10px; font-weight: bold; }
21
- .webcomponent { padding: 10px 20px; }
22
- </style>
23
- <header class="header">
24
- <div class="header__logo">
25
- <svg xmlns="http://www.w3.org/2000/svg" width="161" height="132" viewBox="0 0 161 132"><defs><linearGradient x1="0%" y1="50%" y2="50%" id="a"><stop stop-color="#2A3B8F" offset="0%"/><stop stop-color="#29ABE2" offset="100%"/></linearGradient><linearGradient x1="100%" y1="50%" x2="0%" y2="50%" id="c"><stop stop-color="#B4D44E" offset="0%"/><stop stop-color="#E7F716" offset="100%"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><path fill="#166DA5" d="M160.6 65.9l-17.4 29.3-24.4-29.7 24.4-28.9z"/><path fill="#8FDB69" d="M141.3 100.2l-26.5-31.7-15.9 26.6 24.7 36.1z"/><path fill="#166DA5" d="M141 31.4l-26.2 31.8-15.9-26.6L123.6.9z"/><path fill="url(#a)" opacity=".95" d="M61.1 31.4H141L123.4.7H78.7z M114.8 63.3H159l-15.9-26.8H98.8"/><path fill="url(#c)" opacity=".95" d="M141.3 100.3H61l17.6 30.5h45z M114.8 68.4H159l-15.9 26.8H98.8"/><path fill="#010101" d="M78.6 130.8L41 65.8 79.1.8H37.9L.4 65.8l37.5 65z"/></g></svg>
26
- </div>
27
- <h1 class="header__name">
28
- <span>WEBCOMPONENT:</span> casino-wagering-bonuses-controller
29
- </h1>
30
- </header>
31
-
32
- <div class="webcomponent">
33
- <casino-wagering-bonuses-controller></casino-wagering-bonuses-controller>
34
- </div>
35
-
36
- </body>
37
- </html>
package/index.js DELETED
@@ -1 +0,0 @@
1
- import './dist/casino-wagering-bonuses-controller.js';
Binary file
package/public/reset.css DELETED
@@ -1,48 +0,0 @@
1
- /* http://meyerweb.com/eric/tools/css/reset/
2
- v2.0 | 20110126
3
- License: none (public domain)
4
- */
5
-
6
- html, body, div, span, applet, object, iframe,
7
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
- a, abbr, acronym, address, big, cite, code,
9
- del, dfn, em, img, ins, kbd, q, s, samp,
10
- small, strike, strong, sub, sup, tt, var,
11
- b, u, i, center,
12
- dl, dt, dd, ol, ul, li,
13
- fieldset, form, label, legend,
14
- table, caption, tbody, tfoot, thead, tr, th, td,
15
- article, aside, canvas, details, embed,
16
- figure, figcaption, footer, header, hgroup,
17
- menu, nav, output, ruby, section, summary,
18
- time, mark, audio, video {
19
- margin: 0;
20
- padding: 0;
21
- border: 0;
22
- font-size: 100%;
23
- font: inherit;
24
- vertical-align: baseline;
25
- }
26
- /* HTML5 display-role reset for older browsers */
27
- article, aside, details, figcaption, figure,
28
- footer, header, hgroup, menu, nav, section {
29
- display: block;
30
- }
31
- body {
32
- line-height: 1;
33
- }
34
- ol, ul {
35
- list-style: none;
36
- }
37
- blockquote, q {
38
- quotes: none;
39
- }
40
- blockquote:before, blockquote:after,
41
- q:before, q:after {
42
- content: '';
43
- content: none;
44
- }
45
- table {
46
- border-collapse: collapse;
47
- border-spacing: 0;
48
- }
package/rollup.config.js DELETED
@@ -1,64 +0,0 @@
1
- import svelte from 'rollup-plugin-svelte';
2
- import commonjs from '@rollup/plugin-commonjs';
3
- import resolve from '@rollup/plugin-node-resolve';
4
- import serve from 'rollup-plugin-dev-server';
5
- import livereload from 'rollup-plugin-livereload';
6
- import { terser } from 'rollup-plugin-terser';
7
- import sveltePreprocess from 'svelte-preprocess';
8
- import typescript from '@rollup/plugin-typescript';
9
- import image from '@rollup/plugin-image';
10
- const production = process.env.NODE_ENV === 'production';
11
- const dev = process.env.NODE_ENV === 'development';
12
-
13
- export default {
14
- input: 'src/index.ts',
15
- output: {
16
- sourcemap: true,
17
- format: 'umd',
18
- name: 'app',
19
- file: 'dist/casino-wagering-bonuses-controller.js'
20
- },
21
- plugins: [
22
- svelte({
23
- preprocess: sveltePreprocess(),
24
- compilerOptions: {
25
- // enable run-time checks when not in production
26
- customElement: true,
27
- dev: !production
28
- }
29
- }),
30
- image(),
31
- commonjs(),
32
- resolve({
33
- browser: true,
34
- dedupe: ['svelte']
35
- }),
36
- dev && serve({
37
- open: true,
38
- verbose: true,
39
- allowCrossOrigin: true,
40
- historyApiFallback: false,
41
- host: 'localhost',
42
- port: 5050,
43
- }),
44
- dev && livereload({ watch: ['', 'dist'] }),
45
- typescript({
46
- include: [
47
- "../casino-wagering-bonus/src/**/*.ts",
48
- ],
49
- sourceMap: !production,
50
- inlineSources: !production,
51
- }),
52
- // If we're building for production (npm run build
53
- // instead of npm run dev), minify
54
- production &&
55
- terser({
56
- output: {
57
- comments: "all"
58
- },
59
- })
60
- ],
61
- watch: {
62
- clearScreen: false
63
- }
64
- };
@@ -1,279 +0,0 @@
1
- <svelte:options tag={null} />
2
- <script lang="ts">
3
-
4
- import '@everymatrix/casino-wagering-bonus'
5
- import '@everymatrix/general-animation-loading'
6
-
7
- import { fetchApi, getRequestStatusByStatusFilter, setWageringEventSource } from '@everymatrix/casino-wagering-bonus/src/business'
8
- import {
9
- clearEventSource,
10
- composeEventSourceMessageHandler,
11
- onSvelteMountMessage,
12
- _postMessage
13
- } from '@everymatrix/casino-wagering-bonus/src/message'
14
- import type { TEventSource } from '@everymatrix/casino-wagering-bonus/src/message'
15
- import { Bonus, BonusStatus, BonusStatusFilterType, Lang } from '@everymatrix/casino-wagering-bonus/src/types'
16
- import { addNewMessages, setTranslations } from '@everymatrix/casino-wagering-bonus/src/svelte.i18n';
17
- import { TRANSLATIONS } from '@everymatrix/casino-wagering-bonus/src/translations';
18
- import { onMount } from 'svelte';
19
- import { classWithPart } from '@everymatrix/casino-wagering-bonus/src/util';
20
- import { infoParts } from '@everymatrix/casino-wagering-bonus/src/private.exportparts';
21
-
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';
25
-
26
- export let endpoint = ''
27
- export let lang = Lang.en
28
- export let session = ''
29
- export let currency: string = 'EUR';
30
- export let filter: BonusStatusFilterType = BonusStatusFilterType.claimable
31
- export let limit: string = ''
32
- export let sortorder: string = 'desc'
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
-
44
- let isMounted = false
45
- $: isMounted && init()
46
- onMount(() => {
47
- isMounted = true
48
- return () => {
49
- isMounted = false
50
- }
51
- })
52
-
53
- let bonuses: any[] = []
54
- let eventSource: TEventSource
55
- let bonusesProgress: any = {}
56
- let isLoading: boolean = true;
57
- let errorMessage: string = ''
58
- let abortController: AbortController
59
-
60
- setTranslations(TRANSLATIONS)
61
-
62
- const eventSourceHandler = composeEventSourceMessageHandler({
63
- "WageringProgressUpdate": (data: any) => {
64
- bonuses = bonuses.map(bonus => {
65
- let progresses = data?.items[bonus.bonusWalletID]
66
-
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
72
-
73
- let _bonus: any = {...bonus}
74
-
75
- _bonus = { ..._bonus, wageringProgress: {
76
- ..._bonus.wageringProgress,
77
- currentLevel: level,
78
- currentLevelIncrement: levelIncrement,
79
- gap,
80
- } }
81
-
82
- if(_status){
83
- _bonus = { ..._bonus, status: _status}
84
- setTimeout(() => init(), 500)
85
-
86
- if(_status !== filter){
87
- return null
88
- }
89
- }
90
-
91
- return _bonus
92
- }).filter(b => b)
93
- },
94
- })
95
-
96
- const initCore = async () => {
97
- abortController?.abort()
98
- abortController = new AbortController();
99
-
100
- const response: any = await fetchApi.list(abortController, endpoint, session, {
101
- lang,
102
- status: filter === 'claimable' ? 'claimable' : getRequestStatusByStatusFilter(filter),
103
- limit,
104
- sortOrder: sortorder || 'desc',
105
- })
106
-
107
- if(!response.success) {
108
- errorMessage = response.errorMessage
109
- }else{
110
- bonuses = (response.items || response.bonuses)
111
-
112
- clearEventSource(eventSource, eventSourceHandler)
113
- if(filter === BonusStatusFilterType.active){
114
- updateEventSource()
115
- }
116
- }
117
- }
118
-
119
- const updateEventSource = () => {
120
- clearEventSource(eventSource, eventSourceHandler)
121
- eventSource = setWageringEventSource(endpoint, session, bonuses, eventSourceHandler, bonusesProgress)
122
- eventSource.onerror = () => {
123
- updateEventSource()
124
- }
125
- }
126
-
127
- const init = async () => {
128
- if(!isMounted || !filter || !lang || !session || !endpoint) return;
129
-
130
- isLoading = true
131
- await initCore()
132
- isLoading = false
133
- }
134
-
135
- onSvelteMountMessage({
136
- 'OnWageringBonusClaimed': () => init(),
137
- 'OnWageringBonusExpired': () => init(),
138
- })
139
- onMount(() => () => clearEventSource(eventSource, eventSourceHandler))
140
-
141
- $: endpoint && init()
142
- $: lang && init()
143
- $: session && init()
144
- $: sortorder && init()
145
-
146
- let innerWidth
147
- $: isMobileView = innerWidth <= 648
148
-
149
- $: classWithPartMatchMobile = (partAndClass) =>
150
- classWithPart(`${partAndClass}${isMobileView ? ` ${partAndClass}Mobile` : ''}`)
151
-
152
- $: locale = (key, values = {}) => $_('wageringBonuses.' + key, {values})
153
- </script>
154
-
155
- <div bind:this={customStylingContainer} bind:clientWidth={innerWidth} {...classWithPartMatchMobile(`Root`)}>
156
- <section {...classWithPartMatchMobile(`WageringTabs`)}>
157
- {#each Object.values(BonusStatusFilterType) as statusFilter}
158
- <div
159
- {...classWithPartMatchMobile(`WageringTab`)}
160
- class:active={filter === statusFilter}
161
- on:click={() => {
162
- if(filter === statusFilter) return;
163
- filter = statusFilter
164
- init()
165
- }}
166
- >
167
- {locale(statusFilter)}
168
- </div>
169
- {/each}
170
- </section>
171
-
172
- <div>
173
- {#if isLoading}
174
- <general-animation-loading />
175
- {:else}
176
- <div {...classWithPartMatchMobile(`Bonuses`)}>
177
- {#if bonuses.length > 0}
178
- {#each bonuses as item}
179
- <casino-wagering-bonus {...{
180
- endpoint,
181
- session,
182
- lang,
183
- currency,
184
- rawbonus: JSON.stringify(item),
185
- exportparts: infoParts([
186
- { key: 'ExpiryTime'},
187
- { key: 'Status'},
188
- { key: 'Levels'},
189
- ])
190
- }} />
191
- {/each}
192
- {:else}
193
- {#if errorMessage}
194
- <div class="Error">Error: {errorMessage}</div>
195
- {:else}
196
- {locale('noBonuses')}
197
- {/if}
198
- {/if}
199
- </div>
200
- {/if}
201
- </div>
202
-
203
- </div>
204
-
205
- <style lang="scss">
206
-
207
- *,
208
- *::before,
209
- *::after {
210
- margin: 0;
211
- padding: 0;
212
- list-style: none;
213
- text-decoration: none;
214
- outline: none;
215
- box-sizing: border-box;
216
- }
217
-
218
- casino-wagering-bonus::part(Root) {
219
- margin-bottom: 30px;
220
- }
221
-
222
- .Root {
223
- background: var(--emfe-w-color-white, #FFFFFF);
224
- padding: 20px;
225
- color: var(--emfe-w-color-black, #000000);
226
- }
227
-
228
- .Bonuses {
229
- display: flex;
230
- flex-wrap: wrap;
231
- justify-content: left;
232
- margin-top: 10px;
233
- column-gap: 10px;
234
- }
235
-
236
- .BonusesMobile {
237
- // justify-content:initial;
238
- & > casino-wagering-bonus {
239
- width: 100%;
240
- }
241
- }
242
-
243
- .WageringTabs {
244
- margin: 20px 0;
245
- font-size: 16px;
246
- }
247
-
248
- .WageringTab {
249
- display: inline;
250
- padding: 8px;
251
- cursor: pointer;
252
-
253
- color: #000000;
254
- border-bottom: 1px solid #00AEEF;
255
-
256
- &.active {
257
- color: #00AEEF;
258
- border-bottom-width: 3px;
259
- padding-bottom: 6px;
260
-
261
- font-weight: 700;
262
- }
263
-
264
- }
265
-
266
- .WageringTabsMobile {
267
- display: flex;
268
- justify-content: space-around;
269
- }
270
- .WageringTabMobile {
271
- width: 100%;
272
- text-align: center;
273
- }
274
-
275
- .Error {
276
- color: red;
277
- }
278
-
279
- </style>
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- import CasinoWageringBonusesController from './CasinoWageringBonusesController.svelte';
2
- // @ts-ignore
3
- !customElements.get('casino-wagering-bonuses-controller') && customElements.define('casino-wagering-bonuses-controller', CasinoWageringBonusesController);
4
- export default CasinoWageringBonusesController;
@@ -1,13 +0,0 @@
1
- import { html } from 'lit-element';
2
-
3
- import CasinoWageringBonusesController from '../src/CasinoWageringBonusesController';
4
-
5
- // This default export determines where your story goes in the story list
6
- export default {
7
- title: 'CasinoWageringBonusesController',
8
- };
9
-
10
- // 👇 We create a “template” of how args map to rendering
11
- const CasinoWageringBonusesController = ({ aProperty }) => html`<casino-wagering-bonuses-controller></casino-wagering-bonuses-controller>`;
12
-
13
- export const FirstStory = CasinoWageringBonusesController.bind({});
package/svelte.config.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- svelte: {
3
- "language-server": {
4
- runtime: `sass`
5
- }
6
- }
7
- }
package/tsconfig.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "@tsconfig/svelte/tsconfig.json",
3
-
4
- "include": [
5
- "src/**/*",
6
- "../casino-wagering-bonus/src/**/*"
7
- ],
8
- "exclude": ["node_modules/*", "__sapper__/*", "public/*"]
9
- }