@akinon/projectzero 1.101.0-rc.73 → 1.101.0-rc.75
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/CHANGELOG.md +4 -0
- package/app-template/CHANGELOG.md +52 -0
- package/app-template/package.json +20 -18
- package/app-template/public/locales/en/checkout.json +6 -0
- package/app-template/public/locales/tr/checkout.json +6 -0
- package/app-template/src/components/price.tsx +1 -1
- package/app-template/src/views/checkout/steps/payment/options/store-credit.tsx +121 -0
- package/app-template/src/views/checkout/summary.tsx +10 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# projectzeronext
|
|
2
2
|
|
|
3
|
+
## 1.101.0-rc.75
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [9442cf0]
|
|
8
|
+
- @akinon/pz-saved-card@1.101.0-rc.75
|
|
9
|
+
- @akinon/next@1.101.0-rc.75
|
|
10
|
+
- @akinon/pz-akifast@1.101.0-rc.75
|
|
11
|
+
- @akinon/pz-b2b@1.101.0-rc.75
|
|
12
|
+
- @akinon/pz-basket-gift-pack@1.101.0-rc.75
|
|
13
|
+
- @akinon/pz-bkm@1.101.0-rc.75
|
|
14
|
+
- @akinon/pz-checkout-gift-pack@1.101.0-rc.75
|
|
15
|
+
- @akinon/pz-click-collect@1.101.0-rc.75
|
|
16
|
+
- @akinon/pz-credit-payment@1.101.0-rc.75
|
|
17
|
+
- @akinon/pz-gpay@1.101.0-rc.75
|
|
18
|
+
- @akinon/pz-hepsipay@1.101.0-rc.75
|
|
19
|
+
- @akinon/pz-masterpass@1.101.0-rc.75
|
|
20
|
+
- @akinon/pz-one-click-checkout@1.101.0-rc.75
|
|
21
|
+
- @akinon/pz-otp@1.101.0-rc.75
|
|
22
|
+
- @akinon/pz-pay-on-delivery@1.101.0-rc.75
|
|
23
|
+
- @akinon/pz-similar-products@1.101.0-rc.75
|
|
24
|
+
- @akinon/pz-tabby-extension@1.101.0-rc.75
|
|
25
|
+
- @akinon/pz-tamara-extension@1.101.0-rc.75
|
|
26
|
+
|
|
27
|
+
## 1.101.0-rc.74
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- e9e902b: ZERO-3650: Add Loyalty
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [a2fbee6]
|
|
36
|
+
- @akinon/next@1.101.0-rc.74
|
|
37
|
+
- @akinon/pz-akifast@1.101.0-rc.74
|
|
38
|
+
- @akinon/pz-b2b@1.101.0-rc.74
|
|
39
|
+
- @akinon/pz-basket-gift-pack@1.101.0-rc.74
|
|
40
|
+
- @akinon/pz-bkm@1.101.0-rc.74
|
|
41
|
+
- @akinon/pz-checkout-gift-pack@1.101.0-rc.74
|
|
42
|
+
- @akinon/pz-click-collect@1.101.0-rc.74
|
|
43
|
+
- @akinon/pz-credit-payment@1.101.0-rc.74
|
|
44
|
+
- @akinon/pz-gpay@1.101.0-rc.74
|
|
45
|
+
- @akinon/pz-hepsipay@1.101.0-rc.74
|
|
46
|
+
- @akinon/pz-masterpass@1.101.0-rc.74
|
|
47
|
+
- @akinon/pz-one-click-checkout@1.101.0-rc.74
|
|
48
|
+
- @akinon/pz-otp@1.101.0-rc.74
|
|
49
|
+
- @akinon/pz-pay-on-delivery@1.101.0-rc.74
|
|
50
|
+
- @akinon/pz-saved-card@1.101.0-rc.74
|
|
51
|
+
- @akinon/pz-similar-products@1.101.0-rc.74
|
|
52
|
+
- @akinon/pz-tabby-extension@1.101.0-rc.74
|
|
53
|
+
- @akinon/pz-tamara-extension@1.101.0-rc.74
|
|
54
|
+
|
|
3
55
|
## 1.101.0-rc.73
|
|
4
56
|
|
|
5
57
|
### Minor Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "projectzeronext",
|
|
3
|
-
"version": "1.101.0-rc.
|
|
3
|
+
"version": "1.101.0-rc.75",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -24,22 +24,24 @@
|
|
|
24
24
|
"test:middleware": "jest middleware-matcher.test.ts --bail"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@akinon/next": "1.101.0-rc.
|
|
28
|
-
"@akinon/pz-akifast": "1.101.0-rc.
|
|
29
|
-
"@akinon/pz-b2b": "1.101.0-rc.
|
|
30
|
-
"@akinon/pz-basket-gift-pack": "1.101.0-rc.
|
|
31
|
-
"@akinon/pz-bkm": "1.101.0-rc.
|
|
32
|
-
"@akinon/pz-checkout-gift-pack": "1.101.0-rc.
|
|
33
|
-
"@akinon/pz-click-collect": "1.101.0-rc.
|
|
34
|
-
"@akinon/pz-credit-payment": "1.101.0-rc.
|
|
35
|
-
"@akinon/pz-gpay": "1.101.0-rc.
|
|
36
|
-
"@akinon/pz-
|
|
37
|
-
"@akinon/pz-
|
|
38
|
-
"@akinon/pz-
|
|
39
|
-
"@akinon/pz-
|
|
40
|
-
"@akinon/pz-
|
|
41
|
-
"@akinon/pz-
|
|
42
|
-
"@akinon/pz-
|
|
27
|
+
"@akinon/next": "1.101.0-rc.75",
|
|
28
|
+
"@akinon/pz-akifast": "1.101.0-rc.75",
|
|
29
|
+
"@akinon/pz-b2b": "1.101.0-rc.75",
|
|
30
|
+
"@akinon/pz-basket-gift-pack": "1.101.0-rc.75",
|
|
31
|
+
"@akinon/pz-bkm": "1.101.0-rc.75",
|
|
32
|
+
"@akinon/pz-checkout-gift-pack": "1.101.0-rc.75",
|
|
33
|
+
"@akinon/pz-click-collect": "1.101.0-rc.75",
|
|
34
|
+
"@akinon/pz-credit-payment": "1.101.0-rc.75",
|
|
35
|
+
"@akinon/pz-gpay": "1.101.0-rc.75",
|
|
36
|
+
"@akinon/pz-hepsipay": "1.101.0-rc.75",
|
|
37
|
+
"@akinon/pz-masterpass": "1.101.0-rc.75",
|
|
38
|
+
"@akinon/pz-one-click-checkout": "1.101.0-rc.75",
|
|
39
|
+
"@akinon/pz-otp": "1.101.0-rc.75",
|
|
40
|
+
"@akinon/pz-pay-on-delivery": "1.101.0-rc.75",
|
|
41
|
+
"@akinon/pz-saved-card": "1.101.0-rc.75",
|
|
42
|
+
"@akinon/pz-similar-products": "1.101.0-rc.75",
|
|
43
|
+
"@akinon/pz-tabby-extension": "1.101.0-rc.75",
|
|
44
|
+
"@akinon/pz-tamara-extension": "1.101.0-rc.75",
|
|
43
45
|
"@hookform/resolvers": "2.9.0",
|
|
44
46
|
"@next/third-parties": "14.1.0",
|
|
45
47
|
"@react-google-maps/api": "2.17.1",
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
"yup": "0.32.11"
|
|
63
65
|
},
|
|
64
66
|
"devDependencies": {
|
|
65
|
-
"@akinon/eslint-plugin-projectzero": "1.101.0-rc.
|
|
67
|
+
"@akinon/eslint-plugin-projectzero": "1.101.0-rc.75",
|
|
66
68
|
"@semantic-release/changelog": "6.0.2",
|
|
67
69
|
"@semantic-release/exec": "6.0.3",
|
|
68
70
|
"@semantic-release/git": "10.0.1",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"subtotal": "Subtotal",
|
|
38
38
|
"shipping": "Shipping",
|
|
39
39
|
"discounts_total": "Discounts Total",
|
|
40
|
+
"loyalty_money_total": "Loyalty Money Total",
|
|
40
41
|
"total": "Total",
|
|
41
42
|
"delivery_info": "Delivery Info",
|
|
42
43
|
"change": "change",
|
|
@@ -138,6 +139,11 @@
|
|
|
138
139
|
"payments": "Payments",
|
|
139
140
|
"per_month": "Per Month",
|
|
140
141
|
"total": "Total"
|
|
142
|
+
},
|
|
143
|
+
"store_credit": {
|
|
144
|
+
"use_my_store_credits": "Use my pz-zero credits",
|
|
145
|
+
"available_balance": "Available Balance",
|
|
146
|
+
"insufficient_balance": "Your pz-zero credits are not sufficient to pay for the order, please select an additional payment method to cover the balance of <Amount/>"
|
|
141
147
|
}
|
|
142
148
|
},
|
|
143
149
|
"agreement": {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"subtotal": "Ara toplam",
|
|
38
38
|
"shipping": "Kargo",
|
|
39
39
|
"discounts_total": "İndirimler Toplamı",
|
|
40
|
+
"loyalty_money_total": "Sadakat Parası Toplamı",
|
|
40
41
|
"total": "Toplam",
|
|
41
42
|
"delivery_info": "Teslimat Bilgileri",
|
|
42
43
|
"change": "değiştir",
|
|
@@ -138,6 +139,11 @@
|
|
|
138
139
|
"payments": "Ödemeler",
|
|
139
140
|
"per_month": "Her ay",
|
|
140
141
|
"total": "Toplam"
|
|
142
|
+
},
|
|
143
|
+
"store_credit": {
|
|
144
|
+
"use_my_store_credits": "pz-zero kredilerimi kullan",
|
|
145
|
+
"available_balance": "Mevcut Bakiyem",
|
|
146
|
+
"insufficient_balance": "pz-zero kredileriniz siparişi ödemek için yeterli değil, lütfen <Amount/> tutarını karşılamak için ek bir ödeme yöntemi seçin."
|
|
141
147
|
}
|
|
142
148
|
},
|
|
143
149
|
"agreement": {
|
|
@@ -56,7 +56,7 @@ export const Price = (props: NumericFormatProps & PriceProps) => {
|
|
|
56
56
|
|
|
57
57
|
const currentCurrencyDecimalScale = Settings.localization.currencies.find(
|
|
58
58
|
(currency) => currency.code === currencyCode_
|
|
59
|
-
)
|
|
59
|
+
)?.decimalScale;
|
|
60
60
|
|
|
61
61
|
return (
|
|
62
62
|
<NumericFormat
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import {
|
|
3
|
+
useGetCheckoutLoyaltyBalanceQuery,
|
|
4
|
+
usePayWithLoyaltyBalanceMutation
|
|
5
|
+
} from '@akinon/next/data/client/checkout';
|
|
6
|
+
import { useAppSelector } from '@akinon/next/redux/hooks';
|
|
7
|
+
import { useMemo, useState } from 'react';
|
|
8
|
+
import { useLocalization } from '@akinon/next/hooks';
|
|
9
|
+
import { twMerge } from 'tailwind-merge';
|
|
10
|
+
import { Icon, Price } from '@theme/components';
|
|
11
|
+
import { Trans } from '@akinon/next/components';
|
|
12
|
+
import { LoaderSpinner } from '@theme/components';
|
|
13
|
+
|
|
14
|
+
export const StoreCredits = () => {
|
|
15
|
+
const { t } = useLocalization();
|
|
16
|
+
|
|
17
|
+
const [payWithLoyaltyBalance, { isLoading: isPayWithLoyaltyBalanceLoading }] =
|
|
18
|
+
usePayWithLoyaltyBalanceMutation();
|
|
19
|
+
|
|
20
|
+
const { loyaltyBalance, preOrder } = useAppSelector(
|
|
21
|
+
(state) => state.checkout
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const { isLoading: isLoyaltyBalanceLoading } =
|
|
25
|
+
useGetCheckoutLoyaltyBalanceQuery(undefined, {
|
|
26
|
+
refetchOnMountOrArgChange: true,
|
|
27
|
+
skip: !preOrder?.payment_option
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const isLoyaltyBalanceUsed = useMemo(() => {
|
|
31
|
+
return parseFloat(preOrder?.loyalty_money ?? '0') > 0;
|
|
32
|
+
}, [preOrder?.loyalty_money]);
|
|
33
|
+
|
|
34
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
35
|
+
|
|
36
|
+
const handleClick = async () => {
|
|
37
|
+
if (isLoading) return;
|
|
38
|
+
setIsLoading(true);
|
|
39
|
+
|
|
40
|
+
try {
|
|
41
|
+
await payWithLoyaltyBalance(isLoyaltyBalanceUsed ? '0' : loyaltyBalance);
|
|
42
|
+
} finally {
|
|
43
|
+
setIsLoading(false);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
if (preOrder?.is_guest) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (isLoyaltyBalanceLoading) {
|
|
52
|
+
return (
|
|
53
|
+
<div className="mb-3 px-4 py-3 xs:px-0">
|
|
54
|
+
<LoaderSpinner />
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (parseFloat(loyaltyBalance) <= 0) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
className={twMerge(
|
|
65
|
+
'hidden flex-col w-full mb-4 border border-solid border-gray-400 px-0 md:p-4',
|
|
66
|
+
isPayWithLoyaltyBalanceLoading && 'pointer-events-none opacity-30',
|
|
67
|
+
parseFloat(loyaltyBalance) > 0 && 'block'
|
|
68
|
+
)}
|
|
69
|
+
>
|
|
70
|
+
<div className="flex w-full items-center">
|
|
71
|
+
<button onClick={handleClick}>
|
|
72
|
+
<span
|
|
73
|
+
className={clsx(
|
|
74
|
+
'flex h-5 w-5 items-center justify-center rounded border border-solid border-primary',
|
|
75
|
+
isLoyaltyBalanceUsed ? 'bg-primary' : 'bg-white'
|
|
76
|
+
)}
|
|
77
|
+
>
|
|
78
|
+
<Icon
|
|
79
|
+
name={isLoyaltyBalanceUsed ? 'check' : ''}
|
|
80
|
+
size={10}
|
|
81
|
+
className={clsx({ 'text-white': isLoyaltyBalanceUsed })}
|
|
82
|
+
/>
|
|
83
|
+
</span>
|
|
84
|
+
</button>
|
|
85
|
+
|
|
86
|
+
<div className="w-full pl-4">
|
|
87
|
+
<p className="cursor-pointer text-sm" onClick={handleClick}>
|
|
88
|
+
{t('checkout.payment.store_credit.use_my_store_credits')}
|
|
89
|
+
</p>
|
|
90
|
+
<p className="flex text-sm text-[#606060]">
|
|
91
|
+
{t('checkout.payment.store_credit.available_balance')}:
|
|
92
|
+
<Price
|
|
93
|
+
value={loyaltyBalance}
|
|
94
|
+
currencyCode={preOrder?.currency_type_label}
|
|
95
|
+
className="pe-1 font-bold"
|
|
96
|
+
/>
|
|
97
|
+
</p>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
{isLoyaltyBalanceUsed && parseFloat(preOrder?.unpaid_amount) > 0 && (
|
|
102
|
+
<p className="my-4 text-[15px] font-light italic text-[#707070] max-xs:text-xs">
|
|
103
|
+
<Trans
|
|
104
|
+
i18nKey="checkout.payment.store_credit.insufficient_balance"
|
|
105
|
+
components={{
|
|
106
|
+
Amount: (
|
|
107
|
+
<div className="inline-flex">
|
|
108
|
+
<Price
|
|
109
|
+
value={preOrder?.unpaid_amount}
|
|
110
|
+
currencyCode={preOrder?.currency_type_label}
|
|
111
|
+
className="text-primary"
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
)
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
</p>
|
|
118
|
+
)}
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
@@ -8,6 +8,7 @@ import PluginModule, { Component } from '@akinon/next/components/plugin-module';
|
|
|
8
8
|
import { twMerge } from 'tailwind-merge';
|
|
9
9
|
import { Image } from '@akinon/next/components/image';
|
|
10
10
|
import { Trans } from '@akinon/next/components/trans';
|
|
11
|
+
import { StoreCredits } from './steps/payment/options/store-credit';
|
|
11
12
|
|
|
12
13
|
export const Summary = () => {
|
|
13
14
|
const { t } = useLocalization();
|
|
@@ -38,6 +39,7 @@ export const Summary = () => {
|
|
|
38
39
|
'flex flex-col w-full mb-4 border border-solid border-gray-400'
|
|
39
40
|
}}
|
|
40
41
|
/>
|
|
42
|
+
<StoreCredits />
|
|
41
43
|
<div className="flex flex-col w-full border border-solid border-gray-400">
|
|
42
44
|
<div className="flex justify-between items-center flex-row border-b border-solid border-gray-400 px-4 py-2 sm:px-5 sm:py-4 sm:min-h-15">
|
|
43
45
|
<span className="text-black-800 text-xl font-light sm:text-2xl">
|
|
@@ -118,6 +120,14 @@ export const Summary = () => {
|
|
|
118
120
|
<Price value={preOrder?.shipping_amount} />
|
|
119
121
|
</span>
|
|
120
122
|
</div>
|
|
123
|
+
{parseFloat(preOrder?.loyalty_money) > 0 && (
|
|
124
|
+
<div className="flex items-center justify-between w-full text-xs text-black-800 py-1 px-4 sm:px-5">
|
|
125
|
+
<span>{t('checkout.summary.loyalty_money_total')}</span>
|
|
126
|
+
<span>
|
|
127
|
+
<Price value={preOrder?.loyalty_money} />
|
|
128
|
+
</span>
|
|
129
|
+
</div>
|
|
130
|
+
)}
|
|
121
131
|
<div className="flex items-center justify-between w-full text-xs text-black-800 py-1 px-4 sm:px-5">
|
|
122
132
|
<span>{t('checkout.summary.discounts_total')}</span>
|
|
123
133
|
<span>
|