@akinon/next 1.73.0-rc.9 → 1.74.0-rc.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,77 +1,26 @@
1
1
  # @akinon/next
2
2
 
3
- ## 1.73.0-rc.9
4
-
5
- ### Minor Changes
6
-
7
- - 6d6a39d5: ZERO-3086: Add getOldOrders API endpoint
8
-
9
- ## 1.73.0-rc.8
10
-
11
- ### Minor Changes
12
-
13
- - 72fd4d67: ZERO-3084: Fix URL search parameters encoding in default middleware
14
-
15
- ## 1.73.0-rc.7
16
-
17
- ### Minor Changes
18
-
19
- - 37239b31: ZERO-3072: Add currency handling in checkout rewrite logic and set cookie
20
-
21
- ## 1.73.0-rc.6
22
-
23
- ### Minor Changes
24
-
25
- - 31d5a712: ZERO-3078: filter valid redux middlewares
26
-
27
- ## 1.73.0-rc.5
28
-
29
- ### Minor Changes
30
-
31
- - 24557b3c: ZERO-3072: Add query string handling to /orders/hooks/ and /orders/checkout-with-token/ rewrite logic
32
- - 178044ed: ZERO-3063: Add support for custom loader in SelectedPaymentOptionView
33
-
34
- ## 1.73.0-rc.4
35
-
36
- ### Minor Changes
37
-
38
- - c594b469: ZERO-3078: get saved cards from page context
39
-
40
- ## 1.73.0-rc.3
3
+ ## 1.74.0-rc.0
41
4
 
42
5
  ### Minor Changes
43
6
 
44
7
  - 5e3333dc: ZERO-3078: get saved cards from page context
45
- - 7727ae55: ZERO-3073: Refactor basket page to use server-side data fetching and simplify component structure
46
- - 07b2298e: ZERO-3074: Exclude url schemes to init url without locales
47
-
48
- ## 1.73.0-rc.2
49
-
50
- ### Minor Changes
51
-
52
- - eeb20bea: Revert "ZERO-3054: Refactor cache handler to use custom Redis handler and implement key hashing"
53
-
54
- ## 1.73.0-rc.1
55
-
56
- ### Minor Changes
57
-
58
- - fdd255ee: ZERO-3054: Refactor cache handler to use custom Redis handler and implement key hashing
59
-
60
- ## 1.73.0-rc.0
61
-
62
- ### Minor Changes
63
-
64
8
  - 5dfeea04: ZERO-2801: Revert ZERO-2801
65
9
  - 81248a14: ZERO-3024: Refactor urlLocaleMatcherRegex to include lookahead assertion
66
10
  - ed55a810: ZERO-3023: fix session cookie persistence after browser restart
67
11
  - 2d9b2b2c: ZERO-2816: Add segment to headers
68
12
  - 3bfa12aa: ZERO-3003:Add fetchLoyaltyData and setLoyaltyData requests to RTK
69
13
  - cc538c6a: ZERO-3048: Update hepsiPayMiddleware to use Success flag for availability check
14
+ - f49bb74f: ZERO-3097: Add setCookie to logging in payment redirection middlewares
70
15
  - e9541a13: ZERO-2816: Add headers to url
71
16
  - 94eb8252: ZERO-3069: Add selectNameSpaceMainBasket mutation
72
17
  - 4d3deb4f: ZERO-2935: sentry 8 upgrade
18
+ - 72fd4d67: ZERO-3084: Fix URL search parameters encoding in default middleware
73
19
  - c53ef7b9: ZERO-2668: The Link component has been updated to improve the logic for handling href values. Previously, if the href was not a string or started with 'http', it would return the href as is. Now, if the href is not provided, it will default to '#' to prevent any potential errors. Additionally, if the href is a string and does not start with 'http', it will be formatted with the locale and pathname, based on the localeUrlStrategy and defaultLocaleValue. This ensures that the correct href is generated based on the localization settings.
20
+ - 178044ed: ZERO-3063: Add support for custom loader in SelectedPaymentOptionView
74
21
  - 64699d3f: ZERO-2761: Fix invalid import for plugin module
22
+ - 999168d6: ZERO-3104: Remove local cache handler from CacheHandler initialization
23
+ - 7727ae55: ZERO-3073: Refactor basket page to use server-side data fetching and simplify component structure
75
24
  - 17f87524: ZERO-2816: Make the incoming currency lowercase
76
25
  - 65d3b862: ZERO-3054: Update headers in appFetch
77
26
  - 30105142: ZERO-3011:add shipping_option_operator and custom filter to getOrders
@@ -81,15 +30,32 @@
81
30
  - 7e56d6b6: ZERO-2841: Update api tagTypes
82
31
  - 5a333a57: ZERO-3061: Add success parameter for completeWalletPage
83
32
  - 43c182ee: ZERO-3054: Update Redis variable checks to conditionally include CACHE_SECRET
33
+ - 31d5a712: ZERO-3078: filter valid redux middlewares
84
34
  - ca774b39: ZERO-3002:add register with loyalty url
35
+ - 2d305aaf: ZERO-2935: Update Sentry configuration: remove hideSourceMaps option and add it to withPzConfig
36
+ - eeb20bea: Revert "ZERO-3054: Refactor cache handler to use custom Redis handler and implement key hashing"
85
37
  - 56cdddc8: ZERO-0000: SHOP-78125: Change unpaid_amount with total_amount_with_interest
86
38
  - f2c92d5c: ZERO-2816: Update cookie name
87
39
  - 7bd3d992: ZERO-2801: Refactor locale middleware to handle single locale configuration
88
40
  - f0b2f416: ZERO-3062: Update proxyRequest to handle multiple values for search parameters
41
+ - fdd255ee: ZERO-3054: Refactor cache handler to use custom Redis handler and implement key hashing
42
+ - c594b469: ZERO-3078: get saved cards from page context
43
+ - 86a5a620: ZERO-3104: Add optional headers parameter to data fetching functions
89
44
  - 49eeebfa: ZERO-2909: Add deleteCollectionItem query to wishlistApi
90
45
  - 3f9b8d7e: ZERO-2761: Update plugins.js for akinon-next
91
46
  - 3344bca5: ZERO-3013: Enable web vitals tracking in settings.js
92
47
 
48
+ ## 1.73.0
49
+
50
+ ### Minor Changes
51
+
52
+ - 6d6a39d: ZERO-3086: Add getOldOrders API endpoint
53
+ - 7b93652: ZERO-3087: change password reset endpoint
54
+ - 24557b3: ZERO-3072: Add query string handling to /orders/hooks/ and /orders/checkout-with-token/ rewrite logic
55
+ - 07b2298: ZERO-3074: Exclude url schemes to init url without locales
56
+ - 37239b3: ZERO-3072: Add currency handling in checkout rewrite logic and set cookie
57
+ - e96633e: ZERO-3100: Update stores endpoint
58
+
93
59
  ## 1.72.0
94
60
 
95
61
  ### Minor Changes
@@ -7,7 +7,8 @@ import { ServerVariables } from '../../utils/server-variables';
7
7
  const getFlatPageDataHandler = (
8
8
  pk: number,
9
9
  locale: string,
10
- currency: string
10
+ currency: string,
11
+ headers?: Record<string, string>
11
12
  ) => {
12
13
  return async function () {
13
14
  const data = await appFetch<FlatPage>({
@@ -17,7 +18,8 @@ const getFlatPageDataHandler = (
17
18
  init: {
18
19
  headers: {
19
20
  Accept: 'application/json',
20
- 'Content-Type': 'application/json'
21
+ 'Content-Type': 'application/json',
22
+ ...(headers ?? {})
21
23
  }
22
24
  }
23
25
  });
@@ -29,15 +31,17 @@ const getFlatPageDataHandler = (
29
31
  export const getFlatPageData = ({
30
32
  pk,
31
33
  locale = ServerVariables.locale,
32
- currency = ServerVariables.currency
34
+ currency = ServerVariables.currency,
35
+ headers
33
36
  }: {
34
37
  pk: number;
35
38
  locale?: string;
36
39
  currency?: string;
40
+ headers?: Record<string, string>;
37
41
  }) => {
38
42
  return Cache.wrap(
39
43
  CacheKey.FlatPage(pk),
40
44
  locale,
41
- getFlatPageDataHandler(pk, locale, currency)
45
+ getFlatPageDataHandler(pk, locale, currency, headers)
42
46
  );
43
47
  };
@@ -5,7 +5,12 @@ import appFetch from '../../utils/app-fetch';
5
5
  import { ServerVariables } from '../../utils/server-variables';
6
6
  import { form } from '../urls';
7
7
 
8
- const getFormDataHandler = (pk: number, locale: string, currency: string) => {
8
+ const getFormDataHandler = (
9
+ pk: number,
10
+ locale: string,
11
+ currency: string,
12
+ headers?: Record<string, string>
13
+ ) => {
9
14
  return async function () {
10
15
  const data = await appFetch<FormType>({
11
16
  url: form.getForm(pk),
@@ -14,7 +19,8 @@ const getFormDataHandler = (pk: number, locale: string, currency: string) => {
14
19
  init: {
15
20
  headers: {
16
21
  Accept: 'application/json',
17
- 'Content-Type': 'application/json'
22
+ 'Content-Type': 'application/json',
23
+ ...(headers ?? {})
18
24
  }
19
25
  }
20
26
  });
@@ -26,15 +32,17 @@ const getFormDataHandler = (pk: number, locale: string, currency: string) => {
26
32
  export const getFormData = ({
27
33
  pk,
28
34
  locale = ServerVariables.locale,
29
- currency = ServerVariables.currency
35
+ currency = ServerVariables.currency,
36
+ headers
30
37
  }: {
31
38
  pk: number;
32
39
  locale?: string;
33
40
  currency?: string;
41
+ headers?: Record<string, string>;
34
42
  }) => {
35
43
  return Cache.wrap(
36
44
  CacheKey.Form(pk),
37
45
  locale,
38
- getFormDataHandler(pk, locale, currency)
46
+ getFormDataHandler(pk, locale, currency, headers)
39
47
  );
40
48
  };
@@ -7,7 +7,8 @@ import { ServerVariables } from '../../utils/server-variables';
7
7
  const getLandingPageHandler = (
8
8
  pk: number,
9
9
  locale: string,
10
- currency: string
10
+ currency: string,
11
+ headers?: Record<string, string>
11
12
  ) => {
12
13
  return async function () {
13
14
  const data = await appFetch<LandingPage>({
@@ -17,7 +18,8 @@ const getLandingPageHandler = (
17
18
  init: {
18
19
  headers: {
19
20
  Accept: 'application/json',
20
- 'Content-Type': 'application/json'
21
+ 'Content-Type': 'application/json',
22
+ ...(headers ?? {})
21
23
  }
22
24
  }
23
25
  });
@@ -29,15 +31,17 @@ const getLandingPageHandler = (
29
31
  export const getLandingPageData = ({
30
32
  pk,
31
33
  locale = ServerVariables.locale,
32
- currency = ServerVariables.currency
34
+ currency = ServerVariables.currency,
35
+ headers
33
36
  }: {
34
37
  pk: number;
35
38
  locale?: string;
36
39
  currency?: string;
40
+ headers?: Record<string, string>;
37
41
  }) => {
38
42
  return Cache.wrap(
39
43
  CacheKey.LandingPage(pk),
40
44
  locale,
41
- getLandingPageHandler(pk, locale, currency)
45
+ getLandingPageHandler(pk, locale, currency, headers)
42
46
  );
43
47
  };
@@ -13,6 +13,7 @@ interface MenuHandlerParams {
13
13
  currency?: string;
14
14
  depth?: number;
15
15
  parent?: string;
16
+ headers?: Record<string, string>;
16
17
  }
17
18
 
18
19
  const DEFAULT_DEPTH = 3;
@@ -22,13 +23,17 @@ const getMenuHandler =
22
23
  locale = ServerVariables.locale,
23
24
  currency = ServerVariables.currency,
24
25
  depth,
25
- parent
26
+ parent,
27
+ headers
26
28
  }: MenuHandlerParams = {}) =>
27
29
  async () => {
28
30
  const response = await appFetch<MenuResponse>({
29
31
  url: misc.menus(depth ?? DEFAULT_DEPTH, parent),
30
32
  locale,
31
- currency
33
+ currency,
34
+ init: {
35
+ headers
36
+ }
32
37
  });
33
38
 
34
39
  return response?.menu;
@@ -11,6 +11,7 @@ type GetProduct = {
11
11
  currency?: string;
12
12
  searchParams?: URLSearchParams;
13
13
  groupProduct?: boolean;
14
+ headers?: Record<string, string>;
14
15
  };
15
16
 
16
17
  const getProductDataHandler = ({
@@ -18,7 +19,8 @@ const getProductDataHandler = ({
18
19
  locale,
19
20
  currency,
20
21
  searchParams,
21
- groupProduct
22
+ groupProduct,
23
+ headers
22
24
  }: GetProduct) => {
23
25
  return async function () {
24
26
  let url = groupProduct
@@ -40,7 +42,8 @@ const getProductDataHandler = ({
40
42
  init: {
41
43
  headers: {
42
44
  Accept: 'application/json',
43
- 'Content-Type': 'application/json'
45
+ 'Content-Type': 'application/json',
46
+ ...(headers ?? {})
44
47
  }
45
48
  }
46
49
  });
@@ -95,7 +98,8 @@ export const getProductData = async ({
95
98
  locale = ServerVariables.locale,
96
99
  currency = ServerVariables.currency,
97
100
  searchParams,
98
- groupProduct
101
+ groupProduct,
102
+ headers
99
103
  }: GetProduct) => {
100
104
  return Cache.wrap(
101
105
  CacheKey[groupProduct ? 'GroupProduct' : 'Product'](
@@ -103,7 +107,14 @@ export const getProductData = async ({
103
107
  searchParams ?? new URLSearchParams()
104
108
  ),
105
109
  locale,
106
- getProductDataHandler({ pk, locale, currency, searchParams, groupProduct }),
110
+ getProductDataHandler({
111
+ pk,
112
+ locale,
113
+ currency,
114
+ searchParams,
115
+ groupProduct,
116
+ headers
117
+ }),
107
118
  {
108
119
  expire: 300
109
120
  }
@@ -7,9 +7,10 @@ interface SeoDataParams {
7
7
  url: string;
8
8
  locale?: string;
9
9
  currency?: string;
10
+ headers?: Record<string, string>;
10
11
  }
11
12
 
12
- function getSeoDataHandler({ url, locale, currency }: SeoDataParams) {
13
+ function getSeoDataHandler({ url, locale, currency, headers }: SeoDataParams) {
13
14
  return async function () {
14
15
  let data = {} as {
15
16
  title: string;
@@ -19,7 +20,12 @@ function getSeoDataHandler({ url, locale, currency }: SeoDataParams) {
19
20
  };
20
21
 
21
22
  try {
22
- data = await appFetch({ url: misc.cmsSeo(url), locale, currency });
23
+ data = await appFetch({
24
+ url: misc.cmsSeo(url),
25
+ locale,
26
+ currency,
27
+ init: { headers }
28
+ });
23
29
  } catch (error) {
24
30
  // logger.error('Error while fetching seo data', { url, error });
25
31
  }
@@ -31,11 +37,12 @@ function getSeoDataHandler({ url, locale, currency }: SeoDataParams) {
31
37
  export const getSeoData = async (
32
38
  url,
33
39
  locale = ServerVariables.locale,
34
- currency = ServerVariables.currency
40
+ currency = ServerVariables.currency,
41
+ headers?: Record<string, string>
35
42
  ) => {
36
43
  return Cache.wrap(
37
44
  CacheKey.Seo(url),
38
45
  locale,
39
- getSeoDataHandler({ url, locale, currency })
46
+ getSeoDataHandler({ url, locale, currency, headers })
40
47
  );
41
48
  };
@@ -6,29 +6,44 @@ import { widgets } from '../urls';
6
6
  import { ServerVariables } from '../../utils/server-variables';
7
7
 
8
8
  const getWidgetDataHandler =
9
- (slug: string, locale: string, currency: string) => async () => {
9
+ (
10
+ slug: string,
11
+ locale: string,
12
+ currency: string,
13
+ headers?: Record<string, string>
14
+ ) =>
15
+ async () => {
10
16
  if (!slug) {
11
17
  return null;
12
18
  }
13
19
 
14
- return await appFetch({ url: widgets.getWidget(slug), locale, currency });
20
+ return await appFetch({
21
+ url: widgets.getWidget(slug),
22
+ locale,
23
+ currency,
24
+ init: {
25
+ headers
26
+ }
27
+ });
15
28
  };
16
29
 
17
30
  export const getWidgetData = async <T>({
18
31
  slug,
19
32
  locale = ServerVariables.locale,
20
33
  currency = ServerVariables.currency,
21
- cacheOptions
34
+ cacheOptions,
35
+ headers
22
36
  }: {
23
37
  slug: string;
24
38
  locale?: string;
25
39
  currency?: string;
26
40
  cacheOptions?: CacheOptions;
41
+ headers?: Record<string, string>;
27
42
  }): Promise<WidgetResultType<T>> => {
28
43
  return Cache.wrap(
29
44
  CacheKey.Widget(slug),
30
45
  locale,
31
- getWidgetDataHandler(slug, locale, currency),
46
+ getWidgetDataHandler(slug, locale, currency, headers),
32
47
  cacheOptions
33
48
  );
34
49
  };
package/data/urls.ts CHANGED
@@ -40,9 +40,7 @@ export const account = {
40
40
  shipping_option_slug
41
41
  ? `&shipping_option_slug${shipping_option_operator}${shipping_option_slug}`
42
42
  : ''
43
- }${filterType && filterValue ? `&${filterType}=${filterValue}` : ''}${
44
- currency ? `&currency=${currency}` : ''
45
- }`,
43
+ }${currency ? `&currency=${currency}` : ''}`,
46
44
  getOldOrders: ({ page, limit }: { page?: number; limit?: number }) =>
47
45
  `/users/old-orders/?page=${page || 1}&limit=${limit || 12}}`,
48
46
  getQuotations: (page?: number, status?: string, limit?: number) =>
@@ -50,7 +48,7 @@ export const account = {
50
48
  (status ? `&status=${status}` : '') +
51
49
  (limit ? `&limit=${limit}` : ''),
52
50
  sendContact: '/users/contact-us',
53
- passwordReset: (slug: string) => `/users/reset/${slug}`,
51
+ passwordReset: (slug: string) => `/users/api-reset/${slug}`,
54
52
  anonymize: '/users/anonymize/',
55
53
  loyaltyBalance: '/account/loyalty-account-balance/',
56
54
  loyaltyTransactions: '/account/loyalty/'
@@ -151,7 +149,7 @@ export const landingpage = {
151
149
 
152
150
  export const misc = {
153
151
  autocomplete: '/autocomplete/',
154
- stores: '/stores/',
152
+ stores: '/address/retail_store/',
155
153
  menu: '/misc/menus/generate/',
156
154
  prettyUrl: (pathname: string) => `/misc/pretty-url${pathname}/`,
157
155
  prettyUrls: (pathname: string) => `/pretty_urls/?new_path__exact=${pathname}`,
@@ -23,10 +23,10 @@ CacheHandler.onCreation(async () => {
23
23
  timeoutMs: 5000
24
24
  });
25
25
 
26
- const localHandler = createLruHandler();
26
+ // const localHandler = createLruHandler();
27
27
 
28
28
  return {
29
- handlers: [redisHandler, localHandler]
29
+ handlers: [redisHandler]
30
30
  };
31
31
  });
32
32
 
@@ -145,7 +145,8 @@ const withCompleteGpay =
145
145
  logger.info('Redirecting to order success page', {
146
146
  middleware: 'complete-gpay',
147
147
  redirectUrlWithLocale,
148
- ip
148
+ ip,
149
+ setCookie: request.headers.get('set-cookie')
149
150
  });
150
151
 
151
152
  // Using POST method while redirecting causes an error,
@@ -145,7 +145,8 @@ const withCompleteMasterpass =
145
145
  logger.info('Redirecting to order success page', {
146
146
  middleware: 'complete-masterpass',
147
147
  redirectUrlWithLocale,
148
- ip
148
+ ip,
149
+ setCookie: request.headers.get('set-cookie')
149
150
  });
150
151
 
151
152
  // Using POST method while redirecting causes an error,
@@ -146,7 +146,8 @@ const withRedirectionPayment =
146
146
  logger.info('Redirecting to order success page', {
147
147
  middleware: 'redirection-payment',
148
148
  redirectUrlWithLocale,
149
- ip
149
+ ip,
150
+ setCookie: request.headers.get('set-cookie')
150
151
  });
151
152
 
152
153
  // Using POST method while redirecting causes an error,
@@ -145,7 +145,8 @@ const withSavedCardRedirection =
145
145
  logger.info('Redirecting to order success page', {
146
146
  middleware: 'saved-card-redirection',
147
147
  redirectUrlWithLocale,
148
- ip
148
+ ip,
149
+ setCookie: request.headers.get('set-cookie')
149
150
  });
150
151
 
151
152
  // Using POST method while redirecting causes an error,
@@ -145,7 +145,8 @@ const withThreeDRedirection =
145
145
  logger.info('Redirecting to order success page', {
146
146
  middleware: 'three-d-redirection',
147
147
  redirectUrlWithLocale,
148
- ip
148
+ ip,
149
+ setCookie: request.headers.get('set-cookie')
149
150
  });
150
151
 
151
152
  // Using POST method while redirecting causes an error,
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.73.0-rc.9",
4
+ "version": "1.74.0-rc.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.73.0-rc.9",
33
+ "@akinon/eslint-plugin-projectzero": "1.74.0-rc.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/with-pz-config.js CHANGED
@@ -61,7 +61,10 @@ const defaultConfig = {
61
61
  translations: false
62
62
  };
63
63
  return config;
64
- }
64
+ },
65
+ sentry: {
66
+ hideSourceMaps: true
67
+ } // TODO: This section will be reviewed again in the Sentry 8 update.
65
68
  };
66
69
 
67
70
  const withPzConfig = (