@akinon/next 1.89.0-rc.5 → 1.89.0-rc.7
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
CHANGED
package/components/price.tsx
CHANGED
|
@@ -55,8 +55,8 @@ export const Price = (props: NumericFormatProps & PriceProps) => {
|
|
|
55
55
|
: formattedValue;
|
|
56
56
|
|
|
57
57
|
const currentCurrencyDecimalScale = Settings.localization.currencies.find(
|
|
58
|
-
(currency) => currency
|
|
59
|
-
)
|
|
58
|
+
(currency) => currency?.code === currencyCode_
|
|
59
|
+
)?.decimalScale;
|
|
60
60
|
|
|
61
61
|
return (
|
|
62
62
|
<NumericFormat
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useAppSelector } from '../redux/hooks';
|
|
2
|
+
|
|
3
|
+
export const useLoyaltyAvailability = () => {
|
|
4
|
+
const { paymentOptions, unavailablePaymentOptions } = useAppSelector(
|
|
5
|
+
(state) => state.checkout
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
const hasLoyaltyInAvailable = paymentOptions.some(
|
|
9
|
+
(option) =>
|
|
10
|
+
option.payment_type === 'loyalty_money' ||
|
|
11
|
+
option.payment_type === 'loyalty'
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const hasLoyaltyInUnavailable = unavailablePaymentOptions.some(
|
|
15
|
+
(option) =>
|
|
16
|
+
option.payment_type === 'loyalty_money' ||
|
|
17
|
+
option.payment_type === 'loyalty'
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return hasLoyaltyInAvailable || hasLoyaltyInUnavailable;
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/next",
|
|
3
3
|
"description": "Core package for Project Zero Next",
|
|
4
|
-
"version": "1.89.0-rc.
|
|
4
|
+
"version": "1.89.0-rc.7",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"set-cookie-parser": "2.6.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@akinon/eslint-plugin-projectzero": "1.89.0-rc.
|
|
37
|
+
"@akinon/eslint-plugin-projectzero": "1.89.0-rc.7",
|
|
38
38
|
"@babel/core": "7.26.10",
|
|
39
39
|
"@babel/preset-env": "7.26.9",
|
|
40
40
|
"@babel/preset-typescript": "7.27.0",
|
|
@@ -20,7 +20,8 @@ import {
|
|
|
20
20
|
setShippingOptions,
|
|
21
21
|
setHepsipayAvailability,
|
|
22
22
|
setWalletPaymentData,
|
|
23
|
-
setPayOnDeliveryOtpModalActive
|
|
23
|
+
setPayOnDeliveryOtpModalActive,
|
|
24
|
+
setUnavailablePaymentOptions
|
|
24
25
|
} from '../../redux/reducers/checkout';
|
|
25
26
|
import { RootState, TypedDispatch } from 'redux/store';
|
|
26
27
|
import { checkoutApi } from '../../data/client/checkout';
|
|
@@ -148,6 +149,14 @@ export const contextListMiddleware: Middleware = ({
|
|
|
148
149
|
dispatch(setPaymentOptions(context.page_context.payment_options));
|
|
149
150
|
}
|
|
150
151
|
|
|
152
|
+
if (context.page_context.unavailable_options) {
|
|
153
|
+
dispatch(
|
|
154
|
+
setUnavailablePaymentOptions(
|
|
155
|
+
context.page_context.unavailable_options
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
151
160
|
if (context.page_context.credit_payment_options) {
|
|
152
161
|
dispatch(
|
|
153
162
|
setCreditPaymentOptions(context.page_context.credit_payment_options)
|
|
@@ -40,6 +40,7 @@ export interface CheckoutState {
|
|
|
40
40
|
shippingOptions: ShippingOption[];
|
|
41
41
|
dataSourceShippingOptions: DataSource[];
|
|
42
42
|
paymentOptions: PaymentOption[];
|
|
43
|
+
unavailablePaymentOptions: PaymentOption[];
|
|
43
44
|
creditPaymentOptions: CheckoutCreditPaymentOption[];
|
|
44
45
|
selectedCreditPaymentPk: number;
|
|
45
46
|
paymentChoices: PaymentChoice[];
|
|
@@ -94,6 +95,7 @@ const initialState: CheckoutState = {
|
|
|
94
95
|
shippingOptions: [],
|
|
95
96
|
dataSourceShippingOptions: [],
|
|
96
97
|
paymentOptions: [],
|
|
98
|
+
unavailablePaymentOptions: [],
|
|
97
99
|
creditPaymentOptions: [],
|
|
98
100
|
selectedCreditPaymentPk: null,
|
|
99
101
|
paymentChoices: [],
|
|
@@ -157,6 +159,9 @@ const checkoutSlice = createSlice({
|
|
|
157
159
|
setPaymentOptions(state, { payload }) {
|
|
158
160
|
state.paymentOptions = payload;
|
|
159
161
|
},
|
|
162
|
+
setUnavailablePaymentOptions(state, { payload }) {
|
|
163
|
+
state.unavailablePaymentOptions = payload;
|
|
164
|
+
},
|
|
160
165
|
setPaymentChoices(state, { payload }) {
|
|
161
166
|
state.paymentChoices = payload;
|
|
162
167
|
},
|
|
@@ -218,9 +223,10 @@ export const {
|
|
|
218
223
|
setShippingOptions,
|
|
219
224
|
setDataSourceShippingOptions,
|
|
220
225
|
setPaymentOptions,
|
|
226
|
+
setUnavailablePaymentOptions,
|
|
227
|
+
setPaymentChoices,
|
|
221
228
|
setCreditPaymentOptions,
|
|
222
229
|
setSelectedCreditPaymentPk,
|
|
223
|
-
setPaymentChoices,
|
|
224
230
|
setCardType,
|
|
225
231
|
setInstallmentOptions,
|
|
226
232
|
setBankAccounts,
|