@everymatrix/casino-tournaments-limited-controller 1.0.15 → 1.0.69

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/src/message.js DELETED
@@ -1,97 +0,0 @@
1
- import { onMount } from 'svelte'
2
- import { EventSourcePolyfill } from 'event-source-polyfill';
3
-
4
- export const _postMessage = (message) => window.postMessage(message, window.location.href);
5
- export const postMessageTabTotalUpdate = (state, total) => {
6
- _postMessage({
7
- type: 'TournamentsTabTotalUpdate',
8
- state, total
9
- })
10
- }
11
-
12
- export const postMessageTabLocaleTextUpdate = (state, text) => {
13
- _postMessage({
14
- type: 'TournamentsTabLocaleTextUpdate',
15
- state, text
16
- })
17
- }
18
-
19
- const composeMessageHandler = (listeners) => {
20
- const handler = e => {
21
- Object.keys(listeners).map(key => {
22
- if (e.data && e.data.type == key) {
23
- const {type, ...restData} = e.data
24
- listeners[key](restData)
25
- }
26
- })
27
- }
28
-
29
- return handler
30
- }
31
-
32
- export const onMountMessageLifeCycle = (messageRegisters) => {
33
-
34
- const messageHandler = composeMessageHandler(messageRegisters)
35
-
36
- onMount(() => {
37
- window.addEventListener('message', messageHandler);
38
- return () => {
39
- window.removeEventListener('message', messageHandler);
40
- }
41
- })
42
- }
43
-
44
- export const createEventSource = (url, session = null) => {
45
- let headers = {
46
- 'accept': 'text/event-stream',
47
- }
48
-
49
- if(session){
50
- headers['X-SessionID'] = session
51
- }
52
-
53
- return new EventSourcePolyfill(url, { headers });
54
- }
55
-
56
- export const updateEventSourceLifeCycle = (eventSource, newEventSource, eventSourceHandler) => {
57
-
58
- if(eventSource){
59
- eventSource.removeEventListener('message', eventSourceHandler);
60
- eventSource.close();
61
- }
62
-
63
- let _eventSource = newEventSource
64
-
65
- if(typeof(_eventSource) != "undefined"){
66
- _eventSource.addEventListener('message', eventSourceHandler);
67
- }
68
-
69
- return _eventSource
70
- }
71
-
72
- export const composeEventSourceMessageHandler = (listeners) => {
73
-
74
- const handler = (message) => {
75
- let messageData = message.data;
76
-
77
- if(!messageData) return;
78
-
79
- try{
80
- let data = JSON.parse(messageData);
81
- if(!data) return;
82
-
83
- Object.keys(listeners).map(key => {
84
- if (data.messageType == key) {
85
- const {messageType, ...restData} = data
86
- console.log(messageType, restData);
87
- listeners[key](restData)
88
- }
89
- })
90
-
91
- }catch(err){
92
- console.error(err);
93
- }
94
- }
95
-
96
- return handler
97
- }
@@ -1,142 +0,0 @@
1
- export const translations = {
2
- en: {
3
- tournamentsLimitedController: {
4
- 500: '500 - Internal server error',
5
- Scheduled: 'Upcoming',
6
- Ongoing: 'Running',
7
- Finished: 'Closed',
8
- last: 'last',
9
- loading: 'Loading, please wait ...',
10
- noTournaments: 'No tournaments found',
11
- nothing: 'Nothing to show here.',
12
- name: 'Name',
13
- rank: 'Rank',
14
- enddate: 'End Date',
15
- prize: 'Prize',
16
- myTournaments: 'My Tournaments'
17
- }
18
- },
19
- zh: {
20
- tournamentsLimitedController: {
21
- 500: '500内部服务器错误',
22
- Scheduled: '即将到来',
23
- Ongoing: '跑步',
24
- Finished: '关闭',
25
- last: '最后的',
26
- loading: '加载请稍候 ...',
27
- noTournaments: '没有找到比赛',
28
- nothing: '这里没有什么可显示的。',
29
- name: '姓名',
30
- rank: '秩',
31
- enddate: '结束日期',
32
- prize: '奖',
33
- myTournaments: '我的锦标赛'
34
- }
35
- },
36
- fr: {
37
- tournamentsLimitedController: {
38
- 500: '500 - Erreur interne du serveur',
39
- Scheduled: 'A venir',
40
- Ongoing: 'Fonctionnement',
41
- Finished: 'Fermé',
42
- last: 'dernière',
43
- loading: 'Chargement, veuillez patienter ...',
44
- noTournaments: 'Aucun tournoi trouvé',
45
- nothing: 'Rien à montrer ici.',
46
- name: 'Nom',
47
- rank: 'Rang',
48
- enddate: 'Date de fin',
49
- prize: 'Prix',
50
- myTournaments: 'Mes tournois'
51
- }
52
- },
53
- ro: {
54
- tournamentsLimitedController: {
55
- 500: '500 - Eroare internă de server',
56
- Scheduled: 'Urmează',
57
- Ongoing: 'Rulează',
58
- Finished: 'Închis',
59
- last: 'ultimul',
60
- loading: 'Se încarcă...',
61
- noTournaments: 'Niciun turneu',
62
- nothing: 'Niciun turneu disponibil aici',
63
- name: 'Nume',
64
- rank: 'Poziție',
65
- enddate: 'Data finalizării',
66
- prize: 'Premiu',
67
- myTournaments: 'Turneele Mele',
68
- }
69
- },
70
- tr: {
71
- tournamentsLimitedController: {
72
- 500: '500 - Dahili sunucu hatası',
73
- showMore: 'Daha fazla',
74
- Scheduled: 'Planlanmış',
75
- Ongoing: 'Devam Eden',
76
- Finished: 'Sona Ermiş',
77
- last: 'geçen',
78
- loading: 'Yükelniyor, lütfen bekleyin ...',
79
- noTournaments: 'Herhangi bir turnuva bulunamadı.',
80
- nothing: 'Gösterilecek.',
81
- prizes: 'Ödüller',
82
- name: 'İsim',
83
- rank: 'Sıra',
84
- enddate: 'Bitiş tarihi',
85
- prize: 'Ödül',
86
- myTournaments: 'Turnuvalarım',
87
- }
88
- },
89
- el: {
90
- tournamentsLimitedController: {
91
- 500: '500 - Σφάλμα Διακομιστή',
92
- showMore: 'Περισσότερα',
93
- Scheduled: 'Προγραμματισμένα',
94
- Ongoing: 'Τρέχοντα',
95
- Finished: 'Ολοκληρωμένα',
96
- last: 'τελευταίος',
97
- loading: 'Φορτώνει, παρακαλούμε περιμένετε ...',
98
- noTournaments: 'Δεν βρέθηκαν τουρνουά',
99
- nothing: 'Δεν υπάρχει τίποτα εδώ.',
100
- prizes: 'Έπαθλα',
101
- name: 'Ονομα',
102
- rank: 'Τάξη',
103
- enddate: 'Ημερομηνία λήξης',
104
- prize: 'Βραβείο',
105
- myTournaments: 'Τα τουρνουά μου'
106
- }
107
- },
108
- es: {
109
- tournamentsLimitedController: {
110
- 500: '500 - Error interno del servidor',
111
- Scheduled: 'Próximamente',
112
- Ongoing: 'Ejecutar',
113
- Finished: 'Cerrado',
114
- last: 'último',
115
- loading: 'cargando, por favor espere…',
116
- noTournaments: 'No se han encontrado torneos',
117
- nothing: 'Nada que mostrar aquí.',
118
- name: 'Nombre',
119
- rank: 'Rango',
120
- enddate: 'Fecha de finalización',
121
- prize: 'Premio',
122
- myTournaments: 'Mis Torneos',
123
- }
124
- },
125
- hu: {
126
- tournamentsLimitedController: {
127
- 500: '500 - Belső szerver hiba',
128
- Scheduled: 'Közelgő',
129
- Ongoing: 'Jelenleg folyó',
130
- Finished: 'Lezárt',
131
- last: 'Legutóbbi',
132
- loading: 'Betöltés, kérjük várjon...',
133
- noTournaments: 'Verseny nem található',
134
- nothing: 'Nincs megjelenítendő adat.',
135
- name: 'Név',
136
- rank: 'rangsor',
137
- enddate: 'Befejezés dátuma',
138
- prize: 'Díj',
139
- myTournaments: 'Versenyeim',
140
- }
141
- },
142
- };
package/src/util.js DELETED
@@ -1,61 +0,0 @@
1
- import { isMobile as isMobileCheck, getDevice } from 'rvhelper'
2
-
3
- const { userAgent } = window.navigator
4
-
5
- export const isMobile = isMobileCheck(window.navigator.userAgent)
6
- export const platform = getDevice(userAgent)
7
-
8
- export const convertParamsFromObjectToString = (object) => {
9
-
10
- let _array = []
11
-
12
- Object.keys(object).map(key => {
13
- _array.push(`${key}=${object[key]}`)
14
- })
15
-
16
- return encodeURI(_array.join('&'))
17
- }
18
-
19
- export const optionsComposed = (session) => {
20
-
21
- let reqHeaders = new Headers();
22
-
23
- reqHeaders.append('platform', platform);
24
- reqHeaders.append("X-SessionID", session);
25
-
26
- return {
27
- method: 'GET',
28
- headers: reqHeaders,
29
- cache: 'no-cache'
30
- };
31
-
32
- }
33
-
34
- export const _fetch = async (url, options) => {
35
- let res
36
- try{
37
- res = await fetch(url.toString(), options)
38
- res = await res.json()
39
- return res
40
- } catch(e) {
41
- console.error(e)
42
- }
43
- }
44
-
45
- export const matchStatusFromViewToApi = (status) => {
46
- switch(status){
47
- case 'Scheduled': return 'Unstarted';
48
- case 'Ongoing': return 'Running';
49
- case 'Finished': return 'Closing|Closed';
50
- default: console.error('matching status failed')
51
- }
52
- }
53
- export const matchStatusFromApiToView = (status) => {
54
- switch(status){
55
- case 'Unstarted': return 'Scheduled';
56
- case 'Running': return 'Ongoing';
57
- case 'Closing': return 'Finished';
58
- case 'Closed': return 'Finished';
59
- default: console.error('matching status failed')
60
- }
61
- }
@@ -1,13 +0,0 @@
1
- import { html } from 'lit-element';
2
-
3
- import CasinoTournamentsLimitedController from '../src/CasinoTournamentsLimitedController';
4
-
5
- // This default export determines where your story goes in the story list
6
- export default {
7
- title: 'CasinoTournamentsLimitedController',
8
- };
9
-
10
- // 👇 We create a “template” of how args map to rendering
11
- const CasinoTournamentsLimitedController = ({ aProperty }) => html`<casino-tournaments-limited-controller></casino-tournaments-limited-controller>`;
12
-
13
- export const FirstStory = CasinoTournamentsLimitedController.bind({});
package/tsconfig.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "extends": "@tsconfig/svelte/tsconfig.json",
3
-
4
- "include": ["src/**/*"],
5
- "exclude": ["node_modules/*", "__sapper__/*", "public/*"]
6
- }