@everymatrix/cashier-page 1.34.3 → 1.36.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.
package/index.html CHANGED
@@ -36,7 +36,7 @@
36
36
  local="en-US"
37
37
  channel="Desktop"
38
38
  type="Deposit"
39
- session="b54930b8-1e79-496b-bb20-ac07d5098e39"
39
+ session="935b0211-7b3d-4454-8b0a-f8e66099c18f"
40
40
  translationurl="https://static.everymatrix.com/mmstage/translations/1995/mm-localization-en.json"
41
41
  assetsurl="https://static.everymatrix.com/mmstage/cashier/operator-assets/1995"
42
42
  endpoint="https://odeonbet-api.stage.norway.mazeday.com"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/cashier-page",
3
- "version": "1.34.3",
3
+ "version": "1.36.0",
4
4
  "main": "index.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "4e28e0c3c1affa9d973865e59eaf5af69fcddede"
38
+ "gitHead": "09be81de9c66446d0062303022d5f036d874d153"
39
39
  }
@@ -1,12 +1,13 @@
1
1
  <svelte:options tag={null} />
2
2
  <script lang="ts">
3
3
  import {onMount} from "svelte";
4
- import {_, addNewMessages, setLocale} from './i18n';
4
+ import { _, addNewMessages, setLocale, setupI18n } from './i18n';
5
5
  import {TRANSLATIONS} from './translations';
6
6
 
7
7
  import type {PaymentMethod} from "./CashierPage.types";
8
- import {TxnChannel, TxnType} from "./CashierPage.types";
8
+ import {TxnChannel, TxnType, ResponseCode} from "./CashierPage.types";
9
9
 
10
+ import '@everymatrix/cashier-header';
10
11
  import '@everymatrix/cashier-methods-list';
11
12
  import '@everymatrix/cashier-method-details';
12
13
  import '@everymatrix/cashier-error';
@@ -43,6 +44,7 @@
43
44
  export let assetsurl: string;
44
45
  export let type: string = TxnType.Deposit;
45
46
  export let channel: string = TxnChannel.Desktop;
47
+ export let showheader: string = 'true';
46
48
  export let numberofmethodsshown: string;
47
49
  export let clientstyling:string = '';
48
50
  export let clientstylingurl:string = ''
@@ -74,13 +76,10 @@
74
76
  let confirmAmount: number;
75
77
  let hideAmountField: boolean;
76
78
  let redirectMode: RedirectionModeStringEnum;
79
+ let modalErrorMessage: string;
80
+ let title: string;
81
+ let showHeaderBack: string;
77
82
 
78
- $: endpoint && session && customerid && lang && channel && type && successurl && failurl && cancelurl && getPlayerSession();
79
- $: clientstyling && customStylingContainer && setClientStyling();
80
- $: clientstylingurl && customStylingContainer && setClientStylingURL();
81
- $: lang && setActiveLanguage();
82
- $: lang && translationurl && setTranslationUrl();
83
- $: widgetWidth && setDevice();
84
83
  const setActiveLanguage = ():void => {
85
84
  setLocale(lang);
86
85
  }
@@ -129,7 +128,16 @@
129
128
  if (data.error) {
130
129
  errorMessage = data.error
131
130
  }
132
- if (data.ResponseCode !== 'Success') {
131
+ if (data.ResponseCode === ResponseCode.PlayerSessionIsNotValid) {
132
+ errorResponseCode = data.ResponseCode;
133
+ setErrorResponseCode();
134
+ return;
135
+ }
136
+ if (data.ResponseCode === ResponseCode.JwtTokenError) {
137
+ errorResponseCode = data.ResponseCode;
138
+ setErrorResponseCode();
139
+ }
140
+ if (data.ResponseCode !== ResponseCode.Success) {
133
141
  errorResponseCode = data.ResponseCode;
134
142
  setErrorResponseCode();
135
143
  return;
@@ -140,12 +148,28 @@
140
148
  .catch(error => console.log(error))
141
149
  }
142
150
 
151
+ const setTitle = () => {
152
+ if (showMethodDetailsPage && isMobileWidth()) {
153
+ title = selectedPaymentMethod.Label || selectedPaymentMethod.Name;
154
+ showHeaderBack = 'true'
155
+ } else {
156
+ title = `header.${type.toLowerCase()}`
157
+ showHeaderBack = 'false'
158
+ }
159
+ }
143
160
  const setDevice = () => {
144
- mobileView = (widgetWidth < 750).toString();
161
+ mobileView = isMobileWidth().toString();
162
+ setTitle()
163
+ }
164
+
165
+ const isMobileWidth = () => {
166
+ return widgetWidth < 750
145
167
  }
146
168
  const selectPayMeth = (e) => {
147
169
  selectedPaymentMethod.Name = e.detail.Name;
170
+ selectedPaymentMethod.Label = e.detail.Label
148
171
  showMethodDetailsPage = true;
172
+ setTitle()
149
173
  }
150
174
  const setErrorResponseCode = () => {
151
175
  window.postMessage({type: 'ErrorResponseCode', errorResponseCode}, window.location.href);
@@ -174,6 +198,7 @@
174
198
 
175
199
  const hideMethodDetails = (e) => {
176
200
  showMethodDetailsPage = !e.detail.hideMethodDetails
201
+ setTitle()
177
202
  }
178
203
 
179
204
  onMount(() => {
@@ -203,26 +228,37 @@
203
228
  }
204
229
 
205
230
  const messageHandler = (e:any) => {
206
- if (e.data.type == 'ShowSessionError') {
231
+ if (e.data.type === 'ShowSessionError') {
207
232
  errorMessage = e.data.error
208
233
  }
209
234
  if (e.data.type === 'ToggleDisableActionOnPage') {
210
235
  isProcessingTxn = e.data.disable
211
236
  }
212
- if (e.data.type == 'ErrorResponseCode') {
237
+ if (e.data.type === 'ErrorResponseCode') {
213
238
  errorResponseCode = e.data.errorResponseCode;
214
239
  }
215
- if (e.data.type == 'ShowConfirmModal') {
240
+ if (e.data.type === 'ShowConfirmModal') {
216
241
  showConfirmModal = e.data.showConfirmModal;
217
242
  confirmAmount = e.data.editedAmount;
218
243
  hideAmountField = e.data.hideAmountField;
219
244
  }
220
- if (e.data.type == 'RedirectInfo') {
245
+ if (e.data.type === 'RedirectInfo') {
221
246
  redirectUrl = e.data.redirectUrl;
222
- redirectMode = e.data.redirectMode;
247
+ redirectMode = e.data.redirectMode;
248
+ setTitle()
249
+ }
250
+ if (e.data.type === 'ShowCashierModal') {
251
+ modalErrorMessage = e.data.modalErrorMessage;
223
252
  }
224
253
  }
225
254
 
255
+ $: endpoint && session && customerid && lang && channel && type && successurl && failurl && cancelurl && getPlayerSession();
256
+ $: clientstyling && customStylingContainer && setClientStyling();
257
+ $: clientstylingurl && customStylingContainer && setClientStylingURL();
258
+ $: lang && setActiveLanguage();
259
+ $: lang && setTitle();
260
+ $: translationurl && setTranslationUrl();
261
+ $: widgetWidth && setDevice();
226
262
  </script>
227
263
  <div class={showMethodDetailsPage ? "CashierPageWidget BothSections" : "CashierPageWidget"}
228
264
  bind:this={customStylingContainer}
@@ -232,12 +268,26 @@
232
268
  <div class="DisablePage"></div>
233
269
  {/if}
234
270
  {#if lang}
235
- <div class="Header">{ $_(`header.${type.toLowerCase()}`)}</div>
271
+ {#if !!showheader && showheader !== 'false'}
272
+ <cashier-header class="Header"
273
+ {lang}
274
+ {translationurl}
275
+ {title}
276
+ {clientstylingurl}
277
+ {clientstyling}
278
+ showbackbutton="{showHeaderBack}"
279
+ >
280
+ </cashier-header>
281
+ {/if}
236
282
  {#if redirectUrl && redirectMode === RedirectionModeStringEnum.Default}
237
283
  <div class="IframeRedirect">
238
284
  <cashier-iframe-redirect
239
- lang="{lang}"
240
- translationurl="{translationurl}"
285
+ {lang}
286
+ {translationurl}
287
+ {title}
288
+ {clientstylingurl}
289
+ {clientstyling}
290
+ showbackbutton="{showheader}"
241
291
  iframeurl="{redirectUrl}"
242
292
  ></cashier-iframe-redirect>
243
293
  </div>
@@ -248,11 +298,11 @@
248
298
  {translationurl}
249
299
  {clientstylingurl}
250
300
  {clientstyling}
251
- errorcode={errorResponseCode}
301
+ errorcode={modalErrorMessage}
252
302
  >
253
303
  <div slot="button" class="ModalButton" on:click={hideModal}>{$_('closeModal')}</div>
254
304
  </cashier-error>
255
- </cashier-modal>
305
+ </cashier-modal>
256
306
  {#if showConfirmModal}
257
307
  <cashier-confirm-modal>
258
308
  <span slot="text">{ confirmAmount && !hideAmountField ? $_(`${type.toLowerCase()}.confirmTextWithAmount`,
@@ -276,6 +326,7 @@
276
326
  {clientstyling}
277
327
  {assetsurl}
278
328
  session="{xPaymentSessionToken}"
329
+ ismobileview="{mobileView}"
279
330
  ></cashier-methods-list>
280
331
  </div>
281
332
  <div class="CashierMethodDetailsWrapper">
@@ -299,7 +350,7 @@
299
350
  </div>
300
351
  </div>
301
352
  {:else}
302
- <cashier-error
353
+ <cashier-error class="Error"
303
354
  {lang}
304
355
  {assetsurl}
305
356
  {translationurl}
@@ -326,10 +377,10 @@
326
377
  }
327
378
  }
328
379
  @mixin container-height {
329
- height: calc(100% - 66px);
380
+ height: 100%;
330
381
  overflow: auto;
331
- padding: var(--emw--spacing-x-small, 7px) var(--emw--spacing-small, 12px) var(--emw--spacing-small, 12px) var(--emw--spacing-small, 12px);
332
382
  box-sizing: border-box;
383
+ scrollbar-gutter: stable both-edges;
333
384
  }
334
385
  .DisablePage {
335
386
  container-type: inline-size;
@@ -347,15 +398,37 @@
347
398
  container-name: deposit-page;
348
399
  height: inherit;
349
400
  position: relative;
401
+ box-sizing: border-box;
350
402
  .CashierMethodDetailsWrapper {
351
403
  display: none;
352
404
  }
405
+ &:has(.Header) {
406
+ .Content, .CashierPage, .Error {
407
+ border-radius: 0 0 6px 6px;
408
+ border: 1px solid var(--mmw--color-grey-105, #E8E9EB);
409
+ box-sizing: border-box;
410
+ }
411
+ .Content, .CashierPage, .DisablePage {
412
+ height: calc(100% - var(--mmw--header-height, 32px));
413
+ }
414
+ .DisablePage {
415
+ top: var(--mmw--header-height, 32px);
416
+ }
417
+ }
353
418
  }
354
- .BothSections {
355
- .Header {
356
- transition: all 1s;
357
- width: 100%;
419
+ .Content {
420
+ height: 100%;
421
+ position: relative;
422
+ }
423
+ .CashierMethodListWrapper {
424
+ @include container-height;
425
+ padding: var(--emw--spacing-large, 20px) var(--emw--spacing-x-small, 10px) var(--emw--spacing-small, 12px) var(--emw--spacing-x-small, 10px);
426
+ width: 50%;
427
+ &::-webkit-scrollbar {
428
+ border-right: none;
358
429
  }
430
+ }
431
+ .BothSections {
359
432
  .CashierMethodDetailsWrapper {
360
433
  @include container-height;
361
434
  display: block;
@@ -363,16 +436,11 @@
363
436
  width: 50%;
364
437
  justify-content: center;
365
438
  }
366
- }
367
- .Header {
368
- width: 50%;
369
- display: flex;
370
- margin: auto;
371
- padding: var(--emw--spacing-medium, 15px) 0;
372
- font-size: var(--emw--font-size-small, 14px);
373
- font-weight: bold;
374
- color: var(--mmw--color-grey-10, #111);
375
- line-height: var(--emw--font-size-small, 14px);
439
+ .CashierMethodListWrapper {
440
+ &::-webkit-scrollbar {
441
+ border-right: 1px solid var(--emw--color-gray-100, #E0E0E0 );
442
+ }
443
+ }
376
444
  }
377
445
  .CashierPage {
378
446
  position: relative;
@@ -381,13 +449,7 @@
381
449
  justify-content: center;
382
450
  height: inherit;
383
451
  }
384
- .CashierMethodListWrapper {
385
- @include container-height;
386
- width: 50%;
387
- &::-webkit-scrollbar {
388
- border-right: 1px solid var(--emw--color-gray-100, #E0E0E0 );
389
- }
390
- }
452
+
391
453
  cashier-method-details {
392
454
  width: 0;
393
455
  }
@@ -408,15 +470,13 @@
408
470
  background-color: var(--emw--color-white, #FFF);
409
471
  }
410
472
  @container deposit-page (max-width:750px) {
411
- .Header {
412
- width: 100%;
413
- }
414
473
  .CashierPage, .BothSections .CashierPage {
415
474
  flex-direction: column;
416
475
  justify-content: flex-start;
417
476
  gap: 0;
418
477
  cashier-methods-list, cashier-method-details, .CashierMethodDetailsWrapper {
419
478
  width: 100%;
479
+ height: 100%;
420
480
  }
421
481
  }
422
482
  cashier-method-details {
@@ -72,3 +72,9 @@ export enum TxnChannel {
72
72
  Mobile='Mobile',
73
73
  NativeApp='NativeApp'
74
74
  }
75
+
76
+ export enum ResponseCode {
77
+ PlayerSessionIsNotValid ='PlayerSessionIsNotValid',
78
+ Success = 'Success',
79
+ JwtTokenError = 'JwtTokenError'
80
+ }
@@ -2,10 +2,6 @@ export const TRANSLATIONS = {
2
2
  "en": {
3
3
  "loading": "Loading...",
4
4
  "closeModal": "CLOSE",
5
- "header": {
6
- "deposit": "Deposit",
7
- "withdraw": "Withdraw"
8
- },
9
5
  "deposit": {
10
6
  "makeTxnButton": "DEPOSIT",
11
7
  "confirmText": "You're going to deposit to your account",
@@ -25,5 +21,25 @@ export const TRANSLATIONS = {
25
21
  "deposit": "Uplata",
26
22
  "withdraw": "Povlačenje"
27
23
  }
24
+ },
25
+ "tr": {
26
+ "loading": "Yükleniyor...",
27
+ "closeModal": "KAPAT",
28
+ "header": {
29
+ "deposit": "Yatır",
30
+ "withdraw": "Çek"
31
+ },
32
+ "deposit": {
33
+ "makeTxnButton": "YATIR",
34
+ "confirmText": "Hesabınıza yatırıyorsunuz",
35
+ "confirmTextWithAmount": "Hesabınıza {amount} {currency} yatırıyorsunuz",
36
+ "confirmButton": "Tamam"
37
+ },
38
+ "withdraw": {
39
+ "makeTxnButton": "ÇEK",
40
+ "confirmText": "Hesabınızdan çekiyorsunuz",
41
+ "confirmTextWithAmount": "Hesabınıza {amount} {currency} yatırıyorsunuz",
42
+ "confirmButton": "Tamam"
43
+ }
28
44
  }
29
- }
45
+ };