Skip to content

Commit 9574dff

Browse files
committed
refactored android price loading
1 parent e539c76 commit 9574dff

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

assets/css/custom.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ ul.list-primary li::marker {
140140
}
141141

142142
.input-box {
143-
@apply rounded-sm border-gray-300 focus:ring-0 focus:border-secondary;
143+
@apply rounded-sm border border-gray-300 focus:ring-0 focus:border-secondary px-3 py-2;
144144
}
145145

146146
.pre-box {

assets/js/androidkey.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,17 @@ class AndroidLicense {
2121
}
2222

2323
loadPrice() {
24-
this._paddle.then(paddle => {
25-
paddle.Product.Prices(PADDLE_ANDROID_PRODUCT_ID, prices => {
26-
this._checkoutData.price = prices.price.gross;
27-
});
24+
$.ajax({
25+
url: PADDLE_PRICES_URL,
26+
dataType: 'jsonp',
27+
data: {
28+
product_ids: PADDLE_ANDROID_PRODUCT_ID
29+
},
30+
}).done(data => {
31+
this._checkoutData.price = {
32+
amount: data.response.products[0].price.gross,
33+
currency: data.response.products[0].currency
34+
};
2835
});
2936
}
3037

i18n/de.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
translation: "Lizenzschlüssel kaufen"
4545
- id: android_getkey_price
4646
translation: "Preis"
47-
- id: android_getkey_price_placeholder
48-
translation: "Lädt…"
4947
- id: android_getkey_email
5048
translation: "E-Mail"
5149
- id: android_getkey_email_placeholder

i18n/en.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
translation: "Buy a license key"
4545
- id: android_getkey_price
4646
translation: "Price"
47-
- id: android_getkey_price_placeholder
48-
translation: "Loading…"
4947
- id: android_getkey_email
5048
translation: "Email"
5149
- id: android_getkey_email_placeholder

layouts/partials/android-getkey.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ <h3 class="font-h3 text-lg">{{ i18n "android_getkey_title" }}</h3>
44
</div>
55

66
<form x-show="!checkoutData.success" x-ref="form" class="px-4 py-8">
7-
<div class="w-full md:w-1/2 mb-4">
7+
<div class="mb-4">
88
<label class="label-uppercase mb-2">{{ i18n "android_getkey_price" }}</label>
9-
<input x-model="checkoutData.price" type="text" class="input-box w-full" placeholder="{{ i18n "android_getkey_price_placeholder" }}" readonly/>
9+
<div class="input-box flex items-center w-full lg:w-1/2">
10+
<span x-text="checkoutData.price ? checkoutData.price.amount.toLocaleString('{{ .Site.Language.Lang }}', { style: 'currency', currency: checkoutData.price.currency }) : '…'"></span>
11+
</div>
1012
</div>
1113
<div class="mb-4">
1214
<label class="label-uppercase mb-2">{{ i18n "android_getkey_email" }}</label>

0 commit comments

Comments
 (0)