@akinon/next 1.71.0-rc.7 → 1.71.0

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
@@ -1,44 +1,11 @@
1
1
  # @akinon/next
2
2
 
3
- ## 1.71.0-rc.7
4
-
5
- ## 1.71.0-rc.6
3
+ ## 1.71.0
6
4
 
7
5
  ### Minor Changes
8
6
 
9
7
  - f34454a: ZERO-2953: Add hepsipay payment method
10
8
 
11
- ## 1.71.0-rc.5
12
-
13
- ## 1.71.0-rc.4
14
-
15
- ## 1.71.0-rc.3
16
-
17
- ### Minor Changes
18
-
19
- - 3344bca: ZERO-3013: Enable web vitals tracking in settings.js
20
-
21
- ## 1.71.0-rc.2
22
-
23
- ### Minor Changes
24
-
25
- - 56cdddc: ZERO-0000: SHOP-78125: Change unpaid_amount with total_amount_with_interest
26
-
27
- ## 1.71.0-rc.1
28
-
29
- ### Minor Changes
30
-
31
- - 9a50730: ZERO-3015: Add currency parameter to getOrders query
32
-
33
- ## 1.71.0-rc.0
34
-
35
- ### Minor Changes
36
-
37
- - 3bfa12a: ZERO-3003:Add fetchLoyaltyData and setLoyaltyData requests to RTK
38
- - 4d3deb4: ZERO-2935: sentry 8 upgrade
39
- - 3010514: ZERO-3011:add shipping_option_operator and custom filter to getOrders
40
- - ca774b3: ZERO-3002:add register with loyalty url
41
-
42
9
  ## 1.70.0
43
10
 
44
11
  ### Minor Changes
@@ -49,72 +16,12 @@
49
16
 
50
17
  ### Minor Changes
51
18
 
52
- - 3bfa12a: ZERO-3003:Add fetchLoyaltyData and setLoyaltyData requests to RTK
53
- - 4d3deb4: ZERO-2935: sentry 8 upgrade
54
- - 3010514: ZERO-3011:add shipping_option_operator and custom filter to getOrders
55
- - ca774b3: ZERO-3002:add register with loyalty url
56
- - f046f8e: ZERO-2575: update version for react-number-format
57
-
58
- ## 1.69.0-rc.8
59
-
60
- ### Minor Changes
61
-
62
- - 3010514: ZERO-3011:add shipping_option_operator and custom filter to getOrders
63
- - ca774b3: ZERO-3002:add register with loyalty url
64
-
65
- ## 1.69.0-rc.7
66
-
67
- ### Minor Changes
68
-
69
- - 3bfa12a: ZERO-3003:Add fetchLoyaltyData and setLoyaltyData requests to RTK
70
-
71
- ## 1.69.0-rc.6
72
-
73
- ### Minor Changes
74
-
75
- - 4d3deb4: ZERO-2935: sentry 8 upgrade
76
19
  - 063da74: ZERO-3010: Remove pz-iyzico-saved-card package
77
20
  - 72da021: ZERO-3010: Remove unused code in pretty-url.tsx
78
21
  - 5632a99: ZERO-3010: Remove iyzicoSavedCardReducer from reducers
79
22
  - cbdb0c8: ZERO-3010: Move pretty url page into project
80
23
  - 80c869b: ZERO-3010: Remove savedCardMiddleware from redux middlewares
81
24
 
82
- ## 1.69.0-rc.5
83
-
84
- ### Minor Changes
85
-
86
- - 80c869b: ZERO-3010: Remove savedCardMiddleware from redux middlewares
87
-
88
- ## 1.69.0-rc.4
89
-
90
- ### Minor Changes
91
-
92
- - 063da74: ZERO-3010: Remove pz-iyzico-saved-card package
93
-
94
- ## 1.69.0-rc.3
95
-
96
- ### Minor Changes
97
-
98
- - cbdb0c8: ZERO-3010: Move pretty url page into project
99
-
100
- ## 1.69.0-rc.2
101
-
102
- ### Minor Changes
103
-
104
- - 5632a99: ZERO-3010: Remove iyzicoSavedCardReducer from reducers
105
-
106
- ## 1.69.0-rc.1
107
-
108
- ### Minor Changes
109
-
110
- - 72da021: ZERO-3010: Remove unused code in pretty-url.tsx
111
-
112
- ## 1.69.0-rc.0
113
-
114
- ### Minor Changes
115
-
116
- - 4d3deb4: ZERO-2935: sentry 8 upgrade
117
-
118
25
  ## 1.68.0
119
26
 
120
27
  ### Minor Changes
@@ -1,12 +1,13 @@
1
+ 'use client';
2
+
1
3
  import { MouseEvent, useCallback, useEffect, useState } from 'react';
2
- import { PaginationProps } from '@theme/components/types';
4
+ import { PaginationProps } from '../types';
3
5
  import { twMerge } from 'tailwind-merge';
4
6
  import clsx from 'clsx';
5
- import { Link, Button, LoaderSpinner } from '@theme/components';
6
7
  import usePagination from '@akinon/next/hooks/use-pagination';
7
8
  import { useLocalization } from '@akinon/next/hooks';
8
9
  import { useRouter } from '@akinon/next/hooks';
9
- import { useInView } from 'react-intersection-observer';
10
+ import { Link } from './link';
10
11
 
11
12
  export const Pagination = (props: PaginationProps) => {
12
13
  const { t } = useLocalization();
@@ -20,13 +21,8 @@ export const Pagination = (props: PaginationProps) => {
20
21
  prevClassName,
21
22
  pageClassName,
22
23
  nextClassName,
23
- moreButtonClassName,
24
24
  threshold = 1,
25
- type = 'list',
26
- onPageChange,
27
- direction,
28
- render,
29
- isLoading
25
+ render
30
26
  } = props;
31
27
 
32
28
  const pagination = usePagination(total, limit, currentPage, numberOfPages);
@@ -37,16 +33,12 @@ export const Pagination = (props: PaginationProps) => {
37
33
  pageList,
38
34
  prev,
39
35
  next,
40
- last,
41
36
  setTotal,
42
37
  setLimit
43
38
  } = pagination;
44
39
 
45
40
  const [paginationItems, setPaginationItems] = useState([]);
46
- const showNext = currentPage * paginationLimit < paginationTotal;
47
- const { ref, inView } = useInView({ threshold: 0.75 });
48
- const [prevPage, setPrevPage] = useState(page);
49
- const [nextPage, setNextPage] = useState(page);
41
+ const showNext = currentPage * paginationLimit < total;
50
42
 
51
43
  const createListItems = useCallback(() => {
52
44
  setPaginationItems([]);
@@ -106,38 +98,9 @@ export const Pagination = (props: PaginationProps) => {
106
98
  router.push(newUrl.pathname + newUrl.search, undefined);
107
99
  };
108
100
 
109
- const handlePageChange = () => {
110
- let changingPage;
111
-
112
- if (direction === 'prev') {
113
- changingPage = Number(type !== 'list' ? prevPage : page) - 1;
114
- setPrevPage(changingPage);
115
- } else {
116
- changingPage = Number(type !== 'list' ? nextPage : page) + 1;
117
- setNextPage(changingPage);
118
- }
119
-
120
- onPageChange(changingPage);
121
- };
122
-
123
- useEffect(() => {
124
- if (type === 'infinite' && page === 1) {
125
- setPrevPage(1);
126
- setNextPage(1);
127
- }
128
- }, [page]);
129
-
130
- useEffect(() => {
131
- if (inView) {
132
- handlePageChange();
133
- }
134
- }, [inView]); // eslint-disable-line react-hooks/exhaustive-deps
135
-
136
101
  useEffect(() => {
137
- if (type === 'list') {
138
- createListItems();
139
- }
140
- }, [page]); // eslint-disable-line react-hooks/exhaustive-deps
102
+ createListItems();
103
+ }, [createListItems, page]);
141
104
 
142
105
  useEffect(() => {
143
106
  if (total && total !== paginationTotal) {
@@ -155,128 +118,76 @@ export const Pagination = (props: PaginationProps) => {
155
118
  return <>{render(pagination)}</>;
156
119
  }
157
120
 
158
- return direction === 'prev' && type !== 'list' ? (
159
- <>
160
- <div className="flex items-center justify-center">
161
- <Button
162
- className={twMerge('px-5', moreButtonClassName)}
163
- onClick={() => handlePageChange()}
164
- >
165
- {isLoading ? (
166
- <LoaderSpinner className="h-4 w-4" />
167
- ) : (
168
- t('category.pagination.load_previous_page')
169
- )}
170
- </Button>
171
- </div>
172
- </>
173
- ) : (
174
- <>
175
- {type === 'more' && (
176
- <div className="flex items-center justify-center">
177
- <Button
121
+ return (
122
+ <ul
123
+ className={twMerge(
124
+ 'flex mt-8 mb-4 justify-center items-center',
125
+ containerClassName
126
+ )}
127
+ >
128
+ {prev && (
129
+ <li>
130
+ <Link
131
+ onClick={(e) => handleClick(e, prev)}
132
+ href={prev}
178
133
  className={twMerge(
179
- 'px-5',
180
- Number(nextPage) === Number(last)
181
- ? 'bg-gray-600 border-gray-600 pointer-events-none'
182
- : 'bg-black',
183
- moreButtonClassName
134
+ 'flex cursor-pointer text-sm px-2',
135
+ prevClassName
184
136
  )}
185
- onClick={() => handlePageChange()}
186
- disabled={Number(nextPage) === Number(last)}
187
137
  >
188
- {isLoading ? (
189
- <LoaderSpinner className="h-4 w-4" />
190
- ) : (
191
- t('category.pagination.more')
192
- )}
193
- </Button>
194
- </div>
138
+ <span>&lt;</span>
139
+ <span className="hidden lg:inline-block ms-4">
140
+ {t('category.pagination.previous')}
141
+ </span>
142
+ </Link>
143
+ </li>
195
144
  )}
196
145
 
197
- {type === 'infinite' && Number(nextPage) !== last && (
198
- <div ref={ref}></div>
199
- )}
200
-
201
- {(type === 'infinite' || type === 'more') &&
202
- Number(nextPage) === last &&
203
- !isLoading && (
204
- <p className="mt-8 text-center">
205
- {t('category.pagination.shown_items')}
206
- </p>
207
- )}
208
-
209
- {type === 'list' && (
210
- <ul
211
- className={twMerge(
212
- 'mb-4 mt-8 flex items-center justify-center',
213
- containerClassName
214
- )}
215
- >
216
- {prev && currentPage !== 1 && (
217
- <li>
146
+ {paginationItems &&
147
+ paginationItems?.map((item, i) => (
148
+ <li key={i}>
149
+ {item?.url != '#' ? (
218
150
  <Link
219
- onClick={(e) => handleClick(e, prev)}
220
- href={prev}
151
+ onClick={(e) => handleClick(e, item.url)}
152
+ href={item.url}
221
153
  className={twMerge(
222
- 'flex cursor-pointer px-2 text-sm items-center',
223
- prevClassName
154
+ clsx(
155
+ 'text-xs px-2 cursor-pointer',
156
+ { 'pointer-events-none': item.url === null },
157
+ Number(page) === Number(item?.page)
158
+ ? 'font-semibold text-black-800'
159
+ : 'text-gray-400'
160
+ ),
161
+ pageClassName
224
162
  )}
225
163
  >
226
- <span>&lt;</span>
227
- <span className="ms-4 hidden lg:inline-block">
228
- {t('category.pagination.previous')}
229
- </span>
164
+ {item?.page}
230
165
  </Link>
231
- </li>
232
- )}
233
-
234
- {paginationItems.map((item, i) => (
235
- <li key={i}>
236
- {item?.url != '#' ? (
237
- <Link
238
- onClick={(e) => handleClick(e, item.url)}
239
- href={item.url}
240
- className={twMerge(
241
- clsx(
242
- 'cursor-pointer px-2 text-xs items-center',
243
- { 'pointer-events-none': item.url === null },
244
- Number(page) === Number(item?.page)
245
- ? 'font-semibold text-black-800'
246
- : 'text-gray-400'
247
- ),
248
- pageClassName
249
- )}
250
- >
251
- {item?.page}
252
- </Link>
253
- ) : (
254
- <span className="flex cursor-default items-center justify-center text-xs">
255
- {item?.page}
256
- </span>
257
- )}
258
- </li>
259
- ))}
260
-
261
- {showNext && (
262
- <li>
263
- <Link
264
- onClick={(e) => handleClick(e, next)}
265
- href={next}
266
- className={twMerge(
267
- 'flex cursor-pointer px-2 text-xs items-center',
268
- nextClassName
269
- )}
270
- >
271
- <span className="me-4 hidden lg:inline-block">
272
- {t('category.pagination.next')}
273
- </span>
274
- <span>&gt;</span>
275
- </Link>
276
- </li>
277
- )}
278
- </ul>
166
+ ) : (
167
+ <span className="cursor-default text-xs flex items-center justify-center">
168
+ {item?.page}
169
+ </span>
170
+ )}
171
+ </li>
172
+ ))}
173
+
174
+ {showNext && (
175
+ <li>
176
+ <Link
177
+ onClick={(e) => handleClick(e, next)}
178
+ href={next}
179
+ className={twMerge(
180
+ 'flex cursor-pointer text-xs px-2',
181
+ nextClassName
182
+ )}
183
+ >
184
+ <span className="hidden lg:inline-block me-4">
185
+ {t('category.pagination.next')}
186
+ </span>
187
+ <span>&gt;</span>
188
+ </Link>
189
+ </li>
279
190
  )}
280
- </>
191
+ </ul>
281
192
  );
282
193
  };
@@ -3,26 +3,24 @@
3
3
  import { useReportWebVitals } from 'next/web-vitals';
4
4
  import { useSelectedLayoutSegment } from 'next/navigation';
5
5
  import { usePathname } from 'next/navigation';
6
- import settings from 'settings';
7
6
 
8
7
  export function WebVitals() {
9
8
  let layoutSegment = useSelectedLayoutSegment();
10
9
  const pathname = usePathname();
11
- const { enabled } = settings.webVitals || { enabled: false };
12
10
 
13
11
  if (pathname === '/' && layoutSegment === null) {
14
12
  layoutSegment = 'home';
15
13
  }
16
14
 
17
15
  useReportWebVitals((metric) => {
18
- if (process.env.NODE_ENV !== 'development' || !enabled) {
16
+ if (process.env.NODE_ENV !== 'development') {
19
17
  return;
20
18
  }
21
19
 
22
20
  const { name, value, rating } = metric;
23
21
  const page = layoutSegment || 'unknown';
24
22
 
25
- fetch(`/api/web-vitals`, {
23
+ fetch(`${process.env.NEXT_PUBLIC_URL}/api/web-vitals`, {
26
24
  method: 'POST',
27
25
  headers: {
28
26
  'Content-Type': 'application/json'
@@ -21,11 +21,6 @@ interface GetOrdersParams {
21
21
  page?: number;
22
22
  createdDate?: string;
23
23
  endDate?: string;
24
- shipping_option_slug?: string;
25
- shipping_option_operator?: string;
26
- filterType?: string;
27
- filterValue?: string;
28
- currency?: string;
29
24
  }
30
25
 
31
26
  export interface GetQuotationsResponse {
@@ -119,29 +114,9 @@ const accountApi = api.injectEndpoints({
119
114
  query: (id) => buildClientRequestUrl(account.orderId(id))
120
115
  }),
121
116
  getOrders: builder.query<GetOrdersResponse, GetOrdersParams>({
122
- query: ({
123
- page,
124
- limit,
125
- createdDate,
126
- endDate,
127
- shipping_option_operator,
128
- shipping_option_slug,
129
- filterType,
130
- filterValue,
131
- currency
132
- } = {}) =>
117
+ query: ({ page, limit, createdDate, endDate } = {}) =>
133
118
  buildClientRequestUrl(
134
- account.getOrders({
135
- page,
136
- limit,
137
- createdDate,
138
- endDate,
139
- shipping_option_operator,
140
- shipping_option_slug,
141
- filterType,
142
- filterValue,
143
- currency
144
- })
119
+ account.getOrders({ page, limit, createdDate, endDate })
145
120
  )
146
121
  }),
147
122
  getQuotations: builder.query<GetQuotationsResponse, GetQuotationsParams>({
@@ -106,7 +106,7 @@ const completeMasterpassPayment = async (
106
106
  referenceNo,
107
107
  merchantId: credentials?.merchant_id ?? null,
108
108
  msisdn,
109
- amount: preOrder?.total_amount_with_interest?.replace('.', '') ?? '',
109
+ amount: preOrder?.unpaid_amount?.replace('.', '') ?? '',
110
110
  additionalParams: additionalParams ?? extras?.additionalParams,
111
111
  language,
112
112
  installmentCount: preOrder?.installment?.installment_count ?? 1
@@ -776,26 +776,6 @@ export const checkoutApi = api.injectEndpoints({
776
776
  extra_field
777
777
  }
778
778
  })
779
- }),
780
- fetchLoyaltyData: build.query<CheckoutResponse, void>({
781
- query: () => ({
782
- url: buildClientRequestUrl(checkout.loyaltyCardPage, {
783
- accept: 'application/json',
784
- contentType: 'application/json'
785
- }),
786
- method: 'GET'
787
- })
788
- }),
789
- setLoyaltyData: build.mutation<CheckoutResponse, number>({
790
- query: (amount) => ({
791
- url: buildClientRequestUrl(checkout.loyaltyCardPage, {
792
- useFormData: true
793
- }),
794
- method: 'POST',
795
- body: {
796
- selected_loyalty_amount: amount
797
- }
798
- })
799
779
  })
800
780
  }),
801
781
  overrideExisting: false
@@ -835,8 +815,6 @@ export const {
835
815
  useSetDeliveryBagsMutation,
836
816
  useSetAttributeBasedShippingOptionsMutation,
837
817
  useSetOrderSelectionPageMutation,
838
- useFetchLoyaltyDataQuery,
839
- useSetLoyaltyDataMutation,
840
818
  useSetWalletSelectionPageMutation,
841
819
  useSetWalletPaymentPageMutation,
842
820
  useSetWalletCompletePageMutation
package/data/urls.ts CHANGED
@@ -18,30 +18,20 @@ export const account = {
18
18
  limit,
19
19
  createdDate,
20
20
  endDate,
21
- shipping_option_slug,
22
- shipping_option_operator = '=',
23
- filterType,
24
- filterValue,
25
- currency
21
+ shipping_option_slug
26
22
  }: {
27
23
  page?: number;
28
24
  limit?: number;
29
25
  createdDate?: string;
30
26
  endDate?: string;
31
27
  shipping_option_slug?: string;
32
- shipping_option_operator?: string;
33
- filterType?: string;
34
- filterValue?: string;
35
- currency?: string;
36
28
  }) =>
37
29
  `/users/orders/?page=${page || 1}&limit=${limit || 12}${
38
30
  createdDate ? `&created_date__gte=${createdDate}` : ''
39
31
  }${endDate ? `&created_date__lte=${endDate}` : ''}${
40
32
  shipping_option_slug
41
- ? `&shipping_option_slug${shipping_option_operator}${shipping_option_slug}`
33
+ ? `&shipping_option_slug=${shipping_option_slug}`
42
34
  : ''
43
- }${filterType && filterValue ? `&${filterType}=${filterValue}` : ''}${
44
- currency ? `&currency=${currency}` : ''
45
35
  }`,
46
36
  getQuotations: (page?: number, status?: string, limit?: number) =>
47
37
  `/b2b/my-quotations/?page=${page || 1}` +
@@ -133,8 +123,7 @@ export const checkout = {
133
123
  setAttributeBasedShippingOption:
134
124
  '/orders/checkout/?page=AttributeBasedShippingOptionSelectionPage',
135
125
  deliveryBagsPage: '/orders/checkout/?page=DeliveryBagsPage',
136
- setOrderSelectionPage: '/orders/checkout/?page=OrderSelectionPage',
137
- loyaltyCardPage: '/orders/checkout/?page=LoyaltyCardPage'
126
+ setOrderSelectionPage: '/orders/checkout/?page=OrderSelectionPage'
138
127
  };
139
128
 
140
129
  export const flatpage = {
@@ -214,8 +203,7 @@ export const user = {
214
203
  confirmEmailVerification: (token: string) =>
215
204
  `/users/registration/account-confirm-email/${token}/`,
216
205
  csrfToken: '/csrf_token/',
217
- anonymousOrderTracking: '/users/orders/anonymous',
218
- loyaltyRegister: '/users/register-with-loyalty/'
206
+ anonymousOrderTracking: '/users/orders/anonymous'
219
207
  };
220
208
 
221
209
  export const b2b = {
@@ -1,12 +1,5 @@
1
- import { initSentry } from '../sentry';
2
-
3
1
  export async function register() {
4
2
  if (process.env.NEXT_RUNTIME === 'nodejs') {
5
3
  await import('./node');
6
- initSentry('Server');
7
- }
8
-
9
- if (process.env.NEXT_RUNTIME === 'edge') {
10
- initSentry('Edge');
11
4
  }
12
5
  }
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.71.0-rc.7",
4
+ "version": "1.71.0",
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.71.0-rc.7",
33
+ "@akinon/eslint-plugin-projectzero": "1.71.0",
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",
package/types/index.ts CHANGED
@@ -78,9 +78,6 @@ export interface Currency {
78
78
  }
79
79
 
80
80
  export interface Settings {
81
- webVitals?: {
82
- enabled: boolean;
83
- };
84
81
  usePrettyUrlRoute?: boolean;
85
82
  commerceUrl: string;
86
83
  redis: {
package/with-pz-config.js CHANGED
@@ -61,6 +61,9 @@ const defaultConfig = {
61
61
  translations: false
62
62
  };
63
63
  return config;
64
+ },
65
+ sentry: {
66
+ hideSourceMaps: true
64
67
  }
65
68
  };
66
69