@everymatrix/player-lugas-limit 1.10.6 → 1.10.8

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.
@@ -940,6 +940,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
940
940
  hostRef.$flags$ &= ~8 /* isConstructingInstance */;
941
941
  }
942
942
  endNewInstance();
943
+ fireConnectedCallback(hostRef.$lazyInstance$);
943
944
  }
944
945
  if (Cstr.style) {
945
946
  // this component has styles but we haven't registered them yet
@@ -968,6 +969,11 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
968
969
  schedule();
969
970
  }
970
971
  };
972
+ const fireConnectedCallback = (instance) => {
973
+ {
974
+ safeCall(instance, 'connectedCallback');
975
+ }
976
+ };
971
977
  const connectedCallback = (elm) => {
972
978
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
973
979
  const hostRef = getHostRef(elm);
@@ -1006,6 +1012,10 @@ const connectedCallback = (elm) => {
1006
1012
  initializeComponent(elm, hostRef, cmpMeta);
1007
1013
  }
1008
1014
  }
1015
+ else {
1016
+ // fire off connectedCallback() on component instance
1017
+ fireConnectedCallback(hostRef.$lazyInstance$);
1018
+ }
1009
1019
  endConnected();
1010
1020
  }
1011
1021
  };
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-034179c3.js');
5
+ const index = require('./index-87beb026.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["player-lugas-limit.cjs",[[1,"player-lugas-limit",{"userid":[1],"session":[1],"endpoint":[1],"currency":[1],"flow":[1],"amountMinMax":[1,"amount-min-max"],"amount":[1],"lang":[1],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"translationurl":[1],"validation":[32],"kyc":[32],"dropDown":[32],"isLoading":[32],"hasErrors":[32],"inputValue":[32],"isButtonDisabled":[32],"crossProviders":[32],"invalidInput":[32],"stylingAppends":[32],"isVisible":[32],"userAmount":[32],"operatorDepositLimitAmount":[32]}]]]], options);
17
+ return index.bootstrapLazy([["player-lugas-limit.cjs",[[1,"player-lugas-limit",{"userid":[1],"session":[1],"endpoint":[1],"currency":[1],"flow":[1],"amountMinMax":[1,"amount-min-max"],"amount":[1],"lang":[1],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"translationUrl":[1,"translation-url"],"validation":[32],"kyc":[32],"dropDown":[32],"isLoading":[32],"hasErrors":[32],"inputValue":[32],"isButtonDisabled":[32],"crossProviders":[32],"invalidInput":[32],"stylingAppends":[32],"userAmount":[32],"operatorDepositLimitAmount":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-034179c3.js');
5
+ const index = require('./index-87beb026.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE = 'en';
8
8
  const SUPPORTED_LANGUAGES = ['ro', 'en'];
9
- const TRANSLATIONS = {
9
+ let TRANSLATIONS = {
10
10
  en: {
11
11
  loading: 'Loading, please wait ...',
12
12
  error: 'It was an error while trying to fetch the data',
@@ -104,6 +104,18 @@ const TRANSLATIONS = {
104
104
  softMigrationP3: 'Do you want to set a new limit or confirm the existing limit ',
105
105
  }
106
106
  };
107
+ const getTranslations = (url) => {
108
+ // fetch url, get the data, replace the TRANSLATIONS content
109
+ fetch(url)
110
+ .then((res) => res.json())
111
+ .then((data) => {
112
+ Object.keys(data).forEach((item) => {
113
+ for (let key in data[item]) {
114
+ TRANSLATIONS[item][key] = data[item][key];
115
+ }
116
+ });
117
+ });
118
+ };
107
119
  const translate = (key, customLang, values) => {
108
120
  const lang = customLang;
109
121
  let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
@@ -116,12 +128,13 @@ const translate = (key, customLang, values) => {
116
128
  return translation;
117
129
  };
118
130
 
119
- 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: 12px;\n container-type: inline-size;\n}\n.ModalContainer .Container {\n position: fixed;\n top: 30vh;\n width: 25%;\n background: #fff;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n border-radius: 4px;\n transform: scale(1.1);\n}\n.ModalContainer .ModalHeader {\n display: flex;\n justify-content: space-between;\n align-items: center;\n background-color: #ffffff;\n border-radius: 4px 4px 0px 0px;\n padding: 10px;\n}\n.ModalContainer .ModalBody {\n background: #F5F6F6;\n padding: 16px 10px 10px;\n container-type: inline-size;\n border-radius: 4px;\n}\n.ModalContainer .ModalBody hr {\n border: 1px solid rgba(0, 0, 0, 0.1);\n margin: 12px 0px;\n}\n.ModalContainer .ModalBody p {\n margin: 0;\n}\n.ModalContainer .ModalBody .VallidatorContainer {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n}\n.ModalContainer .ModalBody .VallidatorContainer .CrossProvider {\n background-color: #404350;\n color: white;\n margin: 5px 0px;\n padding: 10px 15px;\n border-radius: 2px;\n}\n.ModalContainer .ModalBody .VallidatorContainer .CrossProvider svg {\n position: absolute;\n width: 5px;\n height: 28px;\n}\n.ModalContainer .ModalBody .VallidatorContainer .CrossProvider p {\n padding-left: 15px;\n}\n.ModalContainer .ModalBody .VallidatorContainer .Paragraphs {\n padding: 5px 0px;\n}\n.ModalContainer .ModalBody .VallidatorContainer .Paragraphs p {\n padding: 5px 0px;\n}\n.ModalContainer .ModalBody .VallidatorContainer .ContainerButtons {\n display: flex;\n justify-content: space-around;\n gap: 10px;\n}\n.ModalContainer .ModalBody .VallidatorContainer .ContainerButtons .FirstButton {\n background-color: #ffffff;\n font-weight: bold;\n color: #002554;\n font-size: 10px;\n border: 2.5px solid #dee2e6;\n width: 100%;\n cursor: pointer;\n}\n.ModalContainer .ModalBody .VallidatorContainer .ContainerButtons .SecondButton {\n background-color: #6BB816;\n border: none;\n cursor: pointer;\n font-weight: bold;\n font-size: 10px;\n color: #ffffff;\n width: 100%;\n}\n.ModalContainer .ModalBody .VallidatorContainer .ContainerButtons button {\n width: 240px;\n height: 30px;\n}\n.ModalContainer .ModalFooter {\n display: flex;\n justify-content: center;\n background-color: rgba(161, 156, 156, 0.11);\n margin: 5px 0px;\n}\n.ModalContainer .ModalFooter .Dropdown {\n background-color: white;\n padding: 8px;\n width: 100%;\n border: 1px solid #dee2e6;\n}\n.ModalContainer .ModalFooter .Dropdown p {\n padding: 5px 0px;\n}\n.ModalContainer .ModalFooter .Dropdown .InvalidParagraph {\n padding: 5px 0px 0px;\n font-size: 10px;\n color: #FF0000;\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput {\n display: flex;\n flex-direction: row;\n width: 100%;\n gap: 10px;\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput input {\n flex: 4;\n border: 1px solid #E3E3E3;\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput button {\n padding: 2px;\n cursor: pointer;\n transition: background-color 0.2s ease-in-out 0s;\n flex: 1;\n font-size: 10px;\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput button:enabled {\n background-color: #6BB816;\n color: #ffffff;\n font-weight: bold;\n border: none;\n border: 2.5px solid rgba(255, 255, 255, 0);\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput button:disabled {\n background-color: #ffffff;\n color: #002554;\n font-weight: bold;\n cursor: not-allowed;\n border: 1px solid #E3E3E3;\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput:first-child {\n margin-left: 0px;\n display: flex;\n padding: 12px 0px;\n justify-content: center;\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput .InvalidInput {\n border: 1px solid #FF0000;\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}";
131
+ 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: 12px;\n container-type: inline-size;\n}\n.ModalContainer .Container {\n position: fixed;\n top: 30vh;\n width: 25%;\n background: #fff;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n border-radius: 4px;\n transform: scale(1.1);\n}\n.ModalContainer .ModalHeader {\n display: flex;\n justify-content: space-between;\n align-items: center;\n background-color: #ffffff;\n border-radius: 4px 4px 0px 0px;\n padding: 10px;\n}\n.ModalContainer .ModalBody {\n background: #F5F6F6;\n padding: 16px 10px 10px;\n container-type: inline-size;\n border-radius: 4px;\n}\n.ModalContainer .ModalBody hr {\n border: 1px solid rgba(0, 0, 0, 0.1);\n margin: 12px 0px;\n}\n.ModalContainer .ModalBody p {\n margin: 0;\n}\n.ModalContainer .ModalBody .VallidatorContainer {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n}\n.ModalContainer .ModalBody .VallidatorContainer .CrossProvider {\n background-color: #404350;\n color: white;\n margin: 5px 0px;\n padding: 10px 15px;\n border-radius: 2px;\n}\n.ModalContainer .ModalBody .VallidatorContainer .CrossProvider svg {\n position: absolute;\n width: 5px;\n height: 28px;\n}\n.ModalContainer .ModalBody .VallidatorContainer .CrossProvider p {\n padding-left: 15px;\n}\n.ModalContainer .ModalBody .VallidatorContainer .Paragraphs {\n padding: 5px 0px;\n}\n.ModalContainer .ModalBody .VallidatorContainer .Paragraphs p {\n padding: 5px 0px;\n}\n.ModalContainer .ModalBody .VallidatorContainer .ContainerButtons {\n display: flex;\n justify-content: space-around;\n gap: 10px;\n padding-top: 5px;\n}\n.ModalContainer .ModalBody .VallidatorContainer .ContainerButtons .FirstButton {\n background-color: #ffffff;\n font-weight: bold;\n color: #002554;\n font-size: 10px;\n border: 2.5px solid #dee2e6;\n width: 100%;\n cursor: pointer;\n}\n.ModalContainer .ModalBody .VallidatorContainer .ContainerButtons .SecondButton {\n background-color: #6BB816;\n border: none;\n cursor: pointer;\n font-weight: bold;\n font-size: 10px;\n color: #ffffff;\n width: 100%;\n}\n.ModalContainer .ModalBody .VallidatorContainer .ContainerButtons button {\n width: 240px;\n height: 30px;\n}\n.ModalContainer .ModalFooter {\n display: flex;\n justify-content: center;\n background-color: rgba(161, 156, 156, 0.11);\n margin: 5px 0px;\n}\n.ModalContainer .ModalFooter .Dropdown {\n background-color: white;\n padding: 8px;\n width: 100%;\n border: 1px solid #dee2e6;\n}\n.ModalContainer .ModalFooter .Dropdown p {\n padding: 5px 0px;\n}\n.ModalContainer .ModalFooter .Dropdown .InvalidParagraph {\n padding: 5px 0px 0px;\n font-size: 10px;\n color: #FF0000;\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput {\n display: flex;\n flex-direction: row;\n width: 100%;\n gap: 10px;\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput input {\n flex: 4;\n border: 1px solid #E3E3E3;\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput button {\n padding: 2px;\n cursor: pointer;\n transition: background-color 0.2s ease-in-out 0s;\n flex: 1;\n font-size: 10px;\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput button:enabled {\n background-color: #6BB816;\n color: #ffffff;\n font-weight: bold;\n border: none;\n border: 2.5px solid rgba(255, 255, 255, 0);\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput button:disabled {\n background-color: #ffffff;\n color: #002554;\n font-weight: bold;\n cursor: not-allowed;\n border: 1px solid #E3E3E3;\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput:first-child {\n margin-left: 0px;\n display: flex;\n padding: 12px 0px;\n justify-content: center;\n}\n.ModalContainer .ModalFooter .Dropdown .DropdownInput .InvalidInput {\n border: 1px solid #FF0000;\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}";
120
132
 
121
133
  const PlayerLugasLimit = class {
122
134
  constructor(hostRef) {
123
135
  index.registerInstance(this, hostRef);
124
136
  this.uploadDocuments = index.createEvent(this, "uploadDocuments", 7);
137
+ this.closePopup = index.createEvent(this, "closePopup", 7);
125
138
  /**
126
139
  * The userid
127
140
  */
@@ -131,11 +144,11 @@ const PlayerLugasLimit = class {
131
144
  */
132
145
  this.session = '';
133
146
  /**
134
- * The endpoint
147
+ * The NorWAy endpoint
135
148
  */
136
149
  this.endpoint = '';
137
150
  /**
138
- * The currency
151
+ * Currency of the player
139
152
  */
140
153
  this.currency = 'EUR';
141
154
  /**
@@ -158,6 +171,10 @@ const PlayerLugasLimit = class {
158
171
  * Client custom styling via url content
159
172
  */
160
173
  this.clientStylingUrlContent = '';
174
+ /**
175
+ * The translationurl
176
+ */
177
+ this.translationUrl = '';
161
178
  this.validation = true;
162
179
  this.dropDown = false;
163
180
  this.isLoading = false;
@@ -167,7 +184,6 @@ const PlayerLugasLimit = class {
167
184
  this.crossProviders = false;
168
185
  this.invalidInput = false;
169
186
  this.stylingAppends = false;
170
- this.isVisible = true;
171
187
  this.userAmount = '';
172
188
  this.operatorDepositLimitAmount = '';
173
189
  this.setClientStyling = () => {
@@ -182,31 +198,8 @@ const PlayerLugasLimit = class {
182
198
  this.stylingContainer.prepend(cssFile);
183
199
  }, 1);
184
200
  };
185
- this.setPlayerSituation = () => {
186
- let url = new URL(`${this.endpoint}/player/${this.userid}/limit/lugas`);
187
- fetch(url.href)
188
- .then((res) => {
189
- if (res.status === 200) {
190
- return res.json();
191
- }
192
- else {
193
- this.crossProviders = true;
194
- this.dropDown = true;
195
- throw new Error("HTTP status " + res.status);
196
- }
197
- })
198
- .then((data) => {
199
- this.kyc = data.popup;
200
- this.validation = false;
201
- this.dropDown = false;
202
- })
203
- .catch((err) => {
204
- // Handle any errors
205
- console.error(err);
206
- });
207
- };
208
- this.postPlayerSituation = () => {
209
- let url = new URL(`${this.endpoint}/player/${this.userid}/limit/lugas`);
201
+ this.postPlayerSituation = (userAmount) => {
202
+ let url = new URL(`${this.endpoint}v1/player/${this.userid}/limit/lugas`);
210
203
  let options = {
211
204
  method: 'POST',
212
205
  headers: {
@@ -214,7 +207,7 @@ const PlayerLugasLimit = class {
214
207
  'Content-Type': 'application/json',
215
208
  'Authorization': `Bearer ${this.session}`
216
209
  },
217
- body: JSON.stringify({ amount: `${this.userAmount}` })
210
+ body: userAmount ? JSON.stringify({ amount: `${userAmount}` }) : JSON.stringify({})
218
211
  };
219
212
  fetch(url.href, options)
220
213
  .then((res) => {
@@ -231,7 +224,9 @@ const PlayerLugasLimit = class {
231
224
  this.kyc = data.popup;
232
225
  this.validation = false;
233
226
  this.dropDown = false;
234
- this.operatorDepositLimitAmount = data.operatorDepositLimitAmount;
227
+ if (data.operatorDepositLimitAmount) {
228
+ this.operatorDepositLimitAmount = data.operatorDepositLimitAmount;
229
+ }
235
230
  })
236
231
  .catch((err) => {
237
232
  // Handle any errors
@@ -240,11 +235,7 @@ const PlayerLugasLimit = class {
240
235
  };
241
236
  this.handleClick = (input) => {
242
237
  switch (input) {
243
- case 'nextStep':
244
- case 'keepExistingLimit':
245
- this.setPlayerSituation();
246
- break;
247
- case 'sureSetNewLimit':
238
+ case 'postSituation':
248
239
  this.postPlayerSituation();
249
240
  break;
250
241
  case 'setNewLimit':
@@ -254,14 +245,13 @@ const PlayerLugasLimit = class {
254
245
  this.uploadDocuments.emit();
255
246
  break;
256
247
  case 'Close':
257
- //close modal
258
- this.isVisible = false;
248
+ this.closePopup.emit();
259
249
  break;
260
250
  }
261
251
  };
262
252
  this.setLimit = () => {
263
253
  this.userAmount = this.inputValue;
264
- this.postPlayerSituation();
254
+ this.postPlayerSituation(this.userAmount);
265
255
  };
266
256
  }
267
257
  componentDidRender() {
@@ -275,21 +265,25 @@ const PlayerLugasLimit = class {
275
265
  }
276
266
  // end custom styling area
277
267
  }
268
+ connectedCallback() {
269
+ getTranslations(this.translationUrl);
270
+ }
278
271
  handleInputChange(event) {
279
272
  const inputValue = event.target.value;
280
273
  this.inputValue = inputValue;
281
- this.isButtonDisabled = isNaN(Number(inputValue)) || Number(inputValue) < 10 || Number(inputValue) > 30000;
282
- this.invalidInput = isNaN(Number(inputValue)) || Number(inputValue) < 10 || Number(inputValue) > 30000;
274
+ let min = parseInt(this.amountMinMax.split(',')[0]);
275
+ let max = parseInt(this.amountMinMax.split(',')[1]);
276
+ this.isButtonDisabled = isNaN(Number(inputValue)) || Number(inputValue) < min || Number(inputValue) > max;
277
+ this.invalidInput = isNaN(Number(inputValue)) || Number(inputValue) < min || Number(inputValue) > max;
283
278
  }
284
- // traduceri setclient styling
285
279
  renderKYC(step) {
286
280
  if (step == 0) {
287
281
  //CLOSE MODAL
288
- this.isVisible = false;
282
+ this.closePopup.emit();
289
283
  return;
290
284
  }
291
285
  if (step == 1) {
292
- return (index.h("div", { class: "VallidatorContainer" }, index.h("div", { class: "Paragraphs" }, index.h("p", null, translate('kycSure', this.lang)), index.h("p", null, translate('kyc1', this.lang)), index.h("div", { class: "ContainerButtons" }, index.h("button", { class: "FirstButton", onClick: () => this.handleClick('sureSetNewLimit') }, translate('setNewLimit', this.lang)), index.h("button", { class: "SecondButton", onClick: () => this.handleClick('keepExistingLimit') }, translate('keepExistingLimit', this.lang))))));
286
+ return (index.h("div", { class: "VallidatorContainer" }, index.h("div", { class: "Paragraphs" }, index.h("p", null, translate('kycSure', this.lang)), index.h("p", null, translate('kyc1', this.lang)), index.h("div", { class: "ContainerButtons" }, index.h("button", { class: "FirstButton", onClick: () => this.postPlayerSituation(this.userAmount) }, translate('setNewLimit', this.lang)), index.h("button", { class: "SecondButton", onClick: () => this.handleClick('postSituation') }, translate('keepExistingLimit', this.lang))))));
293
287
  }
294
288
  else if (step == 2) {
295
289
  return (index.h("div", { class: "VallidatorContainer" }, index.h("div", { class: "Paragraphs" }, index.h("p", null, translate('kycThanks', this.lang)), index.h("p", null, translate('kyc2', this.lang, { values: { amount: this.operatorDepositLimitAmount } })), index.h("div", { class: "ContainerButtons" }, index.h("button", { class: "FirstButton", onClick: () => this.handleClick('Close') }, translate('Close', this.lang)), index.h("button", { class: "SecondButton", onClick: () => this.handleClick('UploadDocuments') }, translate('UploadDocuments', this.lang))))));
@@ -303,19 +297,16 @@ const PlayerLugasLimit = class {
303
297
  return (index.h("div", { class: "VallidatorContainer" }, index.h("div", { class: "Paragraphs" }, index.h("p", null, translate('softMigrationP1', this.lang)), index.h("p", null, translate('softMigrationP2', this.lang)), index.h("p", null, translate('softMigrationP3', this.lang), "(of ", this.currency, " ", this.amount, ")?")), this.crossProviders ?
304
298
  index.h("div", { class: "CrossProvider" }, index.h("svg", { width: "4", height: "17", viewBox: "0 0 4 17", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("rect", { width: "4", height: "12", rx: "2", fill: "white" }), index.h("rect", { y: "14", width: "4", height: "3", rx: "1.5", fill: "white" })), index.h("p", null, translate('crossProviders', this.lang)))
305
299
  :
306
- index.h("div", { class: "ContainerButtons" }, index.h("button", { class: "FirstButton", onClick: () => this.handleClick('setNewLimit') }, translate('setNewLimit', this.lang)), index.h("button", { class: "SecondButton", onClick: () => this.handleClick('nextStep') }, translate('confirm', this.lang)))));
300
+ index.h("div", { class: "ContainerButtons" }, index.h("button", { class: "FirstButton", onClick: () => this.handleClick('setNewLimit') }, translate('setNewLimit', this.lang)), index.h("button", { class: "SecondButton", onClick: () => this.handleClick('postSituation') }, translate('confirm', this.lang)))));
307
301
  }
308
302
  else if (input == '2') {
309
303
  return (index.h("div", { class: "VallidatorContainer" }, index.h("div", { class: "Paragraphs" }, index.h("p", null, translate('newUserP1', this.lang)), index.h("p", null, translate('newUserP2', this.lang)), index.h("p", null, translate('newUserP3', this.lang))), this.crossProviders ?
310
304
  index.h("div", { class: "CrossProvider" }, index.h("svg", { width: "4", height: "17", viewBox: "0 0 4 17", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("rect", { width: "4", height: "12", rx: "2", fill: "white" }), index.h("rect", { y: "14", width: "4", height: "3", rx: "1.5", fill: "white" })), index.h("p", null, translate('crossProviders', this.lang)))
311
305
  :
312
- index.h("div", { class: "ContainerButtons" }, index.h("button", { class: "FirstButton", onClick: () => this.handleClick('setNewLimit') }, translate('setNewLimit', this.lang)), index.h("button", { class: "SecondButton", onClick: () => this.handleClick('nextStep') }, translate('keepExistingLimit', this.lang)))));
306
+ index.h("div", { class: "ContainerButtons" }, index.h("button", { class: "FirstButton", onClick: () => this.handleClick('setNewLimit') }, translate('setNewLimit', this.lang)), index.h("button", { class: "SecondButton", onClick: () => this.handleClick('postSituation') }, translate('keepExistingLimit', this.lang)))));
313
307
  }
314
308
  }
315
309
  render() {
316
- if (!this.isVisible) {
317
- return null; // Render nothing if component is not visible
318
- }
319
310
  let kycConfirmation = this.renderKYC(this.kyc);
320
311
  let validationContainer = this.renderValidator(this.flow);
321
312
  if (this.isLoading) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-034179c3.js');
3
+ const index = require('./index-87beb026.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["player-lugas-limit.cjs",[[1,"player-lugas-limit",{"userid":[1],"session":[1],"endpoint":[1],"currency":[1],"flow":[1],"amountMinMax":[1,"amount-min-max"],"amount":[1],"lang":[1],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"translationurl":[1],"validation":[32],"kyc":[32],"dropDown":[32],"isLoading":[32],"hasErrors":[32],"inputValue":[32],"isButtonDisabled":[32],"crossProviders":[32],"invalidInput":[32],"stylingAppends":[32],"isVisible":[32],"userAmount":[32],"operatorDepositLimitAmount":[32]}]]]], options);
18
+ return index.bootstrapLazy([["player-lugas-limit.cjs",[[1,"player-lugas-limit",{"userid":[1],"session":[1],"endpoint":[1],"currency":[1],"flow":[1],"amountMinMax":[1,"amount-min-max"],"amount":[1],"lang":[1],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"translationUrl":[1,"translation-url"],"validation":[32],"kyc":[32],"dropDown":[32],"isLoading":[32],"hasErrors":[32],"inputValue":[32],"isButtonDisabled":[32],"crossProviders":[32],"invalidInput":[32],"stylingAppends":[32],"userAmount":[32],"operatorDepositLimitAmount":[32]}]]]], options);
19
19
  });
@@ -78,6 +78,7 @@
78
78
  display: flex;
79
79
  justify-content: space-around;
80
80
  gap: 10px;
81
+ padding-top: 5px;
81
82
  }
82
83
  .ModalContainer .ModalBody .VallidatorContainer .ContainerButtons .FirstButton {
83
84
  background-color: #ffffff;
@@ -1,5 +1,5 @@
1
1
  import { Component, Prop, h, State, Event } from '@stencil/core';
2
- import { translate } from '../../utils/locale.utils';
2
+ import { getTranslations, translate } from '../../utils/locale.utils';
3
3
  export class PlayerLugasLimit {
4
4
  constructor() {
5
5
  /**
@@ -11,11 +11,11 @@ export class PlayerLugasLimit {
11
11
  */
12
12
  this.session = '';
13
13
  /**
14
- * The endpoint
14
+ * The NorWAy endpoint
15
15
  */
16
16
  this.endpoint = '';
17
17
  /**
18
- * The currency
18
+ * Currency of the player
19
19
  */
20
20
  this.currency = 'EUR';
21
21
  /**
@@ -38,6 +38,10 @@ export class PlayerLugasLimit {
38
38
  * Client custom styling via url content
39
39
  */
40
40
  this.clientStylingUrlContent = '';
41
+ /**
42
+ * The translationurl
43
+ */
44
+ this.translationUrl = '';
41
45
  this.validation = true;
42
46
  this.dropDown = false;
43
47
  this.isLoading = false;
@@ -47,7 +51,6 @@ export class PlayerLugasLimit {
47
51
  this.crossProviders = false;
48
52
  this.invalidInput = false;
49
53
  this.stylingAppends = false;
50
- this.isVisible = true;
51
54
  this.userAmount = '';
52
55
  this.operatorDepositLimitAmount = '';
53
56
  this.setClientStyling = () => {
@@ -62,31 +65,8 @@ export class PlayerLugasLimit {
62
65
  this.stylingContainer.prepend(cssFile);
63
66
  }, 1);
64
67
  };
65
- this.setPlayerSituation = () => {
66
- let url = new URL(`${this.endpoint}/player/${this.userid}/limit/lugas`);
67
- fetch(url.href)
68
- .then((res) => {
69
- if (res.status === 200) {
70
- return res.json();
71
- }
72
- else {
73
- this.crossProviders = true;
74
- this.dropDown = true;
75
- throw new Error("HTTP status " + res.status);
76
- }
77
- })
78
- .then((data) => {
79
- this.kyc = data.popup;
80
- this.validation = false;
81
- this.dropDown = false;
82
- })
83
- .catch((err) => {
84
- // Handle any errors
85
- console.error(err);
86
- });
87
- };
88
- this.postPlayerSituation = () => {
89
- let url = new URL(`${this.endpoint}/player/${this.userid}/limit/lugas`);
68
+ this.postPlayerSituation = (userAmount) => {
69
+ let url = new URL(`${this.endpoint}v1/player/${this.userid}/limit/lugas`);
90
70
  let options = {
91
71
  method: 'POST',
92
72
  headers: {
@@ -94,7 +74,7 @@ export class PlayerLugasLimit {
94
74
  'Content-Type': 'application/json',
95
75
  'Authorization': `Bearer ${this.session}`
96
76
  },
97
- body: JSON.stringify({ amount: `${this.userAmount}` })
77
+ body: userAmount ? JSON.stringify({ amount: `${userAmount}` }) : JSON.stringify({})
98
78
  };
99
79
  fetch(url.href, options)
100
80
  .then((res) => {
@@ -111,7 +91,9 @@ export class PlayerLugasLimit {
111
91
  this.kyc = data.popup;
112
92
  this.validation = false;
113
93
  this.dropDown = false;
114
- this.operatorDepositLimitAmount = data.operatorDepositLimitAmount;
94
+ if (data.operatorDepositLimitAmount) {
95
+ this.operatorDepositLimitAmount = data.operatorDepositLimitAmount;
96
+ }
115
97
  })
116
98
  .catch((err) => {
117
99
  // Handle any errors
@@ -120,11 +102,7 @@ export class PlayerLugasLimit {
120
102
  };
121
103
  this.handleClick = (input) => {
122
104
  switch (input) {
123
- case 'nextStep':
124
- case 'keepExistingLimit':
125
- this.setPlayerSituation();
126
- break;
127
- case 'sureSetNewLimit':
105
+ case 'postSituation':
128
106
  this.postPlayerSituation();
129
107
  break;
130
108
  case 'setNewLimit':
@@ -134,14 +112,13 @@ export class PlayerLugasLimit {
134
112
  this.uploadDocuments.emit();
135
113
  break;
136
114
  case 'Close':
137
- //close modal
138
- this.isVisible = false;
115
+ this.closePopup.emit();
139
116
  break;
140
117
  }
141
118
  };
142
119
  this.setLimit = () => {
143
120
  this.userAmount = this.inputValue;
144
- this.postPlayerSituation();
121
+ this.postPlayerSituation(this.userAmount);
145
122
  };
146
123
  }
147
124
  componentDidRender() {
@@ -155,17 +132,21 @@ export class PlayerLugasLimit {
155
132
  }
156
133
  // end custom styling area
157
134
  }
135
+ connectedCallback() {
136
+ getTranslations(this.translationUrl);
137
+ }
158
138
  handleInputChange(event) {
159
139
  const inputValue = event.target.value;
160
140
  this.inputValue = inputValue;
161
- this.isButtonDisabled = isNaN(Number(inputValue)) || Number(inputValue) < 10 || Number(inputValue) > 30000;
162
- this.invalidInput = isNaN(Number(inputValue)) || Number(inputValue) < 10 || Number(inputValue) > 30000;
141
+ let min = parseInt(this.amountMinMax.split(',')[0]);
142
+ let max = parseInt(this.amountMinMax.split(',')[1]);
143
+ this.isButtonDisabled = isNaN(Number(inputValue)) || Number(inputValue) < min || Number(inputValue) > max;
144
+ this.invalidInput = isNaN(Number(inputValue)) || Number(inputValue) < min || Number(inputValue) > max;
163
145
  }
164
- // traduceri setclient styling
165
146
  renderKYC(step) {
166
147
  if (step == 0) {
167
148
  //CLOSE MODAL
168
- this.isVisible = false;
149
+ this.closePopup.emit();
169
150
  return;
170
151
  }
171
152
  if (step == 1) {
@@ -174,8 +155,8 @@ export class PlayerLugasLimit {
174
155
  h("p", null, translate('kycSure', this.lang)),
175
156
  h("p", null, translate('kyc1', this.lang)),
176
157
  h("div", { class: "ContainerButtons" },
177
- h("button", { class: "FirstButton", onClick: () => this.handleClick('sureSetNewLimit') }, translate('setNewLimit', this.lang)),
178
- h("button", { class: "SecondButton", onClick: () => this.handleClick('keepExistingLimit') }, translate('keepExistingLimit', this.lang))))));
158
+ h("button", { class: "FirstButton", onClick: () => this.postPlayerSituation(this.userAmount) }, translate('setNewLimit', this.lang)),
159
+ h("button", { class: "SecondButton", onClick: () => this.handleClick('postSituation') }, translate('keepExistingLimit', this.lang))))));
179
160
  }
180
161
  else if (step == 2) {
181
162
  return (h("div", { class: "VallidatorContainer" },
@@ -217,7 +198,7 @@ export class PlayerLugasLimit {
217
198
  :
218
199
  h("div", { class: "ContainerButtons" },
219
200
  h("button", { class: "FirstButton", onClick: () => this.handleClick('setNewLimit') }, translate('setNewLimit', this.lang)),
220
- h("button", { class: "SecondButton", onClick: () => this.handleClick('nextStep') }, translate('confirm', this.lang)))));
201
+ h("button", { class: "SecondButton", onClick: () => this.handleClick('postSituation') }, translate('confirm', this.lang)))));
221
202
  }
222
203
  else if (input == '2') {
223
204
  return (h("div", { class: "VallidatorContainer" },
@@ -234,13 +215,10 @@ export class PlayerLugasLimit {
234
215
  :
235
216
  h("div", { class: "ContainerButtons" },
236
217
  h("button", { class: "FirstButton", onClick: () => this.handleClick('setNewLimit') }, translate('setNewLimit', this.lang)),
237
- h("button", { class: "SecondButton", onClick: () => this.handleClick('nextStep') }, translate('keepExistingLimit', this.lang)))));
218
+ h("button", { class: "SecondButton", onClick: () => this.handleClick('postSituation') }, translate('keepExistingLimit', this.lang)))));
238
219
  }
239
220
  }
240
221
  render() {
241
- if (!this.isVisible) {
242
- return null; // Render nothing if component is not visible
243
- }
244
222
  let kycConfirmation = this.renderKYC(this.kyc);
245
223
  let validationContainer = this.renderValidator(this.flow);
246
224
  if (this.isLoading) {
@@ -346,7 +324,7 @@ export class PlayerLugasLimit {
346
324
  "optional": false,
347
325
  "docs": {
348
326
  "tags": [],
349
- "text": "The endpoint"
327
+ "text": "The NorWAy endpoint"
350
328
  },
351
329
  "attribute": "endpoint",
352
330
  "reflect": false,
@@ -364,7 +342,7 @@ export class PlayerLugasLimit {
364
342
  "optional": false,
365
343
  "docs": {
366
344
  "tags": [],
367
- "text": "The currency"
345
+ "text": "Currency of the player"
368
346
  },
369
347
  "attribute": "currency",
370
348
  "reflect": false,
@@ -477,7 +455,7 @@ export class PlayerLugasLimit {
477
455
  "reflect": false,
478
456
  "defaultValue": "''"
479
457
  },
480
- "translationurl": {
458
+ "translationUrl": {
481
459
  "type": "string",
482
460
  "mutable": false,
483
461
  "complexType": {
@@ -491,8 +469,9 @@ export class PlayerLugasLimit {
491
469
  "tags": [],
492
470
  "text": "The translationurl"
493
471
  },
494
- "attribute": "translationurl",
495
- "reflect": false
472
+ "attribute": "translation-url",
473
+ "reflect": false,
474
+ "defaultValue": "''"
496
475
  }
497
476
  }; }
498
477
  static get states() { return {
@@ -506,7 +485,6 @@ export class PlayerLugasLimit {
506
485
  "crossProviders": {},
507
486
  "invalidInput": {},
508
487
  "stylingAppends": {},
509
- "isVisible": {},
510
488
  "userAmount": {},
511
489
  "operatorDepositLimitAmount": {}
512
490
  }; }
@@ -516,6 +494,21 @@ export class PlayerLugasLimit {
516
494
  "bubbles": true,
517
495
  "cancelable": true,
518
496
  "composed": true,
497
+ "docs": {
498
+ "tags": [],
499
+ "text": "Upload documents event"
500
+ },
501
+ "complexType": {
502
+ "original": "any",
503
+ "resolved": "any",
504
+ "references": {}
505
+ }
506
+ }, {
507
+ "method": "closePopup",
508
+ "name": "closePopup",
509
+ "bubbles": true,
510
+ "cancelable": true,
511
+ "composed": true,
519
512
  "docs": {
520
513
  "tags": [],
521
514
  "text": ""
@@ -1,6 +1,6 @@
1
1
  const DEFAULT_LANGUAGE = 'en';
2
2
  const SUPPORTED_LANGUAGES = ['ro', 'en'];
3
- const TRANSLATIONS = {
3
+ let TRANSLATIONS = {
4
4
  en: {
5
5
  loading: 'Loading, please wait ...',
6
6
  error: 'It was an error while trying to fetch the data',
@@ -98,6 +98,18 @@ const TRANSLATIONS = {
98
98
  softMigrationP3: 'Do you want to set a new limit or confirm the existing limit ',
99
99
  }
100
100
  };
101
+ export const getTranslations = (url) => {
102
+ // fetch url, get the data, replace the TRANSLATIONS content
103
+ fetch(url)
104
+ .then((res) => res.json())
105
+ .then((data) => {
106
+ Object.keys(data).forEach((item) => {
107
+ for (let key in data[item]) {
108
+ TRANSLATIONS[item][key] = data[item][key];
109
+ }
110
+ });
111
+ });
112
+ };
101
113
  export const translate = (key, customLang, values) => {
102
114
  const lang = customLang;
103
115
  let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];