@akinon/next 2.0.0-beta.14 → 2.0.0-beta.16

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,5 +1,23 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 2.0.0-beta.16
4
+
5
+ ### Minor Changes
6
+
7
+ - 823d82f9: ZERO-3393: Enhance error handling in checkout middleware to ensure errors are checked for existence before processing
8
+ - d2c0e759: ZERO-3684: Handle cross-origin iframe access in iframeURLChange function
9
+ - 68bbcb27: ZERO-3393: Fix error handling in checkout middleware to check for errors array length
10
+ - 9b7d0de6: ZERO-3393: Improve error handling in checkout middleware to support both object and array error formats
11
+ - 5ec0faf8: ZERO-3355: Refactor Redis client creation to include optional password in configuration
12
+
13
+ ## 2.0.0-beta.15
14
+
15
+ ### Minor Changes
16
+
17
+ - 49c82e1a: ZERO-4047: Remove Sentry configuration from default Next.js config
18
+ - d7e5178b: ZERO-3985: Add query string handling for orders redirection in middleware
19
+ - b59fdd1c: ZERO-4009: Add password reset token validation
20
+
3
21
  ## 2.0.0-beta.14
4
22
 
5
23
  ### Minor Changes
@@ -77,6 +77,10 @@ interface LoyaltyTransactions {
77
77
  }[];
78
78
  }
79
79
 
80
+ interface PasswordResetValidateResponse {
81
+ validlink: boolean;
82
+ }
83
+
80
84
  const accountApi = api.injectEndpoints({
81
85
  endpoints: (builder) => ({
82
86
  updatePassword: builder.mutation<void, AccountChangePasswordFormType>({
@@ -221,6 +225,12 @@ const accountApi = api.injectEndpoints({
221
225
  }),
222
226
  getLoyaltyTransactions: builder.query<LoyaltyTransactions, void>({
223
227
  query: () => buildClientRequestUrl(account.loyaltyTransactions)
228
+ }),
229
+ getValidatePasswordResetToken: builder.query<
230
+ PasswordResetValidateResponse,
231
+ string
232
+ >({
233
+ query: (slug) => buildClientRequestUrl(account.passwordReset(slug))
224
234
  })
225
235
  }),
226
236
  overrideExisting: true
@@ -247,5 +257,6 @@ export const {
247
257
  usePasswordResetMutation,
248
258
  useAnonymizeMutation,
249
259
  useGetLoyaltyBalanceQuery,
250
- useGetLoyaltyTransactionsQuery
260
+ useGetLoyaltyTransactionsQuery,
261
+ useGetValidatePasswordResetTokenQuery
251
262
  } = accountApi;
@@ -132,8 +132,13 @@ const withPzDefault =
132
132
  }
133
133
 
134
134
  if (req.nextUrl.pathname.startsWith('/orders/redirection/')) {
135
+ const queryString = searchParams.toString();
135
136
  return NextResponse.rewrite(
136
- new URL(`${encodeURI(Settings.commerceUrl)}/orders/redirection/`)
137
+ new URL(
138
+ `${encodeURI(Settings.commerceUrl)}/orders/redirection/${
139
+ queryString ? `?${queryString}` : ''
140
+ }`
141
+ )
137
142
  );
138
143
  }
139
144
 
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": "2.0.0-beta.14",
4
+ "version": "2.0.0-beta.16",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -35,7 +35,7 @@
35
35
  "set-cookie-parser": "2.6.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@akinon/eslint-plugin-projectzero": "2.0.0-beta.14",
38
+ "@akinon/eslint-plugin-projectzero": "2.0.0-beta.16",
39
39
  "@babel/core": "7.26.10",
40
40
  "@babel/preset-env": "7.26.9",
41
41
  "@babel/preset-typescript": "7.27.0",
@@ -51,7 +51,11 @@ export const errorMiddleware: Middleware = ({ dispatch }: MiddlewareParams) => {
51
51
  const result = next(action) as CheckoutResult;
52
52
  const errors = result?.payload?.errors;
53
53
 
54
- if (errors) {
54
+ if (
55
+ !!errors &&
56
+ ((typeof errors === 'object' && Object.keys(errors).length > 0) ||
57
+ (Array.isArray(errors) && errors.length > 0))
58
+ ) {
55
59
  dispatch(setErrors(errors));
56
60
  }
57
61
 
@@ -1,8 +1,14 @@
1
1
  const iframeURLChange = (iframe, callback) => {
2
2
  iframe.addEventListener('load', () => {
3
3
  setTimeout(() => {
4
- if (iframe?.contentWindow?.location) {
5
- callback(iframe.contentWindow.location);
4
+ try {
5
+ if (iframe?.contentWindow?.location) {
6
+ const iframeLocation = iframe.contentWindow.location;
7
+
8
+ callback(iframeLocation);
9
+ }
10
+ } catch (error) {
11
+ // Expected: browser blocks cross-origin iframe access for security
6
12
  }
7
13
  }, 0);
8
14
  });
@@ -1,8 +1,14 @@
1
1
  const iframeURLChange = (iframe, callback) => {
2
2
  iframe.addEventListener('load', () => {
3
3
  setTimeout(() => {
4
- if (iframe?.contentWindow?.location) {
5
- callback(iframe.contentWindow.location);
4
+ try {
5
+ if (iframe?.contentWindow?.location) {
6
+ const iframeLocation = iframe.contentWindow.location;
7
+
8
+ callback(iframeLocation);
9
+ }
10
+ } catch (error) {
11
+ // Expected: browser blocks cross-origin iframe access for security
6
12
  }
7
13
  }, 0);
8
14
  });
package/with-pz-config.js CHANGED
@@ -71,7 +71,7 @@ const defaultConfig = {
71
71
  translations: false
72
72
  };
73
73
  return config;
74
- },
74
+ }
75
75
  };
76
76
 
77
77
  const withPzConfig = (