@akinon/next 1.13.1 → 1.14.1
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/.editorconfig +7 -0
- package/CHANGELOG.md +19 -0
- package/assets/styles/index.scss +28 -28
- package/bin/pz-install-plugins.js +0 -0
- package/bin/pz-install-theme.js +0 -0
- package/bin/pz-postbuild.js +0 -0
- package/bin/pz-postdev.js +0 -0
- package/bin/pz-postinstall.js +0 -0
- package/bin/pz-poststart.js +0 -0
- package/bin/pz-prebuild.js +0 -0
- package/bin/pz-predev.js +0 -0
- package/bin/pz-prestart.js +0 -0
- package/components/accordion.tsx +52 -0
- package/components/button.tsx +46 -0
- package/components/index.ts +17 -1
- package/components/input.tsx +110 -0
- package/components/plugin-module.tsx +11 -8
- package/components/price.tsx +55 -0
- package/components/selected-payment-option-view.tsx +7 -0
- package/data/client/address.ts +107 -107
- package/data/client/api.ts +2 -1
- package/data/client/b2b.ts +106 -106
- package/data/client/checkout.ts +516 -479
- package/data/client/wishlist.ts +31 -1
- package/data/server/category.ts +6 -2
- package/data/server/form.ts +4 -4
- package/data/server/list.ts +6 -1
- package/data/urls.ts +13 -2
- package/hooks/use-payment-options.ts +2 -1
- package/package.json +2 -2
- package/plugins.js +2 -1
- package/redux/middlewares/checkout.ts +265 -260
- package/redux/reducers/checkout.ts +13 -0
- package/redux/reducers/index.ts +14 -14
- package/types/commerce/b2b.ts +117 -117
- package/types/commerce/checkout.ts +7 -0
- package/types/index.ts +37 -0
- package/utils/generate-commerce-search-params.ts +22 -22
- package/utils/get-currency.ts +29 -29
package/data/client/wishlist.ts
CHANGED
|
@@ -14,6 +14,11 @@ interface GetFavoritesParams {
|
|
|
14
14
|
page?: number;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
interface GetStockParams {
|
|
18
|
+
limit?: number;
|
|
19
|
+
page?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
interface GetFavoritesResponse {
|
|
18
23
|
count: number;
|
|
19
24
|
results: FavoriteItem[];
|
|
@@ -38,6 +43,17 @@ interface AddStockAlertResponse {
|
|
|
38
43
|
product: number;
|
|
39
44
|
}
|
|
40
45
|
|
|
46
|
+
interface GetStockAlertsResponse {
|
|
47
|
+
count: number;
|
|
48
|
+
results: FavoriteItem[];
|
|
49
|
+
next?: string | null;
|
|
50
|
+
previous?: string | null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface DeleteStockAlertResponse {
|
|
54
|
+
success: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
41
57
|
export const wishlistApi = api.injectEndpoints({
|
|
42
58
|
endpoints: (build) => ({
|
|
43
59
|
getFavorites: build.query<GetFavoritesResponse, GetFavoritesParams>({
|
|
@@ -75,6 +91,18 @@ export const wishlistApi = api.injectEndpoints({
|
|
|
75
91
|
...(email ? { email } : {})
|
|
76
92
|
}
|
|
77
93
|
})
|
|
94
|
+
}),
|
|
95
|
+
getStockAlerts: build.query<GetStockAlertsResponse, GetStockParams>({
|
|
96
|
+
query: ({ page, limit }) =>
|
|
97
|
+
buildClientRequestUrl(wishlist.getStockAlerts({ page, limit })),
|
|
98
|
+
providesTags: ['StockAlert']
|
|
99
|
+
}),
|
|
100
|
+
deleteStockAlert: build.mutation<DeleteStockAlertResponse, number>({
|
|
101
|
+
query: (alertPk: number) => ({
|
|
102
|
+
url: buildClientRequestUrl(wishlist.deleteStockAlert(alertPk)),
|
|
103
|
+
method: 'DELETE'
|
|
104
|
+
}),
|
|
105
|
+
invalidatesTags: ['StockAlert']
|
|
78
106
|
})
|
|
79
107
|
}),
|
|
80
108
|
overrideExisting: true
|
|
@@ -84,5 +112,7 @@ export const {
|
|
|
84
112
|
useGetFavoritesQuery,
|
|
85
113
|
useAddFavoriteMutation,
|
|
86
114
|
useRemoveFavoriteMutation,
|
|
87
|
-
useAddStockAlertMutation
|
|
115
|
+
useAddStockAlertMutation,
|
|
116
|
+
useGetStockAlertsQuery,
|
|
117
|
+
useDeleteStockAlertMutation
|
|
88
118
|
} = wishlistApi;
|
package/data/server/category.ts
CHANGED
|
@@ -42,7 +42,9 @@ function getCategoryDataHandler(
|
|
|
42
42
|
logger.error('Error while parsing category data', {
|
|
43
43
|
handler: 'getCategoryDataHandler',
|
|
44
44
|
error,
|
|
45
|
-
rawData
|
|
45
|
+
rawData: rawData.startsWith('<!DOCTYPE html>')
|
|
46
|
+
? `${rawData.substring(0, 50)}...`
|
|
47
|
+
: rawData
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
50
|
|
|
@@ -109,7 +111,9 @@ function getCategoryBySlugDataHandler(slug: string) {
|
|
|
109
111
|
logger.error('Error while parsing category data', {
|
|
110
112
|
handler: 'getCategoryBySlugDataHandler',
|
|
111
113
|
error,
|
|
112
|
-
rawData
|
|
114
|
+
rawData: rawData.startsWith('<!DOCTYPE html>')
|
|
115
|
+
? `${rawData.substring(0, 50)}...`
|
|
116
|
+
: rawData
|
|
113
117
|
});
|
|
114
118
|
}
|
|
115
119
|
|
package/data/server/form.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Cache, CacheKey } from
|
|
2
|
-
import { FormType } from
|
|
1
|
+
import { Cache, CacheKey } from '../../lib/cache';
|
|
2
|
+
import { FormType } from '../../types/commerce/form';
|
|
3
3
|
|
|
4
|
-
import appFetch from
|
|
5
|
-
import { form } from
|
|
4
|
+
import appFetch from '../../utils/app-fetch';
|
|
5
|
+
import { form } from '../urls';
|
|
6
6
|
|
|
7
7
|
const getFormDataHandler = (pk: number) => {
|
|
8
8
|
return async function () {
|
package/data/server/list.ts
CHANGED
|
@@ -38,7 +38,12 @@ const getListDataHandler = (
|
|
|
38
38
|
numberValueParser
|
|
39
39
|
) as GetCategoryResponse;
|
|
40
40
|
} catch (error) {
|
|
41
|
-
logger.error('Error while parsing list data', {
|
|
41
|
+
logger.error('Error while parsing list data', {
|
|
42
|
+
error,
|
|
43
|
+
rawData: rawData.startsWith('<!DOCTYPE html>')
|
|
44
|
+
? `${rawData.substring(0, 50)}...`
|
|
45
|
+
: rawData
|
|
46
|
+
});
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
return data;
|
package/data/urls.ts
CHANGED
|
@@ -81,6 +81,9 @@ export const checkout = {
|
|
|
81
81
|
setMasterPassInstallmentOption:
|
|
82
82
|
'/orders/checkout/?page=MasterpassInstallmentPage',
|
|
83
83
|
setFundsTransferOption: '/orders/checkout/?page=FundsTransferChoicePage',
|
|
84
|
+
setCreditPaymentOption: '/orders/checkout/?page=CreditPaymentSelectionPage',
|
|
85
|
+
confirmationCreditPayment:
|
|
86
|
+
'/orders/checkout/?page=CreditPaymentConfirmationPage',
|
|
84
87
|
getCheckoutProviders: '/orders/checkout-provider-list/',
|
|
85
88
|
getCheckoutProvidersIndex: '/orders/checkout/?page=CheckoutProviderIndexPage',
|
|
86
89
|
setCheckoutProvider: '/orders/checkout/?page=CheckoutProviderSelectionPage',
|
|
@@ -138,7 +141,15 @@ export const wishlist = {
|
|
|
138
141
|
`/wishlists/favourite-products/?limit=${limit || 12}&page=${page || 1}`,
|
|
139
142
|
addFavorite: '/wishlists/favourite-products/',
|
|
140
143
|
removeFavorite: (favPk: number) => `/wishlists/favourite-products/${favPk}/`,
|
|
141
|
-
addStockAlert: '/wishlists/product-alerts/'
|
|
144
|
+
addStockAlert: '/wishlists/product-alerts/',
|
|
145
|
+
getStockAlerts: ({
|
|
146
|
+
page = 1,
|
|
147
|
+
limit = 12
|
|
148
|
+
}: {
|
|
149
|
+
page?: number;
|
|
150
|
+
limit?: number;
|
|
151
|
+
}) => `/wishlists/product-alerts/?limit=${limit}&page=${page}`,
|
|
152
|
+
deleteStockAlert: (pk: number) => `/wishlists/product-alerts/${pk}/`
|
|
142
153
|
};
|
|
143
154
|
|
|
144
155
|
export const user = {
|
|
@@ -170,7 +181,7 @@ export const widgets = {
|
|
|
170
181
|
};
|
|
171
182
|
|
|
172
183
|
export const form = {
|
|
173
|
-
getForm: (pk: number) => `/forms/${pk}/generate
|
|
184
|
+
getForm: (pk: number) => `/forms/${pk}/generate/`
|
|
174
185
|
};
|
|
175
186
|
|
|
176
187
|
const URLS = {
|
|
@@ -16,7 +16,8 @@ export const usePaymentOptions = () => {
|
|
|
16
16
|
|
|
17
17
|
const paymentTypeToPluginMap = {
|
|
18
18
|
pay_on_delivery: 'pz-pay-on-delivery',
|
|
19
|
-
bkm_express: 'pz-bkm'
|
|
19
|
+
bkm_express: 'pz-bkm',
|
|
20
|
+
masterpass: 'pz-masterpass'
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
const isInitialTypeIncluded = (type: string) => initialTypes.has(type);
|
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.
|
|
4
|
+
"version": "1.14.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@typescript-eslint/eslint-plugin": "6.7.4",
|
|
27
27
|
"@typescript-eslint/parser": "6.7.4",
|
|
28
28
|
"eslint": "^8.14.0",
|
|
29
|
-
"@akinon/eslint-plugin-projectzero": "1.
|
|
29
|
+
"@akinon/eslint-plugin-projectzero": "1.14.1",
|
|
30
30
|
"eslint-config-prettier": "8.5.0"
|
|
31
31
|
}
|
|
32
32
|
}
|