@gudhub/ssg-web-components-library 1.0.116 → 1.0.117
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 +1 -1
- package/src/components/liqpay-component/config.js +6 -0
- package/src/components/liqpay-component/liqpay-component.html +91 -0
- package/src/components/liqpay-component/liqpay-component.js +197 -0
- package/src/components/liqpay-component/liqpay-component.json +14 -0
- package/src/components/liqpay-component/liqpay-component.md +0 -0
- package/src/components/liqpay-component/liqpay-component.scss +337 -0
- package/src/components/liqpay-payment-button/config.js +6 -0
- package/src/components/liqpay-payment-button/liqpay-payment-button.html +5 -0
- package/src/components/liqpay-payment-button/liqpay-payment-button.js +23 -0
- package/src/components/liqpay-payment-button/liqpay-payment-button.json +4 -0
- package/src/components/liqpay-payment-button/liqpay-payment-button.md +0 -0
- package/src/components/liqpay-payment-button/liqpay-payment-button.scss +7 -0
- package/src/components/masonry-gallery/masonry-gallery.js +68 -24
- package/src/config.js +2 -0
package/package.json
CHANGED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<section class="liqpay-component">
|
|
2
|
+
<!-- <div class="liqpay-component__logo">
|
|
3
|
+
<div class="liqpay-component__logo-badge">
|
|
4
|
+
<div class="liqpay-component__logo-badge-text">
|
|
5
|
+
<span class="liqpay-component__logo-gud">GUD</span>
|
|
6
|
+
<span class="liqpay-component__logo-hub">HUB</span>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
<span class="liqpay-component__logo-crm">CRM</span>
|
|
10
|
+
</div> -->
|
|
11
|
+
|
|
12
|
+
<h1 class="liqpay-component__title" data-liqpay-title></h1>
|
|
13
|
+
|
|
14
|
+
<p class="liqpay-component__subtitle" data-liqpay-subtitle></p>
|
|
15
|
+
|
|
16
|
+
<div class="liqpay-component__card">
|
|
17
|
+
<div class="liqpay-component__amount-row">
|
|
18
|
+
<div>
|
|
19
|
+
<p class="liqpay-component__amount-label">Amount</p>
|
|
20
|
+
<p class="liqpay-component__amount" data-liqpay-amount></p>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="liqpay-component__secured-badge">
|
|
23
|
+
<div class="liqpay-component__secured-icon" aria-hidden="true">
|
|
24
|
+
<svg viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
25
|
+
<polyline points="2,5 4,7.5 8,3" stroke="#ffffff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
|
26
|
+
</svg>
|
|
27
|
+
</div>
|
|
28
|
+
<span class="liqpay-component__secured-text">Secured</span>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<div class="liqpay-component__divider"></div>
|
|
33
|
+
|
|
34
|
+
<div class="liqpay-component__summary">
|
|
35
|
+
<div class="liqpay-component__summary-row">
|
|
36
|
+
<span class="liqpay-component__summary-label">Description</span>
|
|
37
|
+
<strong class="liqpay-component__summary-value" data-liqpay-description></strong>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div class="liqpay-component__summary-row" data-liqpay-order-row>
|
|
41
|
+
<span class="liqpay-component__summary-label">Order ID</span>
|
|
42
|
+
<strong class="liqpay-component__summary-value" data-liqpay-order-id></strong>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<p class="liqpay-component__text" data-liqpay-text></p>
|
|
47
|
+
|
|
48
|
+
<form
|
|
49
|
+
class="liqpay-component__form"
|
|
50
|
+
method="POST"
|
|
51
|
+
accept-charset="utf-8"
|
|
52
|
+
data-liqpay-form
|
|
53
|
+
>
|
|
54
|
+
<input type="hidden" name="data" data-liqpay-data>
|
|
55
|
+
<input type="hidden" name="signature" data-liqpay-signature>
|
|
56
|
+
|
|
57
|
+
<button class="liqpay-component__button" type="button" data-liqpay-button>
|
|
58
|
+
<svg class="liqpay-component__button-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
59
|
+
<rect x="2" y="7" width="14" height="10" rx="2" stroke="#ffffff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
|
60
|
+
<path d="M6 7V5a3 3 0 016 0v2" stroke="#ffffff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
|
61
|
+
</svg>
|
|
62
|
+
<span data-liqpay-button-text></span>
|
|
63
|
+
</button>
|
|
64
|
+
</form>
|
|
65
|
+
|
|
66
|
+
<p class="liqpay-component__error" data-liqpay-error hidden></p>
|
|
67
|
+
|
|
68
|
+
<p class="liqpay-component__powered">
|
|
69
|
+
Powered by <span class="liqpay-component__powered-brand">LiqPay</span>
|
|
70
|
+
</p>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div class="liqpay-component__security">
|
|
74
|
+
<div class="liqpay-component__security-item">
|
|
75
|
+
<div class="liqpay-component__security-icon" aria-hidden="true">
|
|
76
|
+
<svg viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
77
|
+
<polyline points="2,5 4,7.5 8,3" stroke="#16a34a" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
|
78
|
+
</svg>
|
|
79
|
+
</div>
|
|
80
|
+
<span>256-bit Encryption</span>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="liqpay-component__security-item">
|
|
83
|
+
<div class="liqpay-component__security-icon" aria-hidden="true">
|
|
84
|
+
<svg viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
85
|
+
<polyline points="2,5 4,7.5 8,3" stroke="#16a34a" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
|
86
|
+
</svg>
|
|
87
|
+
</div>
|
|
88
|
+
<span>PCI DSS Compliant</span>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</section>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import html from './liqpay-component.html';
|
|
2
|
+
import './liqpay-component.scss';
|
|
3
|
+
import jsonTemplate from './liqpay-component.json';
|
|
4
|
+
|
|
5
|
+
class LiqpayComponent extends window.GHComponent {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
super.setDefaultData(jsonTemplate);
|
|
9
|
+
|
|
10
|
+
this.isLoading = false;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async onServerRender() {
|
|
14
|
+
super.render(html);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
onClientRender() {
|
|
18
|
+
this.initComponent();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
initComponent() {
|
|
22
|
+
this.titleElement = this.querySelector('[data-liqpay-title]');
|
|
23
|
+
this.subtitleElement = this.querySelector('[data-liqpay-subtitle]');
|
|
24
|
+
this.amountElement = this.querySelector('[data-liqpay-amount]');
|
|
25
|
+
this.descriptionElement = this.querySelector('[data-liqpay-description]');
|
|
26
|
+
this.textElement = this.querySelector('[data-liqpay-text]');
|
|
27
|
+
this.orderRowElement = this.querySelector('[data-liqpay-order-row]');
|
|
28
|
+
this.orderIdElement = this.querySelector('[data-liqpay-order-id]');
|
|
29
|
+
this.formElement = this.querySelector('[data-liqpay-form]');
|
|
30
|
+
this.dataInput = this.querySelector('[data-liqpay-data]');
|
|
31
|
+
this.signatureInput = this.querySelector('[data-liqpay-signature]');
|
|
32
|
+
this.buttonElement = this.querySelector('[data-liqpay-button]');
|
|
33
|
+
this.buttonTextElement = this.querySelector('[data-liqpay-button-text]');
|
|
34
|
+
this.errorElement = this.querySelector('[data-liqpay-error]');
|
|
35
|
+
|
|
36
|
+
this.renderPaymentInfo();
|
|
37
|
+
this.bindEvents();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
getConfig() {
|
|
41
|
+
return {
|
|
42
|
+
...jsonTemplate,
|
|
43
|
+
...(this.json || {})
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
renderPaymentInfo() {
|
|
48
|
+
const config = this.getConfig();
|
|
49
|
+
|
|
50
|
+
console.log("CONFIG:", config);
|
|
51
|
+
|
|
52
|
+
const amount = Number(config.amount || 0);
|
|
53
|
+
const currency = config.currency || 'UAH';
|
|
54
|
+
|
|
55
|
+
this.titleElement.textContent = config.title || '';
|
|
56
|
+
this.subtitleElement.textContent = config.subtitle || '';
|
|
57
|
+
this.descriptionElement.textContent = config.payment_description || '';
|
|
58
|
+
this.textElement.textContent = config.description || '';
|
|
59
|
+
this.amountElement.textContent = this.formatAmount(amount, currency);
|
|
60
|
+
this.buttonTextElement.textContent = config.button_text || 'Сплатити';
|
|
61
|
+
|
|
62
|
+
if (config.order_id) {
|
|
63
|
+
this.orderIdElement.textContent = config.order_id;
|
|
64
|
+
this.orderRowElement.hidden = false;
|
|
65
|
+
} else {
|
|
66
|
+
this.orderIdElement.textContent = '';
|
|
67
|
+
this.orderRowElement.hidden = true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
this.formElement.action = config.liqpay_checkout_url;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
bindEvents() {
|
|
74
|
+
this.buttonElement.addEventListener('click', () => this.handlePayment());
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async handlePayment() {
|
|
78
|
+
if (this.isLoading) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const config = this.getConfig();
|
|
83
|
+
|
|
84
|
+
this.hideError();
|
|
85
|
+
|
|
86
|
+
if (!this.validatePaymentConfig(config)) {
|
|
87
|
+
this.showError('Некоректні дані для оплати.');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
this.setLoading(true);
|
|
93
|
+
|
|
94
|
+
const payment = await this.createPayment(config);
|
|
95
|
+
|
|
96
|
+
this.dataInput.value = payment.data;
|
|
97
|
+
this.signatureInput.value = payment.signature;
|
|
98
|
+
|
|
99
|
+
this.formElement.submit();
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.error('Failed to create LiqPay payment:', error);
|
|
102
|
+
this.showError(
|
|
103
|
+
config.error_text || 'Не вдалося підготувати оплату. Спробуйте ще раз.'
|
|
104
|
+
);
|
|
105
|
+
} finally {
|
|
106
|
+
this.setLoading(false);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async createPayment(config) {
|
|
111
|
+
const response = await fetch(`https://gudhub-nodejs.ngrok.io:443${config.create_payment_url}`, {
|
|
112
|
+
method: 'POST',
|
|
113
|
+
headers: {
|
|
114
|
+
'Content-Type': 'application/json'
|
|
115
|
+
},
|
|
116
|
+
body: JSON.stringify({
|
|
117
|
+
amount: config.amount,
|
|
118
|
+
currency: config.currency,
|
|
119
|
+
order_id: config.order_id,
|
|
120
|
+
description: config.payment_description
|
|
121
|
+
})
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
if (!response.ok) {
|
|
125
|
+
const errorText = await response.text();
|
|
126
|
+
|
|
127
|
+
throw new Error(`Payment request failed with status ${response.status}: ${errorText}`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const payment = await response.json();
|
|
131
|
+
|
|
132
|
+
if (!payment?.data || !payment?.signature) {
|
|
133
|
+
throw new Error('Invalid payment response');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return payment;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
validatePaymentConfig(config) {
|
|
140
|
+
const amount = Number(config.amount);
|
|
141
|
+
|
|
142
|
+
if (!Number.isFinite(amount) || amount <= 0) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (!config.currency) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (!config.order_id) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!config.payment_description) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (!config.create_payment_url) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (!config.liqpay_checkout_url) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
setLoading(isLoading) {
|
|
170
|
+
const config = this.getConfig();
|
|
171
|
+
|
|
172
|
+
this.isLoading = isLoading;
|
|
173
|
+
this.buttonElement.disabled = isLoading;
|
|
174
|
+
this.buttonTextElement.textContent = isLoading
|
|
175
|
+
? config.loading_text || 'Підготовка оплати...'
|
|
176
|
+
: config.button_text || 'Сплатити';
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
showError(message) {
|
|
180
|
+
this.errorElement.textContent = message;
|
|
181
|
+
this.errorElement.hidden = false;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
hideError() {
|
|
185
|
+
this.errorElement.textContent = '';
|
|
186
|
+
this.errorElement.hidden = true;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
formatAmount(amount, currency) {
|
|
190
|
+
return new Intl.NumberFormat('uk-UA', {
|
|
191
|
+
style: 'currency',
|
|
192
|
+
currency
|
|
193
|
+
}).format(amount);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
window.customElements.define('liqpay-component', LiqpayComponent);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Test Payment",
|
|
3
|
+
"subtitle": "Complete your test payment securely with LiqPay.",
|
|
4
|
+
"description": "After clicking the button you will be redirected to the LiqPay secure payment page.",
|
|
5
|
+
"amount": 1,
|
|
6
|
+
"currency": "UAH",
|
|
7
|
+
"order_id": "test-order-001",
|
|
8
|
+
"payment_description": "Test LiqPay payment",
|
|
9
|
+
"button_text": "Сплатити",
|
|
10
|
+
"loading_text": "Підготовка оплати...",
|
|
11
|
+
"error_text": "Не вдалося підготувати оплату. Спробуйте ще раз.",
|
|
12
|
+
"create_payment_url": "/liqpay/create-payment",
|
|
13
|
+
"liqpay_checkout_url": "https://www.liqpay.ua/api/3/checkout"
|
|
14
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
body {
|
|
2
|
+
padding-top: 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
liqpay-component {
|
|
6
|
+
display: block;
|
|
7
|
+
|
|
8
|
+
.liqpay-component {
|
|
9
|
+
position: relative;
|
|
10
|
+
min-height: 100vh;
|
|
11
|
+
padding: 48px 20px 80px;
|
|
12
|
+
background:
|
|
13
|
+
radial-gradient(ellipse 80% 60% at 15% 50%, rgba(29, 78, 216, 0.18) 0%, transparent 70%),
|
|
14
|
+
radial-gradient(ellipse 60% 50% at 85% 50%, rgba(109, 40, 217, 0.14) 0%, transparent 70%),
|
|
15
|
+
linear-gradient(135deg, #0a1628 0%, #0d1f3c 40%, #0e1a35 60%, #0c1525 100%);
|
|
16
|
+
background-attachment: fixed;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
|
|
22
|
+
// &__logo {
|
|
23
|
+
// display: flex;
|
|
24
|
+
// align-items: center;
|
|
25
|
+
// gap: 8px;
|
|
26
|
+
// margin-bottom: 28px;
|
|
27
|
+
// }
|
|
28
|
+
|
|
29
|
+
// &__logo-badge {
|
|
30
|
+
// background: #1e3a5f;
|
|
31
|
+
// border: 1px solid #2a4f7c;
|
|
32
|
+
// border-radius: 8px;
|
|
33
|
+
// padding: 6px 10px;
|
|
34
|
+
// display: flex;
|
|
35
|
+
// align-items: center;
|
|
36
|
+
// }
|
|
37
|
+
|
|
38
|
+
// &__logo-badge-text {
|
|
39
|
+
// display: flex;
|
|
40
|
+
// flex-direction: column;
|
|
41
|
+
// line-height: 1;
|
|
42
|
+
// }
|
|
43
|
+
|
|
44
|
+
// &__logo-gud {
|
|
45
|
+
// font-size: 17px;
|
|
46
|
+
// font-weight: 700;
|
|
47
|
+
// color: #4a9eff;
|
|
48
|
+
// letter-spacing: 0.02em;
|
|
49
|
+
// }
|
|
50
|
+
|
|
51
|
+
// &__logo-hub {
|
|
52
|
+
// font-size: 17px;
|
|
53
|
+
// font-weight: 700;
|
|
54
|
+
// color: #4a9eff;
|
|
55
|
+
// letter-spacing: 0.04em;
|
|
56
|
+
// }
|
|
57
|
+
|
|
58
|
+
// &__logo-crm {
|
|
59
|
+
// font-size: 46px;
|
|
60
|
+
// font-weight: 700;
|
|
61
|
+
// color: #ffffff;
|
|
62
|
+
// letter-spacing: -0.3px;
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
&__title {
|
|
66
|
+
margin: 0;
|
|
67
|
+
color: #ffffff;
|
|
68
|
+
font-size: 32px;
|
|
69
|
+
font-weight: 700;
|
|
70
|
+
letter-spacing: -0.5px;
|
|
71
|
+
line-height: 1.2;
|
|
72
|
+
text-align: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&__subtitle {
|
|
76
|
+
margin: 10px 0 32px;
|
|
77
|
+
color: #8599b5;
|
|
78
|
+
font-size: 15px;
|
|
79
|
+
font-weight: 400;
|
|
80
|
+
text-align: center;
|
|
81
|
+
line-height: 1.5;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&__card {
|
|
85
|
+
width: 100%;
|
|
86
|
+
max-width: 420px;
|
|
87
|
+
background: #eef0f4;
|
|
88
|
+
border-radius: 20px;
|
|
89
|
+
padding: 28px 28px 24px;
|
|
90
|
+
border: none;
|
|
91
|
+
box-shadow: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&__amount-row {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: flex-start;
|
|
97
|
+
justify-content: space-between;
|
|
98
|
+
gap: 12px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&__amount-label {
|
|
102
|
+
margin: 0 0 4px;
|
|
103
|
+
font-size: 13px;
|
|
104
|
+
font-weight: 500;
|
|
105
|
+
color: #6b7280;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&__amount {
|
|
109
|
+
margin: 0;
|
|
110
|
+
font-size: 38px;
|
|
111
|
+
font-weight: 700;
|
|
112
|
+
color: #111827;
|
|
113
|
+
letter-spacing: -1px;
|
|
114
|
+
line-height: 1;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&__secured-badge {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: 6px;
|
|
121
|
+
flex-shrink: 0;
|
|
122
|
+
margin-top: 6px;
|
|
123
|
+
background: #ffffff;
|
|
124
|
+
border: 1.5px solid #16a34a;
|
|
125
|
+
border-radius: 100px;
|
|
126
|
+
padding: 5px 12px 5px 7px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&__secured-icon {
|
|
130
|
+
width: 18px;
|
|
131
|
+
height: 18px;
|
|
132
|
+
border-radius: 50%;
|
|
133
|
+
background: #16a34a;
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
flex-shrink: 0;
|
|
138
|
+
|
|
139
|
+
svg {
|
|
140
|
+
width: 10px;
|
|
141
|
+
height: 10px;
|
|
142
|
+
display: block;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&__secured-text {
|
|
147
|
+
font-size: 12px;
|
|
148
|
+
font-weight: 600;
|
|
149
|
+
color: #16a34a;
|
|
150
|
+
line-height: 1;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&__divider {
|
|
154
|
+
height: 1px;
|
|
155
|
+
background: #d4d7de;
|
|
156
|
+
margin: 20px 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&__summary {
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
gap: 14px;
|
|
163
|
+
margin: 0;
|
|
164
|
+
padding: 0;
|
|
165
|
+
border-radius: 0;
|
|
166
|
+
background: transparent;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&__summary-row {
|
|
170
|
+
display: flex;
|
|
171
|
+
align-items: flex-start;
|
|
172
|
+
justify-content: space-between;
|
|
173
|
+
gap: 16px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&__summary-label {
|
|
177
|
+
font-size: 14px;
|
|
178
|
+
font-weight: 500;
|
|
179
|
+
color: #6b7280;
|
|
180
|
+
flex-shrink: 0;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&__summary-value {
|
|
184
|
+
font-size: 14px;
|
|
185
|
+
font-weight: 600;
|
|
186
|
+
color: #111827;
|
|
187
|
+
text-align: right;
|
|
188
|
+
max-width: 60%;
|
|
189
|
+
word-break: break-word;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&__text {
|
|
193
|
+
margin: 16px 0 0;
|
|
194
|
+
color: #6b7280;
|
|
195
|
+
font-size: 13px;
|
|
196
|
+
line-height: 1.6;
|
|
197
|
+
|
|
198
|
+
&:empty {
|
|
199
|
+
display: none;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&__form {
|
|
204
|
+
margin: 0;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
&__button {
|
|
208
|
+
display: inline-flex;
|
|
209
|
+
align-items: center;
|
|
210
|
+
justify-content: center;
|
|
211
|
+
gap: 10px;
|
|
212
|
+
width: 100%;
|
|
213
|
+
min-height: 52px;
|
|
214
|
+
margin-top: 22px;
|
|
215
|
+
padding: 0 24px;
|
|
216
|
+
border: none;
|
|
217
|
+
border-radius: 12px;
|
|
218
|
+
background: #2563eb;
|
|
219
|
+
color: #ffffff;
|
|
220
|
+
font-size: 16px;
|
|
221
|
+
font-weight: 700;
|
|
222
|
+
letter-spacing: -0.2px;
|
|
223
|
+
cursor: pointer;
|
|
224
|
+
transition:
|
|
225
|
+
background 0.18s ease,
|
|
226
|
+
transform 0.1s ease;
|
|
227
|
+
|
|
228
|
+
&:hover {
|
|
229
|
+
background: #1d4ed8;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
&:active {
|
|
233
|
+
background: #1e40af;
|
|
234
|
+
transform: scale(0.98);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
&:disabled {
|
|
238
|
+
cursor: not-allowed;
|
|
239
|
+
opacity: 0.6;
|
|
240
|
+
transform: none;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
&__button-icon {
|
|
245
|
+
width: 18px;
|
|
246
|
+
height: 18px;
|
|
247
|
+
flex-shrink: 0;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
&__error {
|
|
251
|
+
margin: 14px 0 0;
|
|
252
|
+
color: #dc2626;
|
|
253
|
+
font-size: 13px;
|
|
254
|
+
line-height: 1.5;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
&__powered {
|
|
258
|
+
margin: 16px 0 0;
|
|
259
|
+
text-align: center;
|
|
260
|
+
font-size: 13px;
|
|
261
|
+
color: #9ca3af;
|
|
262
|
+
font-weight: 400;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
&__powered-brand {
|
|
266
|
+
color: #16a34a;
|
|
267
|
+
font-weight: 700;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&__security {
|
|
271
|
+
display: flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
gap: 24px;
|
|
274
|
+
margin-top: 24px;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
&__security-item {
|
|
278
|
+
display: flex;
|
|
279
|
+
align-items: center;
|
|
280
|
+
gap: 7px;
|
|
281
|
+
font-size: 13px;
|
|
282
|
+
color: #8599b5;
|
|
283
|
+
font-weight: 500;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
&__security-icon {
|
|
287
|
+
width: 18px;
|
|
288
|
+
height: 18px;
|
|
289
|
+
border-radius: 50%;
|
|
290
|
+
border: 1.5px solid #16a34a;
|
|
291
|
+
display: flex;
|
|
292
|
+
align-items: center;
|
|
293
|
+
justify-content: center;
|
|
294
|
+
flex-shrink: 0;
|
|
295
|
+
|
|
296
|
+
svg {
|
|
297
|
+
width: 10px;
|
|
298
|
+
height: 10px;
|
|
299
|
+
display: block;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
@media (max-width: 480px) {
|
|
305
|
+
.liqpay-component {
|
|
306
|
+
padding: 40px 16px 72px;
|
|
307
|
+
|
|
308
|
+
&__title {
|
|
309
|
+
font-size: 26px;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
&__card {
|
|
313
|
+
padding: 22px 18px 20px;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
&__amount {
|
|
317
|
+
font-size: 30px;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
&__summary-row {
|
|
321
|
+
flex-direction: column;
|
|
322
|
+
gap: 4px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
&__summary-value {
|
|
326
|
+
max-width: 100%;
|
|
327
|
+
text-align: left;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
&__security {
|
|
331
|
+
flex-direction: column;
|
|
332
|
+
gap: 10px;
|
|
333
|
+
align-items: flex-start;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import html from './liqpay-payment-button.html';
|
|
2
|
+
import './liqpay-payment-button.scss';
|
|
3
|
+
import jsonTemplate from './liqpay-payment-button.json';
|
|
4
|
+
|
|
5
|
+
class liqpayPaymentButton extends window.GHComponent {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
super.setDefaultData(jsonTemplate);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async onServerRender() {
|
|
12
|
+
this.ghId = this.getAttribute('data-gh-id') || null;
|
|
13
|
+
this.json = await super.getGhData(this.ghId, 'areas');
|
|
14
|
+
|
|
15
|
+
console.log("AAAAAAAAAAAAAAAAAAAAAAAA", this.json);
|
|
16
|
+
|
|
17
|
+
if (this.json) {
|
|
18
|
+
super.render(html);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
window.customElements.define('liqpay-payment-button', liqpayPaymentButton);
|
|
File without changes
|
|
@@ -19,6 +19,9 @@ class MasonryGallery extends GHComponent {
|
|
|
19
19
|
this.fitWidthValue = !!this.columnWidthValue;
|
|
20
20
|
this.contactUsButton = this.hasAttribute('data-modal-button') ? this.getAttribute('data-modal-button') : null;
|
|
21
21
|
this.contactUsButtonId = this.hasAttribute('data-modal-button-id') ? this.getAttribute('data-modal-button-id') : null;
|
|
22
|
+
this.showCount = this.hasAttribute('data-show-count')
|
|
23
|
+
? +this.getAttribute('data-show-count')
|
|
24
|
+
: 10;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
async onServerRender() {
|
|
@@ -28,6 +31,20 @@ class MasonryGallery extends GHComponent {
|
|
|
28
31
|
this.ghId = this.getAttribute('data-gh-id') || null;
|
|
29
32
|
this.json = await super.getGhData(this.ghId, this.application);
|
|
30
33
|
|
|
34
|
+
if (
|
|
35
|
+
typeof this.json.items === 'object' &&
|
|
36
|
+
this.json.items !== null &&
|
|
37
|
+
this.json.items.url
|
|
38
|
+
) {
|
|
39
|
+
const response = await fetch(this.json.items.url);
|
|
40
|
+
const data = await response.json();
|
|
41
|
+
|
|
42
|
+
this.setCacheGhData(
|
|
43
|
+
'masonry-images',
|
|
44
|
+
data.images
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
31
48
|
if (Array.isArray(this.json.items)) {
|
|
32
49
|
const isMoreItems = this.json.moreItems ? this.json.moreItems : null;
|
|
33
50
|
|
|
@@ -55,32 +72,25 @@ class MasonryGallery extends GHComponent {
|
|
|
55
72
|
const modal = document.getElementById('modal');
|
|
56
73
|
|
|
57
74
|
if (this.hasAttribute('images-url')) {
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
const images = await this.getCacheGhData(
|
|
76
|
+
'masonry-images'
|
|
77
|
+
);
|
|
60
78
|
|
|
61
|
-
|
|
62
|
-
|
|
79
|
+
const isInitImagesEqualNull =
|
|
80
|
+
this.getAttribute('init-count') === 'null';
|
|
63
81
|
|
|
64
|
-
|
|
82
|
+
const initCountImages = this.contactUsButton
|
|
83
|
+
? this.showCount
|
|
84
|
+
: images.length;
|
|
65
85
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const initCountImages = this.hasAttribute('init-count') && !isInitImagesEqualNull ? this.getAttribute('init-count') : images.length;
|
|
86
|
+
const initImages = images.slice(0, initCountImages);
|
|
87
|
+
const initMoreImages = images.slice(initCountImages);
|
|
69
88
|
|
|
70
|
-
|
|
71
|
-
|
|
89
|
+
this.allImagesArrayLength = images.length;
|
|
90
|
+
this.initCountImages = initCountImages;
|
|
72
91
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.initImages = initImages;
|
|
77
|
-
this.moreImages = initMoreImages;
|
|
78
|
-
} catch (error) {
|
|
79
|
-
console.error(error);
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
this.initImages = JSON.parse(this.getAttribute('init-images'));
|
|
83
|
-
this.moreImages = JSON.parse(this.getAttribute('add-array'));
|
|
92
|
+
this.initImages = initImages;
|
|
93
|
+
this.moreImages = initMoreImages;
|
|
84
94
|
}
|
|
85
95
|
|
|
86
96
|
const grid = this.imagesContainer;
|
|
@@ -200,9 +210,35 @@ class MasonryGallery extends GHComponent {
|
|
|
200
210
|
const promise = new Promise(async (res, rej) => {
|
|
201
211
|
const img = document.createElement('img');
|
|
202
212
|
|
|
203
|
-
const
|
|
213
|
+
const fileName = imageSrc.split('/').pop();
|
|
214
|
+
|
|
215
|
+
const pathToJpg = `/assets/images/masonry/${fileName}`;
|
|
216
|
+
const pathToWebp = `${pathToJpg}.webp`;
|
|
217
|
+
|
|
218
|
+
const response = await fetch(pathToWebp, {
|
|
219
|
+
method: 'HEAD'
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
if (!response.ok) {
|
|
223
|
+
await fetch('/upload-image-path', {
|
|
224
|
+
method: 'POST',
|
|
225
|
+
headers: {
|
|
226
|
+
'Content-Type': 'application/json'
|
|
227
|
+
},
|
|
228
|
+
body: JSON.stringify({
|
|
229
|
+
imageSrc: pathToJpg,
|
|
230
|
+
imageUrl: imageSrc,
|
|
231
|
+
isCrop: true
|
|
232
|
+
})
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
img.src = `/assets/images/masonry/${fileName}`;
|
|
204
237
|
|
|
205
|
-
img.setAttribute(
|
|
238
|
+
img.setAttribute(
|
|
239
|
+
'src',
|
|
240
|
+
`/assets/images/masonry/${fileName}`
|
|
241
|
+
);
|
|
206
242
|
img.setAttribute('alt', imageAlt);
|
|
207
243
|
img.setAttribute('title', imageTitle);
|
|
208
244
|
|
|
@@ -252,6 +288,14 @@ class MasonryGallery extends GHComponent {
|
|
|
252
288
|
const button = buttonWrapper.querySelector('#grid-add-items');
|
|
253
289
|
const addImages = this.addImages;
|
|
254
290
|
|
|
291
|
+
if (!this.contactUsButton) {
|
|
292
|
+
if (button) {
|
|
293
|
+
button.remove();
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
|
|
255
299
|
const isInitCountEqualAllLength = this.initCountImages === this.allImagesArrayLength;
|
|
256
300
|
|
|
257
301
|
if (!masonryGrid || !button || !buttonWrapper || !this.moreImages || isInitCountEqualAllLength) {
|
|
@@ -263,7 +307,7 @@ class MasonryGallery extends GHComponent {
|
|
|
263
307
|
let images = [...this.moreImages];
|
|
264
308
|
|
|
265
309
|
// Get more-count attribute value
|
|
266
|
-
const moreCountImages =
|
|
310
|
+
const moreCountImages = this.showCount;
|
|
267
311
|
|
|
268
312
|
button.addEventListener('click', async () => {
|
|
269
313
|
// If we set max-height for block, this code removes styles which hide content, when we click show more
|
package/src/config.js
CHANGED
|
@@ -67,6 +67,8 @@ export { GoogleAnalytics } from './components/google-analytics/config.js';
|
|
|
67
67
|
export { GoogleTag } from './components/google-tag/config.js';
|
|
68
68
|
export { cookiesPopup } from './components/cookies-popup/config.js';
|
|
69
69
|
export { infoTable } from './components/info-table/config.js';
|
|
70
|
+
export { liqpayPaymentButton } from './components/liqpay-payment-button/config.js';
|
|
71
|
+
export { liqpayComponent } from './components/liqpay-component/config.js';
|
|
70
72
|
export { faqComponent } from './components/faq-component/config.js';
|
|
71
73
|
|
|
72
74
|
// export { liqPayComponent } from './components/liqpay-component/config.js';
|