@everymatrix/cashier-method-details 1.27.2 → 1.27.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +2 -0
- package/dist/cashier-method-details.js +212 -212
- package/dist/cashier-method-details.js.map +1 -1
- package/package.json +2 -2
- package/src/CashierMethodDetails.svelte +48 -6
- package/src/translations.js +11 -4
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@everymatrix/cashier-method-details",
|
3
|
-
"version": "1.27.
|
3
|
+
"version": "1.27.5",
|
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": "
|
38
|
+
"gitHead": "8155a0b8b58289a1253d06ffabea74af8bbd932e"
|
39
39
|
}
|
@@ -12,6 +12,7 @@
|
|
12
12
|
import '@everymatrix/cashier-notifications'
|
13
13
|
|
14
14
|
import type {PaymentMethod} from "./CashierMethodDetails.types";
|
15
|
+
import {number} from "svelte-i18n";
|
15
16
|
export class PaymentMethodDetails {
|
16
17
|
name: string;
|
17
18
|
label: string;
|
@@ -113,10 +114,16 @@
|
|
113
114
|
export let currency: string;
|
114
115
|
export let amount: number;
|
115
116
|
export let assetsurl: string;
|
117
|
+
export let type: string = TxnType.Deposit;
|
116
118
|
export let selectedpaymentmethodname: string;
|
117
119
|
export let clientstyling:string = '';
|
118
120
|
export let clientstylingurl:string = ''
|
119
121
|
|
122
|
+
export enum TxnType {
|
123
|
+
Deposit='Deposit',
|
124
|
+
Withdraw='Withdraw'
|
125
|
+
}
|
126
|
+
|
120
127
|
const VISIBLE_FIELD_TYPES: string[] =
|
121
128
|
'Text,Number,Money,Boolean,Lookup,Date,Time,DateTime,Password,Label,Link,QRCode'.split(',');
|
122
129
|
export enum RedirectionModeStringEnum {
|
@@ -156,6 +163,8 @@
|
|
156
163
|
let amountError = '';
|
157
164
|
let showError = {};
|
158
165
|
let fieldValidation = {};
|
166
|
+
let openLookupTop = false;
|
167
|
+
let maxLookupHeight: number;
|
159
168
|
|
160
169
|
$: endpoint && session && selectedpaymentmethodname && currency && getPaymentDetails();
|
161
170
|
$: clientstyling && customStylingContainer && setClientStyling();
|
@@ -284,10 +293,18 @@
|
|
284
293
|
|
285
294
|
const showLookup = (event, name) => {
|
286
295
|
if (name === openedLookup) {
|
296
|
+
showError[openedLookup] = true;
|
297
|
+
validateField(fields.find(field => field.name === openedLookup));
|
287
298
|
openedLookup = null
|
288
299
|
return;
|
289
300
|
}
|
301
|
+
event.stopPropagation();
|
290
302
|
clickedElem = event.composedPath()[0]
|
303
|
+
const clickY = clickedElem.getBoundingClientRect().y;
|
304
|
+
const minLookupHeight = 200;
|
305
|
+
const lookupMargin = 55;
|
306
|
+
openLookupTop = (window.innerHeight - clickY) < minLookupHeight;
|
307
|
+
maxLookupHeight = openLookupTop ? clickY - minLookupHeight : window.innerHeight - clickY - lookupMargin;
|
291
308
|
openedLookup = name
|
292
309
|
}
|
293
310
|
|
@@ -590,7 +607,11 @@
|
|
590
607
|
{:else if field.type === FieldTypes.Lookup}
|
591
608
|
<div class="CustomSelect">
|
592
609
|
<div class="Selected" id="{index}" on:click="{(e) => showLookup(e, field.name)}">{prepareFields[field.name] || ''}</div>
|
593
|
-
<div class="OptionList"
|
610
|
+
<div class="OptionList"
|
611
|
+
class:Opened={openedLookup === field.name}
|
612
|
+
class:Top={openLookupTop}
|
613
|
+
style="max-height: {`${maxLookupHeight}px`};"
|
614
|
+
>
|
594
615
|
{#each field.values as value}
|
595
616
|
<div on:click="{() => {prepareFields[field.name] = value.Name; fields = fields}}">
|
596
617
|
<span>{value.Value}</span>
|
@@ -627,7 +648,7 @@
|
|
627
648
|
<svg class="ButtonLock" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
628
649
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.51564 0.574496C6.49714 0.733152 5.5928 1.46162 5.21164 2.43037C5.01714 2.92471 4.98674 3.24368 4.98671 4.78987L4.98668 5.99306L4.55336 6.00671C4.20693 6.01762 4.08258 6.03221 3.93336 6.07946C3.43136 6.23846 3.00318 6.58293 2.73943 7.04C2.70133 7.106 2.63639 7.256 2.59508 7.37334L2.52002 7.58665V13.9067L2.59268 14.12C2.6993 14.4331 2.83849 14.6518 3.09336 14.9067C3.34821 15.1615 3.56693 15.3007 3.88002 15.4073L4.09336 15.48H11.9067L12.12 15.4073C12.4331 15.3007 12.6518 15.1615 12.9067 14.9067C13.1616 14.6518 13.3007 14.4331 13.4074 14.12L13.48 13.9067V7.58665L13.405 7.37334C13.1846 6.74712 12.6999 6.27875 12.0667 6.08C11.9191 6.03371 11.7891 6.0184 11.4467 6.00696L11.0134 5.99253L11.0133 4.78959C11.0133 4.128 11.0008 3.45465 10.9855 3.29334C10.9257 2.66268 10.7188 2.13556 10.3497 1.67368C9.66549 0.817589 8.6023 0.405214 7.51564 0.574496ZM8.46436 1.58665C9.01596 1.7035 9.52999 2.11659 9.79758 2.65809C9.98521 3.03771 9.98202 3.00646 9.99305 4.58L10.003 6H5.99702L6.00699 4.58C6.01802 3.00646 6.01483 3.03771 6.20246 2.65809C6.31793 2.42446 6.43799 2.26065 6.61818 2.09103C6.89043 1.83468 7.21371 1.65496 7.52352 1.58775C7.74977 1.53865 8.23518 1.53809 8.46436 1.58665ZM11.9201 7.0955C12.0975 7.17871 12.2992 7.37412 12.3874 7.54806C12.4231 7.61846 12.465 7.75796 12.4805 7.85803C12.4993 7.97978 12.5061 8.97962 12.501 10.88L12.4934 13.72L12.4082 13.8997C12.26 14.2127 12.0016 14.419 11.6821 14.4796C11.4864 14.5167 4.51364 14.5167 4.31793 14.4796C3.99843 14.419 3.74008 14.2127 3.59183 13.8997L3.50668 13.72L3.49905 10.88C3.49393 8.97728 3.50074 7.97987 3.51964 7.85778C3.57627 7.49218 3.79218 7.21543 4.12918 7.0765L4.28002 7.01431L8.02668 7.0205L11.7734 7.02665L11.9201 7.0955Z" fill="white"/>
|
629
650
|
</svg>
|
630
|
-
{$_(
|
651
|
+
{$_(`${type.toLowerCase()}.makeTxnButton`)}
|
631
652
|
<span class="ButtonAmount">{formatter.format(amount)} {currency}</span>
|
632
653
|
</button>
|
633
654
|
{:else}
|
@@ -682,14 +703,17 @@
|
|
682
703
|
{/if}
|
683
704
|
{#if showConfirmModal}
|
684
705
|
<cashier-confirm-modal>
|
685
|
-
<span slot="text">{$_(
|
686
|
-
<div slot="confirm">{$_(
|
706
|
+
<span slot="text">{$_(`${type.toLowerCase()}.confirmText`)} {formatter.format(amount)} {currency} ?</span>
|
707
|
+
<div slot="confirm">{$_(`${type.toLowerCase()}.confirmButton`)}</div>
|
687
708
|
</cashier-confirm-modal>
|
688
709
|
{/if}
|
689
710
|
</div>
|
690
711
|
|
691
712
|
|
692
713
|
<style lang="scss">
|
714
|
+
|
715
|
+
$input-height: 40px;
|
716
|
+
|
693
717
|
@keyframes loading-spinner {
|
694
718
|
from {
|
695
719
|
transform: rotate(0deg)
|
@@ -698,6 +722,18 @@
|
|
698
722
|
transform: rotate(360deg)
|
699
723
|
}
|
700
724
|
}
|
725
|
+
::-webkit-scrollbar {
|
726
|
+
width: 4px;
|
727
|
+
}
|
728
|
+
::-webkit-scrollbar-track {
|
729
|
+
background: transparent;
|
730
|
+
}
|
731
|
+
::-webkit-scrollbar-thumb {
|
732
|
+
background: var(--emw--color-gray-100, #E8E9EB);
|
733
|
+
}
|
734
|
+
::-webkit-scrollbar-thumb:hover {
|
735
|
+
background: var(--emw--color-gray-300, #666);
|
736
|
+
}
|
701
737
|
|
702
738
|
input::-webkit-outer-spin-button,
|
703
739
|
input::-webkit-inner-spin-button {
|
@@ -865,7 +901,7 @@
|
|
865
901
|
input, .Selected {
|
866
902
|
border: 1px solid var(--emw--color-gray-100, #E8E9EB);
|
867
903
|
border-radius: var(--emw--border-radius-medium, 4px);
|
868
|
-
height:
|
904
|
+
height: $input-height;
|
869
905
|
line-height: var(--emw--size-small, 14px);
|
870
906
|
color: var(--emw--color-black, #111);
|
871
907
|
padding: 0 15px;
|
@@ -1011,7 +1047,6 @@
|
|
1011
1047
|
.OptionList {
|
1012
1048
|
display: none;
|
1013
1049
|
position: absolute;
|
1014
|
-
top: 100%;
|
1015
1050
|
left: 0;
|
1016
1051
|
right: 0;
|
1017
1052
|
z-index: 99;
|
@@ -1019,10 +1054,17 @@
|
|
1019
1054
|
border: 1px solid var(--emw--color-gray-100, #E8E9EB);
|
1020
1055
|
border-radius: var(--emw--border-radius-medium, 4px);
|
1021
1056
|
margin-top: 5px;
|
1057
|
+
overflow: auto;
|
1058
|
+
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.1);
|
1059
|
+
&.Top {
|
1060
|
+
transform: translate(0, calc(-1 * (100% + $input-height + 10px)));
|
1061
|
+
}
|
1022
1062
|
div {
|
1023
1063
|
padding: 8px 16px;
|
1024
1064
|
cursor: pointer;
|
1025
1065
|
user-select: none;
|
1066
|
+
line-height: calc(var(--emw--size-small, 14px) + 3px);
|
1067
|
+
font-size: var(--emw--size-small, 14px);
|
1026
1068
|
&:hover {
|
1027
1069
|
background-color: var(--emw--color-background-secondary, #F9F9F9)
|
1028
1070
|
}
|
package/src/translations.js
CHANGED
@@ -2,9 +2,6 @@ export const TRANSLATIONS = {
|
|
2
2
|
"en": {
|
3
3
|
"loading": "Loading...",
|
4
4
|
"amountLabel": "Amount",
|
5
|
-
"makeDepositButton": "DEPOSIT",
|
6
|
-
"confirmDepositText": "Are you sure you want to deposit",
|
7
|
-
"confirmDepositButton": "Ok",
|
8
5
|
"redirectTitle": "You are redirected to the payment\'s provider page",
|
9
6
|
"redirectMessage": "Please complete your transaction on the payment\'s provider page.",
|
10
7
|
"backToPayment": "Close",
|
@@ -21,6 +18,16 @@ export const TRANSLATIONS = {
|
|
21
18
|
"amountMultiplierError": "Amount should be multiple of {multiplier}",
|
22
19
|
"amountIntError": "Amount should be integer value",
|
23
20
|
"amountDecimalError": "Amount should have 2 or less digits after decimal point",
|
24
|
-
"invalidFieldError": "{field} is invalid"
|
21
|
+
"invalidFieldError": "{field} is invalid",
|
22
|
+
"deposit": {
|
23
|
+
"makeTxnButton": "DEPOSIT",
|
24
|
+
"confirmText": "Are you sure you want to deposit?",
|
25
|
+
"confirmButton": "Ok",
|
26
|
+
},
|
27
|
+
"withdraw": {
|
28
|
+
"makeTxnButton": "WITHDRAW",
|
29
|
+
"confirmText": "Are you sure you want to withdraw?",
|
30
|
+
"confirmButton": "Ok",
|
31
|
+
}
|
25
32
|
}
|
26
33
|
};
|