@everymatrix/cashier-methods-list 1.20.11 → 1.22.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/cashier-methods-list",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.1",
|
|
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": "d365a5415b2dc80d690d889ddf05b1b22a5469bf"
|
|
39
39
|
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
export let session:string;
|
|
11
11
|
export let customerid: string;
|
|
12
12
|
export let currency: string;
|
|
13
|
+
export let numberofmethodsshown: string;
|
|
13
14
|
export let translationurl:string='';
|
|
14
15
|
export let clientstyling:string = '';
|
|
15
16
|
export let clientstylingurl:string = ''
|
|
@@ -22,6 +23,8 @@
|
|
|
22
23
|
let displayNone:boolean = false;
|
|
23
24
|
let customStylingContainer:HTMLElement;
|
|
24
25
|
let selectedPaymentMethod: string;
|
|
26
|
+
let methodsButtonToogleText: string = '';
|
|
27
|
+
let paymentMethodsToShow: PaymentMethod[] = [];
|
|
25
28
|
|
|
26
29
|
$: endpoint && session && customerid && getMetaData();
|
|
27
30
|
$: lang && setActiveLanguage();
|
|
@@ -62,7 +65,6 @@
|
|
|
62
65
|
headers.append("X-Payment-Session-Token", `${session}`);
|
|
63
66
|
const requestParams:RequestInit = {
|
|
64
67
|
method: "POST",
|
|
65
|
-
mode: "cors",
|
|
66
68
|
headers: headers,
|
|
67
69
|
body: JSON.stringify({
|
|
68
70
|
"Currency": currency,
|
|
@@ -71,9 +73,10 @@
|
|
|
71
73
|
fetch(url, requestParams).then(res => res.json()).then(data => {
|
|
72
74
|
paymentMethods = data.PaymentMethods.PaymentMethods.map((payMeth) => ({
|
|
73
75
|
...payMeth,
|
|
74
|
-
LimitString: setLimit(payMeth),
|
|
75
76
|
LogoUrl: payMeth.Logos && payMeth.Logos[0].LogoUrl ? `https:${payMeth.Logos[0].LogoUrl}` : '',
|
|
76
77
|
}));
|
|
78
|
+
methodsButtonToogleText = (numberofmethodsshown && +numberofmethodsshown > 0 && paymentMethods.length > +numberofmethodsshown) ? $_('showAll') : '';
|
|
79
|
+
paymentMethodsToShow = methodsButtonToogleText ? paymentMethods.slice(0, +numberofmethodsshown) : paymentMethods;
|
|
77
80
|
})
|
|
78
81
|
}
|
|
79
82
|
|
|
@@ -91,10 +94,25 @@
|
|
|
91
94
|
detail: payMeth,
|
|
92
95
|
bubbles: true,
|
|
93
96
|
cancelable: true,
|
|
94
|
-
composed: true
|
|
97
|
+
composed: true
|
|
95
98
|
}));
|
|
96
99
|
}
|
|
97
100
|
|
|
101
|
+
const showAllMethodsToggle = () => {
|
|
102
|
+
paymentMethodsToShow == paymentMethods ? showLessMethods() : showAllMethods()
|
|
103
|
+
}
|
|
104
|
+
const showAllMethods = () => {
|
|
105
|
+
paymentMethodsToShow = paymentMethods;
|
|
106
|
+
methodsButtonToogleText = $_('showLess');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const showLessMethods = () => {
|
|
110
|
+
paymentMethodsToShow = paymentMethods.slice(0, +numberofmethodsshown);
|
|
111
|
+
if (selectedPaymentMethod && !paymentMethodsToShow.find(item => item.Name === selectedPaymentMethod)) {
|
|
112
|
+
paymentMethodsToShow.splice(0, 0, paymentMethods.find(item => item.Name === selectedPaymentMethod));
|
|
113
|
+
}
|
|
114
|
+
methodsButtonToogleText = $_('showAll');
|
|
115
|
+
}
|
|
98
116
|
const setClientStyling = ():void => {
|
|
99
117
|
let sheet = document.createElement('style');
|
|
100
118
|
sheet.innerHTML = clientstyling;
|
|
@@ -118,36 +136,30 @@
|
|
|
118
136
|
}
|
|
119
137
|
|
|
120
138
|
</script>
|
|
121
|
-
|
|
122
|
-
<div class="
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
<div class="LogoSelector">
|
|
139
|
+
<div>
|
|
140
|
+
<div class="CashierMethodList">
|
|
141
|
+
{#each paymentMethodsToShow as payMeth, index}
|
|
142
|
+
<div class="SelectorWrapper" on:click={() => selectPayMeth(payMeth)}
|
|
143
|
+
class:checked="{selectedPaymentMethod === payMeth.Name}" on:keyup={() => {}}>
|
|
127
144
|
<div class="MethodLogo">
|
|
128
145
|
<img src={payMeth.LogoUrl} alt={payMeth.Label} />
|
|
129
146
|
</div>
|
|
130
|
-
<div class="
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
</div>
|
|
147
|
+
<div class="MethodTitle">
|
|
148
|
+
<span>{payMeth.Label || payMeth.Name}</span>
|
|
149
|
+
</div>
|
|
150
|
+
<div class="MethodLimits">
|
|
151
|
+
<span class="Limits">{$_('generalMin')} {payMeth.DisplayCurrency.MinAmountLimit} {payMeth.DisplayCurrency.Name}</span>
|
|
152
|
+
<span class="Limits">{$_('generalMax')} {payMeth.DisplayCurrency.MaxAmountLimit} {payMeth.DisplayCurrency.Name}</span>
|
|
137
153
|
</div>
|
|
138
154
|
</div>
|
|
139
|
-
|
|
140
|
-
<input type=radio id={index} name="radioGroup"
|
|
141
|
-
bind:group={paymethnames} value={payMeth.Name}>
|
|
142
|
-
<label for={index}></label>
|
|
143
|
-
</div>
|
|
155
|
+
{/each}
|
|
144
156
|
</div>
|
|
145
|
-
|
|
157
|
+
{#if methodsButtonToogleText}
|
|
158
|
+
<div class="ShowAllButton" on:click={() => showAllMethodsToggle()}>{methodsButtonToogleText}</div>
|
|
159
|
+
{/if}
|
|
146
160
|
</div>
|
|
147
|
-
|
|
148
161
|
<style lang="scss">
|
|
149
162
|
|
|
150
|
-
|
|
151
163
|
*,
|
|
152
164
|
*::before,
|
|
153
165
|
*::after {
|
|
@@ -158,120 +170,86 @@
|
|
|
158
170
|
outline: none;
|
|
159
171
|
box-sizing: border-box;
|
|
160
172
|
}
|
|
161
|
-
.
|
|
173
|
+
.CashierMethodList {
|
|
162
174
|
display: flex;
|
|
163
175
|
flex-direction: column;
|
|
164
|
-
|
|
176
|
+
background: var(--emw--color-background, #FFF);
|
|
177
|
+
box-shadow: 0 0 4px rgba(0, 0, 0, 0.10);
|
|
178
|
+
width: 100%;
|
|
179
|
+
border-radius: var(--emw--border-radius-large, 6px);
|
|
165
180
|
.SelectorWrapper {
|
|
166
181
|
display: flex;
|
|
167
182
|
flex-direction: row;
|
|
168
183
|
align-items: center;
|
|
169
|
-
justify-content:
|
|
184
|
+
justify-content: left;
|
|
170
185
|
cursor: pointer;
|
|
171
186
|
position: relative;
|
|
172
|
-
height:
|
|
173
|
-
width: 390px;
|
|
174
|
-
background: var(--mm-selector-background-color, #F8F9FA);
|
|
175
|
-
box-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
|
|
187
|
+
height: 52px;
|
|
176
188
|
box-sizing: border-box;
|
|
177
|
-
border-
|
|
178
|
-
padding:
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
overflow: hidden;
|
|
182
|
-
display: flex;
|
|
183
|
-
flex-direction: row;
|
|
184
|
-
align-items: center;
|
|
185
|
-
justify-content: flex-start;
|
|
189
|
+
border-bottom: 1px solid var(--emw--color-gray-100, #E8E9EB);
|
|
190
|
+
padding: 0 12px;
|
|
191
|
+
&:first-child {
|
|
192
|
+
border-radius: var(--emw--border-radius-large, 6px) var(--emw--border-radius-large, 6px) 0 0;
|
|
186
193
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
width: 82px;
|
|
190
|
-
height: 47px;
|
|
191
|
-
border: 1px solid var(--mm-selector-label-color, #CED4DA);
|
|
192
|
-
box-sizing: content-box;
|
|
193
|
-
border-radius: 2px;
|
|
194
|
-
img {
|
|
195
|
-
width: inherit;
|
|
196
|
-
height: inherit;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
.MethodInfo {
|
|
200
|
-
display: flex;
|
|
201
|
-
flex-direction: column;
|
|
202
|
-
width: calc(100% - 70px);
|
|
203
|
-
gap: 8px;
|
|
204
|
-
}
|
|
205
|
-
.MethodLimits {
|
|
206
|
-
height: 16px;
|
|
207
|
-
display: flex;
|
|
208
|
-
flex-direction: row;
|
|
209
|
-
align-items: center;
|
|
210
|
-
.Limits {
|
|
211
|
-
max-width: 100%;
|
|
212
|
-
white-space: nowrap;
|
|
213
|
-
font-size: 14px;
|
|
214
|
-
color: var(--mm-selector-limits-color, #495057);
|
|
215
|
-
font-weight: 400;
|
|
216
|
-
font-style: normal;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
.RadioButtonSelector {
|
|
220
|
-
position: static;
|
|
221
|
-
height: 30px;
|
|
222
|
-
width: 30px;
|
|
223
|
-
input {
|
|
224
|
-
height: 0;
|
|
225
|
-
width: revert;
|
|
226
|
-
padding: 0;
|
|
227
|
-
border: none;
|
|
228
|
-
display: none;
|
|
229
|
-
}
|
|
230
|
-
label {
|
|
231
|
-
pointer-events: none;
|
|
232
|
-
position: relative;
|
|
233
|
-
cursor: pointer;
|
|
234
|
-
line-height: 20px;
|
|
235
|
-
display: block;
|
|
236
|
-
color: var(--mm-selector-label-color, #CED4DA);
|
|
237
|
-
}
|
|
238
|
-
label::before {
|
|
239
|
-
left: 0;
|
|
240
|
-
content: "";
|
|
241
|
-
position: absolute;
|
|
242
|
-
top: 0;
|
|
243
|
-
width: 30px;
|
|
244
|
-
height: 30px;
|
|
245
|
-
border: 3px solid var(--mm-selector-label-color, #CED4DA);
|
|
246
|
-
border-radius: 100%;
|
|
247
|
-
background: var(--emfe-w-color-white, #FFFFFF);
|
|
248
|
-
box-sizing: border-box;
|
|
249
|
-
}
|
|
250
|
-
label::after {
|
|
251
|
-
left: 6px;
|
|
252
|
-
opacity: 1;
|
|
253
|
-
content: "";
|
|
254
|
-
width: 18px;
|
|
255
|
-
height: 18px;
|
|
256
|
-
background: var(--mm-selector-color-selected, #388D79);
|
|
257
|
-
position: absolute;
|
|
258
|
-
top: 6px;
|
|
259
|
-
border-radius: 100%;
|
|
260
|
-
transition: all 0.2s ease;
|
|
261
|
-
}
|
|
194
|
+
&:last-child {
|
|
195
|
+
border-radius: 0 0 var(--emw--border-radius-large, 6px) var(--emw--border-radius-large, 6px);
|
|
262
196
|
}
|
|
263
197
|
&.checked {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
198
|
+
background: var(--emw--color-background-secondary, #F9F9F9);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
.MethodLogo {
|
|
202
|
+
margin-right: 7px;
|
|
203
|
+
width: 56px;
|
|
204
|
+
height: 32px;
|
|
205
|
+
background: var(--emw--color-background, #FFF);
|
|
206
|
+
border: 1px solid var(--emw--color-gray-100, #E8E9EB);
|
|
207
|
+
border-radius: var(--emw--border-radius-large, 6px);
|
|
208
|
+
overflow: hidden;
|
|
209
|
+
img {
|
|
210
|
+
width: inherit;
|
|
211
|
+
height: inherit;
|
|
268
212
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
213
|
+
}
|
|
214
|
+
.MethodTitle {
|
|
215
|
+
color: var(--emw--color-black, #111);
|
|
216
|
+
font-size: var(--emw--font-size-small, 14px);
|
|
217
|
+
word-break: break-all;
|
|
218
|
+
font-feature-settings: 'numr' on;
|
|
219
|
+
}
|
|
220
|
+
.MethodLimits {
|
|
221
|
+
display: flex;
|
|
222
|
+
flex-direction: column;
|
|
223
|
+
align-items: flex-end;
|
|
224
|
+
margin-left: auto;
|
|
225
|
+
.Limits {
|
|
226
|
+
max-width: 100%;
|
|
227
|
+
white-space: nowrap;
|
|
228
|
+
font-size: var(--emw--font-size-2x-small, 11px);
|
|
229
|
+
line-height: var(--emw--size-small, 14px);
|
|
230
|
+
color: var(--emw--color-gray-300, #666);
|
|
231
|
+
font-weight: var(--emw--font-weight-normal, 400);
|
|
232
|
+
font-style: normal;
|
|
273
233
|
}
|
|
274
234
|
}
|
|
275
235
|
}
|
|
236
|
+
.ShowAllButton {
|
|
237
|
+
cursor: pointer;
|
|
238
|
+
color: var(--emw--color-primary, #292929);
|
|
239
|
+
text-align: center;
|
|
240
|
+
font-size: var(--emw--font-size-x-small, 12px);
|
|
241
|
+
font-style: normal;
|
|
242
|
+
font-weight: var(--emw--font-weight-semibold, 500);
|
|
243
|
+
line-height: normal;
|
|
244
|
+
text-transform: uppercase;
|
|
245
|
+
border: 1px solid var(--emw--color-gray-100, #E8E9EB);
|
|
246
|
+
border-radius: var(--emw--border-radius-medium, 4px);
|
|
247
|
+
margin: 12px auto;
|
|
248
|
+
height: 36px;
|
|
249
|
+
display: flex;
|
|
250
|
+
align-items: center;
|
|
251
|
+
justify-content: center;
|
|
252
|
+
width: 80%;
|
|
253
|
+
}
|
|
276
254
|
|
|
277
255
|
</style>
|