@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.
@@ -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;
@@ -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
 
@@ -1,8 +1,8 @@
1
- import { Cache, CacheKey } from "../../lib/cache";
2
- import { FormType } from "../../types/commerce/form";
1
+ import { Cache, CacheKey } from '../../lib/cache';
2
+ import { FormType } from '../../types/commerce/form';
3
3
 
4
- import appFetch from "../../utils/app-fetch";
5
- import { form } from "../urls";
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 () {
@@ -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', { error, rawData });
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.13.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.13.1",
29
+ "@akinon/eslint-plugin-projectzero": "1.14.1",
30
30
  "eslint-config-prettier": "8.5.0"
31
31
  }
32
32
  }
package/plugins.js CHANGED
@@ -6,5 +6,6 @@ module.exports = [
6
6
  'pz-checkout-gift-pack',
7
7
  'pz-gpay',
8
8
  'pz-otp',
9
- 'pz-bkm'
9
+ 'pz-bkm',
10
+ 'pz-masterpass'
10
11
  ];