@akinon/next 2.0.27-rc.0 → 2.0.28-beta.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,33 +1,16 @@
1
1
  # @akinon/next
2
2
 
3
- ## 2.0.27-rc.0
3
+ ## 2.0.28-beta.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 0cf9ea23: BRDG-16491: Prevent redirect when iframe payment is active
8
- - 324f97d5: ZERO-4219: replace masterpass-rest-complete with masterpass-rest-callback
9
- - 51ea0688: ZERO-4377: Fix checkout card type state being cleared after valid bin number responses.
10
- - ZERO-4160: Enhance oauth-login middleware with improved request handling and logging
11
- - b55acb768: ZERO-2577: Fix pagination bug and update usePagination hook and ensure pagination controls rendering correctly
12
- - 760258c1: ZERO-4160: Enhance oauth-login middleware to handle fetch errors and improve response handling
13
- - 143be2b9: ZERO-3457: Crop styles are customizable and logic improved for rendering similar products modal
14
- - 7889b08f: ZERO-4276: Enhance route generation by adding .env loading and custom skip segments support
15
- - 9f8cd3bc: ZERO-3449: AI Search Active Filters & Crop Style changes have been implemented
16
- - d51fa68e: ZERO-4399: add card rewards to pz-masterpass-rest
17
- - bfafa3f4: ZERO-4160: Refactor oauth-login middleware to use fetchCommerce for API calls and improve cookie handling
18
- - 57d7eb30: ZERO-4276: Refactor route generation logic by removing environment loading and simplifying skip segments handling
19
- - d99a6a7d: ZERO-3457_1: Fixed the settings prop and made sure everything is customizable.
20
- - 9db81a71: ZERO-4365: Remove brand `@theme/*` alias imports from library packages
21
- - 591e345e: ZERO-3855: Enhance credit card payment handling in checkout middlewares
22
- - 4de5303c5: ZERO-2504: add cookie filter to api client request
23
- - 95b139dc: ZERO-3795: Remove duplicate entry for SavedCard in PluginComponents map
24
- - 1d00f2d0: BRDG-16664: Set secure flag for CSRF token cookies in useCaptcha and default middleware
25
- - 4ac7b2a1: ZERO-4219: fix masterpass-rest callback route format and double-encoded error cookie
26
- - 4998a963: ZERO-4168: Add server-side payload optimization
27
- - 804d2bd: ZERO-4536: Add akinon.net domain to CSP frame-ancestors directive
28
- - 3909d322: Edit the duplicate Plugin.SimilarProducts in the plugin-module.
29
- - 6a3d8a6: ZERO-4541: Fix URL query string formatting in getOrders and getOldOrders functions
30
- - e18836b2: ZERO-4160: Restore scope in Sentry addon configuration in akinon.json
7
+ - cbbbfd75: ZERO-4376: Bootstrap beta cycle (next-main pre-release motor)
8
+
9
+ ## 2.0.27
10
+
11
+ ### Patch Changes
12
+
13
+ - 1afe5df: ZERO-4550: Scope the auth stale-session cleanup to password login. Register and OTP-login verify submits are still anonymous (no user pk yet), but their session carries the pending OTP challenge; clearing it on those flows made the backend re-issue the code on every verify instead of validating it. The cleanup now only runs for `formType === 'login'` (preserving the ZERO-4247 fix), so register/OTP flows keep their session and the entered code is verified.
31
14
 
32
15
  ## 2.0.26
33
16
 
package/api/auth.ts CHANGED
@@ -173,8 +173,13 @@ const getDefaultAuthConfig = () => {
173
173
  if (sessionCookie) {
174
174
  reqHeaders.set('cookie', sessionCookie);
175
175
  }
176
- } else {
177
- // Stale session cookie — remove from headers and clear in browser
176
+ } else if (credentials.formType === 'login') {
177
+ // Stale session cookie — only clear it before a fresh password
178
+ // login (ZERO-4247). Register and OTP flows are still anonymous at
179
+ // this point (no pk yet), but their session carries the pending OTP
180
+ // challenge; clearing it here makes the backend lose the challenge
181
+ // and re-issue the code on every verify (ZERO-4550).
182
+ // remove from headers and clear in browser
178
183
  const currentCookies = reqHeaders.get('cookie') || '';
179
184
  const cleanedCookies = currentCookies
180
185
  .split(';')
@@ -456,8 +461,13 @@ const defaultNextAuthOptionsV4 = (req: any, res: any) => {
456
461
  if (sessionCookie) {
457
462
  reqHeaders.set('cookie', sessionCookie);
458
463
  }
459
- } else {
460
- // Stale session cookie — remove from headers and clear in browser
464
+ } else if (credentials.formType === 'login') {
465
+ // Stale session cookie — only clear it before a fresh password
466
+ // login (ZERO-4247). Register and OTP flows are still anonymous at
467
+ // this point (no pk yet), but their session carries the pending OTP
468
+ // challenge; clearing it here makes the backend lose the challenge
469
+ // and re-issue the code on every verify (ZERO-4550).
470
+ // remove from headers and clear in browser
461
471
  const currentCookies = reqHeaders.get('cookie') || '';
462
472
  const cleanedCookies = currentCookies
463
473
  .split(';')
@@ -6,7 +6,6 @@ const findBaseDir = require('../utils/find-base-dir');
6
6
 
7
7
  const generateRoutes = () => {
8
8
  const baseDir = findBaseDir();
9
-
10
9
  const srcDir = path.join(baseDir, 'src');
11
10
  const appDir = path.join(srcDir, 'app');
12
11
 
@@ -35,10 +34,8 @@ const generateRoutes = () => {
35
34
  '[segment]',
36
35
  '[url]',
37
36
  '[theme]',
38
- '[member_type]',
39
- '[clienttype]'
37
+ '[member_type]'
40
38
  ];
41
-
42
39
  const skipCatchAllRoutes = ['[...prettyurl]', '[...not_found]'];
43
40
 
44
41
  const walkDirectory = (dir, basePath = '') => {
@@ -116,6 +116,7 @@ const PluginComponents = new Map([
116
116
  ]
117
117
  ],
118
118
  [Plugin.SavedCard, [Component.SavedCard, Component.IyzicoSavedCard]],
119
+ [Plugin.SavedCard, [Component.SavedCard]],
119
120
  [Plugin.FlowPayment, [Component.FlowPayment]],
120
121
  [
121
122
  Plugin.VirtualTryOn,
@@ -738,6 +738,7 @@ export const checkoutApi = api.injectEndpoints({
738
738
  },
739
739
  async onQueryStarted(arg, { dispatch, queryFulfilled }) {
740
740
  dispatch(setPaymentStepBusy(true));
741
+ dispatch(setCardType(arg));
741
742
  await queryFulfilled;
742
743
  dispatch(setPaymentStepBusy(false));
743
744
  }
@@ -8,8 +8,6 @@ import { parse } from 'lossless-json';
8
8
  import logger from '../../utils/log';
9
9
  import { headers as nHeaders } from 'next/headers';
10
10
  import { ServerVariables } from '../../utils/server-variables';
11
- import { optimizeCategoryResponse } from '../../utils/payload-optimizer';
12
- import settings from 'settings';
13
11
 
14
12
  function getCategoryDataHandler(
15
13
  pk: number,
@@ -83,7 +81,7 @@ function getCategoryDataHandler(
83
81
  };
84
82
  }
85
83
 
86
- export const getCategoryData = async ({
84
+ export const getCategoryData = ({
87
85
  pk,
88
86
  searchParams,
89
87
  headers,
@@ -107,16 +105,6 @@ export const getCategoryData = async ({
107
105
  compressed: true
108
106
  }
109
107
  );
110
-
111
- if (settings.payloadOptimization?.enabled && result?.data) {
112
- try {
113
- return { ...result, data: optimizeCategoryResponse(result.data, settings.payloadOptimization) };
114
- } catch (e) {
115
- logger.error('Payload optimization failed for category', { pk, error: (e as Error).message });
116
- }
117
- }
118
-
119
- return result;
120
108
  };
121
109
 
122
110
  function getCategoryBySlugDataHandler(
@@ -7,8 +7,6 @@ import appFetch, { FetchResponseType } from '../../utils/app-fetch';
7
7
  import { parse } from 'lossless-json';
8
8
  import logger from '../../utils/log';
9
9
  import { ServerVariables } from '../../utils/server-variables';
10
- import { optimizeCategoryResponse } from '../../utils/payload-optimizer';
11
- import settings from 'settings';
12
10
 
13
11
  const getListDataHandler = (
14
12
  locale,
@@ -80,14 +78,4 @@ export const getListData = async ({
80
78
  compressed: true
81
79
  }
82
80
  );
83
-
84
- if (settings.payloadOptimization?.enabled && result) {
85
- try {
86
- return optimizeCategoryResponse(result, settings.payloadOptimization);
87
- } catch (e) {
88
- logger.error('Payload optimization failed for list', { error: (e as Error).message });
89
- }
90
- }
91
-
92
- return result;
93
81
  };
@@ -5,8 +5,6 @@ import appFetch from '../../utils/app-fetch';
5
5
  import { normalizeSearchParams } from '../../utils/normalize-search-params';
6
6
  import { ServerVariables } from '../../utils/server-variables';
7
7
  import logger from '../../utils/log';
8
- import { optimizeProductResponse } from '../../utils/payload-optimizer';
9
- import settings from 'settings';
10
8
 
11
9
  type GetProduct = {
12
10
  pk: number | string;
@@ -168,13 +166,5 @@ export const getProductData = async ({
168
166
  throw error;
169
167
  }
170
168
 
171
- if (settings.payloadOptimization?.enabled && result?.data) {
172
- try {
173
- return { ...result, data: optimizeProductResponse(result.data, settings.payloadOptimization) };
174
- } catch (e) {
175
- logger.error('Payload optimization failed for product', { pk, error: (e as Error).message });
176
- }
177
- }
178
-
179
169
  return result;
180
170
  };
@@ -5,9 +5,6 @@ import { generateCommerceSearchParams } from '../../utils';
5
5
  import { normalizeSearchParams } from '../../utils/normalize-search-params';
6
6
  import appFetch from '../../utils/app-fetch';
7
7
  import { ServerVariables } from '../../utils/server-variables';
8
- import { optimizeCategoryResponse } from '../../utils/payload-optimizer';
9
- import logger from '../../utils/log';
10
- import settings from 'settings';
11
8
 
12
9
  const getSpecialPageDataHandler = (
13
10
  pk: number,
@@ -60,14 +57,4 @@ export const getSpecialPageData = async ({
60
57
  compressed: true
61
58
  }
62
59
  );
63
-
64
- if (settings.payloadOptimization?.enabled && result) {
65
- try {
66
- return optimizeCategoryResponse(result, settings.payloadOptimization);
67
- } catch (e) {
68
- logger.error('Payload optimization failed for special-page', { pk, error: (e as Error).message });
69
- }
70
- }
71
-
72
- return result;
73
60
  };
@@ -4,9 +4,6 @@ import { CacheOptions, WidgetResultType, WidgetSchemaType } from '../../types';
4
4
  import appFetch from '../../utils/app-fetch';
5
5
  import { widgets } from '../urls';
6
6
  import { ServerVariables } from '../../utils/server-variables';
7
- import { optimizeWidgetResponse } from '../../utils/payload-optimizer';
8
- import logger from '../../utils/log';
9
- import settings from 'settings';
10
7
 
11
8
  const getWidgetDataHandler =
12
9
  (
@@ -56,7 +53,7 @@ export const getWidgetData = async <T>({
56
53
  cacheOptions?: CacheOptions;
57
54
  headers?: Record<string, string>;
58
55
  }): Promise<WidgetResultType<T>> => {
59
- const result = await Cache.wrap(
56
+ return Cache.wrap(
60
57
  CacheKey.Widget(slug),
61
58
  locale,
62
59
  getWidgetDataHandler(slug, locale, currency, headers),
@@ -65,16 +62,6 @@ export const getWidgetData = async <T>({
65
62
  ...cacheOptions
66
63
  }
67
64
  );
68
-
69
- if (settings.payloadOptimization?.enabled && result) {
70
- try {
71
- return optimizeWidgetResponse(result, settings.payloadOptimization) as WidgetResultType<T>;
72
- } catch (e) {
73
- logger.error('Payload optimization failed for widget', { slug, error: (e as Error).message });
74
- }
75
- }
76
-
77
- return result as WidgetResultType<T>;
78
65
  };
79
66
 
80
67
  const getCollectionWidgetDataHandler =
package/data/urls.ts CHANGED
@@ -40,11 +40,10 @@ export const account = {
40
40
  shipping_option_slug
41
41
  ? `&shipping_option_slug${shipping_option_operator}${shipping_option_slug}`
42
42
  : ''
43
- }${currency ? `&currency=${currency}` : ''}${
44
- filterType && filterValue ? `&${filterType}=${filterValue}` : ''
45
- }`,
43
+ }${currency ? `&currency=${currency}` : ''}
44
+ ${filterType && filterValue ? `&${filterType}=${filterValue}` : ''}`,
46
45
  getOldOrders: ({ page, limit }: { page?: number; limit?: number }) =>
47
- `/users/old-orders/?page=${page || 1}&limit=${limit || 12}`,
46
+ `/users/old-orders/?page=${page || 1}&limit=${limit || 12}}`,
48
47
  getQuotations: (page?: number, status?: string, limit?: number) =>
49
48
  `/b2b/my-quotations/?page=${page || 1}` +
50
49
  (status ? `&status=${status}` : '') +
@@ -184,11 +183,7 @@ export const product = {
184
183
  breadcrumbUrl: (menuitemmodel: string) =>
185
184
  `/menus/generate_breadcrumb/?item=${menuitemmodel}&generator_name=menu_item`,
186
185
  bundleProduct: (productPk: string, queryString: string) =>
187
- `/bundle-product/${productPk}/?${queryString}`,
188
- similarProducts: (params?: string) =>
189
- `/similar-products${params ? `?${params}` : ''}`,
190
- similarProductsList: (params?: string) =>
191
- `/similar-product-list${params ? `?${params}` : ''}`
186
+ `/bundle-product/${productPk}/?${queryString}`
192
187
  };
193
188
 
194
189
  export const wishlist = {
@@ -39,7 +39,7 @@ export const useCaptcha = () => {
39
39
  };
40
40
 
41
41
  if (csrfToken) {
42
- setCookie('csrftoken', csrfToken, { secure: true });
42
+ setCookie('csrftoken', csrfToken);
43
43
  }
44
44
 
45
45
  const onCaptchaChange = useCallback(async (response) => {