@akinon/next 1.81.0-rc.2 → 1.81.0-rc.3
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 +6 -0
- package/data/client/api.ts +1 -0
- package/data/client/checkout.ts +29 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/data/client/api.ts
CHANGED
package/data/client/checkout.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
setBankAccounts,
|
|
3
3
|
setCardType,
|
|
4
4
|
setInstallmentOptions,
|
|
5
|
+
setPaymentOptions,
|
|
5
6
|
setPaymentStepBusy,
|
|
6
7
|
setSelectedBankAccountPk,
|
|
7
8
|
setSelectedCreditPaymentPk,
|
|
@@ -424,6 +425,12 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
424
425
|
}
|
|
425
426
|
})
|
|
426
427
|
}),
|
|
428
|
+
fetchPaymentOptions: build.query<CheckoutResponse, void>({
|
|
429
|
+
query: () => ({
|
|
430
|
+
url: buildClientRequestUrl(checkout.setPaymentOption)
|
|
431
|
+
}),
|
|
432
|
+
providesTags: ['PaymentOptions']
|
|
433
|
+
}),
|
|
427
434
|
setPaymentOption: build.mutation<CheckoutResponse, number>({
|
|
428
435
|
query: (pk: number) => ({
|
|
429
436
|
url: buildClientRequestUrl(checkout.setPaymentOption, {
|
|
@@ -737,7 +744,27 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
737
744
|
body: {
|
|
738
745
|
loyalty_amount_to_use: amount
|
|
739
746
|
}
|
|
740
|
-
})
|
|
747
|
+
}),
|
|
748
|
+
async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
|
749
|
+
dispatch(setPaymentStepBusy(true));
|
|
750
|
+
dispatch(setPaymentOptions([]));
|
|
751
|
+
await queryFulfilled;
|
|
752
|
+
|
|
753
|
+
const paymentOptionsData = await dispatch(
|
|
754
|
+
checkoutApi.endpoints.fetchPaymentOptions.initiate()
|
|
755
|
+
).unwrap();
|
|
756
|
+
|
|
757
|
+
const paymentOptions = paymentOptionsData?.context_list?.find(
|
|
758
|
+
(context) => context?.page_name === 'PaymentOptionSelectionPage'
|
|
759
|
+
)?.page_context?.payment_options;
|
|
760
|
+
|
|
761
|
+
if (paymentOptions) {
|
|
762
|
+
dispatch(setPaymentOptions(paymentOptions));
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
dispatch(setPaymentStepBusy(false));
|
|
766
|
+
},
|
|
767
|
+
invalidatesTags: ['PaymentOptions']
|
|
741
768
|
}),
|
|
742
769
|
setOrderNote: build.mutation<CheckoutResponse, string>({
|
|
743
770
|
query: (notes) => ({
|
|
@@ -840,6 +867,7 @@ export const {
|
|
|
840
867
|
useSetAddressesMutation,
|
|
841
868
|
useSetShippingOptionMutation,
|
|
842
869
|
useSetDataSourceShippingOptionsMutation,
|
|
870
|
+
useFetchPaymentOptionsQuery,
|
|
843
871
|
useSetPaymentOptionMutation,
|
|
844
872
|
useSetBinNumberMutation,
|
|
845
873
|
useSetInstallmentOptionMutation,
|
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.81.0-rc.
|
|
4
|
+
"version": "1.81.0-rc.3",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"set-cookie-parser": "2.6.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@akinon/eslint-plugin-projectzero": "1.81.0-rc.
|
|
33
|
+
"@akinon/eslint-plugin-projectzero": "1.81.0-rc.3",
|
|
34
34
|
"@types/react-redux": "7.1.30",
|
|
35
35
|
"@types/set-cookie-parser": "2.4.7",
|
|
36
36
|
"@typescript-eslint/eslint-plugin": "6.7.4",
|