@everymatrix/cashier-method-details 1.29.3 → 1.29.4
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@everymatrix/cashier-method-details",
|
3
|
-
"version": "1.29.
|
3
|
+
"version": "1.29.4",
|
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": "70873f2feed3be9c071d9ad09343a833b236b4fc"
|
39
39
|
}
|
@@ -15,7 +15,10 @@
|
|
15
15
|
import flatpickr from "flatpickr";
|
16
16
|
import "flatpickr/dist/flatpickr.min.css";
|
17
17
|
import FlatpickrLanguages from "flatpickr/dist/l10n";
|
18
|
-
|
18
|
+
import dayjs from 'dayjs';
|
19
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
20
|
+
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
21
|
+
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
|
19
22
|
import type {PaymentMethod} from "./CashierMethodDetails.types";
|
20
23
|
export class PaymentMethodDetails {
|
21
24
|
name: string;
|
@@ -279,7 +282,19 @@
|
|
279
282
|
if(!el) {
|
280
283
|
return;
|
281
284
|
}
|
282
|
-
|
285
|
+
const field = JSON.parse(el.dataset.field);
|
286
|
+
flatpickr(el, {...dateOptions[field.type], maxDate: field.maxValue, minDate: field.minValue, defaultDate: field.defaultValue,
|
287
|
+
onReady: (selectedDates, dateStr) => {
|
288
|
+
prepareFields[field.name] = dateStr;
|
289
|
+
},
|
290
|
+
onClose: (selectedDates, dateStr, instance) => {
|
291
|
+
if(!fieldValidation[field.name]) {
|
292
|
+
prepareFields[field.name] = dateStr;
|
293
|
+
} else {
|
294
|
+
prepareFields[field.name] = '';
|
295
|
+
}
|
296
|
+
}
|
297
|
+
})
|
283
298
|
});
|
284
299
|
}
|
285
300
|
const setActiveLanguage = ():void => {
|
@@ -377,7 +392,10 @@
|
|
377
392
|
window.addEventListener('closeIframe', closeIframe, false);
|
378
393
|
window.addEventListener('notificationButtonClick', retryRedirect, false);
|
379
394
|
window.addEventListener('closeCashierReceiptPage', closeReceiptPage, false);
|
380
|
-
document.addEventListener('click',closeAllLookups)
|
395
|
+
document.addEventListener('click',closeAllLookups);
|
396
|
+
dayjs.extend(customParseFormat);
|
397
|
+
dayjs.extend(isSameOrBefore);
|
398
|
+
dayjs.extend(isSameOrAfter);
|
381
399
|
|
382
400
|
return () => {
|
383
401
|
window.removeEventListener('closeModal', closeModal);
|
@@ -678,6 +696,19 @@
|
|
678
696
|
amountIntError() || amountDecimalError();
|
679
697
|
}
|
680
698
|
|
699
|
+
const dateTimeValidation = (field) => {
|
700
|
+
const value = prepareFields[field.name];
|
701
|
+
const format = field.placeholder;
|
702
|
+
const inputValue = dayjs(value, format);
|
703
|
+
const maxValue = dayjs(field.maxValue, format);
|
704
|
+
const minValue = dayjs(field.minValue, format);
|
705
|
+
if (inputValue.isSameOrBefore(minValue) || inputValue.isSameOrAfter(maxValue)) {
|
706
|
+
fieldValidation[field.name] = $_('invalidFieldError',{ values: { field: field.label }})
|
707
|
+
return;
|
708
|
+
}
|
709
|
+
fieldValidation[field.name] = showField(field) ? (emptyFieldError(field, value) || patternMatchesError(field, value)) : '';
|
710
|
+
}
|
711
|
+
|
681
712
|
const validateField = (field) => {
|
682
713
|
const value = prepareFields[field.name]
|
683
714
|
fieldValidation[field.name] = showField(field) ? (emptyFieldError(field, value) || patternMatchesError(field, value)) : '';
|
@@ -763,12 +794,11 @@
|
|
763
794
|
on:blur="{() => { showError[field.name] = true; validateField(field) }}">
|
764
795
|
{:else if field.type === FieldTypes.Time || field.type === FieldTypes.Date || field.type === FieldTypes.DateTime}
|
765
796
|
<input type="text" bind:value={ prepareFields[field.name] } pattern={field.format}
|
766
|
-
data-
|
767
|
-
data-maxvalue={field.maxValue}
|
768
|
-
data-minvalue={field.minValue}
|
797
|
+
data-field={JSON.stringify(field)}
|
769
798
|
placeholder={field.placeholder}
|
770
|
-
on:input={() => {
|
771
|
-
on:change={() => { showError[field.name] = true;
|
799
|
+
on:input={() => { showError[field.name] = true; dateTimeValidation(field) }}
|
800
|
+
on:change={() => { showError[field.name] = true; dateTimeValidation(field) }}
|
801
|
+
on:blur={() => { showError[field.name] = true; dateTimeValidation(field) }}
|
772
802
|
bind:this={flatpickrEl[flatpickrEl.length]}
|
773
803
|
>
|
774
804
|
{:else if field.type === FieldTypes.Number || field.type === FieldTypes.Money}
|
@@ -786,7 +816,7 @@
|
|
786
816
|
|
787
817
|
{:else if field.type === FieldTypes.Lookup}
|
788
818
|
<div class="CustomSelect">
|
789
|
-
<div class="Selected" id="{index}" on:click="{(e) => showLookup(e, field.name)}"> {getValueByFieldName(field.values, prepareFields[field.name])}</div>
|
819
|
+
<div class="Selected" id="{index}" on:click="{(e) => showLookup(e, field.name)}"> <span class="SelectedValue">{getValueByFieldName(field.values, prepareFields[field.name])}</span></div>
|
790
820
|
<div class="OptionList"
|
791
821
|
class:Opened={openedLookup === field.name}
|
792
822
|
class:Top={openLookupTop}
|
@@ -952,6 +982,8 @@
|
|
952
982
|
.CashierMethodDetails {
|
953
983
|
width: 100%;
|
954
984
|
height: 100%;
|
985
|
+
container-name: method-details;
|
986
|
+
container-type: inline-size;
|
955
987
|
}
|
956
988
|
.ReceiptPage {
|
957
989
|
background-color: var(--emw--color-gray-transparency-100, rgb(255, 255, 255));
|
@@ -1256,6 +1288,9 @@
|
|
1256
1288
|
display: flex;
|
1257
1289
|
align-items: center;
|
1258
1290
|
cursor: pointer;
|
1291
|
+
.SelectedValue {
|
1292
|
+
max-width: 95%;
|
1293
|
+
}
|
1259
1294
|
&:after {
|
1260
1295
|
position: absolute;
|
1261
1296
|
content: "";
|
@@ -1296,4 +1331,21 @@
|
|
1296
1331
|
display: block;
|
1297
1332
|
}
|
1298
1333
|
}
|
1334
|
+
@container method-details (width < 699px) {
|
1335
|
+
.FormLogo .SelectedLogoDescription {
|
1336
|
+
font-size: var(--emw--font-size-x-small, 12px);
|
1337
|
+
display: -webkit-box;
|
1338
|
+
-webkit-line-clamp: 2;
|
1339
|
+
-webkit-box-orient: vertical;
|
1340
|
+
overflow: hidden;
|
1341
|
+
text-overflow: ellipsis;
|
1342
|
+
}
|
1343
|
+
|
1344
|
+
label, input, .Description, .FormLogo .ChangePaymeth {
|
1345
|
+
font-size: var(--emw--font-size-x-small, 12px);
|
1346
|
+
}
|
1347
|
+
.SelectedMethodDescription, .AmountLimits {
|
1348
|
+
font-size: var(--emw--font-size-2x-small, 10px);
|
1349
|
+
}
|
1350
|
+
}
|
1299
1351
|
</style>
|
package/src/translations.js
CHANGED
@@ -2,8 +2,8 @@ export const TRANSLATIONS = {
|
|
2
2
|
"en": {
|
3
3
|
"loading": "Loading...",
|
4
4
|
"amountLabel": "Amount",
|
5
|
-
"redirectTitle": "You are redirected to the payment
|
6
|
-
"redirectMessage": "Please complete your transaction on the payment
|
5
|
+
"redirectTitle": "You are redirected to the payment's provider page",
|
6
|
+
"redirectMessage": "Please complete your transaction on the payment's provider page.",
|
7
7
|
"backToPayment": "Close",
|
8
8
|
"retryText": "Please note that your popup blocker may prevent the payment window from appearing",
|
9
9
|
"retryButton": "RETRY",
|
@@ -23,13 +23,13 @@ export const TRANSLATIONS = {
|
|
23
23
|
"backToMethodList": "BACK TO PAYMENT METHODS",
|
24
24
|
"deposit": {
|
25
25
|
"makeTxnButton": "DEPOSIT",
|
26
|
-
"confirmText": "You
|
27
|
-
"confirmButton": "Ok"
|
26
|
+
"confirmText": "You're going to deposit {amount} {currency} to your account",
|
27
|
+
"confirmButton": "Ok"
|
28
28
|
},
|
29
29
|
"withdraw": {
|
30
30
|
"makeTxnButton": "WITHDRAW",
|
31
|
-
"confirmText": "You
|
32
|
-
"confirmButton": "Ok"
|
31
|
+
"confirmText": "You're going to withdraw {amount} {currency} from your account",
|
32
|
+
"confirmButton": "Ok"
|
33
33
|
}
|
34
34
|
}
|
35
|
-
}
|
35
|
+
}
|