@everymatrix/lottery-order-summary 0.1.62 → 0.1.63

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const lotteryOrderSummary = require('./lottery-order-summary-9c494983.js');
5
+ const lotteryOrderSummary = require('./lottery-order-summary-2b32ec84.js');
6
6
  require('./index-b1042ae5.js');
7
7
 
8
8
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b1042ae5.js');
6
- const lotteryOrderSummary = require('./lottery-order-summary-9c494983.js');
6
+ const lotteryOrderSummary = require('./lottery-order-summary-2b32ec84.js');
7
7
 
8
8
  const DEFAULT_LANGUAGE = 'en';
9
9
  const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
@@ -221,20 +221,28 @@ const LotteryOrderSummary = class {
221
221
  if (event.detail && this.isValidTicketSubmitParam(event.detail)) {
222
222
  this.handleSubmitTickets(event.detail);
223
223
  }
224
+ else {
225
+ const errorMessage = 'Invalid ticket data received before submission.';
226
+ console.error(errorMessage, event.detail);
227
+ this.submitError.emit({
228
+ message: errorMessage,
229
+ dataOrigin: event.detail,
230
+ status: 400 // Bad Request
231
+ });
232
+ }
224
233
  }
225
234
  isValidTicketSubmitParam(detail) {
226
235
  return (detail &&
227
- detail.playerId &&
228
236
  Array.isArray(detail.tickets) &&
229
237
  detail.tickets.length > 0 &&
230
238
  detail.tickets.every((ticket) => this.isValidTicketParam(ticket)));
231
239
  }
232
240
  isValidTicketParam(ticket) {
233
241
  return (ticket &&
242
+ ticket.gameName !== undefined &&
243
+ ticket.startingDrawId !== undefined &&
234
244
  ticket.amount !== undefined &&
235
- ticket.multiplier !== undefined &&
236
- ticket.multiplierNum !== undefined &&
237
- typeof ticket.quickPick === 'boolean' &&
245
+ ticket.currency !== undefined &&
238
246
  ticket.selection !== undefined);
239
247
  }
240
248
  async handleSubmitTickets(body) {
@@ -276,7 +284,7 @@ const LotteryOrderSummary = class {
276
284
  this.orderSummarySubmit.emit();
277
285
  }
278
286
  render() {
279
- return (index.h("div", { key: 'efdb1636656b63aec159e534475fd666769fd4ca', ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: '6d4c031bc462d721e18b3e652724835ba8fd690a', class: "order-summary" }, index.h("h3", { key: '16ce86d321b12b51bab202ab336d64968bf9ff89', class: "order-summary__title" }, this.orderSummaryTitle), index.h("div", { key: '198532d79c47577006ac5d11f90394ccc513c329', class: "order-summary__ticket" }, index.h("div", { key: '042e62b7d14a6edd406a14d617d17a1a113f5aae', class: "order-summary__ticket-info" }, index.h("div", { key: '7e52751fb547ba8b8383456c520228b2b02f5753', class: "order-summary__ticket-label" }, index.h("div", { key: '90684f3d39ba97a1abd9d8c63e2674b36e4b8678', class: "order-summary__ticket" }, this.ticketsLabel), index.h("span", { key: '16b27f067a674f75fb14b50dcaaaa4c85eb7ebf2', class: "order-summary__colon" }, this.showColon ? ':' : null)), index.h("div", { key: 'a197e3f00bc600a048b37f90ad3a8e37d57dbb13', class: "order-summary__details" }, index.h("slot", { key: '2ae61d6ba689093da155390d7fe85c3c96bb8ba0', name: "orderSummaryTicketDetail" }))), this.showDivider && index.h("hr", { key: 'a27f9309ef46d2d99edc2dd24c1cbe61153548c8', class: "order-summary__divider" }), index.h("div", { key: 'd7574288d92159b7f455c0ce610e0b44c6a5d5fb', class: "order-summary__ticket-info" }, index.h("div", { key: '160290be8ee8267c24372fcccc0172fbde699e54', class: "order-summary__ticket-label" }, index.h("div", { key: '2489842ef3993d180dbda4304d9bf0dd60c5179d', class: "order-summary__ticket" }, this.totalLabel), index.h("span", { key: 'f58319a518511ff51402e26d897ea60de1bf9dce', class: "order-summary__colon" }, this.showColon ? ':' : null)), index.h("span", { key: '7f01d9a780150d81e777702635d66aa04aa9b6da', class: "order-summary__details" }, index.h("slot", { key: 'f72248a4423c6edf89555d0c53d29cd0d4cedf7a', name: "orderSummaryTotalDetail" })))), index.h("slot", { key: 'a5da30406e02ea7dbdbf1f37fc89106b08bd8d3d', name: "orderSummaryChoice" }), index.h("div", { key: 'ed9429dd65495cea075910c5d41f0b9f7785cbb3', class: "order-summary__button-wrapper" }, index.h("lottery-button", { key: '5a31daaeb0faad9127e5c383fc1196a6763278d1', onClick: this.handleSubmit.bind(this), loading: this.submitLoading, disabled: this.submitDisabled, text: this.submitButtonText })))));
287
+ return (index.h("div", { key: 'bdab321b9336f47e16057d240b3226d7cba59b97', ref: (el) => (this.stylingContainer = el) }, index.h("div", { key: 'de7ffcc9f96d8c7cfc7bdb3a3c7225ee78c33483', class: "order-summary" }, index.h("h3", { key: '9500cd69a6eba0855d4981cdad8eaa91b9c98567', class: "order-summary__title" }, this.orderSummaryTitle), index.h("div", { key: 'ce29c82eef1d12bc63e94e4fa2d5474700860af2', class: "order-summary__ticket" }, index.h("div", { key: '9db79da17590c7f847f46c3b3b66489ea9a0e268', class: "order-summary__ticket-info" }, index.h("div", { key: '4b5a2df807aeb421cf3c1ebf33f410a92f39ccaf', class: "order-summary__ticket-label" }, index.h("div", { key: 'feb73e9f849d2e3d6b77e4c848657f27e6a82323', class: "order-summary__ticket" }, this.ticketsLabel), index.h("span", { key: '51f70dcdda2154d8ce97d8e1a7c0f61a6198afbb', class: "order-summary__colon" }, this.showColon ? ':' : null)), index.h("div", { key: '4fed2d63cd7a881c8844055fe1fde99c8c7aa9fb', class: "order-summary__details" }, index.h("slot", { key: '6a7969738546ee4aca81a075f6174556e78d2c31', name: "orderSummaryTicketDetail" }))), this.showDivider && index.h("hr", { key: '029803fa93960d5098a24d5ca18e77e14562b29f', class: "order-summary__divider" }), index.h("div", { key: '738096c5b605a97851dbf24a972d93d9533ad48b', class: "order-summary__ticket-info" }, index.h("div", { key: 'acd8a7f3e64c97f58c79f57a90143151c996abf8', class: "order-summary__ticket-label" }, index.h("div", { key: '44e6b29978ca4fc2b22ca9d95ee4facfc883f292', class: "order-summary__ticket" }, this.totalLabel), index.h("span", { key: '330a00a4b39e578a1b0d80211d2b68d44c5235c9', class: "order-summary__colon" }, this.showColon ? ':' : null)), index.h("span", { key: '294046815a62a80366458aade4ec5d5476577a93', class: "order-summary__details" }, index.h("slot", { key: '02d129ef0caf523ec0c9da34318df46d3b008376', name: "orderSummaryTotalDetail" })))), index.h("slot", { key: '9395396883f0594ad8db216a9aa9fa0aeff45c10', name: "orderSummaryChoice" }), index.h("div", { key: '462672abc490cde00fea90ea585f48875ca2ec47', class: "order-summary__button-wrapper" }, index.h("lottery-button", { key: '1885bee3570ce6b58d4ae1977c635f418485fdbe', onClick: this.handleSubmit.bind(this), loading: this.submitLoading, disabled: this.submitDisabled, text: this.submitButtonText })))));
280
288
  }
281
289
  static get watchers() { return {
282
290
  "clientStyling": ["handleClientStylingChange"],
@@ -52,20 +52,28 @@ export class LotteryOrderSummary {
52
52
  if (event.detail && this.isValidTicketSubmitParam(event.detail)) {
53
53
  this.handleSubmitTickets(event.detail);
54
54
  }
55
+ else {
56
+ const errorMessage = 'Invalid ticket data received before submission.';
57
+ console.error(errorMessage, event.detail);
58
+ this.submitError.emit({
59
+ message: errorMessage,
60
+ dataOrigin: event.detail,
61
+ status: 400 // Bad Request
62
+ });
63
+ }
55
64
  }
56
65
  isValidTicketSubmitParam(detail) {
57
66
  return (detail &&
58
- detail.playerId &&
59
67
  Array.isArray(detail.tickets) &&
60
68
  detail.tickets.length > 0 &&
61
69
  detail.tickets.every((ticket) => this.isValidTicketParam(ticket)));
62
70
  }
63
71
  isValidTicketParam(ticket) {
64
72
  return (ticket &&
73
+ ticket.gameName !== undefined &&
74
+ ticket.startingDrawId !== undefined &&
65
75
  ticket.amount !== undefined &&
66
- ticket.multiplier !== undefined &&
67
- ticket.multiplierNum !== undefined &&
68
- typeof ticket.quickPick === 'boolean' &&
76
+ ticket.currency !== undefined &&
69
77
  ticket.selection !== undefined);
70
78
  }
71
79
  async handleSubmitTickets(body) {
@@ -107,7 +115,7 @@ export class LotteryOrderSummary {
107
115
  this.orderSummarySubmit.emit();
108
116
  }
109
117
  render() {
110
- 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 })))));
118
+ return (h("div", { key: 'bdab321b9336f47e16057d240b3226d7cba59b97', ref: (el) => (this.stylingContainer = el) }, h("div", { key: 'de7ffcc9f96d8c7cfc7bdb3a3c7225ee78c33483', class: "order-summary" }, h("h3", { key: '9500cd69a6eba0855d4981cdad8eaa91b9c98567', class: "order-summary__title" }, this.orderSummaryTitle), h("div", { key: 'ce29c82eef1d12bc63e94e4fa2d5474700860af2', class: "order-summary__ticket" }, h("div", { key: '9db79da17590c7f847f46c3b3b66489ea9a0e268', class: "order-summary__ticket-info" }, h("div", { key: '4b5a2df807aeb421cf3c1ebf33f410a92f39ccaf', class: "order-summary__ticket-label" }, h("div", { key: 'feb73e9f849d2e3d6b77e4c848657f27e6a82323', class: "order-summary__ticket" }, this.ticketsLabel), h("span", { key: '51f70dcdda2154d8ce97d8e1a7c0f61a6198afbb', class: "order-summary__colon" }, this.showColon ? ':' : null)), h("div", { key: '4fed2d63cd7a881c8844055fe1fde99c8c7aa9fb', class: "order-summary__details" }, h("slot", { key: '6a7969738546ee4aca81a075f6174556e78d2c31', name: "orderSummaryTicketDetail" }))), this.showDivider && h("hr", { key: '029803fa93960d5098a24d5ca18e77e14562b29f', class: "order-summary__divider" }), h("div", { key: '738096c5b605a97851dbf24a972d93d9533ad48b', class: "order-summary__ticket-info" }, h("div", { key: 'acd8a7f3e64c97f58c79f57a90143151c996abf8', class: "order-summary__ticket-label" }, h("div", { key: '44e6b29978ca4fc2b22ca9d95ee4facfc883f292', class: "order-summary__ticket" }, this.totalLabel), h("span", { key: '330a00a4b39e578a1b0d80211d2b68d44c5235c9', class: "order-summary__colon" }, this.showColon ? ':' : null)), h("span", { key: '294046815a62a80366458aade4ec5d5476577a93', class: "order-summary__details" }, h("slot", { key: '02d129ef0caf523ec0c9da34318df46d3b008376', name: "orderSummaryTotalDetail" })))), h("slot", { key: '9395396883f0594ad8db216a9aa9fa0aeff45c10', name: "orderSummaryChoice" }), h("div", { key: '462672abc490cde00fea90ea585f48875ca2ec47', class: "order-summary__button-wrapper" }, h("lottery-button", { key: '1885bee3570ce6b58d4ae1977c635f418485fdbe', onClick: this.handleSubmit.bind(this), loading: this.submitLoading, disabled: this.submitDisabled, text: this.submitButtonText })))));
111
119
  }
112
120
  static get is() { return "lottery-order-summary"; }
113
121
  static get encapsulation() { return "shadow"; }
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { L as LotteryOrderSummary } from './lottery-order-summary-1c477f07.js';
1
+ export { L as LotteryOrderSummary } from './lottery-order-summary-3471596f.js';
2
2
  import './index-8e69c8be.js';
@@ -1,6 +1,6 @@
1
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';
2
+ import { s as setClientStyling, a as setClientStylingURL, b as setStreamStyling } from './lottery-order-summary-3471596f.js';
3
+ export { L as lottery_order_summary } from './lottery-order-summary-3471596f.js';
4
4
 
5
5
  const DEFAULT_LANGUAGE = 'en';
6
6
  const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr', 'zh'];
@@ -219,20 +219,28 @@ const LotteryOrderSummary = class {
219
219
  if (event.detail && this.isValidTicketSubmitParam(event.detail)) {
220
220
  this.handleSubmitTickets(event.detail);
221
221
  }
222
+ else {
223
+ const errorMessage = 'Invalid ticket data received before submission.';
224
+ console.error(errorMessage, event.detail);
225
+ this.submitError.emit({
226
+ message: errorMessage,
227
+ dataOrigin: event.detail,
228
+ status: 400 // Bad Request
229
+ });
230
+ }
222
231
  }
223
232
  isValidTicketSubmitParam(detail) {
224
233
  return (detail &&
225
- detail.playerId &&
226
234
  Array.isArray(detail.tickets) &&
227
235
  detail.tickets.length > 0 &&
228
236
  detail.tickets.every((ticket) => this.isValidTicketParam(ticket)));
229
237
  }
230
238
  isValidTicketParam(ticket) {
231
239
  return (ticket &&
240
+ ticket.gameName !== undefined &&
241
+ ticket.startingDrawId !== undefined &&
232
242
  ticket.amount !== undefined &&
233
- ticket.multiplier !== undefined &&
234
- ticket.multiplierNum !== undefined &&
235
- typeof ticket.quickPick === 'boolean' &&
243
+ ticket.currency !== undefined &&
236
244
  ticket.selection !== undefined);
237
245
  }
238
246
  async handleSubmitTickets(body) {
@@ -274,7 +282,7 @@ const LotteryOrderSummary = class {
274
282
  this.orderSummarySubmit.emit();
275
283
  }
276
284
  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 })))));
285
+ return (h("div", { key: 'bdab321b9336f47e16057d240b3226d7cba59b97', ref: (el) => (this.stylingContainer = el) }, h("div", { key: 'de7ffcc9f96d8c7cfc7bdb3a3c7225ee78c33483', class: "order-summary" }, h("h3", { key: '9500cd69a6eba0855d4981cdad8eaa91b9c98567', class: "order-summary__title" }, this.orderSummaryTitle), h("div", { key: 'ce29c82eef1d12bc63e94e4fa2d5474700860af2', class: "order-summary__ticket" }, h("div", { key: '9db79da17590c7f847f46c3b3b66489ea9a0e268', class: "order-summary__ticket-info" }, h("div", { key: '4b5a2df807aeb421cf3c1ebf33f410a92f39ccaf', class: "order-summary__ticket-label" }, h("div", { key: 'feb73e9f849d2e3d6b77e4c848657f27e6a82323', class: "order-summary__ticket" }, this.ticketsLabel), h("span", { key: '51f70dcdda2154d8ce97d8e1a7c0f61a6198afbb', class: "order-summary__colon" }, this.showColon ? ':' : null)), h("div", { key: '4fed2d63cd7a881c8844055fe1fde99c8c7aa9fb', class: "order-summary__details" }, h("slot", { key: '6a7969738546ee4aca81a075f6174556e78d2c31', name: "orderSummaryTicketDetail" }))), this.showDivider && h("hr", { key: '029803fa93960d5098a24d5ca18e77e14562b29f', class: "order-summary__divider" }), h("div", { key: '738096c5b605a97851dbf24a972d93d9533ad48b', class: "order-summary__ticket-info" }, h("div", { key: 'acd8a7f3e64c97f58c79f57a90143151c996abf8', class: "order-summary__ticket-label" }, h("div", { key: '44e6b29978ca4fc2b22ca9d95ee4facfc883f292', class: "order-summary__ticket" }, this.totalLabel), h("span", { key: '330a00a4b39e578a1b0d80211d2b68d44c5235c9', class: "order-summary__colon" }, this.showColon ? ':' : null)), h("span", { key: '294046815a62a80366458aade4ec5d5476577a93', class: "order-summary__details" }, h("slot", { key: '02d129ef0caf523ec0c9da34318df46d3b008376', name: "orderSummaryTotalDetail" })))), h("slot", { key: '9395396883f0594ad8db216a9aa9fa0aeff45c10', name: "orderSummaryChoice" }), h("div", { key: '462672abc490cde00fea90ea585f48875ca2ec47', class: "order-summary__button-wrapper" }, h("lottery-button", { key: '1885bee3570ce6b58d4ae1977c635f418485fdbe', onClick: this.handleSubmit.bind(this), loading: this.submitLoading, disabled: this.submitDisabled, text: this.submitButtonText })))));
278
286
  }
279
287
  static get watchers() { return {
280
288
  "clientStyling": ["handleClientStylingChange"],
@@ -1 +1 @@
1
- export{L as LotteryOrderSummary}from"./lottery-order-summary-1c477f07.js";import"./index-8e69c8be.js";
1
+ export{L as LotteryOrderSummary}from"./lottery-order-summary-3471596f.js";import"./index-8e69c8be.js";
@@ -1 +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}
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-3471596f.js";export{L as lottery_order_summary}from"./lottery-order-summary-3471596f.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 s(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 o(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(),s=window[a];let o=s[t]&&s[t].sheet;o?s[t].refCount=s[t].refCount+1:(o=new CSSStyleSheet,o.replaceSync(r),s[t]={sheet:o,refCount:1});const d=i.adoptedStyleSheets||[];d.includes(o)||(i.adoptedStyleSheets=[...d,o])}))}(e,t);const s=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]}s()},r}var d;!function(e){e.PURCHASED="Purchased",e.SETTLED="Settled",e.CANCELED="Canceled",e.ERROR="Error"}(d||(d={}));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&&s(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(e,t){e!=t&&o(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription)}componentDidLoad(){this.stylingContainer&&(this.mbSource&&o(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription),this.clientStyling&&i(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&s(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}handleLotteryTicketParamsReady(e){if(e.detail&&this.isValidTicketSubmitParam(e.detail))this.handleSubmitTickets(e.detail);else{const t="Invalid ticket data received before submission.";console.error(t,e.detail),this.submitError.emit({message:t,dataOrigin:e.detail,status:400})}}isValidTicketSubmitParam(e){return e&&Array.isArray(e.tickets)&&e.tickets.length>0&&e.tickets.every((e=>this.isValidTicketParam(e)))}isValidTicketParam(e){return e&&void 0!==e.gameName&&void 0!==e.startingDrawId&&void 0!==e.amount&&void 0!==e.currency&&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,s)=>{const o="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)})),d=Object.assign({"Content-Type":"application/json"},a);"GET"!==t&&"HEAD"!==t&&(d["X-Idempotency-Key"]=o);const n={method:t,headers:d,body:null};r&&"GET"!==t&&"HEAD"!==t?n.body=JSON.stringify(r):delete n.body,fetch(e,n).then((e=>e.ok?e.json():s(e))).then((e=>i(e))).catch((e=>s(e)))}))}(`${this.endpoint}/tickets`,"POST",e,{Authorization:`Bearer ${this.sessionId}`});t.tickets.every((e=>e.state===d.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:"bdab321b9336f47e16057d240b3226d7cba59b97",ref:e=>this.stylingContainer=e},r("div",{key:"de7ffcc9f96d8c7cfc7bdb3a3c7225ee78c33483",class:"order-summary"},r("h3",{key:"9500cd69a6eba0855d4981cdad8eaa91b9c98567",class:"order-summary__title"},this.orderSummaryTitle),r("div",{key:"ce29c82eef1d12bc63e94e4fa2d5474700860af2",class:"order-summary__ticket"},r("div",{key:"9db79da17590c7f847f46c3b3b66489ea9a0e268",class:"order-summary__ticket-info"},r("div",{key:"4b5a2df807aeb421cf3c1ebf33f410a92f39ccaf",class:"order-summary__ticket-label"},r("div",{key:"feb73e9f849d2e3d6b77e4c848657f27e6a82323",class:"order-summary__ticket"},this.ticketsLabel),r("span",{key:"51f70dcdda2154d8ce97d8e1a7c0f61a6198afbb",class:"order-summary__colon"},this.showColon?":":null)),r("div",{key:"4fed2d63cd7a881c8844055fe1fde99c8c7aa9fb",class:"order-summary__details"},r("slot",{key:"6a7969738546ee4aca81a075f6174556e78d2c31",name:"orderSummaryTicketDetail"}))),this.showDivider&&r("hr",{key:"029803fa93960d5098a24d5ca18e77e14562b29f",class:"order-summary__divider"}),r("div",{key:"738096c5b605a97851dbf24a972d93d9533ad48b",class:"order-summary__ticket-info"},r("div",{key:"acd8a7f3e64c97f58c79f57a90143151c996abf8",class:"order-summary__ticket-label"},r("div",{key:"44e6b29978ca4fc2b22ca9d95ee4facfc883f292",class:"order-summary__ticket"},this.totalLabel),r("span",{key:"330a00a4b39e578a1b0d80211d2b68d44c5235c9",class:"order-summary__colon"},this.showColon?":":null)),r("span",{key:"294046815a62a80366458aade4ec5d5476577a93",class:"order-summary__details"},r("slot",{key:"02d129ef0caf523ec0c9da34318df46d3b008376",name:"orderSummaryTotalDetail"})))),r("slot",{key:"9395396883f0594ad8db216a9aa9fa0aeff45c10",name:"orderSummaryChoice"}),r("div",{key:"462672abc490cde00fea90ea585f48875ca2ec47",class:"order-summary__button-wrapper"},r("lottery-button",{key:"1885bee3570ce6b58d4ae1977c635f418485fdbe",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,s as a,o as b,i as s}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/lottery-order-summary",
3
- "version": "0.1.62",
3
+ "version": "0.1.63",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
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}