@everymatrix/lottery-hakuna-ticket-history-item 0.0.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.
Files changed (57) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-99904d3f.js +1310 -0
  3. package/dist/cjs/index.cjs.js +10 -0
  4. package/dist/cjs/loader.cjs.js +15 -0
  5. package/dist/cjs/lottery-button_5.cjs.entry.js +900 -0
  6. package/dist/cjs/lottery-hakuna-ticket-history-item-6b877fa8.js +195 -0
  7. package/dist/cjs/lottery-hakuna-ticket-history-item.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +37 -0
  9. package/dist/collection/components/lottery-hakuna-ticket-history-item/index.js +1 -0
  10. package/dist/collection/components/lottery-hakuna-ticket-history-item/lottery-hakuna-ticket-history-item.css +91 -0
  11. package/dist/collection/components/lottery-hakuna-ticket-history-item/lottery-hakuna-ticket-history-item.js +315 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/locale.utils.js +39 -0
  14. package/dist/collection/utils/utils.js +3 -0
  15. package/dist/esm/app-globals-0f993ce5.js +3 -0
  16. package/dist/esm/index-09b72148.js +1282 -0
  17. package/dist/esm/index.js +2 -0
  18. package/dist/esm/loader.js +11 -0
  19. package/dist/esm/lottery-button_5.entry.js +893 -0
  20. package/dist/esm/lottery-hakuna-ticket-history-item-785a2e3d.js +190 -0
  21. package/dist/esm/lottery-hakuna-ticket-history-item.js +20 -0
  22. package/dist/index.cjs.js +1 -0
  23. package/dist/index.js +1 -0
  24. package/dist/lottery-hakuna-ticket-history-item/app-globals-0f993ce5.js +1 -0
  25. package/dist/lottery-hakuna-ticket-history-item/index-09b72148.js +2 -0
  26. package/dist/lottery-hakuna-ticket-history-item/index.esm.js +1 -0
  27. package/dist/lottery-hakuna-ticket-history-item/lottery-button_5.entry.js +1 -0
  28. package/dist/lottery-hakuna-ticket-history-item/lottery-hakuna-ticket-history-item-785a2e3d.js +1 -0
  29. package/dist/lottery-hakuna-ticket-history-item/lottery-hakuna-ticket-history-item.esm.js +1 -0
  30. package/dist/stencil.config.dev.js +19 -0
  31. package/dist/stencil.config.js +19 -0
  32. package/dist/storybook/main.js +43 -0
  33. package/dist/storybook/preview.js +9 -0
  34. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  35. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/packages/stencil/lottery-hakuna-ticket-history-item/stencil.config.d.ts +2 -0
  36. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/packages/stencil/lottery-hakuna-ticket-history-item/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/packages/stencil/lottery-hakuna-ticket-history-item/storybook/main.d.ts +3 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/packages/stencil/lottery-hakuna-ticket-history-item/storybook/preview.d.ts +70 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/tools/plugins/index.d.ts +4 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-hakuna-ticket-history-item/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  44. package/dist/types/components/lottery-hakuna-ticket-history-item/index.d.ts +1 -0
  45. package/dist/types/components/lottery-hakuna-ticket-history-item/lottery-hakuna-ticket-history-item.d.ts +61 -0
  46. package/dist/types/components.d.ts +133 -0
  47. package/dist/types/index.d.ts +1 -0
  48. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  49. package/dist/types/utils/locale.utils.d.ts +3 -0
  50. package/dist/types/utils/utils.d.ts +1 -0
  51. package/loader/cdn.js +1 -0
  52. package/loader/index.cjs.js +1 -0
  53. package/loader/index.d.ts +24 -0
  54. package/loader/index.es2017.js +1 -0
  55. package/loader/index.js +2 -0
  56. package/loader/package.json +11 -0
  57. package/package.json +27 -0
@@ -0,0 +1,315 @@
1
+ import { h } from "@stencil/core";
2
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
3
+ import "../../../../../lottery-selection-group/dist/types/index";
4
+ import { resolveTranslationUrl, translate } from "../../utils/locale.utils";
5
+ export class LotteryHakunaTicketHistoryItem {
6
+ constructor() {
7
+ this.selectionGroupStyle = `
8
+ :host{
9
+ --lottery-selection-width: 24px;
10
+ --lottery-selection-height: 24px;
11
+ --lottery-selection-padding: 10px;
12
+ --lottery-selection-border-radius: 6px;
13
+ --lottery-selection-border-width: 1px;
14
+ --lottery-selection-border-color: #C51917;
15
+
16
+ --lottery-selection-color: #fff;
17
+ --lottery-selection-font-size: 14px;
18
+ --lottery-selection-font-weight: 500;
19
+
20
+ --lottery-selection-hover-background: transparent;
21
+ --lottery-selection-hover-border-color: #C51917;
22
+ --lottery-selection-hover-color: #fff;
23
+
24
+ .lottery-selection__button{
25
+ box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.15);
26
+ line-height: normal;
27
+ }
28
+ .lottery-selection__button:hover{
29
+ cursor: default;
30
+ }
31
+ --lottery-selection-group-item-gap:6px;
32
+ }
33
+ `;
34
+ this.mbSource = undefined;
35
+ this.clientStyling = undefined;
36
+ this.clientStylingUrl = undefined;
37
+ this.language = 'en';
38
+ this.translationUrl = '';
39
+ this.historyItemName = undefined;
40
+ this.historyItemImageSrc = undefined;
41
+ this.ticketId = undefined;
42
+ this.totalAmount = undefined;
43
+ this.drawDate = undefined;
44
+ this.drawTime = undefined;
45
+ this.selectedNumbers = undefined;
46
+ }
47
+ handleClientStylingChange(newValue, oldValue) {
48
+ if (newValue != oldValue) {
49
+ setClientStyling(this.stylingContainer, this.clientStyling);
50
+ }
51
+ }
52
+ handleClientStylingUrlChange(newValue, oldValue) {
53
+ if (newValue != oldValue) {
54
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
55
+ }
56
+ }
57
+ handleMbSourceChange(newValue, oldValue) {
58
+ if (newValue != oldValue) {
59
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
60
+ }
61
+ }
62
+ async componentWillLoad() {
63
+ resolveTranslationUrl(this.translationUrl);
64
+ }
65
+ componentDidLoad() {
66
+ if (this.stylingContainer) {
67
+ if (this.mbSource)
68
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
69
+ if (this.clientStyling)
70
+ setClientStyling(this.stylingContainer, this.clientStyling);
71
+ if (this.clientStylingUrl)
72
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
73
+ }
74
+ }
75
+ disconnectedCallback() {
76
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
77
+ }
78
+ render() {
79
+ return (h("div", { key: 'a740a3e2d88502ee4009369b8e04810ca21b0315', class: "lottery-hakuna-ticket-history-item__container", ref: (el) => (this.stylingContainer = el) }, h("div", { key: '5488e10c6768d617f73b9675c1ede5c9b1f56640', class: "lottery-hakuna-ticket-history-item__top" }, h("div", { key: 'e4ac3e621a805a1d0b1a531ce70bc7709299e0d0', class: "lottery-hakuna-ticket-history-item__country-wrapper" }, this.historyItemName && (h("img", { key: '8e189b80aefc6d4fdbe25786eb0262852d1cc156', src: this.historyItemImageSrc, alt: this.historyItemName, class: "lottery-hakuna-ticket-history-item__country-flag" })), h("span", { key: '1d860a451d56729e3a9e6bdc64fc2d094e1e54b0', class: "lottery-hakuna-ticket-history-item__country-name" }, this.historyItemName)), h("div", { key: '02772a834c453ceed1c68012acadd3c8041c40ff', class: "lottery-hakuna-ticket-history-item__details" }, h("span", { key: 'c4f6c8b94a95a45d1d6e4c055fe965835040876d', class: "lottery-hakuna-ticket-history-item__meta" }, translate('total', this.language), " ", h("span", { key: '1c88238ed18c0b8babe12d76775b1ac935dacb3f', class: "lottery-hakuna-ticket-history-item__meta-value" }, this.totalAmount)))), h("div", { key: 'd2385c18c6b6b252a2346d703bab06537a97a20f', class: "lottery-hakuna-ticket-history-item__bottom" }, h("div", { key: 'f30447836f082f499a81e74d833f65549e09cb8d', class: "lottery-hakuna-ticket-history-item__numbers-wrapper" }, this.selectedNumbers && (h("lottery-selection-group", { key: '87fc3bb9ab5568323b03c418156b1f1e1d08b016', type: "preview", bulletTexts: this.selectedNumbers, clientStyling: this.selectionGroupStyle + (this.clientStyling || ''), clientStylingUrl: this.clientStylingUrl, mbSource: this.mbSource, hasBorder: true, hasBackground: false, selectionGroupId: this.ticketId ? this.ticketId.toString() : undefined }))), h("div", { key: '4696416810b6bbf569ac9b63594dd8a56a7df4c2', class: "lottery-hakuna-ticket-history-item__date-wrapper" }, this.drawDate && h("div", { key: 'c9e64166205a1183bc6487c597dd7ae05a9d2604' }, this.drawDate), this.drawTime && h("div", { key: '5d6cea8b4e0c53d405ebaebf253aafe779b7ef8a' }, this.drawTime)))));
80
+ }
81
+ static get is() { return "lottery-hakuna-ticket-history-item"; }
82
+ static get encapsulation() { return "shadow"; }
83
+ static get originalStyleUrls() {
84
+ return {
85
+ "$": ["lottery-hakuna-ticket-history-item.scss"]
86
+ };
87
+ }
88
+ static get styleUrls() {
89
+ return {
90
+ "$": ["lottery-hakuna-ticket-history-item.css"]
91
+ };
92
+ }
93
+ static get properties() {
94
+ return {
95
+ "mbSource": {
96
+ "type": "string",
97
+ "mutable": false,
98
+ "complexType": {
99
+ "original": "string",
100
+ "resolved": "string",
101
+ "references": {}
102
+ },
103
+ "required": false,
104
+ "optional": false,
105
+ "docs": {
106
+ "tags": [],
107
+ "text": "The source for stream styling via a service."
108
+ },
109
+ "attribute": "mb-source",
110
+ "reflect": true
111
+ },
112
+ "clientStyling": {
113
+ "type": "string",
114
+ "mutable": false,
115
+ "complexType": {
116
+ "original": "string",
117
+ "resolved": "string",
118
+ "references": {}
119
+ },
120
+ "required": false,
121
+ "optional": false,
122
+ "docs": {
123
+ "tags": [],
124
+ "text": "Custom CSS styles to apply to the component."
125
+ },
126
+ "attribute": "client-styling",
127
+ "reflect": true
128
+ },
129
+ "clientStylingUrl": {
130
+ "type": "string",
131
+ "mutable": false,
132
+ "complexType": {
133
+ "original": "string",
134
+ "resolved": "string",
135
+ "references": {}
136
+ },
137
+ "required": false,
138
+ "optional": false,
139
+ "docs": {
140
+ "tags": [],
141
+ "text": "URL to a custom CSS file for additional styling."
142
+ },
143
+ "attribute": "client-styling-url",
144
+ "reflect": true
145
+ },
146
+ "language": {
147
+ "type": "string",
148
+ "mutable": false,
149
+ "complexType": {
150
+ "original": "string",
151
+ "resolved": "string",
152
+ "references": {}
153
+ },
154
+ "required": false,
155
+ "optional": false,
156
+ "docs": {
157
+ "tags": [],
158
+ "text": "The language code to use for translations. Defaults to 'en'."
159
+ },
160
+ "attribute": "language",
161
+ "reflect": true,
162
+ "defaultValue": "'en'"
163
+ },
164
+ "translationUrl": {
165
+ "type": "string",
166
+ "mutable": false,
167
+ "complexType": {
168
+ "original": "string",
169
+ "resolved": "string",
170
+ "references": {}
171
+ },
172
+ "required": false,
173
+ "optional": false,
174
+ "docs": {
175
+ "tags": [],
176
+ "text": "URL to fetch custom translation data from."
177
+ },
178
+ "attribute": "translation-url",
179
+ "reflect": true,
180
+ "defaultValue": "''"
181
+ },
182
+ "historyItemName": {
183
+ "type": "string",
184
+ "mutable": false,
185
+ "complexType": {
186
+ "original": "string",
187
+ "resolved": "string",
188
+ "references": {}
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": "The name of the country to display."
195
+ },
196
+ "attribute": "history-item-name",
197
+ "reflect": false
198
+ },
199
+ "historyItemImageSrc": {
200
+ "type": "string",
201
+ "mutable": false,
202
+ "complexType": {
203
+ "original": "string",
204
+ "resolved": "string",
205
+ "references": {}
206
+ },
207
+ "required": false,
208
+ "optional": false,
209
+ "docs": {
210
+ "tags": [],
211
+ "text": "The URL of the country flag image."
212
+ },
213
+ "attribute": "history-item-image-src",
214
+ "reflect": false
215
+ },
216
+ "ticketId": {
217
+ "type": "any",
218
+ "mutable": false,
219
+ "complexType": {
220
+ "original": "string | number",
221
+ "resolved": "number | string",
222
+ "references": {}
223
+ },
224
+ "required": false,
225
+ "optional": false,
226
+ "docs": {
227
+ "tags": [],
228
+ "text": "The unique identifier for the ticket."
229
+ },
230
+ "attribute": "ticket-id",
231
+ "reflect": false
232
+ },
233
+ "totalAmount": {
234
+ "type": "string",
235
+ "mutable": false,
236
+ "complexType": {
237
+ "original": "string",
238
+ "resolved": "string",
239
+ "references": {}
240
+ },
241
+ "required": false,
242
+ "optional": false,
243
+ "docs": {
244
+ "tags": [],
245
+ "text": "The total amount of the ticket with currency."
246
+ },
247
+ "attribute": "total-amount",
248
+ "reflect": false
249
+ },
250
+ "drawDate": {
251
+ "type": "string",
252
+ "mutable": false,
253
+ "complexType": {
254
+ "original": "string",
255
+ "resolved": "string",
256
+ "references": {}
257
+ },
258
+ "required": false,
259
+ "optional": false,
260
+ "docs": {
261
+ "tags": [],
262
+ "text": "The date of the draw."
263
+ },
264
+ "attribute": "draw-date",
265
+ "reflect": false
266
+ },
267
+ "drawTime": {
268
+ "type": "string",
269
+ "mutable": false,
270
+ "complexType": {
271
+ "original": "string",
272
+ "resolved": "string",
273
+ "references": {}
274
+ },
275
+ "required": false,
276
+ "optional": false,
277
+ "docs": {
278
+ "tags": [],
279
+ "text": "The time of the draw."
280
+ },
281
+ "attribute": "draw-time",
282
+ "reflect": false
283
+ },
284
+ "selectedNumbers": {
285
+ "type": "string",
286
+ "mutable": false,
287
+ "complexType": {
288
+ "original": "string",
289
+ "resolved": "string",
290
+ "references": {}
291
+ },
292
+ "required": false,
293
+ "optional": false,
294
+ "docs": {
295
+ "tags": [],
296
+ "text": "A comma-separated string of selected numbers. e.g. \"3,6,24,36,42,45\"."
297
+ },
298
+ "attribute": "selected-numbers",
299
+ "reflect": false
300
+ }
301
+ };
302
+ }
303
+ static get watchers() {
304
+ return [{
305
+ "propName": "clientStyling",
306
+ "methodName": "handleClientStylingChange"
307
+ }, {
308
+ "propName": "clientStylingUrl",
309
+ "methodName": "handleClientStylingUrlChange"
310
+ }, {
311
+ "propName": "mbSource",
312
+ "methodName": "handleMbSourceChange"
313
+ }];
314
+ }
315
+ }
@@ -0,0 +1 @@
1
+ export * from './components/lottery-hakuna-ticket-history-item';
@@ -0,0 +1,39 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
3
+ const TRANSLATIONS = {
4
+ en: {
5
+ total: 'Total:',
6
+ },
7
+ };
8
+ export const translate = (key, customLang, replacements) => {
9
+ const lang = customLang;
10
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
11
+ if (replacements) {
12
+ Object.keys(replacements).forEach((placeholder) => {
13
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
14
+ });
15
+ }
16
+ return translation;
17
+ };
18
+ export const getTranslations = (data) => {
19
+ Object.keys(data).forEach((item) => {
20
+ for (let key in data[item]) {
21
+ TRANSLATIONS[item][key] = data[item][key];
22
+ }
23
+ });
24
+ };
25
+ export const resolveTranslationUrl = async (translationUrl) => {
26
+ if (translationUrl) {
27
+ try {
28
+ const response = await fetch(translationUrl);
29
+ if (!response.ok) {
30
+ throw new Error(`HTTP error! status: ${response.status}`);
31
+ }
32
+ const translations = await response.json();
33
+ getTranslations(translations);
34
+ }
35
+ catch (error) {
36
+ console.error('Failed to fetch or parse translations from URL:', error);
37
+ }
38
+ }
39
+ };
@@ -0,0 +1,3 @@
1
+ export function format(first, middle, last) {
2
+ return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
3
+ }
@@ -0,0 +1,3 @@
1
+ const globalScripts = () => {};
2
+
3
+ export { globalScripts as g };