@everymatrix/lottery-order-summary 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.
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-b1042ae5.js +1307 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/lottery-button_2.cjs.entry.js +179 -0
- package/dist/cjs/lottery-order-summary-9c494983.js +292 -0
- package/dist/cjs/lottery-order-summary.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +19 -0
- package/dist/collection/components/lottery-order-summary/index.js +1 -0
- package/dist/collection/components/lottery-order-summary/lottery-order-summary.css +67 -0
- package/dist/collection/components/lottery-order-summary/lottery-order-summary.js +442 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/model/index.js +7 -0
- package/dist/collection/utils/utils.js +38 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-8e69c8be.js +1279 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/lottery-button_2.entry.js +175 -0
- package/dist/esm/lottery-order-summary-1c477f07.js +287 -0
- package/dist/esm/lottery-order-summary.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/lottery-order-summary/app-globals-0f993ce5.js +1 -0
- package/dist/lottery-order-summary/index-8e69c8be.js +2 -0
- package/dist/lottery-order-summary/index.esm.js +1 -0
- package/dist/lottery-order-summary/lottery-button_2.entry.js +1 -0
- package/dist/lottery-order-summary/lottery-order-summary-1c477f07.js +1 -0
- package/dist/lottery-order-summary/lottery-order-summary.esm.js +1 -0
- package/dist/stencil.config.dev.js +19 -0
- package/dist/stencil.config.js +19 -0
- package/dist/storybook/main.js +43 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-order-summary/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-order-summary/.stencil/packages/stencil/lottery-order-summary/stencil.config.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-order-summary/.stencil/packages/stencil/lottery-order-summary/stencil.config.dev.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-order-summary/.stencil/packages/stencil/lottery-order-summary/storybook/main.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-order-summary/.stencil/packages/stencil/lottery-order-summary/storybook/preview.d.ts +70 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-order-summary/.stencil/tools/plugins/index.d.ts +4 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-order-summary/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-order-summary/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-order-summary/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-order-summary/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/lottery-order-summary/index.d.ts +1 -0
- package/dist/types/components/lottery-order-summary/lottery-order-summary.d.ts +87 -0
- package/dist/types/components.d.ts +175 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/model/index.d.ts +34 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/utils.d.ts +3 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +27 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { b as bootstrapLazy } from './index-8e69c8be.js';
|
|
2
|
+
export { s as setNonce } from './index-8e69c8be.js';
|
|
3
|
+
import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
4
|
+
|
|
5
|
+
const defineCustomElements = async (win, options) => {
|
|
6
|
+
if (typeof window === 'undefined') return undefined;
|
|
7
|
+
await globalScripts();
|
|
8
|
+
return bootstrapLazy([["lottery-button_2",[[1,"lottery-order-summary",{"endpoint":[513],"sessionId":[513,"session-id"],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"orderSummaryTitle":[1,"order-summary-title"],"ticketsLabel":[1,"tickets-label"],"totalLabel":[1,"total-label"],"showColon":[4,"show-colon"],"showDivider":[4,"show-divider"],"submitDisabled":[4,"submit-disabled"],"submitButtonText":[1,"submit-button-text"],"submitLoading":[32]},[[8,"lotteryTicketParamsReady","handleLotteryTicketParamsReady"]],{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"lottery-button",{"variant":[513],"size":[513],"color":[513],"disabled":[516],"loading":[516],"text":[513],"mbSource":[513,"mb-source"],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { defineCustomElements };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-8e69c8be.js';
|
|
2
|
+
import { s as setClientStyling, a as setClientStylingURL, b as setStreamStyling } from './lottery-order-summary-1c477f07.js';
|
|
3
|
+
export { L as lottery_order_summary } from './lottery-order-summary-1c477f07.js';
|
|
4
|
+
|
|
5
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
6
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
|
|
7
|
+
const TRANSLATIONS = {
|
|
8
|
+
en: {
|
|
9
|
+
loading: 'Loading'
|
|
10
|
+
},
|
|
11
|
+
ro: {},
|
|
12
|
+
fr: {},
|
|
13
|
+
ar: {},
|
|
14
|
+
hr: {}
|
|
15
|
+
};
|
|
16
|
+
const translate = (key, customLang, replacements) => {
|
|
17
|
+
const lang = customLang;
|
|
18
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
19
|
+
if (replacements) {
|
|
20
|
+
Object.keys(replacements).forEach((placeholder) => {
|
|
21
|
+
translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return translation;
|
|
25
|
+
};
|
|
26
|
+
const getTranslations = (data) => {
|
|
27
|
+
Object.keys(data).forEach((item) => {
|
|
28
|
+
for (let key in data[item]) {
|
|
29
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const resolveTranslationUrl = async (translationUrl) => {
|
|
34
|
+
if (translationUrl) {
|
|
35
|
+
try {
|
|
36
|
+
const response = await fetch(translationUrl);
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
39
|
+
}
|
|
40
|
+
const translations = await response.json();
|
|
41
|
+
getTranslations(translations);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error('Failed to fetch or parse translations from URL:', error);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const lotteryButtonCss = ":host{display:inline-block}.btn{font:inherit;position:relative;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:var(--lottery-button-border-radius, 6px);font-weight:var(--lottery-button-font-weight, 500);cursor:pointer;outline:none;overflow:hidden;transition:var(--lottery-button-transition, background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s);user-select:none;-webkit-tap-highlight-color:transparent;box-shadow:var(--lottery-button-box-shadow, 0 2px 4px 0 rgba(0, 0, 0, 0.5))}.btn .content{position:relative;display:inline-flex;align-items:center;gap:var(--lottery-button-content-gap, 0.5em)}.btn .content ::slotted(span){display:inline-flex;align-items:center}.btn:hover:not(:disabled){box-shadow:var(--lottery-button-hover-box-shadow, 0 4px 8px 0 rgba(0, 0, 0, 0.5))}.btn:disabled{cursor:not-allowed;opacity:var(--lottery-button-disabled-opacity, 0.5)}.btn .loading-container{display:flex;align-items:center}.btn--loading{position:relative}.btn .spinner{display:inline-block;width:1em;height:1em;border:var(--lottery-button-spinner-border, 2px solid rgba(255, 255, 255, 0.3));border-radius:50%;border-top-color:var(--lottery-button-spinner-color, white);animation:spin 1s ease-in-out infinite;margin-left:0.5em;vertical-align:middle}.btn--small .spinner{width:0.8em;height:0.8em}.btn--large .spinner{width:1.2em;height:1.2em}@keyframes spin{to{transform:rotate(360deg)}}.btn--primary{background-color:var(--emw--color-primary, #0d196e);color:var(--emw--color-typography-inverse, #fff)}.btn--primary:hover:not(:disabled){background-color:var(--emw--color-primary-variant, #1367e7)}.btn--primary:active:not(:disabled){background-color:var(--lottery-button-primary-active-bg, #08104a)}.btn--outline .spinner,.btn--dashed .spinner,.btn--text .spinner{border-top-color:currentColor;border-color:var(--lottery-button-spinner-inverse-border-color, rgba(0, 0, 0, 0.2))}.btn--outline{background-color:var(--emw--color-background, #fff);border-color:var(--lottery-button-outline-border-color, #dcdcdc);color:var(--emw--color-typography, #000)}.btn--outline:hover:not(:disabled){background-color:var(--emw--color-background-tertiary, #ccc);border-color:var(--lottery-button-outline-hover-border-color, #a6a6a6)}.btn--outline:active:not(:disabled){background-color:var(--lottery-button-outline-active-bg, #e6e6e6)}.btn--dashed{background-color:transparent;border-style:dashed;border-color:var(--lottery-button-dashed-border-color, #dcdcdc);color:var(--lottery-button-dashed-color, #333)}.btn--dashed:hover:not(:disabled){border-color:var(--lottery-button-dashed-hover-border-color, #a6a6a6);color:var(--lottery-button-dashed-hover-color, #0052d9)}.btn--text{background-color:transparent;color:var(--lottery-button-text-color, #0052d9);border-color:transparent}.btn--text:hover:not(:disabled){background-color:var(--lottery-button-text-hover-bg, #f2f2f2)}.btn--text:active:not(:disabled){background-color:var(--lottery-button-text-active-bg, #e6e6e6)}.btn--custom-color:hover:not(:disabled){opacity:var(--lottery-button-custom-hover-opacity, 0.9)}.btn--custom-color:active:not(:disabled){opacity:var(--lottery-button-custom-active-opacity, 0.8)}.btn--small{height:var(--lottery-button-small-height, 28px);font-size:var(--lottery-button-small-font-size, 12px);padding:var(--lottery-button-small-padding, 0 12px)}.btn--medium{height:var(--lottery-button-medium-height, 34px);font-size:var(--lottery-button-medium-font-size, 14px);padding:var(--lottery-button-medium-padding, 0 18px)}.btn--large{height:var(--lottery-button-large-height, 40px);font-size:var(--lottery-button-large-font-size, 16px);padding:var(--lottery-button-large-padding, 0 24px)}.ripple-container{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;border-radius:inherit}.ripple{position:absolute;border-radius:50%;background-color:var(--lottery-button-ripple-light, rgba(255, 255, 255, 0.3));transform:scale(0);animation:ripple-animation 600ms linear}.btn--outline .ripple,.btn--dashed .ripple,.btn--text .ripple{background-color:var(--lottery-button-ripple-dark, rgba(0, 0, 0, 0.03))}@keyframes ripple-animation{to{transform:scale(4);opacity:0}}";
|
|
50
|
+
const LotteryButtonStyle0 = lotteryButtonCss;
|
|
51
|
+
|
|
52
|
+
const LotteryButton = class {
|
|
53
|
+
constructor(hostRef) {
|
|
54
|
+
registerInstance(this, hostRef);
|
|
55
|
+
this.handleClick = (event) => {
|
|
56
|
+
if (this.disabled) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// Get the button element from the shadow root
|
|
60
|
+
const button = this.host.shadowRoot.querySelector('.btn');
|
|
61
|
+
if (!button)
|
|
62
|
+
return;
|
|
63
|
+
const rect = button.getBoundingClientRect();
|
|
64
|
+
const size = Math.max(rect.width, rect.height);
|
|
65
|
+
const top = event.clientY - rect.top - size / 2;
|
|
66
|
+
const left = event.clientX - rect.left - size / 2;
|
|
67
|
+
// Add the new ripple to the state, triggering a re-render
|
|
68
|
+
const newRipple = { top, left, size };
|
|
69
|
+
this.ripples = [...this.ripples, newRipple];
|
|
70
|
+
// Set a timeout to clean up the ripple from the state after the animation ends
|
|
71
|
+
// This prevents the DOM from filling up with old ripple elements
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
this.ripples = this.ripples.filter((r) => r !== newRipple);
|
|
74
|
+
}, 600); // This duration should match the CSS animation duration
|
|
75
|
+
};
|
|
76
|
+
this.variant = 'primary';
|
|
77
|
+
this.size = 'medium';
|
|
78
|
+
this.color = undefined;
|
|
79
|
+
this.disabled = false;
|
|
80
|
+
this.loading = false;
|
|
81
|
+
this.text = undefined;
|
|
82
|
+
this.mbSource = undefined;
|
|
83
|
+
this.language = 'en';
|
|
84
|
+
this.clientStyling = undefined;
|
|
85
|
+
this.clientStylingUrl = undefined;
|
|
86
|
+
this.translationUrl = '';
|
|
87
|
+
this.ripples = [];
|
|
88
|
+
}
|
|
89
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
90
|
+
if (newValue != oldValue) {
|
|
91
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
95
|
+
if (newValue != oldValue) {
|
|
96
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
100
|
+
if (newValue != oldValue) {
|
|
101
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
disconnectedCallback() {
|
|
105
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
106
|
+
}
|
|
107
|
+
componentDidLoad() {
|
|
108
|
+
if (this.stylingContainer) {
|
|
109
|
+
if (this.mbSource)
|
|
110
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
111
|
+
if (this.clientStyling)
|
|
112
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
113
|
+
if (this.clientStylingUrl)
|
|
114
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
componentWillLoad() {
|
|
118
|
+
if (this.translationUrl) {
|
|
119
|
+
resolveTranslationUrl(this.translationUrl);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
render() {
|
|
123
|
+
const { variant, disabled, size, color } = this;
|
|
124
|
+
const isDisabled = disabled || this.loading;
|
|
125
|
+
// Calculate styles based on variant and color
|
|
126
|
+
const buttonStyles = {};
|
|
127
|
+
if (color) {
|
|
128
|
+
switch (variant) {
|
|
129
|
+
case 'primary':
|
|
130
|
+
Object.assign(buttonStyles, {
|
|
131
|
+
backgroundColor: color,
|
|
132
|
+
borderColor: color
|
|
133
|
+
});
|
|
134
|
+
break;
|
|
135
|
+
case 'outline':
|
|
136
|
+
case 'dashed':
|
|
137
|
+
Object.assign(buttonStyles, {
|
|
138
|
+
color: color,
|
|
139
|
+
borderColor: color
|
|
140
|
+
});
|
|
141
|
+
break;
|
|
142
|
+
case 'text':
|
|
143
|
+
Object.assign(buttonStyles, {
|
|
144
|
+
color: color
|
|
145
|
+
});
|
|
146
|
+
break;
|
|
147
|
+
default:
|
|
148
|
+
Object.assign(buttonStyles, {
|
|
149
|
+
backgroundColor: color,
|
|
150
|
+
borderColor: color
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return (h("button", { key: 'aa74ad98c90e7548228557bf8a8d26b125d4a83a', class: {
|
|
155
|
+
btn: true,
|
|
156
|
+
[`btn--${variant}`]: true,
|
|
157
|
+
[`btn--${size}`]: true,
|
|
158
|
+
'btn--loading': this.loading
|
|
159
|
+
}, style: color ? buttonStyles : undefined, disabled: isDisabled, onClick: this.handleClick, ref: (el) => (this.stylingContainer = el) }, this.loading ? (h("div", { class: "loading-container" }, h("span", { class: "content" }, this.text || translate('loading', this.language)), h("span", { class: "spinner" }))) : (h("span", { class: "content" }, h("slot", { name: "icon-left" }), this.text || h("slot", null), h("slot", { name: "icon-right" }))), h("div", { key: '302ea02be395bb24989d4abc040a513e23fa029a', class: "ripple-container" }, this.ripples.map((ripple, index) => (h("span", { key: index, class: "ripple", style: {
|
|
160
|
+
top: `${ripple.top}px`,
|
|
161
|
+
left: `${ripple.left}px`,
|
|
162
|
+
width: `${ripple.size}px`,
|
|
163
|
+
height: `${ripple.size}px`
|
|
164
|
+
} }))))));
|
|
165
|
+
}
|
|
166
|
+
get host() { return getElement(this); }
|
|
167
|
+
static get watchers() { return {
|
|
168
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
169
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
170
|
+
"mbSource": ["handleMbSourceChange"]
|
|
171
|
+
}; }
|
|
172
|
+
};
|
|
173
|
+
LotteryButton.style = LotteryButtonStyle0;
|
|
174
|
+
|
|
175
|
+
export { LotteryButton as lottery_button };
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-8e69c8be.js';
|
|
2
|
+
|
|
3
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @name setClientStyling
|
|
7
|
+
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
8
|
+
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
9
|
+
* @param {string} clientStyling The style content
|
|
10
|
+
*/
|
|
11
|
+
function setClientStyling(stylingContainer, clientStyling) {
|
|
12
|
+
if (stylingContainer) {
|
|
13
|
+
const sheet = document.createElement('style');
|
|
14
|
+
sheet.innerHTML = clientStyling;
|
|
15
|
+
stylingContainer.appendChild(sheet);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @name setClientStylingURL
|
|
21
|
+
* @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
|
|
22
|
+
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
23
|
+
* @param {string} clientStylingUrl The URL of the style content
|
|
24
|
+
*/
|
|
25
|
+
function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
26
|
+
if (!stylingContainer || !clientStylingUrl) return;
|
|
27
|
+
|
|
28
|
+
const url = new URL(clientStylingUrl);
|
|
29
|
+
|
|
30
|
+
fetch(url.href)
|
|
31
|
+
.then((res) => res.text())
|
|
32
|
+
.then((data) => {
|
|
33
|
+
const cssFile = document.createElement('style');
|
|
34
|
+
cssFile.innerHTML = data;
|
|
35
|
+
if (stylingContainer) {
|
|
36
|
+
stylingContainer.appendChild(cssFile);
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
.catch((err) => {
|
|
40
|
+
console.error('There was an error while trying to load client styling from URL', err);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @name setStreamLibrary
|
|
46
|
+
* @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
|
|
47
|
+
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
48
|
+
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
49
|
+
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
50
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
51
|
+
*/
|
|
52
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
53
|
+
if (!window.emMessageBus) return;
|
|
54
|
+
|
|
55
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
56
|
+
|
|
57
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
58
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
59
|
+
|
|
60
|
+
return subscription;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!window[StyleCacheKey]) {
|
|
64
|
+
window[StyleCacheKey] = {};
|
|
65
|
+
}
|
|
66
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
67
|
+
|
|
68
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
69
|
+
const wrappedUnsubscribe = () => {
|
|
70
|
+
if (window[StyleCacheKey][domain]) {
|
|
71
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
72
|
+
cachedObject.refCount > 1
|
|
73
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
74
|
+
: delete window[StyleCacheKey][domain];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
originalUnsubscribe();
|
|
78
|
+
};
|
|
79
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
80
|
+
|
|
81
|
+
return subscription;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
85
|
+
const sheet = document.createElement('style');
|
|
86
|
+
|
|
87
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
88
|
+
if (stylingContainer) {
|
|
89
|
+
sheet.innerHTML = data;
|
|
90
|
+
stylingContainer.appendChild(sheet);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
96
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
97
|
+
if (!stylingContainer) return;
|
|
98
|
+
|
|
99
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
100
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
101
|
+
let cachedStyle = cacheStyleObject[domain] && cacheStyleObject[domain].sheet;
|
|
102
|
+
|
|
103
|
+
if (!cachedStyle) {
|
|
104
|
+
cachedStyle = new CSSStyleSheet();
|
|
105
|
+
cachedStyle.replaceSync(data);
|
|
106
|
+
cacheStyleObject[domain] = {
|
|
107
|
+
sheet: cachedStyle,
|
|
108
|
+
refCount: 1
|
|
109
|
+
};
|
|
110
|
+
} else {
|
|
111
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
115
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
116
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const generateUUID = () => {
|
|
122
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
123
|
+
var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
124
|
+
return v.toString(16);
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
function fetchRequest(url, method = 'GET', body = null, headers = {}) {
|
|
128
|
+
return new Promise((resolve, reject) => {
|
|
129
|
+
const uuid = generateUUID();
|
|
130
|
+
const headersOrigin = Object.assign({ 'Content-Type': 'application/json' }, headers);
|
|
131
|
+
if (method !== 'GET' && method !== 'HEAD') {
|
|
132
|
+
headersOrigin['X-Idempotency-Key'] = uuid;
|
|
133
|
+
}
|
|
134
|
+
const options = {
|
|
135
|
+
method,
|
|
136
|
+
headers: headersOrigin,
|
|
137
|
+
body: null
|
|
138
|
+
};
|
|
139
|
+
if (body && method !== 'GET' && method !== 'HEAD') {
|
|
140
|
+
options.body = JSON.stringify(body);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
delete options.body;
|
|
144
|
+
}
|
|
145
|
+
fetch(url, options)
|
|
146
|
+
.then((response) => {
|
|
147
|
+
if (!response.ok) {
|
|
148
|
+
return reject(response);
|
|
149
|
+
}
|
|
150
|
+
return response.json();
|
|
151
|
+
})
|
|
152
|
+
.then((data) => resolve(data))
|
|
153
|
+
.catch((error) => reject(error));
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
var TicketStatus;
|
|
158
|
+
(function (TicketStatus) {
|
|
159
|
+
TicketStatus["PURCHASED"] = "Purchased";
|
|
160
|
+
TicketStatus["SETTLED"] = "Settled";
|
|
161
|
+
TicketStatus["CANCELED"] = "Canceled";
|
|
162
|
+
TicketStatus["ERROR"] = "Error";
|
|
163
|
+
})(TicketStatus || (TicketStatus = {}));
|
|
164
|
+
|
|
165
|
+
const lotteryOrderSummaryCss = ":host{width:100%}.order-summary{width:100%;background:var(--emw--color-background, #fff);border-radius:var(--lottery-order-summary-border-radius, 8px);border:var(--lottery-order-summary-border, none);box-shadow:var(--lottery-order-summary-box-shadow, none);box-sizing:border-box}.order-summary__title{margin:var(--lottery-order-summary-title-margin, 0 0 30px 0);text-align:var(--lottery-order-summary-title-text-align, center);color:var(--emw--color-typography, #000);text-transform:uppercase;font-weight:var(--lottery-order-summary-title-font-weight, 700)}.order-summary__ticket-info{display:flex;align-items:center;margin-bottom:var(--lottery-order-summary-row-gap, 16px);gap:var(--lottery-order-summary-col-gap, 10px);color:var(--emw--color-typography, #000)}.order-summary__ticket-label{display:flex;flex-direction:row;align-items:center;width:var(--lottery-order-summary-label-width, 50px);max-width:var(--lottery-order-summary-label-max-width, 100%);flex-shrink:0}.order-summary__colon{margin-left:2px}.order-summary__ticket{font-weight:var(--lottery-order-summary-label-font-weight, 500);color:var(--emw--color-typography, #000);overflow-wrap:break-word}.order-summary__details{display:flex;align-items:center;color:var(--emw--color-typography, #000);font-weight:var(--lottery-order-summary-details-font-weight, 400)}.order-summary__divider{border:none;border-top:var(--lottery-order-summary-divider-border, 1px solid var(--emw--color-gray-100, #e6e6e6));margin:var(--lottery-order-summary-divider-margin, 20px 0)}.order-summary__button-wrapper{display:flex;justify-content:center;margin:var(--lottery-order-summary-button-wrapper-margin, 0);padding:var(--lottery-order-summary-button-wrapper-padding, 0)}";
|
|
166
|
+
const LotteryOrderSummaryStyle0 = lotteryOrderSummaryCss;
|
|
167
|
+
|
|
168
|
+
const LotteryOrderSummary = class {
|
|
169
|
+
constructor(hostRef) {
|
|
170
|
+
registerInstance(this, hostRef);
|
|
171
|
+
this.orderSummarySubmit = createEvent(this, "orderSummarySubmit", 7);
|
|
172
|
+
this.submitSuccess = createEvent(this, "lotteryTicketSubmitSuccess", 7);
|
|
173
|
+
this.submitError = createEvent(this, "lotteryTicketSubmitError", 7);
|
|
174
|
+
this.sessionExpired = createEvent(this, "sessionExpired", 7);
|
|
175
|
+
this.endpoint = undefined;
|
|
176
|
+
this.sessionId = undefined;
|
|
177
|
+
this.mbSource = undefined;
|
|
178
|
+
this.clientStyling = undefined;
|
|
179
|
+
this.clientStylingUrl = undefined;
|
|
180
|
+
this.language = 'en';
|
|
181
|
+
this.orderSummaryTitle = undefined;
|
|
182
|
+
this.ticketsLabel = undefined;
|
|
183
|
+
this.totalLabel = undefined;
|
|
184
|
+
this.showColon = true;
|
|
185
|
+
this.showDivider = false;
|
|
186
|
+
this.submitDisabled = false;
|
|
187
|
+
this.submitButtonText = undefined;
|
|
188
|
+
this.submitLoading = false;
|
|
189
|
+
}
|
|
190
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
191
|
+
if (newValue != oldValue) {
|
|
192
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
196
|
+
if (newValue != oldValue) {
|
|
197
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
201
|
+
if (newValue != oldValue) {
|
|
202
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
componentDidLoad() {
|
|
206
|
+
if (this.stylingContainer) {
|
|
207
|
+
if (this.mbSource)
|
|
208
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
209
|
+
if (this.clientStyling)
|
|
210
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
211
|
+
if (this.clientStylingUrl)
|
|
212
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
disconnectedCallback() {
|
|
216
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
217
|
+
}
|
|
218
|
+
handleLotteryTicketParamsReady(event) {
|
|
219
|
+
if (event.detail && this.isValidTicketSubmitParam(event.detail)) {
|
|
220
|
+
this.handleSubmitTickets(event.detail);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
isValidTicketSubmitParam(detail) {
|
|
224
|
+
return (detail &&
|
|
225
|
+
detail.playerId &&
|
|
226
|
+
Array.isArray(detail.tickets) &&
|
|
227
|
+
detail.tickets.length > 0 &&
|
|
228
|
+
detail.tickets.every((ticket) => this.isValidTicketParam(ticket)));
|
|
229
|
+
}
|
|
230
|
+
isValidTicketParam(ticket) {
|
|
231
|
+
return (ticket &&
|
|
232
|
+
ticket.amount !== undefined &&
|
|
233
|
+
ticket.multiplier !== undefined &&
|
|
234
|
+
ticket.multiplierNum !== undefined &&
|
|
235
|
+
typeof ticket.quickPick === 'boolean' &&
|
|
236
|
+
ticket.selection !== undefined);
|
|
237
|
+
}
|
|
238
|
+
async handleSubmitTickets(body) {
|
|
239
|
+
try {
|
|
240
|
+
this.submitLoading = true;
|
|
241
|
+
const res = await fetchRequest(`${this.endpoint}/tickets`, 'POST', body, {
|
|
242
|
+
Authorization: `Bearer ${this.sessionId}`
|
|
243
|
+
});
|
|
244
|
+
if (!res.tickets.every((ticket) => ticket.state === TicketStatus.PURCHASED)) {
|
|
245
|
+
this.submitError.emit({
|
|
246
|
+
message: 'Failed to purchase ticket',
|
|
247
|
+
dataOrigin: res,
|
|
248
|
+
status: 200
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
this.submitSuccess.emit({
|
|
253
|
+
dataOrigin: res,
|
|
254
|
+
status: 200
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
catch (e) {
|
|
259
|
+
if (e.status === 401) {
|
|
260
|
+
this.sessionExpired.emit();
|
|
261
|
+
}
|
|
262
|
+
if (e.status > 300 || !e.status) {
|
|
263
|
+
this.submitError.emit({
|
|
264
|
+
dataOrigin: e,
|
|
265
|
+
status: e.status || 0
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
finally {
|
|
270
|
+
this.submitLoading = false;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
handleSubmit() {
|
|
274
|
+
this.orderSummarySubmit.emit();
|
|
275
|
+
}
|
|
276
|
+
render() {
|
|
277
|
+
return (h("div", { key: 'efdb1636656b63aec159e534475fd666769fd4ca', ref: (el) => (this.stylingContainer = el) }, h("div", { key: '6d4c031bc462d721e18b3e652724835ba8fd690a', class: "order-summary" }, h("h3", { key: '16ce86d321b12b51bab202ab336d64968bf9ff89', class: "order-summary__title" }, this.orderSummaryTitle), h("div", { key: '198532d79c47577006ac5d11f90394ccc513c329', class: "order-summary__ticket" }, h("div", { key: '042e62b7d14a6edd406a14d617d17a1a113f5aae', class: "order-summary__ticket-info" }, h("div", { key: '7e52751fb547ba8b8383456c520228b2b02f5753', class: "order-summary__ticket-label" }, h("div", { key: '90684f3d39ba97a1abd9d8c63e2674b36e4b8678', class: "order-summary__ticket" }, this.ticketsLabel), h("span", { key: '16b27f067a674f75fb14b50dcaaaa4c85eb7ebf2', class: "order-summary__colon" }, this.showColon ? ':' : null)), h("div", { key: 'a197e3f00bc600a048b37f90ad3a8e37d57dbb13', class: "order-summary__details" }, h("slot", { key: '2ae61d6ba689093da155390d7fe85c3c96bb8ba0', name: "orderSummaryTicketDetail" }))), this.showDivider && h("hr", { key: 'a27f9309ef46d2d99edc2dd24c1cbe61153548c8', class: "order-summary__divider" }), h("div", { key: 'd7574288d92159b7f455c0ce610e0b44c6a5d5fb', class: "order-summary__ticket-info" }, h("div", { key: '160290be8ee8267c24372fcccc0172fbde699e54', class: "order-summary__ticket-label" }, h("div", { key: '2489842ef3993d180dbda4304d9bf0dd60c5179d', class: "order-summary__ticket" }, this.totalLabel), h("span", { key: 'f58319a518511ff51402e26d897ea60de1bf9dce', class: "order-summary__colon" }, this.showColon ? ':' : null)), h("span", { key: '7f01d9a780150d81e777702635d66aa04aa9b6da', class: "order-summary__details" }, h("slot", { key: 'f72248a4423c6edf89555d0c53d29cd0d4cedf7a', name: "orderSummaryTotalDetail" })))), h("slot", { key: 'a5da30406e02ea7dbdbf1f37fc89106b08bd8d3d', name: "orderSummaryChoice" }), h("div", { key: 'ed9429dd65495cea075910c5d41f0b9f7785cbb3', class: "order-summary__button-wrapper" }, h("lottery-button", { key: '5a31daaeb0faad9127e5c383fc1196a6763278d1', onClick: this.handleSubmit.bind(this), loading: this.submitLoading, disabled: this.submitDisabled, text: this.submitButtonText })))));
|
|
278
|
+
}
|
|
279
|
+
static get watchers() { return {
|
|
280
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
281
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
282
|
+
"mbSource": ["handleMbSourceChange"]
|
|
283
|
+
}; }
|
|
284
|
+
};
|
|
285
|
+
LotteryOrderSummary.style = LotteryOrderSummaryStyle0;
|
|
286
|
+
|
|
287
|
+
export { LotteryOrderSummary as L, setClientStylingURL as a, setStreamStyling as b, setClientStyling as s };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-8e69c8be.js';
|
|
2
|
+
export { s as setNonce } from './index-8e69c8be.js';
|
|
3
|
+
import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
var patchBrowser = () => {
|
|
9
|
+
const importMeta = import.meta.url;
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== "") {
|
|
12
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(async (options) => {
|
|
18
|
+
await globalScripts();
|
|
19
|
+
return bootstrapLazy([["lottery-button_2",[[1,"lottery-order-summary",{"endpoint":[513],"sessionId":[513,"session-id"],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"language":[513],"orderSummaryTitle":[1,"order-summary-title"],"ticketsLabel":[1,"tickets-label"],"totalLabel":[1,"total-label"],"showColon":[4,"show-colon"],"showDivider":[4,"show-divider"],"submitDisabled":[4,"submit-disabled"],"submitButtonText":[1,"submit-button-text"],"submitLoading":[32]},[[8,"lotteryTicketParamsReady","handleLotteryTicketParamsReady"]],{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}],[1,"lottery-button",{"variant":[513],"size":[513],"color":[513],"disabled":[516],"loading":[516],"text":[513],"mbSource":[513,"mb-source"],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./cjs/index.cjs.js');
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './esm/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=()=>{};export{o as g}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=new WeakMap,n=e=>t.get(e),l=(e,n)=>t.set(n.t=e,n),o=(e,t)=>t in e,s=(e,t)=>(0,console.error)(e,t),r=new Map,i=new Map,c="slot-fb{display:contents}slot-fb[hidden]{display:none}",u="undefined"!=typeof window?window:{},a=u.document||{head:{}},f={l:0,o:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},h=e=>Promise.resolve(e),d=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),m=!1,p=[],y=[],$=(e,t)=>n=>{e.push(n),m||(m=!0,t&&4&f.l?w(b):f.raf(b))},v=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){s(e)}e.length=0},b=()=>{v(p),v(y),(m=p.length>0)&&f.raf(b)},w=e=>h().then(e),g=$(y,!0),S={},j=e=>"object"==(e=typeof e)||"function"===e;function k(e){var t,n,l;return null!=(l=null==(n=null==(t=e.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?l:void 0}((t,n)=>{for(var l in n)e(t,l,{get:n[l],enumerable:!0})})({},{err:()=>E,map:()=>C,ok:()=>O,unwrap:()=>P,unwrapErr:()=>L});var O=e=>({isOk:!0,isErr:!1,value:e}),E=e=>({isOk:!1,isErr:!0,value:e});function C(e,t){if(e.isOk){const n=t(e.value);return n instanceof Promise?n.then((e=>O(e))):O(n)}if(e.isErr)return E(e.value);throw"should never get here"}var M,x,P=e=>{if(e.isOk)return e.value;throw e.value},L=e=>{if(e.isErr)return e.value;throw e.value},R=(e,t,...n)=>{let l=null,o=null,s=!1,r=!1;const i=[],c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!j(l))&&(l+=""),s&&r?i[i.length-1].i+=l:i.push(s?T(null,l):l),r=s)};if(c(n),t){t.key&&(o=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const u=T(e,null);return u.u=t,i.length>0&&(u.h=i),u.m=o,u},T=(e,t)=>({l:0,p:e,i:t,$:null,h:null,u:null,m:null}),A={},N=e=>n(e).$hostElement$,U=(e,t,n)=>{const l=N(e);return{emit:e=>W(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},W=(e,t,n)=>{const l=f.ce(t,n);return e.dispatchEvent(l),l},D=new WeakMap,F=e=>"sc-"+e.v,H=(e,t,n,l,s,r)=>{if(n!==l){let i=o(e,t),c=t.toLowerCase();if("class"===t){const t=e.classList,o=G(n),s=G(l);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("key"===t);else if("ref"===t)l&&l(e);else if(i||"o"!==t[0]||"n"!==t[1]){const o=j(l);if((i||o&&null!==l)&&!s)try{if(e.tagName.includes("-"))e[t]=l;else{const o=null==l?"":l;"list"===t?i=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&r||s)&&!o&&e.setAttribute(t,l=!0===l?"":l)}else if(t="-"===t[2]?t.slice(3):o(u,c)?c.slice(2):c[2]+t.slice(3),n||l){const o=t.endsWith(V);t=t.replace(_,""),n&&f.rel(e,t,n,o),l&&f.ael(e,t,l,o)}}},q=/\s/,G=e=>e?e.split(q):[],V="Capture",_=RegExp(V+"$"),z=(e,t,n)=>{const l=11===t.$.nodeType&&t.$.host?t.$.host:t.$,o=e&&e.u||S,s=t.u||S;for(const e of B(Object.keys(o)))e in s||H(l,e,o[e],void 0,n,t.l);for(const e of B(Object.keys(s)))H(l,e,o[e],s[e],n,t.l)};function B(e){return e.includes("ref")?[...e.filter((e=>"ref"!==e)),"ref"]:e}var I=!1,J=!1,K=(e,t,n)=>{const l=t.h[n];let o,s,r=0;if(null!==l.i)o=l.$=a.createTextNode(l.i);else if(o=l.$=a.createElement(l.p),z(null,l,J),null!=M&&o["s-si"]!==M&&o.classList.add(o["s-si"]=M),l.h)for(r=0;r<l.h.length;++r)s=K(e,l,r),s&&o.appendChild(s);return o["s-hn"]=x,o},Q=(e,t,n,l,o,s)=>{let r,i=e;for(i.shadowRoot&&i.tagName===x&&(i=i.shadowRoot);o<=s;++o)l[o]&&(r=K(null,n,o),r&&(l[o].$=r,te(i,r,t)))},X=(e,t,n)=>{for(let l=t;l<=n;++l){const t=e[l];if(t){const e=t.$;ee(t),e&&e.remove()}}},Y=(e,t,n=!1)=>e.p===t.p&&(!!n||e.m===t.m),Z=(e,t,n=!1)=>{const l=t.$=e.$,o=e.h,s=t.h,r=t.i;null===r?(("slot"!==t.p||I)&&z(e,t,J),null!==o&&null!==s?((e,t,n,l,o=!1)=>{let s,r,i=0,c=0,u=0,a=0,f=t.length-1,h=t[0],d=t[f],m=l.length-1,p=l[0],y=l[m];for(;i<=f&&c<=m;)if(null==h)h=t[++i];else if(null==d)d=t[--f];else if(null==p)p=l[++c];else if(null==y)y=l[--m];else if(Y(h,p,o))Z(h,p,o),h=t[++i],p=l[++c];else if(Y(d,y,o))Z(d,y,o),d=t[--f],y=l[--m];else if(Y(h,y,o))Z(h,y,o),te(e,h.$,d.$.nextSibling),h=t[++i],y=l[--m];else if(Y(d,p,o))Z(d,p,o),te(e,d.$,h.$),d=t[--f],p=l[++c];else{for(u=-1,a=i;a<=f;++a)if(t[a]&&null!==t[a].m&&t[a].m===p.m){u=a;break}u>=0?(r=t[u],r.p!==p.p?s=K(t&&t[c],n,u):(Z(r,p,o),t[u]=void 0,s=r.$),p=l[++c]):(s=K(t&&t[c],n,c),p=l[++c]),s&&te(h.$.parentNode,s,h.$)}i>f?Q(e,null==l[m+1]?null:l[m+1].$,n,l,c,m):c>m&&X(t,i,f)})(l,o,t,s,n):null!==s?(null!==e.i&&(l.textContent=""),Q(l,null,t,s,0,s.length-1)):null!==o&&X(o,0,o.length-1)):e.i!==r&&(l.data=r)},ee=e=>{e.u&&e.u.ref&&e.u.ref(null),e.h&&e.h.map(ee)},te=(e,t,n)=>null==e?void 0:e.insertBefore(t,n),ne=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},le=(e,t)=>{if(e.l|=16,!(4&e.l))return ne(e,e.j),g((()=>oe(e,t)));e.l|=512},oe=(e,t)=>{const n=e.t;if(!n)throw Error(`Can't render component <${e.$hostElement$.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return t&&(e.l|=256,e.k&&(e.k.map((([e,t])=>fe(n,e,t))),e.k=void 0),l=fe(n,"componentWillLoad")),se(l,(()=>ie(e,n,t)))},se=(e,t)=>re(e)?e.then(t).catch((e=>{console.error(e),t()})):t(),re=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,ie=async(e,t,n)=>{var l;const o=e.$hostElement$,s=o["s-rc"];n&&(e=>{const t=e.O,n=e.$hostElement$,l=t.l,o=((e,t)=>{var n;const l=F(t),o=i.get(l);if(e=11===e.nodeType?e:a,o)if("string"==typeof o){let s,r=D.get(e=e.head||e);if(r||D.set(e,r=new Set),!r.has(l)){{s=a.createElement("style"),s.innerHTML=o;const t=null!=(n=f.C)?n:k(a);null!=t&&s.setAttribute("nonce",t),e.insertBefore(s,e.querySelector("link"))}4&t.l&&(s.innerHTML+=c),r&&r.add(l)}}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o]);return l})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);ce(e,t,o,n),s&&(s.map((e=>e())),o["s-rc"]=void 0);{const t=null!=(l=o["s-p"])?l:[],n=()=>ue(e);0===t.length?n():(Promise.all(t).then(n),e.l|=4,t.length=0)}},ce=(e,t,n,l)=>{try{t=t.render(),e.l&=-17,e.l|=2,((e,t,n=!1)=>{const l=e.$hostElement$,o=e.O,s=e.M||T(null,null),r=(e=>e&&e.p===A)(t)?t:R(null,null,t);if(x=l.tagName,o.P&&(r.u=r.u||{},o.P.map((([e,t])=>r.u[t]=l[e]))),n&&r.u)for(const e of Object.keys(r.u))l.hasAttribute(e)&&!["key","ref","style","class"].includes(e)&&(r.u[e]=l[e]);r.p=null,r.l|=4,e.M=r,r.$=s.$=l.shadowRoot||l,M=l["s-sc"],I=!!(1&o.l),Z(s,r,n)})(e,t,l)}catch(t){s(t,e.$hostElement$)}return null},ue=e=>{const t=e.$hostElement$,n=e.t,l=e.j;64&e.l||(e.l|=64,he(t),fe(n,"componentDidLoad"),e.L(t),l||ae()),e.S&&(e.S(),e.S=void 0),512&e.l&&w((()=>le(e,!1))),e.l&=-517},ae=()=>{he(a.documentElement),w((()=>W(u,"appload",{detail:{namespace:"lottery-order-summary"}})))},fe=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){s(e)}},he=e=>e.classList.add("hydrated"),de=(e,t,l)=>{var o,r;const i=e.prototype;if(t.R||t.T||e.watchers){e.watchers&&!t.T&&(t.T=e.watchers);const c=Object.entries(null!=(o=t.R)?o:{});if(c.map((([e,[o]])=>{(31&o||2&l&&32&o)&&Object.defineProperty(i,e,{get(){return((e,t)=>n(this).A.get(t))(0,e)},set(l){((e,t,l,o)=>{const r=n(e);if(!r)throw Error(`Couldn't find host element for "${o.v}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const i=r.$hostElement$,c=r.A.get(t),u=r.l,a=r.t;if(l=((e,t)=>null==e||j(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?e+"":e)(l,o.R[t][0]),(!(8&u)||void 0===c)&&l!==c&&(!Number.isNaN(c)||!Number.isNaN(l))&&(r.A.set(t,l),a)){if(o.T&&128&u){const e=o.T[t];e&&e.map((e=>{try{a[e](l,c,t)}catch(e){s(e,i)}}))}2==(18&u)&&le(r,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0})})),1&l){const l=new Map;i.attributeChangedCallback=function(e,o,s){f.jmp((()=>{var r;const c=l.get(e);if(this.hasOwnProperty(c))s=this[c],delete this[c];else{if(i.hasOwnProperty(c)&&"number"==typeof this[c]&&this[c]==s)return;if(null==c){const l=n(this),i=null==l?void 0:l.l;if(i&&!(8&i)&&128&i&&s!==o){const n=l.t,i=null==(r=t.T)?void 0:r[e];null==i||i.forEach((t=>{null!=n[t]&&n[t].call(n,s,o,e)}))}return}}this[c]=(null!==s||"boolean"!=typeof this[c])&&s}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(r=t.T)?r:{}),...c.filter((([e,t])=>15&t[0])).map((([e,n])=>{var o;const s=n[1]||e;return l.set(s,e),512&n[0]&&(null==(o=t.P)||o.push([e,s])),s}))]))}}return e},me=e=>{fe(e,"disconnectedCallback")},pe=(e,l={})=>{var o;const h=[],m=l.exclude||[],p=u.customElements,y=a.head,$=y.querySelector("meta[charset]"),v=a.createElement("style"),b=[];let w,g=!0;Object.assign(f,l),f.o=new URL(l.resourcesUrl||"./",a.baseURI).href;let S=!1;if(e.map((e=>{e[1].map((l=>{var o;const c={l:l[0],v:l[1],R:l[2],N:l[3]};4&c.l&&(S=!0),c.R=l[2],c.N=l[3],c.P=[],c.T=null!=(o=l[4])?o:{};const u=c.v,a=class extends HTMLElement{constructor(e){if(super(e),this.hasRegisteredEventListeners=!1,((e,n)=>{const l={l:0,$hostElement$:e,O:n,A:new Map};l.U=new Promise((e=>l.L=e)),e["s-p"]=[],e["s-rc"]=[],t.set(e,l)})(e=this,c),1&c.l)if(e.shadowRoot){if("open"!==e.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${c.v}! Mode is set to ${e.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else e.attachShadow({mode:"open"})}connectedCallback(){const e=n(this);this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0,ye(this,e,c.N)),w&&(clearTimeout(w),w=null),g?b.push(this):f.jmp((()=>(e=>{if(!(1&f.l)){const t=n(e),l=t.O,o=()=>{};if(1&t.l)ye(e,t,l.N),(null==t?void 0:t.t)||(null==t?void 0:t.U)&&t.U.then((()=>{}));else{t.l|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){ne(t,t.j=n);break}}l.R&&Object.entries(l.R).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n)=>{let l;if(!(32&t.l)){if(t.l|=32,n.W){const e=(e=>{const t=e.v.replace(/-/g,"_"),n=e.W;if(!n)return;const l=r.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(r.set(n,e),e[t])),s)
|
|
2
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(n);if(e&&"then"in e){const t=()=>{};l=await e,t()}else l=e;if(!l)throw Error(`Constructor for "${n.v}#${t.D}" was not found`);l.isProxied||(n.T=l.watchers,de(l,n,2),l.isProxied=!0);const o=()=>{};t.l|=8;try{new l(t)}catch(e){s(e)}t.l&=-9,t.l|=128,o()}else l=e.constructor,customElements.whenDefined(e.localName).then((()=>t.l|=128));if(l&&l.style){let e;"string"==typeof l.style&&(e=l.style);const t=F(n);if(!i.has(t)){const l=()=>{};((e,t,n)=>{let l=i.get(e);d&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=t:l.replaceSync(t)):l=t,i.set(e,l)})(t,e,!!(1&n.l)),l()}}}const o=t.j,c=()=>le(t,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(e,t,l)}o()}})(this)))}disconnectedCallback(){f.jmp((()=>(async()=>{if(!(1&f.l)){const e=n(this);e.F&&(e.F.map((e=>e())),e.F=void 0),(null==e?void 0:e.t)?me(e.t):(null==e?void 0:e.U)&&e.U.then((()=>me(e.t)))}})()))}componentOnReady(){return n(this).U}};c.W=e[0],m.includes(u)||p.get(u)||(h.push(u),p.define(u,de(a,c,1)))}))})),h.length>0&&(S&&(v.textContent+=c),v.textContent+=h.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",v.innerHTML.length)){v.setAttribute("data-styles","");const e=null!=(o=f.C)?o:k(a);null!=e&&v.setAttribute("nonce",e),y.insertBefore(v,$?$.nextSibling:y.firstChild)}g=!1,b.length?b.map((e=>e.connectedCallback())):f.jmp((()=>w=setTimeout(ae,30)))},ye=(e,t,n)=>{n&&n.map((([n,l,o])=>{const s=ve(e,n),r=$e(t,o),i=be(n);f.ael(s,l,r,i),(t.F=t.F||[]).push((()=>f.rel(s,l,r,i)))}))},$e=(e,t)=>n=>{var l;try{256&e.l?null==(l=e.t)||l[t](n):(e.k=e.k||[]).push([t,n])}catch(e){s(e)}},ve=(e,t)=>8&t?u:e,be=e=>({passive:!!(1&e),capture:!!(2&e)}),we=e=>f.C=e;export{pe as b,U as c,N as g,R as h,h as p,l as r,we as s}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{L as LotteryOrderSummary}from"./lottery-order-summary-1c477f07.js";import"./index-8e69c8be.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as o,g as r}from"./index-8e69c8be.js";import{s as e,a as n,b as i}from"./lottery-order-summary-1c477f07.js";export{L as lottery_order_summary}from"./lottery-order-summary-1c477f07.js";const a=["ro","en","fr","ar","hr","zh"],l={en:{loading:"Loading"},ro:{},fr:{},ar:{},hr:{}},s=class{constructor(o){t(this,o),this.handleClick=t=>{if(this.disabled)return;const o=this.host.shadowRoot.querySelector(".btn");if(!o)return;const r=o.getBoundingClientRect(),e=Math.max(r.width,r.height),n={top:t.clientY-r.top-e/2,left:t.clientX-r.left-e/2,size:e};this.ripples=[...this.ripples,n],setTimeout((()=>{this.ripples=this.ripples.filter((t=>t!==n))}),600)},this.variant="primary",this.size="medium",this.color=void 0,this.disabled=!1,this.loading=!1,this.text=void 0,this.mbSource=void 0,this.language="en",this.clientStyling=void 0,this.clientStylingUrl=void 0,this.translationUrl="",this.ripples=[]}handleClientStylingChange(t,o){t!=o&&e(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,o){t!=o&&n(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,o){t!=o&&i(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription)}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}componentDidLoad(){this.stylingContainer&&(this.mbSource&&i(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription),this.clientStyling&&e(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&n(this.stylingContainer,this.clientStylingUrl))}componentWillLoad(){this.translationUrl&&(async t=>{if(t)try{const r=await fetch(t);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const e=await r.json();o=e,Object.keys(o).forEach((t=>{for(let r in o[t])l[t][r]=o[t][r]}))}catch(t){console.error("Failed to fetch or parse translations from URL:",t)}var o})(this.translationUrl)}render(){const{variant:t,disabled:r,size:e,color:n}=this,i=r||this.loading,s={};if(n)switch(t){case"primary":default:Object.assign(s,{backgroundColor:n,borderColor:n});break;case"outline":case"dashed":Object.assign(s,{color:n,borderColor:n});break;case"text":Object.assign(s,{color:n})}return o("button",{key:"aa74ad98c90e7548228557bf8a8d26b125d4a83a",class:{btn:!0,[`btn--${t}`]:!0,[`btn--${e}`]:!0,"btn--loading":this.loading},style:n?s:void 0,disabled:i,onClick:this.handleClick,ref:t=>this.stylingContainer=t},this.loading?o("div",{class:"loading-container"},o("span",{class:"content"},this.text||(()=>{const t=this.language;let o=l[void 0!==t&&a.includes(t)?t:"en"].loading;return o})()),o("span",{class:"spinner"})):o("span",{class:"content"},o("slot",{name:"icon-left"}),this.text||o("slot",null),o("slot",{name:"icon-right"})),o("div",{key:"302ea02be395bb24989d4abc040a513e23fa029a",class:"ripple-container"},this.ripples.map(((t,r)=>o("span",{key:r,class:"ripple",style:{top:`${t.top}px`,left:`${t.left}px`,width:`${t.size}px`,height:`${t.size}px`}})))))}get host(){return r(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};s.style=":host{display:inline-block}.btn{font:inherit;position:relative;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:var(--lottery-button-border-radius, 6px);font-weight:var(--lottery-button-font-weight, 500);cursor:pointer;outline:none;overflow:hidden;transition:var(--lottery-button-transition, background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s);user-select:none;-webkit-tap-highlight-color:transparent;box-shadow:var(--lottery-button-box-shadow, 0 2px 4px 0 rgba(0, 0, 0, 0.5))}.btn .content{position:relative;display:inline-flex;align-items:center;gap:var(--lottery-button-content-gap, 0.5em)}.btn .content ::slotted(span){display:inline-flex;align-items:center}.btn:hover:not(:disabled){box-shadow:var(--lottery-button-hover-box-shadow, 0 4px 8px 0 rgba(0, 0, 0, 0.5))}.btn:disabled{cursor:not-allowed;opacity:var(--lottery-button-disabled-opacity, 0.5)}.btn .loading-container{display:flex;align-items:center}.btn--loading{position:relative}.btn .spinner{display:inline-block;width:1em;height:1em;border:var(--lottery-button-spinner-border, 2px solid rgba(255, 255, 255, 0.3));border-radius:50%;border-top-color:var(--lottery-button-spinner-color, white);animation:spin 1s ease-in-out infinite;margin-left:0.5em;vertical-align:middle}.btn--small .spinner{width:0.8em;height:0.8em}.btn--large .spinner{width:1.2em;height:1.2em}@keyframes spin{to{transform:rotate(360deg)}}.btn--primary{background-color:var(--emw--color-primary, #0d196e);color:var(--emw--color-typography-inverse, #fff)}.btn--primary:hover:not(:disabled){background-color:var(--emw--color-primary-variant, #1367e7)}.btn--primary:active:not(:disabled){background-color:var(--lottery-button-primary-active-bg, #08104a)}.btn--outline .spinner,.btn--dashed .spinner,.btn--text .spinner{border-top-color:currentColor;border-color:var(--lottery-button-spinner-inverse-border-color, rgba(0, 0, 0, 0.2))}.btn--outline{background-color:var(--emw--color-background, #fff);border-color:var(--lottery-button-outline-border-color, #dcdcdc);color:var(--emw--color-typography, #000)}.btn--outline:hover:not(:disabled){background-color:var(--emw--color-background-tertiary, #ccc);border-color:var(--lottery-button-outline-hover-border-color, #a6a6a6)}.btn--outline:active:not(:disabled){background-color:var(--lottery-button-outline-active-bg, #e6e6e6)}.btn--dashed{background-color:transparent;border-style:dashed;border-color:var(--lottery-button-dashed-border-color, #dcdcdc);color:var(--lottery-button-dashed-color, #333)}.btn--dashed:hover:not(:disabled){border-color:var(--lottery-button-dashed-hover-border-color, #a6a6a6);color:var(--lottery-button-dashed-hover-color, #0052d9)}.btn--text{background-color:transparent;color:var(--lottery-button-text-color, #0052d9);border-color:transparent}.btn--text:hover:not(:disabled){background-color:var(--lottery-button-text-hover-bg, #f2f2f2)}.btn--text:active:not(:disabled){background-color:var(--lottery-button-text-active-bg, #e6e6e6)}.btn--custom-color:hover:not(:disabled){opacity:var(--lottery-button-custom-hover-opacity, 0.9)}.btn--custom-color:active:not(:disabled){opacity:var(--lottery-button-custom-active-opacity, 0.8)}.btn--small{height:var(--lottery-button-small-height, 28px);font-size:var(--lottery-button-small-font-size, 12px);padding:var(--lottery-button-small-padding, 0 12px)}.btn--medium{height:var(--lottery-button-medium-height, 34px);font-size:var(--lottery-button-medium-font-size, 14px);padding:var(--lottery-button-medium-padding, 0 18px)}.btn--large{height:var(--lottery-button-large-height, 40px);font-size:var(--lottery-button-large-font-size, 16px);padding:var(--lottery-button-large-padding, 0 24px)}.ripple-container{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;border-radius:inherit}.ripple{position:absolute;border-radius:50%;background-color:var(--lottery-button-ripple-light, rgba(255, 255, 255, 0.3));transform:scale(0);animation:ripple-animation 600ms linear}.btn--outline .ripple,.btn--dashed .ripple,.btn--text .ripple{background-color:var(--lottery-button-ripple-dark, rgba(0, 0, 0, 0.03))}@keyframes ripple-animation{to{transform:scale(4);opacity:0}}";export{s as lottery_button}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as r}from"./index-8e69c8be.js";const a="__WIDGET_GLOBAL_STYLE_CACHE__";function i(e,t){if(e){const r=document.createElement("style");r.innerHTML=t,e.appendChild(r)}}function o(e,t){if(!e||!t)return;const r=new URL(t);fetch(r.href).then((e=>e.text())).then((t=>{const r=document.createElement("style");r.innerHTML=t,e&&e.appendChild(r)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}function d(e,t,r,i=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!i)return r=function(e,t){const r=document.createElement("style");return window.emMessageBus.subscribe(t,(t=>{e&&(r.innerHTML=t,e.appendChild(r))}))}(e,t),r;window[a]||(window[a]={}),r=function(e,t){return window.emMessageBus.subscribe(t,(r=>{if(!e)return;const i=e.getRootNode(),o=window[a];let d=o[t]&&o[t].sheet;d?o[t].refCount=o[t].refCount+1:(d=new CSSStyleSheet,d.replaceSync(r),o[t]={sheet:d,refCount:1});const s=i.adoptedStyleSheets||[];s.includes(d)||(i.adoptedStyleSheets=[...s,d])}))}(e,t);const o=r.unsubscribe.bind(r);return r.unsubscribe=()=>{if(window[a][t]){const e=window[a][t];e.refCount>1?e.refCount=e.refCount-1:delete window[a][t]}o()},r}var s;!function(e){e.PURCHASED="Purchased",e.SETTLED="Settled",e.CANCELED="Canceled",e.ERROR="Error"}(s||(s={}));const n=class{constructor(r){e(this,r),this.orderSummarySubmit=t(this,"orderSummarySubmit",7),this.submitSuccess=t(this,"lotteryTicketSubmitSuccess",7),this.submitError=t(this,"lotteryTicketSubmitError",7),this.sessionExpired=t(this,"sessionExpired",7),this.endpoint=void 0,this.sessionId=void 0,this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.language="en",this.orderSummaryTitle=void 0,this.ticketsLabel=void 0,this.totalLabel=void 0,this.showColon=!0,this.showDivider=!1,this.submitDisabled=!1,this.submitButtonText=void 0,this.submitLoading=!1}handleClientStylingChange(e,t){e!=t&&i(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&o(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(e,t){e!=t&&d(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription)}componentDidLoad(){this.stylingContainer&&(this.mbSource&&d(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription),this.clientStyling&&i(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&o(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleLotteryTicketParamsReady(e){e.detail&&this.isValidTicketSubmitParam(e.detail)&&this.handleSubmitTickets(e.detail)}isValidTicketSubmitParam(e){return e&&e.playerId&&Array.isArray(e.tickets)&&e.tickets.length>0&&e.tickets.every((e=>this.isValidTicketParam(e)))}isValidTicketParam(e){return e&&void 0!==e.amount&&void 0!==e.multiplier&&void 0!==e.multiplierNum&&"boolean"==typeof e.quickPick&&void 0!==e.selection}async handleSubmitTickets(e){try{this.submitLoading=!0;const t=await function(e,t="GET",r=null,a={}){return new Promise(((i,o)=>{const d="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),s=Object.assign({"Content-Type":"application/json"},a);"GET"!==t&&"HEAD"!==t&&(s["X-Idempotency-Key"]=d);const n={method:t,headers:s,body:null};r&&"GET"!==t&&"HEAD"!==t?n.body=JSON.stringify(r):delete n.body,fetch(e,n).then((e=>e.ok?e.json():o(e))).then((e=>i(e))).catch((e=>o(e)))}))}(`${this.endpoint}/tickets`,"POST",e,{Authorization:`Bearer ${this.sessionId}`});t.tickets.every((e=>e.state===s.PURCHASED))?this.submitSuccess.emit({dataOrigin:t,status:200}):this.submitError.emit({message:"Failed to purchase ticket",dataOrigin:t,status:200})}catch(e){401===e.status&&this.sessionExpired.emit(),(e.status>300||!e.status)&&this.submitError.emit({dataOrigin:e,status:e.status||0})}finally{this.submitLoading=!1}}handleSubmit(){this.orderSummarySubmit.emit()}render(){return r("div",{key:"efdb1636656b63aec159e534475fd666769fd4ca",ref:e=>this.stylingContainer=e},r("div",{key:"6d4c031bc462d721e18b3e652724835ba8fd690a",class:"order-summary"},r("h3",{key:"16ce86d321b12b51bab202ab336d64968bf9ff89",class:"order-summary__title"},this.orderSummaryTitle),r("div",{key:"198532d79c47577006ac5d11f90394ccc513c329",class:"order-summary__ticket"},r("div",{key:"042e62b7d14a6edd406a14d617d17a1a113f5aae",class:"order-summary__ticket-info"},r("div",{key:"7e52751fb547ba8b8383456c520228b2b02f5753",class:"order-summary__ticket-label"},r("div",{key:"90684f3d39ba97a1abd9d8c63e2674b36e4b8678",class:"order-summary__ticket"},this.ticketsLabel),r("span",{key:"16b27f067a674f75fb14b50dcaaaa4c85eb7ebf2",class:"order-summary__colon"},this.showColon?":":null)),r("div",{key:"a197e3f00bc600a048b37f90ad3a8e37d57dbb13",class:"order-summary__details"},r("slot",{key:"2ae61d6ba689093da155390d7fe85c3c96bb8ba0",name:"orderSummaryTicketDetail"}))),this.showDivider&&r("hr",{key:"a27f9309ef46d2d99edc2dd24c1cbe61153548c8",class:"order-summary__divider"}),r("div",{key:"d7574288d92159b7f455c0ce610e0b44c6a5d5fb",class:"order-summary__ticket-info"},r("div",{key:"160290be8ee8267c24372fcccc0172fbde699e54",class:"order-summary__ticket-label"},r("div",{key:"2489842ef3993d180dbda4304d9bf0dd60c5179d",class:"order-summary__ticket"},this.totalLabel),r("span",{key:"f58319a518511ff51402e26d897ea60de1bf9dce",class:"order-summary__colon"},this.showColon?":":null)),r("span",{key:"7f01d9a780150d81e777702635d66aa04aa9b6da",class:"order-summary__details"},r("slot",{key:"f72248a4423c6edf89555d0c53d29cd0d4cedf7a",name:"orderSummaryTotalDetail"})))),r("slot",{key:"a5da30406e02ea7dbdbf1f37fc89106b08bd8d3d",name:"orderSummaryChoice"}),r("div",{key:"ed9429dd65495cea075910c5d41f0b9f7785cbb3",class:"order-summary__button-wrapper"},r("lottery-button",{key:"5a31daaeb0faad9127e5c383fc1196a6763278d1",onClick:this.handleSubmit.bind(this),loading:this.submitLoading,disabled:this.submitDisabled,text:this.submitButtonText}))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};n.style=":host{width:100%}.order-summary{width:100%;background:var(--emw--color-background, #fff);border-radius:var(--lottery-order-summary-border-radius, 8px);border:var(--lottery-order-summary-border, none);box-shadow:var(--lottery-order-summary-box-shadow, none);box-sizing:border-box}.order-summary__title{margin:var(--lottery-order-summary-title-margin, 0 0 30px 0);text-align:var(--lottery-order-summary-title-text-align, center);color:var(--emw--color-typography, #000);text-transform:uppercase;font-weight:var(--lottery-order-summary-title-font-weight, 700)}.order-summary__ticket-info{display:flex;align-items:center;margin-bottom:var(--lottery-order-summary-row-gap, 16px);gap:var(--lottery-order-summary-col-gap, 10px);color:var(--emw--color-typography, #000)}.order-summary__ticket-label{display:flex;flex-direction:row;align-items:center;width:var(--lottery-order-summary-label-width, 50px);max-width:var(--lottery-order-summary-label-max-width, 100%);flex-shrink:0}.order-summary__colon{margin-left:2px}.order-summary__ticket{font-weight:var(--lottery-order-summary-label-font-weight, 500);color:var(--emw--color-typography, #000);overflow-wrap:break-word}.order-summary__details{display:flex;align-items:center;color:var(--emw--color-typography, #000);font-weight:var(--lottery-order-summary-details-font-weight, 400)}.order-summary__divider{border:none;border-top:var(--lottery-order-summary-divider-border, 1px solid var(--emw--color-gray-100, #e6e6e6));margin:var(--lottery-order-summary-divider-margin, 20px 0)}.order-summary__button-wrapper{display:flex;justify-content:center;margin:var(--lottery-order-summary-button-wrapper-margin, 0);padding:var(--lottery-order-summary-button-wrapper-padding, 0)}";export{n as L,o as a,d as b,i as s}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,b as e}from"./index-8e69c8be.js";export{s as setNonce}from"./index-8e69c8be.js";import{g as l}from"./app-globals-0f993ce5.js";(()=>{const e=import.meta.url,l={};return""!==e&&(l.resourcesUrl=new URL(".",e).href),t(l)})().then((async t=>(await l(),e([["lottery-button_2",[[1,"lottery-order-summary",{endpoint:[513],sessionId:[513,"session-id"],mbSource:[513,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],language:[513],orderSummaryTitle:[1,"order-summary-title"],ticketsLabel:[1,"tickets-label"],totalLabel:[1,"total-label"],showColon:[4,"show-colon"],showDivider:[4,"show-divider"],submitDisabled:[4,"submit-disabled"],submitButtonText:[1,"submit-button-text"],submitLoading:[32]},[[8,"lotteryTicketParamsReady","handleLotteryTicketParamsReady"]],{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}],[1,"lottery-button",{variant:[513],size:[513],color:[513],disabled:[516],loading:[516],text:[513],mbSource:[513,"mb-source"],language:[513],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],ripples:[32]},null,{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}]]]],t))));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { sass } from "@stencil/sass";
|
|
2
|
+
export const config = {
|
|
3
|
+
namespace: 'lottery-order-summary',
|
|
4
|
+
taskQueue: 'async',
|
|
5
|
+
sourceMap: false,
|
|
6
|
+
minifyJs: true,
|
|
7
|
+
extras: {
|
|
8
|
+
experimentalImportInjection: true
|
|
9
|
+
},
|
|
10
|
+
plugins: [sass()],
|
|
11
|
+
outputTargets: [
|
|
12
|
+
{
|
|
13
|
+
type: 'www'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
type: 'docs-readme'
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { cleanPackageJsonStencil } from "../../../tools/plugins";
|
|
2
|
+
import { sass } from "@stencil/sass";
|
|
3
|
+
export const config = {
|
|
4
|
+
namespace: 'lottery-order-summary',
|
|
5
|
+
taskQueue: 'async',
|
|
6
|
+
sourceMap: false,
|
|
7
|
+
minifyJs: true,
|
|
8
|
+
hashFileNames: false,
|
|
9
|
+
extras: {
|
|
10
|
+
experimentalImportInjection: true
|
|
11
|
+
},
|
|
12
|
+
plugins: [cleanPackageJsonStencil(), sass()],
|
|
13
|
+
outputTargets: [
|
|
14
|
+
{
|
|
15
|
+
type: 'dist',
|
|
16
|
+
esmLoaderPath: '../loader'
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
};
|