@everymatrix/lottery-game-details 0.0.3 → 0.1.4

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,167 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-9d95408f.js');
6
+
7
+ const DEFAULT_LANGUAGE = 'en';
8
+ const SUPPORTED_LANGUAGES = ['ro', 'en'];
9
+ const TRANSLATIONS = {
10
+ en: {
11
+ deleteTicket: 'Delete ticket'
12
+ },
13
+ ro: {
14
+ deleteTicket: 'Sterge biletul'
15
+ },
16
+ };
17
+ const translate = (key, customLang) => {
18
+ const lang = customLang;
19
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
20
+ };
21
+
22
+ const helperAccordionCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Header{border-radius:4px 4px 0 0;background:#009993;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none}.Header:hover{background:#00ABA4}.Header .Title,.Header .Subtitle,.Header .Description{margin:0;font-size:14px;color:#fff}.Header .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.HeaderTicketHistory{border-radius:4px;background:#F1F1F1;display:flex;gap:30px;border:1px solid #009993;padding:8px 10px;user-select:none;margin-bottom:5px}.HeaderTicketHistory:hover{background:#00ABA4}.HeaderTicketHistory .Title,.HeaderTicketHistory .Subtitle,.HeaderTicketHistory .Description{margin:0;font-size:14px;color:#000}.HeaderTicketHistory .Expand{margin-left:auto;color:#FFF;width:17px;height:17px;cursor:pointer;text-align:center;transform:rotate(90deg);font-size:20px;user-select:none}.Content{border-radius:0 0 4px 4px;background:#fff;border:1px solid #009993;padding:10px 15px;user-select:none;color:#000;margin-bottom:10px}.ActionButton{cursor:pointer;display:inline-block;border-radius:4px;margin:20px 0 10px;text-transform:uppercase;font-size:12px;text-align:center;padding:8px 20px;min-width:80px;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ActionButton:hover{background:#FF6536;border:1px solid #FF3D00}";
23
+
24
+ const Accordion = class {
25
+ constructor(hostRef) {
26
+ index.registerInstance(this, hostRef);
27
+ this.accordionEvent = index.createEvent(this, "helperAccordionAction", 7);
28
+ /**
29
+ * Flag for ticket history
30
+ */
31
+ this.ticketHistoryFlag = false;
32
+ /**
33
+ * Title (top header)
34
+ */
35
+ this.headerTitle = '';
36
+ /**
37
+ * SubTitle (top header)
38
+ */
39
+ this.headerSubtitle = '';
40
+ /**
41
+ * Description
42
+ */
43
+ this.description = '';
44
+ /**
45
+ * Enables footer content
46
+ */
47
+ this.footer = false;
48
+ /**
49
+ * Enables footer button for tab deletion
50
+ */
51
+ this.deleteTab = false;
52
+ /**
53
+ * Activates postMessages as events for actions from the widget
54
+ */
55
+ this.postMessage = false;
56
+ /**
57
+ * Name of the event emitter by the action button
58
+ */
59
+ this.eventName = 'helperAccordionAction';
60
+ /**
61
+ * Collapsed
62
+ */
63
+ this.collapsed = true;
64
+ /**
65
+ * Language
66
+ */
67
+ this.language = 'en';
68
+ }
69
+ // @TODO fix the `any` type :)
70
+ connectedCallback() {
71
+ this.showContent = !this.collapsed;
72
+ }
73
+ toggleContent() {
74
+ this.showContent = !this.showContent;
75
+ }
76
+ deleteAction() {
77
+ if (this.postMessage) {
78
+ // @TODO maybe change the name type, this one sucks
79
+ window.postMessage({ type: this.eventName }, window.location.href);
80
+ }
81
+ this.accordionEvent.emit();
82
+ }
83
+ render() {
84
+ return (index.h("div", { class: "Wrapper" }, index.h("div", { class: this.ticketHistoryFlag === true ? 'HeaderTicketHistory' : 'Header' }, index.h("p", { class: "Title" }, this.headerTitle), index.h("p", { class: "Subtitle" }, this.headerSubtitle), index.h("p", { class: "Subtitle" }, this.description), index.h("span", { class: "Expand", onClick: () => this.toggleContent() }, this.showContent ? '<' : '>')), this.showContent &&
85
+ index.h("div", null, index.h("div", { class: "Content" }, index.h("slot", { name: 'accordionContent' }), this.footer && this.showContent &&
86
+ index.h("div", null, this.deleteTab &&
87
+ index.h("span", { class: "ActionButton", onClick: () => this.deleteAction() }, translate('deleteTicket', this.language)))))));
88
+ }
89
+ };
90
+ Accordion.style = helperAccordionCss;
91
+
92
+ const helperTabCss = ":host{display:block}.TabContent{font-size:14px;color:#000;font-weight:normal}";
93
+
94
+ const HelperTab = class {
95
+ constructor(hostRef) {
96
+ index.registerInstance(this, hostRef);
97
+ /**
98
+ * Selected index
99
+ */
100
+ this.selectedIndex = 0;
101
+ this.tabContent = '';
102
+ }
103
+ connectedCallback() {
104
+ /**
105
+ * fetch(cmsEndpoint + / + / + selectedIndex)
106
+ */
107
+ }
108
+ render() {
109
+ this.tabContent = index.h("div", { class: "TabContent" }, "Each play includes one set of numbers from 1 to 21 with a selectable number of 8 and a second, 4-digit set of numbers, with a minimum selection of 1. Draws are held every 5 minutes and the winnings are automatically credited to your account.");
110
+ if (this.selectedIndex + 1 == 2) {
111
+ this.tabContent = index.h("div", { class: "TabContent" }, index.h("ol", null, index.h("li", null, "Register or Login"), index.h("li", null, "Buy tickets. Select 'Buy Tickets' to pick your numbers. Want us to automatically generate random numbers for you? Choose \u201CI feel lucky\u201D."), index.h("li", null, "Review and Complete your purchase. Once you've chosen your total number of plays, and confirmed your number of selections, review your ticket details and complete your purchase!")));
112
+ }
113
+ else if (this.selectedIndex + 1 == 3) {
114
+ this.tabContent = index.h("div", { class: "TabContent" }, index.h("ul", null, index.h("li", null, "What are my odds of winning?"), index.h("li", null, "How can I find out if I\u2019ve won a draw game?"), index.h("li", null, "How do I claim my prize?")));
115
+ }
116
+ return (this.tabContent);
117
+ }
118
+ };
119
+ HelperTab.style = helperTabCss;
120
+
121
+ const helperTabsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.Tabs{display:flex;gap:10px;overflow-x:auto}.TabButton{cursor:pointer;width:auto;border-radius:4px;padding:8px 15px;margin:5px 0 10px;border:1px solid #009993;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-align:center;letter-spacing:0;white-space:nowrap}.TabButton:hover{background:#F1F1F1}.TabButton.Active{background:#009993;color:#FFF}";
122
+
123
+ const HelperTabs = class {
124
+ constructor(hostRef) {
125
+ index.registerInstance(this, hostRef);
126
+ /**
127
+ * Tell me if it is disabled
128
+ */
129
+ this.disabled = false;
130
+ /**
131
+ * Tell me what tab is selected
132
+ */
133
+ this.selected = false;
134
+ /**
135
+ * Default selected index
136
+ */
137
+ this.selectedIndex = 0;
138
+ /**
139
+ * Tabs details
140
+ */
141
+ this.tabs = [{ label: 'How to Play' }, { label: 'About' }, { label: 'FAQs' }];
142
+ }
143
+ connectedCallback() {
144
+ }
145
+ render() {
146
+ return (index.h("div", null, index.h("div", { class: "Tabs" }, this.tabs.map((tab, index$1) => index.h("button", { class: 'TabButton' + (this.selectedIndex == index$1 ? ' Active' : ''), onClick: () => this.selectedIndex = index$1 }, tab.label))), index.h("div", null, index.h("helper-tab", { selectedIndex: this.selectedIndex }))));
147
+ }
148
+ get host() { return index.getElement(this); }
149
+ };
150
+ HelperTabs.style = helperTabsCss;
151
+
152
+ const lotteryGameDetailsCss = ":host{display:block}";
153
+
154
+ const LotteryGameDetails = class {
155
+ constructor(hostRef) {
156
+ index.registerInstance(this, hostRef);
157
+ }
158
+ render() {
159
+ return (index.h("div", null, index.h("helper-accordion", { "header-title": "Game Details", collapsed: false }, index.h("div", { slot: "accordionContent" }, index.h("helper-tabs", null)))));
160
+ }
161
+ };
162
+ LotteryGameDetails.style = lotteryGameDetailsCss;
163
+
164
+ exports.helper_accordion = Accordion;
165
+ exports.helper_tab = HelperTab;
166
+ exports.helper_tabs = HelperTabs;
167
+ exports.lottery_game_details = LotteryGameDetails;