@everymatrix/player-lugas-limit 1.63.2 → 1.64.0

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.
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["player-lugas-limit.cjs",[[1,"player-lugas-limit",{"userId":[1,"user-id"],"session":[1],"endpoint":[1],"currency":[1],"amount":[1],"lang":[1],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"mbSource":[1,"mb-source"],"translationUrl":[1,"translation-url"],"showCustomAmount":[32],"isLoading":[32],"hasErrors":[32],"inputValue":[32],"showInvalidInputError":[32],"predefinedAmountsArray":[32],"isWithinRange":[32],"minimumRange":[32],"selectedPredefinedAmount":[32],"errorMessage":[32],"wasSubmitted":[32],"minAmount":[32],"maxAmount":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"]}]]]], options);
11
+ return index.bootstrapLazy([["player-lugas-limit.cjs",[[1,"player-lugas-limit",{"userId":[1,"user-id"],"session":[1],"endpoint":[1],"currency":[1],"amount":[1],"lang":[1],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"mbSource":[1,"mb-source"],"translationUrl":[1,"translation-url"],"isLoading":[32],"showCustomAmount":[32],"isSubmitted":[32],"isUseExistingLimitOptionActive":[32],"selectedPredefinedAmount":[32],"errorMessageOnInitialization":[32],"errorMessageOnSubmit":[32],"errorMessageOnInput":[32],"newAmount":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -139,57 +139,36 @@ function setStreamStyling(stylingContainer, domain, subscription) {
139
139
  }
140
140
  }
141
141
 
142
- const playerLugasLimitCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");\n:host {\n font-family: \"Roboto\", sans-serif;\n}\n\n.ModalContainer {\n position: absolute;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: var(--emw--font-size-small, 12px);\n container-type: inline-size;\n}\n.ModalContainer hr {\n border: 1px solid rgba(0, 0, 0, 0.1);\n margin: 10px 0px;\n}\n.ModalContainer p {\n margin: 0;\n}\n.ModalContainer button {\n width: 100%;\n border: 1px solid var(--emw--color-gray-100, #E8E9EB);\n padding: 10px 0;\n cursor: pointer;\n width: 100%;\n border-radius: var(--emw--border-radius-small, 4px);\n}\n.ModalContainer button.PrimaryButton {\n background: var(--emw--color-primary, #6BB816);\n border: none;\n font-weight: 500;\n}\n.ModalContainer button.PrimaryButton:not(:disabled) {\n color: var(--emw--color-white, #FFF);\n}\n.ModalContainer .Container {\n position: fixed;\n top: 30vh;\n width: 320px;\n background: var(--emw--color-white, #fff);\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n transform: scale(1.1);\n border-radius: 4px;\n overflow: hidden;\n}\n.ModalContainer .ValidatorContainer {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n}\n.ModalContainer .Paragraphs:not(:last-child) {\n margin-bottom: 20px;\n}\n.ModalContainer .ModalHeader {\n display: flex;\n justify-content: space-between;\n align-items: center;\n background-color: var(--emw--color-gray-50, #F7F8FA);\n padding: 12px;\n}\n.ModalContainer .ModalHeader h2 {\n font-weight: bold;\n font-size: var(--emw--font-size-small, 12px);\n margin: 0;\n}\n.ModalContainer .ModalBody {\n background: var(--emw--color-white, #FFF);\n padding: 12px;\n container-type: inline-size;\n border-radius: 4px;\n}\n.ModalContainer .ModalBody .ErrorContainer {\n display: flex;\n align-items: center;\n color: var(--emw--color-red-100, #E10014);\n border-bottom: 1px solid var(--emw--color-gray-100, #E8E9EB);\n margin: -12px;\n padding: 12px;\n margin-bottom: 12px;\n font-weight: bold;\n position: relative;\n background: linear-gradient(180deg, var(--emw--color-gray-100, #E8E9EB) 0%, rgba(255, 255, 255, 0.47) 30%);\n}\n.ModalContainer .ModalBody .DismissError {\n position: absolute;\n right: 12px;\n cursor: pointer;\n}\n.ModalContainer .ModalBody .ErrorParagraph {\n display: flex;\n align-items: center;\n}\n.ModalContainer .ModalBody .ErrorIcon {\n background: linear-gradient(180deg, var(--emw--color-red-100, #E10014) 0%, var(--emw--color-red-150, #D60080) 100%);\n text-align: center;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n margin-right: 6px;\n}\n.ModalContainer .ModalBody .ErrorIcon svg {\n width: 6px;\n height: 6px;\n}\n.ModalContainer .ModalBody .ErrorIcon svg path {\n fill: var(--emw--color-white, #FFF);\n}\n.ModalContainer .ModalBody .ChooseLimitLabel {\n text-transform: uppercase;\n}\n.ModalContainer .ModalBody .LimitAmountWrapper {\n display: flex;\n flex-direction: column;\n gap: 10px;\n position: relative;\n}\n.ModalContainer .ModalBody .PredefinedAmounts {\n display: flex;\n justify-content: space-between;\n}\n.ModalContainer .ModalBody .PredefinedAmounts button {\n background: none;\n margin: -1px 0 0 -1px;\n color: var(--emw--color-gray-150, #808080);\n}\n.ModalContainer .ModalBody .PredefinedAmounts button.Active {\n font-weight: bold;\n background: var(--emw--color-gray-50, #F7F8FA);\n color: var(--emw--color-gray-200, #323233);\n}\n.ModalContainer .ModalBody .PredefinedAmounts button:first-child {\n border-radius: 4px 0 0 4px;\n}\n.ModalContainer .ModalBody .PredefinedAmounts button:last-child {\n border-radius: 0 4px 4px 0;\n}\n.ModalContainer .ModalBody .CustomAmountInput {\n width: 100%;\n padding: 10px;\n border: 1px solid var(--emw--color-gray-100, #E8E9EB);\n border-radius: 4px;\n box-sizing: border-box;\n margin-bottom: 6px;\n color: var(--emw--color-gray-200, #323233);\n font-weight: bold;\n}\n.ModalContainer .ModalBody .CustomAmountInput.InvalidInput {\n border: 1px solid var(--emw--color-red, #FF0000);\n}\n.ModalContainer .ModalBody .InvalidParagraph {\n font-size: var(--emw--font-size-small, 12px);\n color: var(--emw--color-red, #FF0000);\n}\n.ModalContainer .ModalBody .SetLimitBtn {\n margin-top: 10px;\n}\n.ModalContainer .ModalFooter {\n padding-top: 12px;\n margin: 5px 0px;\n}\n.ModalContainer .Link {\n color: inherit;\n text-decoration: underline;\n cursor: pointer;\n}\n.ModalContainer .PrivacyNote {\n font-size: var(--emw--font-size-x-small, 10px);\n font-style: italic;\n}\n.ModalContainer .ExistingLimit {\n margin-bottom: 15px;\n}\n\ninput {\n /* Firefox */\n -moz-appearance: textfield;\n /* Chrome, Safari, Edge, Opera */\n}\ninput::-webkit-outer-spin-button, input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\n@container (max-width: 1300px) {\n .ModalContainer .Container {\n width: 50%;\n }\n}\n@container (max-width: 800px) {\n .ModalContainer .Container {\n width: 70%;\n }\n}\n.LoadingWrapper {\n width: 100%;\n height: 100%;\n background: rgba(255, 255, 255, 0.8);\n position: absolute;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.spinner {\n animation: rotate 2s linear infinite;\n z-index: 2;\n width: 30px;\n height: 30px;\n}\n.spinner .path {\n stroke: var(--emw--color-primary, #6BB816);\n stroke-linecap: round;\n animation: dash 1.5s ease-in-out infinite;\n}\n\n@keyframes rotate {\n 100% {\n transform: rotate(360deg);\n }\n}\n@keyframes dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n}";
142
+ const playerLugasLimitCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");\n:host {\n font-family: \"Roboto\", sans-serif;\n}\n\n.ModalContainer {\n position: absolute;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: var(--emw--font-size-small, 12px);\n container-type: inline-size;\n}\n.ModalContainer hr {\n border: 1px solid rgba(0, 0, 0, 0.1);\n margin: 10px 0px;\n}\n.ModalContainer p {\n margin: 0;\n}\n.ModalContainer button {\n width: 100%;\n border: 1px solid var(--emw--color-gray-100, #E8E9EB);\n padding: 10px 0;\n cursor: pointer;\n width: 100%;\n border-radius: var(--emw--border-radius-small, 4px);\n}\n.ModalContainer button.PrimaryButton {\n background: var(--emw--color-primary, #6BB816);\n border: none;\n font-weight: 500;\n}\n.ModalContainer button.PrimaryButton:not(:disabled) {\n color: var(--emw--color-white, #FFF);\n}\n.ModalContainer button.PrimaryButton:disabled {\n cursor: default;\n}\n.ModalContainer .Container {\n position: fixed;\n top: 30vh;\n width: 320px;\n background: var(--emw--color-white, #fff);\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n transform: scale(1.1);\n border-radius: 4px;\n overflow: hidden;\n}\n.ModalContainer .ValidatorContainer {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n}\n.ModalContainer .Paragraphs:not(:last-child) {\n margin-bottom: 20px;\n}\n.ModalContainer .ModalHeader {\n display: flex;\n justify-content: space-between;\n align-items: center;\n background-color: var(--emw--color-gray-50, #F7F8FA);\n padding: 12px;\n}\n.ModalContainer .ModalHeader h2 {\n font-weight: bold;\n font-size: var(--emw--font-size-small, 12px);\n margin: 0;\n}\n.ModalContainer .ModalBody {\n background: var(--emw--color-white, #FFF);\n padding: 12px;\n container-type: inline-size;\n border-radius: 4px;\n}\n.ModalContainer .ModalBody .ErrorContainer {\n display: flex;\n align-items: center;\n color: var(--emw--color-red-100, #E10014);\n border-bottom: 1px solid var(--emw--color-gray-100, #E8E9EB);\n margin: -12px;\n padding: 12px;\n margin-bottom: 12px;\n font-weight: bold;\n position: relative;\n background: linear-gradient(180deg, var(--emw--color-gray-100, #E8E9EB) 0%, rgba(255, 255, 255, 0.47) 30%);\n}\n.ModalContainer .ModalBody .DismissError {\n position: absolute;\n right: 12px;\n cursor: pointer;\n}\n.ModalContainer .ModalBody .ErrorParagraph {\n display: flex;\n align-items: center;\n}\n.ModalContainer .ModalBody .ErrorIcon {\n background: linear-gradient(180deg, var(--emw--color-red-100, #E10014) 0%, var(--emw--color-red-150, #D60080) 100%);\n text-align: center;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n margin-right: 6px;\n}\n.ModalContainer .ModalBody .ErrorIcon svg {\n width: 6px;\n height: 6px;\n}\n.ModalContainer .ModalBody .ErrorIcon svg path {\n fill: var(--emw--color-white, #FFF);\n}\n.ModalContainer .ModalBody .ChooseLimitLabel {\n text-transform: uppercase;\n}\n.ModalContainer .ModalBody .LimitAmountWrapper {\n display: flex;\n flex-direction: column;\n gap: 10px;\n position: relative;\n}\n.ModalContainer .ModalBody .PredefinedAmounts {\n display: flex;\n justify-content: space-between;\n}\n.ModalContainer .ModalBody .PredefinedAmounts button {\n background: none;\n margin: -1px 0 0 -1px;\n color: var(--emw--color-gray-150, #808080);\n}\n.ModalContainer .ModalBody .PredefinedAmounts button.Active {\n font-weight: bold;\n background: var(--emw--color-gray-50, #F7F8FA);\n color: var(--emw--color-gray-200, #323233);\n}\n.ModalContainer .ModalBody .PredefinedAmounts button:first-child {\n border-radius: 4px 0 0 4px;\n}\n.ModalContainer .ModalBody .PredefinedAmounts button:last-child {\n border-radius: 0 4px 4px 0;\n}\n.ModalContainer .ModalBody .CustomAmountInput {\n width: 100%;\n padding: 10px;\n border: 1px solid var(--emw--color-gray-100, #E8E9EB);\n border-radius: 4px;\n box-sizing: border-box;\n margin-bottom: 6px;\n color: var(--emw--color-gray-200, #323233);\n font-weight: bold;\n}\n.ModalContainer .ModalBody .CustomAmountInput.InvalidInput {\n border: 1px solid var(--emw--color-red, #FF0000);\n}\n.ModalContainer .ModalBody .InvalidParagraph {\n font-size: var(--emw--font-size-small, 12px);\n color: var(--emw--color-red, #FF0000);\n}\n.ModalContainer .ModalBody .SetLimitBtn {\n margin-top: 10px;\n}\n.ModalContainer .ModalFooter {\n padding-top: 12px;\n margin: 5px 0px;\n}\n.ModalContainer .Link {\n color: inherit;\n text-decoration: underline;\n cursor: pointer;\n}\n.ModalContainer .Link.Inactive {\n cursor: default;\n color: var(--emw--color-gray-150, #808080);\n}\n.ModalContainer .PrivacyNote {\n font-size: var(--emw--font-size-x-small, 10px);\n font-style: italic;\n}\n.ModalContainer .ExistingLimit {\n margin-bottom: 15px;\n}\n\ninput {\n /* Firefox */\n -moz-appearance: textfield;\n /* Chrome, Safari, Edge, Opera */\n}\ninput::-webkit-outer-spin-button, input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\n@container (max-width: 1300px) {\n .ModalContainer .Container {\n width: 50%;\n }\n}\n@container (max-width: 800px) {\n .ModalContainer .Container {\n width: 70%;\n }\n}\n.LoadingWrapper {\n width: 100%;\n height: 100%;\n background: rgba(255, 255, 255, 0.8);\n position: absolute;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.spinner {\n animation: rotate 2s linear infinite;\n z-index: 2;\n width: 30px;\n height: 30px;\n}\n.spinner .path {\n stroke: var(--emw--color-primary, #6BB816);\n stroke-linecap: round;\n animation: dash 1.5s ease-in-out infinite;\n}\n\n@keyframes rotate {\n 100% {\n transform: rotate(360deg);\n }\n}\n@keyframes dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n}";
143
143
  const PlayerLugasLimitStyle0 = playerLugasLimitCss;
144
144
 
145
145
  const PlayerLugasLimit = class {
146
146
  constructor(hostRef) {
147
147
  index.registerInstance(this, hostRef);
148
148
  this.closeLugasModal = index.createEvent(this, "closeLugasModal", 7);
149
+ /** Array of predefined limit amounts */
150
+ this.predefinedAmounts = [];
151
+ /** Displayed currency */
152
+ this.displayedCurrency = '';
149
153
  /**
150
- * Fetches and applies client styling from a URL
151
- */
152
- this.setClientStyling = () => {
153
- const sheet = document.createElement('style');
154
- sheet.innerHTML = this.clientStyling;
155
- this.stylingContainer.prepend(sheet);
156
- };
157
- /**
158
- * Fetches and applies client styling from a URL
159
- */
160
- this.setClientStylingURL = () => {
161
- const url = new URL(this.clientStylingUrl);
162
- const cssFile = document.createElement('style');
163
- fetch(url.href)
164
- .then((res) => res.text())
165
- .then((data) => {
166
- cssFile.innerHTML = data;
167
- setTimeout(() => {
168
- this.stylingContainer.prepend(cssFile);
169
- }, 1);
170
- })
171
- .catch((err) => {
172
- console.log('error ', err);
173
- });
174
- };
175
- /**
176
- * Posts the player's limit situation to the API.
154
+ * Submits the new monthly deposit limit set by the player
177
155
  * @param userAmount - User-defined amount
178
156
  * @param keepLimit - Whether to keep the current limit
179
157
  * @param initialNewLimit - Whether the limit is being set initially
180
158
  */
181
- this.postPlayerSituation = (userAmount, keepLimit = false, initialNewLimit = false) => {
182
- this.wasSubmitted = true;
183
- this.errorMessage = '';
159
+ this.submitMonthlyDepositLimit = (amount, keepLimit = false, initialNewLimit = false) => {
160
+ if (keepLimit && !this.isUseExistingLimitOptionActive) {
161
+ return;
162
+ }
163
+ this.isSubmitted = true;
164
+ this.errorMessageOnSubmit = '';
184
165
  const url = new URL(`${this.endpoint}v2/player/${this.userId}/limit/lugas`);
185
- const roleLimitAmount = initialNewLimit ? this.amount : 0;
186
- const bodyDraft = {
166
+ const roleLimitAmount = initialNewLimit ? this.newAmount : 0;
167
+ const body = {
168
+ amount,
187
169
  keepLimit,
188
170
  roleLimitAmount
189
171
  };
190
- if (userAmount) {
191
- bodyDraft['amount'] = `${userAmount}`;
192
- }
193
172
  const options = {
194
173
  method: 'POST',
195
174
  headers: {
@@ -198,7 +177,7 @@ const PlayerLugasLimit = class {
198
177
  'Content-Type': 'application/json',
199
178
  'Authorization': `Bearer ${this.session}`
200
179
  },
201
- body: JSON.stringify(bodyDraft)
180
+ body: JSON.stringify(body)
202
181
  };
203
182
  fetch(url.href, options)
204
183
  .then(async (res) => {
@@ -207,10 +186,13 @@ const PlayerLugasLimit = class {
207
186
  throw errorResponse; // Throw the error response to handle later
208
187
  }
209
188
  this.closeLugasModal.emit();
210
- return res.json();
211
189
  })
212
190
  .catch((err) => {
213
191
  var _a;
192
+ this.errorMessageOnSubmit = translate('LugasNotSet', this.lang);
193
+ if (keepLimit) {
194
+ this.isUseExistingLimitOptionActive = false;
195
+ }
214
196
  // Check for specific error structure
215
197
  if (err.errorCode === 3 && err.errorSourceName === "GmLegislation") {
216
198
  console.error(err.error, (_a = err.thirdPartyResponse) === null || _a === void 0 ? void 0 : _a.message);
@@ -218,10 +200,8 @@ const PlayerLugasLimit = class {
218
200
  else {
219
201
  console.error("Unexpected Error:", err);
220
202
  }
221
- this.errorMessage = translate('LugasNotSet', this.lang);
222
- }).finally(() => {
223
- this.wasSubmitted = false;
224
- });
203
+ })
204
+ .finally(() => this.isSubmitted = false);
225
205
  };
226
206
  this.userId = '';
227
207
  this.session = '';
@@ -233,19 +213,15 @@ const PlayerLugasLimit = class {
233
213
  this.clientStylingUrl = '';
234
214
  this.mbSource = undefined;
235
215
  this.translationUrl = '';
236
- this.showCustomAmount = false;
237
216
  this.isLoading = false;
238
- this.hasErrors = false;
239
- this.inputValue = '';
240
- this.showInvalidInputError = false;
241
- this.predefinedAmountsArray = [];
242
- this.isWithinRange = undefined;
243
- this.minimumRange = undefined;
217
+ this.showCustomAmount = false;
218
+ this.isSubmitted = false;
219
+ this.isUseExistingLimitOptionActive = true;
244
220
  this.selectedPredefinedAmount = undefined;
245
- this.errorMessage = '';
246
- this.wasSubmitted = false;
247
- this.minAmount = undefined;
248
- this.maxAmount = undefined;
221
+ this.errorMessageOnInitialization = '';
222
+ this.errorMessageOnSubmit = '';
223
+ this.errorMessageOnInput = '';
224
+ this.newAmount = '';
249
225
  }
250
226
  /**
251
227
  * Watch for changes in the translation URL and fetch new translations
@@ -271,7 +247,8 @@ const PlayerLugasLimit = class {
271
247
  if (this.translationUrl.length > 2) {
272
248
  await getTranslations(this.translationUrl);
273
249
  }
274
- await this.getMonthlyDepositLimit();
250
+ await this.getMonthlyDepositLimitConfig();
251
+ this.displayedCurrency = this.currency === 'EUR' ? '€' : this.currency;
275
252
  }
276
253
  componentDidLoad() {
277
254
  if (this.stylingContainer) {
@@ -294,7 +271,7 @@ const PlayerLugasLimit = class {
294
271
  *
295
272
  * @returns Promise - Promise that resolves when the configuration is fetched
296
273
  */
297
- async getMonthlyDepositLimit() {
274
+ async getMonthlyDepositLimitConfig() {
298
275
  const url = new URL(`${this.endpoint}api/v1/gm/legislation/config/month-deposit-limit`);
299
276
  this.isLoading = true;
300
277
  return new Promise((resolve) => {
@@ -306,17 +283,15 @@ const PlayerLugasLimit = class {
306
283
  return res.json();
307
284
  })
308
285
  .then((data) => {
309
- this.predefinedAmountsArray = data.preDefinedOptions;
286
+ this.predefinedAmounts = data.preDefinedOptions;
310
287
  this.minAmount = data.minAmount;
311
288
  this.maxAmount = data.maxAmount;
312
289
  resolve(true);
313
290
  }).catch((err) => {
314
- this.hasErrors = true;
291
+ this.errorMessageOnInitialization = translate('error', this.lang);
315
292
  console.log(err);
316
293
  })
317
- .finally(() => {
318
- this.isLoading = false;
319
- });
294
+ .finally(() => this.isLoading = false);
320
295
  });
321
296
  }
322
297
  /**
@@ -325,32 +300,30 @@ const PlayerLugasLimit = class {
325
300
  */
326
301
  handleSubmit(event) {
327
302
  event.preventDefault();
328
- if (this.showInvalidInputError) {
329
- return;
303
+ if (!this.errorMessageOnInput) {
304
+ this.submitMonthlyDepositLimit(this.newAmount, false, true);
330
305
  }
331
- this.postPlayerSituation(this.inputValue, false, true);
332
- }
333
- /**
334
- * Checks if the input contains only digits.
335
- * @param input - The input to validate
336
- */
337
- containsOnlyDigits(input) {
338
- const regex = /^[0-9]+$/;
339
- return regex.test(input);
340
306
  }
341
307
  /**
342
308
  * Handles input changes.
343
309
  * @param event - The input change event
344
310
  */
345
311
  handleInputChange(event) {
346
- const inputValue = event.target.value;
347
- this.showInvalidInputError = false;
348
- this.inputValue = inputValue;
312
+ this.newAmount = event.target.value;
349
313
  // Perform validation checks
350
- this.isValidNumber = !isNaN(Number(inputValue)) && this.containsOnlyDigits(inputValue);
351
- this.minimumRange = Number(inputValue) >= this.minAmount;
352
- this.isWithinRange = Number(inputValue) <= this.maxAmount;
353
- this.showInvalidInputError = inputValue ? !this.isValidNumber || !this.isWithinRange || !this.minimumRange : false;
314
+ this.isValidNumber = !isNaN(Number(this.newAmount));
315
+ this.isWithinRange = (Number(this.newAmount) >= this.minAmount) && (Number(this.newAmount) <= this.maxAmount);
316
+ if (!this.isWithinRange || !this.isValidNumber) {
317
+ this.errorMessageOnInput = translate('invalidInputMessageLimit', this.lang, { values: { currency: this.displayedCurrency, minValue: this.minAmount, maxValue: this.maxAmount } });
318
+ }
319
+ else {
320
+ this.errorMessageOnInput = '';
321
+ const newAmountSplit = this.newAmount.split('.');
322
+ if (newAmountSplit.length > 1) {
323
+ this.newAmount = `${newAmountSplit[0]}.${newAmountSplit[1].slice(0, 2)}`;
324
+ event.target.value = this.newAmount;
325
+ }
326
+ }
354
327
  }
355
328
  /**
356
329
  * Handles predefined amount clicks.
@@ -358,22 +331,20 @@ const PlayerLugasLimit = class {
358
331
  */
359
332
  handleAmountClick(amount) {
360
333
  this.showCustomAmount = false;
361
- this.amount = amount;
362
- this.inputValue = '';
363
- this.showInvalidInputError = false;
334
+ this.errorMessageOnInput = '';
364
335
  this.selectedPredefinedAmount = amount;
365
336
  switch (amount) {
366
337
  case 'Other':
338
+ this.newAmount = '';
367
339
  this.showCustomAmount = true;
368
- this.amount = '';
369
340
  break;
370
341
  case 'Max':
342
+ this.newAmount = this.maxAmount.toString();
371
343
  this.showCustomAmount = true;
372
- this.amount = this.maxAmount.toString();
373
- this.inputValue = this.maxAmount.toString();
374
344
  break;
375
345
  default:
376
- this.postPlayerSituation(this.amount, false, true);
346
+ this.newAmount = amount;
347
+ this.submitMonthlyDepositLimit(this.newAmount, false, true);
377
348
  break;
378
349
  }
379
350
  }
@@ -388,15 +359,14 @@ const PlayerLugasLimit = class {
388
359
  * Renders the validator.
389
360
  */
390
361
  renderValidator() {
391
- const displayedCurrency = this.currency === 'EUR' ? '€' : this.currency;
392
362
  const renderPredefinedButtons = () => {
393
- return this.predefinedAmountsArray.map((currentAmount) => (index.h("button", { class: this.selectedPredefinedAmount === currentAmount ? 'Active' : '', onClick: () => this.handleAmountClick(currentAmount) }, currentAmount)));
363
+ return this.predefinedAmounts.map((currentAmount) => (index.h("button", { class: this.selectedPredefinedAmount === currentAmount ? 'Active' : '', onClick: () => this.handleAmountClick(currentAmount) }, currentAmount)));
394
364
  };
395
- return (index.h("div", { class: "ValidatorContainer" }, this.errorMessage && (index.h("div", { class: "ErrorContainer" }, index.h("span", { class: "DismissError", onClick: () => this.errorMessage = '' }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "9", height: "9", viewBox: "0 0 9 9", fill: "none" }, index.h("path", { d: "M8.18659 0.14708C8.37063 0.33182 8.38174 0.62421 8.21888 0.821452L8.18659 0.857219L4.87619 4.16727L8.18659 7.47732C8.27743 7.56861 8.32973 7.69132 8.33266 7.82007C8.3356 7.94883 8.28895 8.0738 8.20235 8.16913C8.11576 8.26446 7.99584 8.32288 7.86739 8.3323C7.73895 8.34172 7.61179 8.30143 7.51221 8.21975L7.47645 8.18746L4.1664 4.87706L0.856348 8.18746C0.765058 8.27831 0.64235 8.3306 0.513592 8.33354C0.384834 8.33647 0.25987 8.28982 0.164536 8.20322C0.0692018 8.11663 0.0107856 7.99671 0.00136402 7.86827C-0.00805761 7.73982 0.0322357 7.61266 0.113914 7.51308L0.146209 7.47732L3.4566 4.16727L0.146209 0.857219C0.0553613 0.765928 0.00306475 0.64322 0.000130477 0.514462C-0.0028038 0.385704 0.0438486 0.260741 0.130443 0.165407C0.217038 0.0700723 0.336953 0.0116562 0.4654 0.00223455C0.593846 -0.00718708 0.721002 0.0331062 0.820581 0.114785L0.856348 0.14708L4.1664 3.45748L7.47645 0.14708C7.52307 0.10045 7.57843 0.0634608 7.63935 0.0382248C7.70027 0.0129888 7.76557 0 7.83152 0C7.89746 0 7.96276 0.0129888 8.02368 0.0382248C8.0846 0.0634608 8.13996 0.10045 8.18659 0.14708Z", fill: "#111111" }))), index.h("p", { class: "ErrorParagraph" }, index.h("span", { class: "ErrorIcon" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "9", height: "9", viewBox: "0 0 9 9" }, index.h("path", { d: "M8.18659 0.14708C8.37063 0.33182 8.38174 0.62421 8.21888 0.821452L8.18659 0.857219L4.87619 4.16727L8.18659 7.47732C8.27743 7.56861 8.32973 7.69132 8.33266 7.82007C8.3356 7.94883 8.28895 8.0738 8.20235 8.16913C8.11576 8.26446 7.99584 8.32288 7.86739 8.3323C7.73895 8.34172 7.61179 8.30143 7.51221 8.21975L7.47645 8.18746L4.1664 4.87706L0.856348 8.18746C0.765058 8.27831 0.64235 8.3306 0.513592 8.33354C0.384834 8.33647 0.25987 8.28982 0.164536 8.20322C0.0692018 8.11663 0.0107856 7.99671 0.00136402 7.86827C-0.00805761 7.73982 0.0322357 7.61266 0.113914 7.51308L0.146209 7.47732L3.4566 4.16727L0.146209 0.857219C0.0553613 0.765928 0.00306475 0.64322 0.000130477 0.514462C-0.0028038 0.385704 0.0438486 0.260741 0.130443 0.165407C0.217038 0.0700723 0.336953 0.0116562 0.4654 0.00223455C0.593846 -0.00718708 0.721002 0.0331062 0.820581 0.114785L0.856348 0.14708L4.1664 3.45748L7.47645 0.14708C7.52307 0.10045 7.57843 0.0634608 7.63935 0.0382248C7.70027 0.0129888 7.76557 0 7.83152 0C7.89746 0 7.96276 0.0129888 8.02368 0.0382248C8.0846 0.0634608 8.13996 0.10045 8.18659 0.14708Z" }))), this.errorMessage))), index.h("div", { class: "Paragraphs" }, index.h("p", null, translate('LugasInfoBox', this.lang))), index.h("div", { class: "LimitAmountWrapper" }, this.wasSubmitted
365
+ return (index.h("div", { class: "ValidatorContainer" }, this.errorMessageOnSubmit && (index.h("div", { class: "ErrorContainer" }, index.h("span", { class: "DismissError", onClick: () => this.errorMessageOnSubmit = '' }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "9", height: "9", viewBox: "0 0 9 9", fill: "none" }, index.h("path", { d: "M8.18659 0.14708C8.37063 0.33182 8.38174 0.62421 8.21888 0.821452L8.18659 0.857219L4.87619 4.16727L8.18659 7.47732C8.27743 7.56861 8.32973 7.69132 8.33266 7.82007C8.3356 7.94883 8.28895 8.0738 8.20235 8.16913C8.11576 8.26446 7.99584 8.32288 7.86739 8.3323C7.73895 8.34172 7.61179 8.30143 7.51221 8.21975L7.47645 8.18746L4.1664 4.87706L0.856348 8.18746C0.765058 8.27831 0.64235 8.3306 0.513592 8.33354C0.384834 8.33647 0.25987 8.28982 0.164536 8.20322C0.0692018 8.11663 0.0107856 7.99671 0.00136402 7.86827C-0.00805761 7.73982 0.0322357 7.61266 0.113914 7.51308L0.146209 7.47732L3.4566 4.16727L0.146209 0.857219C0.0553613 0.765928 0.00306475 0.64322 0.000130477 0.514462C-0.0028038 0.385704 0.0438486 0.260741 0.130443 0.165407C0.217038 0.0700723 0.336953 0.0116562 0.4654 0.00223455C0.593846 -0.00718708 0.721002 0.0331062 0.820581 0.114785L0.856348 0.14708L4.1664 3.45748L7.47645 0.14708C7.52307 0.10045 7.57843 0.0634608 7.63935 0.0382248C7.70027 0.0129888 7.76557 0 7.83152 0C7.89746 0 7.96276 0.0129888 8.02368 0.0382248C8.0846 0.0634608 8.13996 0.10045 8.18659 0.14708Z", fill: "#111111" }))), index.h("p", { class: "ErrorParagraph" }, index.h("span", { class: "ErrorIcon" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "9", height: "9", viewBox: "0 0 9 9" }, index.h("path", { d: "M8.18659 0.14708C8.37063 0.33182 8.38174 0.62421 8.21888 0.821452L8.18659 0.857219L4.87619 4.16727L8.18659 7.47732C8.27743 7.56861 8.32973 7.69132 8.33266 7.82007C8.3356 7.94883 8.28895 8.0738 8.20235 8.16913C8.11576 8.26446 7.99584 8.32288 7.86739 8.3323C7.73895 8.34172 7.61179 8.30143 7.51221 8.21975L7.47645 8.18746L4.1664 4.87706L0.856348 8.18746C0.765058 8.27831 0.64235 8.3306 0.513592 8.33354C0.384834 8.33647 0.25987 8.28982 0.164536 8.20322C0.0692018 8.11663 0.0107856 7.99671 0.00136402 7.86827C-0.00805761 7.73982 0.0322357 7.61266 0.113914 7.51308L0.146209 7.47732L3.4566 4.16727L0.146209 0.857219C0.0553613 0.765928 0.00306475 0.64322 0.000130477 0.514462C-0.0028038 0.385704 0.0438486 0.260741 0.130443 0.165407C0.217038 0.0700723 0.336953 0.0116562 0.4654 0.00223455C0.593846 -0.00718708 0.721002 0.0331062 0.820581 0.114785L0.856348 0.14708L4.1664 3.45748L7.47645 0.14708C7.52307 0.10045 7.57843 0.0634608 7.63935 0.0382248C7.70027 0.0129888 7.76557 0 7.83152 0C7.89746 0 7.96276 0.0129888 8.02368 0.0382248C8.0846 0.0634608 8.13996 0.10045 8.18659 0.14708Z" }))), this.errorMessageOnSubmit))), index.h("div", { class: "Paragraphs" }, index.h("p", null, translate('LugasInfoBox', this.lang))), index.h("div", { class: "LimitAmountWrapper" }, this.isSubmitted
396
366
  && index.h("slot", { name: 'spinner' })
397
367
  && index.h("div", { class: "LoadingWrapper" }, index.h("svg", { class: "spinner", viewBox: "0 0 50 50" }, index.h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" }))), index.h("p", { class: "ChooseLimitLabel" }, translate('ChooseLimit', this.lang)), index.h("div", { class: "PredefinedAmounts" }, index.h("button", { class: this.selectedPredefinedAmount === 'Other' ? 'Active' : '', onClick: () => this.handleAmountClick('Other') }, translate('ButtonCustomValue', this.lang)), renderPredefinedButtons(), index.h("button", { class: this.selectedPredefinedAmount === 'Max' ? 'Active' : '', onClick: () => this.handleAmountClick('Max') }, translate('ButtonMax', this.lang))), this.showCustomAmount && (index.h("form", { onSubmit: (event) => this.handleSubmit(event) }, this.showCustomAmount &&
398
- index.h("div", null, index.h("input", { class: `CustomAmountInput ${this.showInvalidInputError ? 'InvalidInput' : ''}`, type: "number", value: this.amount, onInput: (event) => this.handleInputChange(event), placeholder: "0.00", disabled: this.selectedPredefinedAmount === 'Max' }), this.showInvalidInputError && (index.h("p", { class: "InvalidParagraph" }, translate('invalidInputMessageLimit', this.lang, { values: { currency: displayedCurrency, minValue: this.minAmount, maxValue: this.maxAmount } })))), this.selectedPredefinedAmount &&
399
- index.h("button", { class: "PrimaryButton SetLimitBtn", type: "submit", disabled: this.wasSubmitted }, translate('LugasSetLimitDialogButtonSetLimit', this.lang, { values: { currency: displayedCurrency, amount: this.inputValue || '0.00' } }))))), index.h("div", { class: "ModalFooter" }, index.h("hr", null), index.h("div", { class: "Paragraphs" }, index.h("p", { class: "ExistingLimit" }, translate('LugasSetLimitDialogExistingLimit.text', this.lang), index.h("span", { class: "Link", onClick: () => this.postPlayerSituation(this.amount, true) }, translate('LugasSetLimitDialogExistingLimit.link', this.lang))), index.h("p", { class: "PrivacyNote" }, translate('LugasSetLimitDialogPrivacyNote.text', this.lang), index.h("span", { class: "Link", onClick: this.goToPrivacyPolicy }, translate('LugasSetLimitDialogPrivacyNote.link', this.lang)))))));
368
+ index.h("div", null, index.h("input", { class: `CustomAmountInput ${this.errorMessageOnInput ? 'InvalidInput' : ''}`, type: "number", value: this.selectedPredefinedAmount === 'Max' ? this.maxAmount : null, step: 0.01, placeholder: "0.00", disabled: this.selectedPredefinedAmount === 'Max', onInput: (event) => this.handleInputChange(event) }), this.errorMessageOnInput && index.h("p", { class: "InvalidParagraph" }, this.errorMessageOnInput)), this.selectedPredefinedAmount &&
369
+ index.h("button", { class: "PrimaryButton SetLimitBtn", type: "submit", disabled: this.isSubmitted || !Boolean(this.newAmount) || Boolean(this.errorMessageOnInput) }, translate('LugasSetLimitDialogButtonSetLimit', this.lang, { values: { currency: this.displayedCurrency, amount: this.newAmount || '0.00' } }))))), index.h("div", { class: "ModalFooter" }, index.h("hr", null), index.h("div", { class: "Paragraphs" }, index.h("p", { class: "ExistingLimit" }, translate('LugasSetLimitDialogExistingLimit.text', this.lang), index.h("span", { class: this.isUseExistingLimitOptionActive ? 'Link' : 'Link Inactive', onClick: () => this.submitMonthlyDepositLimit(this.amount, true) }, translate('LugasSetLimitDialogExistingLimit.link', this.lang))), index.h("p", { class: "PrivacyNote" }, translate('LugasSetLimitDialogPrivacyNote.text', this.lang), index.h("span", { class: "Link", onClick: this.goToPrivacyPolicy }, translate('LugasSetLimitDialogPrivacyNote.link', this.lang)))))));
400
370
  }
401
371
  /**
402
372
  * Renders the component.
@@ -405,8 +375,8 @@ const PlayerLugasLimit = class {
405
375
  if (this.isLoading) {
406
376
  return (index.h("div", null, index.h("p", null, translate('loading', this.lang, { values: { currency: this.currency } }))));
407
377
  }
408
- else if (this.hasErrors) {
409
- return (index.h("div", null, index.h("p", null, translate('error', this.lang))));
378
+ else if (this.errorMessageOnInitialization) {
379
+ return (index.h("div", null, index.h("p", null, this.errorMessageOnInitialization)));
410
380
  }
411
381
  else {
412
382
  const validationContainer = this.renderValidator();
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["player-lugas-limit.cjs",[[1,"player-lugas-limit",{"userId":[1,"user-id"],"session":[1],"endpoint":[1],"currency":[1],"amount":[1],"lang":[1],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"mbSource":[1,"mb-source"],"translationUrl":[1,"translation-url"],"showCustomAmount":[32],"isLoading":[32],"hasErrors":[32],"inputValue":[32],"showInvalidInputError":[32],"predefinedAmountsArray":[32],"isWithinRange":[32],"minimumRange":[32],"selectedPredefinedAmount":[32],"errorMessage":[32],"wasSubmitted":[32],"minAmount":[32],"maxAmount":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"]}]]]], options);
22
+ return index.bootstrapLazy([["player-lugas-limit.cjs",[[1,"player-lugas-limit",{"userId":[1,"user-id"],"session":[1],"endpoint":[1],"currency":[1],"amount":[1],"lang":[1],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"mbSource":[1,"mb-source"],"translationUrl":[1,"translation-url"],"isLoading":[32],"showCustomAmount":[32],"isSubmitted":[32],"isUseExistingLimitOptionActive":[32],"selectedPredefinedAmount":[32],"errorMessageOnInitialization":[32],"errorMessageOnSubmit":[32],"errorMessageOnInput":[32],"newAmount":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -39,6 +39,9 @@
39
39
  .ModalContainer button.PrimaryButton:not(:disabled) {
40
40
  color: var(--emw--color-white, #FFF);
41
41
  }
42
+ .ModalContainer button.PrimaryButton:disabled {
43
+ cursor: default;
44
+ }
42
45
  .ModalContainer .Container {
43
46
  position: fixed;
44
47
  top: 30vh;
@@ -174,6 +177,10 @@
174
177
  text-decoration: underline;
175
178
  cursor: pointer;
176
179
  }
180
+ .ModalContainer .Link.Inactive {
181
+ cursor: default;
182
+ color: var(--emw--color-gray-150, #808080);
183
+ }
177
184
  .ModalContainer .PrivacyNote {
178
185
  font-size: var(--emw--font-size-x-small, 10px);
179
186
  font-style: italic;