@akinon/next 1.48.0-rc.7 → 1.49.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +4 -456
  2. package/api/client.ts +17 -50
  3. package/assets/styles/index.scss +26 -50
  4. package/bin/pz-prebuild.js +0 -1
  5. package/bin/pz-predev.js +0 -1
  6. package/components/index.ts +0 -1
  7. package/components/input.tsx +7 -21
  8. package/components/link.tsx +13 -17
  9. package/components/pagination.tsx +2 -1
  10. package/components/price.tsx +4 -11
  11. package/components/pz-root.tsx +3 -15
  12. package/components/selected-payment-option-view.tsx +38 -26
  13. package/data/client/account.ts +9 -10
  14. package/data/client/address.ts +8 -32
  15. package/data/client/api.ts +2 -2
  16. package/data/client/b2b.ts +2 -35
  17. package/data/client/basket.ts +5 -6
  18. package/data/client/checkout.ts +4 -47
  19. package/data/client/user.ts +2 -3
  20. package/data/server/category.ts +19 -43
  21. package/data/server/flatpage.ts +7 -29
  22. package/data/server/form.ts +11 -29
  23. package/data/server/landingpage.ts +7 -26
  24. package/data/server/list.ts +6 -16
  25. package/data/server/menu.ts +2 -15
  26. package/data/server/product.ts +21 -46
  27. package/data/server/seo.ts +24 -17
  28. package/data/server/special-page.ts +5 -15
  29. package/data/server/widget.ts +7 -14
  30. package/data/urls.ts +1 -8
  31. package/hocs/server/with-segment-defaults.tsx +1 -4
  32. package/hooks/index.ts +1 -2
  33. package/hooks/use-pagination.ts +2 -2
  34. package/hooks/use-payment-options.ts +1 -2
  35. package/lib/cache.ts +6 -8
  36. package/middlewares/default.ts +8 -91
  37. package/middlewares/pretty-url.ts +1 -11
  38. package/middlewares/url-redirection.ts +0 -4
  39. package/package.json +4 -5
  40. package/plugins.d.ts +0 -1
  41. package/redux/middlewares/checkout.ts +11 -70
  42. package/redux/reducers/checkout.ts +5 -24
  43. package/redux/reducers/config.ts +0 -2
  44. package/types/commerce/account.ts +0 -1
  45. package/types/commerce/address.ts +1 -1
  46. package/types/commerce/b2b.ts +2 -12
  47. package/types/commerce/checkout.ts +1 -31
  48. package/types/commerce/misc.ts +0 -2
  49. package/types/commerce/order.ts +0 -12
  50. package/types/index.ts +3 -37
  51. package/utils/app-fetch.ts +10 -21
  52. package/utils/generate-commerce-search-params.ts +1 -3
  53. package/utils/index.ts +6 -27
  54. package/utils/menu-generator.ts +2 -2
  55. package/utils/server-translation.ts +1 -11
  56. package/utils/server-variables.ts +1 -2
  57. package/with-pz-config.js +2 -13
  58. package/assets/styles/index.css +0 -49
  59. package/assets/styles/index.css.map +0 -1
  60. package/bin/pz-generate-translations.js +0 -41
  61. package/components/file-input.tsx +0 -8
  62. package/hooks/use-message-listener.ts +0 -24
  63. package/lib/cache-handler.mjs +0 -33
  64. package/routes/pretty-url.tsx +0 -192
  65. package/utils/redirection-iframe.ts +0 -85
@@ -5,32 +5,26 @@ import { category, product } from '../urls';
5
5
  import { Cache, CacheKey } from '../../lib/cache';
6
6
  import { parse } from 'lossless-json';
7
7
  import logger from '../../utils/log';
8
- import { headers as nHeaders } from 'next/headers';
9
- import { ServerVariables } from '../../utils/server-variables';
10
8
 
11
9
  function getCategoryDataHandler(
12
10
  pk: number,
13
- locale: string,
14
- currency: string,
15
11
  searchParams?: URLSearchParams,
16
12
  headers?: Record<string, string>
17
13
  ) {
18
14
  return async function () {
19
15
  const params = generateCommerceSearchParams(searchParams);
20
16
 
21
- const rawData = await appFetch<string>({
22
- url: `${category.getCategoryByPk(pk)}${params ? params : ''}`,
23
- locale,
24
- currency,
25
- init: {
17
+ const rawData = await appFetch<string>(
18
+ `${category.getCategoryByPk(pk)}${params ? params : ''}`,
19
+ {
26
20
  headers: {
27
21
  Accept: 'application/json',
28
22
  'Content-Type': 'application/json',
29
23
  ...(headers ?? {})
30
24
  }
31
25
  },
32
- responseType: FetchResponseType.TEXT
33
- });
26
+ FetchResponseType.TEXT
27
+ );
34
28
 
35
29
  let data: GetCategoryResponse;
36
30
 
@@ -64,17 +58,15 @@ function getCategoryDataHandler(
64
58
  return { data, breadcrumbData: undefined };
65
59
  }
66
60
 
67
- const breadcrumbData = await appFetch<any>({
68
- url: product.breadcrumbUrl(menuItemModel),
69
- locale,
70
- currency,
71
- init: {
61
+ const breadcrumbData = await appFetch<any>(
62
+ product.breadcrumbUrl(menuItemModel),
63
+ {
72
64
  headers: {
73
65
  Accept: 'application/json',
74
66
  'Content-Type': 'application/json'
75
67
  }
76
68
  }
77
- });
69
+ );
78
70
 
79
71
  return { data, breadcrumbData: breadcrumbData?.menu };
80
72
  };
@@ -83,44 +75,33 @@ function getCategoryDataHandler(
83
75
  export const getCategoryData = ({
84
76
  pk,
85
77
  searchParams,
86
- headers,
87
- locale = ServerVariables.locale,
88
- currency = ServerVariables.currency
78
+ headers
89
79
  }: {
90
80
  pk: number;
91
- locale?: string;
92
- currency?: string;
93
81
  searchParams?: URLSearchParams;
94
82
  headers?: Record<string, string>;
95
83
  }) => {
96
84
  return Cache.wrap(
97
85
  CacheKey.Category(pk, searchParams, headers),
98
- locale,
99
- getCategoryDataHandler(pk, locale, currency, searchParams, headers),
86
+ getCategoryDataHandler(pk, searchParams, headers),
100
87
  {
101
88
  expire: 300
102
89
  }
103
90
  );
104
91
  };
105
92
 
106
- function getCategoryBySlugDataHandler(
107
- slug: string,
108
- locale: string,
109
- currency: string
110
- ) {
93
+ function getCategoryBySlugDataHandler(slug: string) {
111
94
  return async function () {
112
- const rawData = await appFetch<string>({
113
- url: category.getCategoryBySlug(slug),
114
- locale,
115
- currency,
116
- init: {
95
+ const rawData = await appFetch<string>(
96
+ category.getCategoryBySlug(slug),
97
+ {
117
98
  headers: {
118
99
  Accept: 'application/json',
119
100
  'Content-Type': 'application/json'
120
101
  }
121
102
  },
122
- responseType: FetchResponseType.TEXT
123
- });
103
+ FetchResponseType.TEXT
104
+ );
124
105
 
125
106
  let data: GetCategoryResponse;
126
107
 
@@ -148,15 +129,10 @@ function getCategoryBySlugDataHandler(
148
129
  };
149
130
  }
150
131
 
151
- export const getCategoryBySlugData = async ({
152
- slug,
153
- locale = ServerVariables.locale,
154
- currency = ServerVariables.currency
155
- }) => {
132
+ export const getCategoryBySlugData = async ({ slug }) => {
156
133
  return Cache.wrap(
157
134
  CacheKey.CategorySlug(slug),
158
- locale,
159
- getCategoryBySlugDataHandler(slug, locale, currency),
135
+ getCategoryBySlugDataHandler(slug),
160
136
  {
161
137
  expire: 300
162
138
  }
@@ -2,23 +2,13 @@ import { flatpage } from '../urls';
2
2
  import { FlatPage } from '../../types';
3
3
  import appFetch from '../../utils/app-fetch';
4
4
  import { Cache, CacheKey } from '../../lib/cache';
5
- import { ServerVariables } from '../../utils/server-variables';
6
5
 
7
- const getFlatPageDataHandler = (
8
- pk: number,
9
- locale: string,
10
- currency: string
11
- ) => {
6
+ const getFlatPageDataHandler = (pk: number) => {
12
7
  return async function () {
13
- const data = await appFetch<FlatPage>({
14
- url: flatpage.getFlatPageByPk(pk),
15
- locale,
16
- currency,
17
- init: {
18
- headers: {
19
- Accept: 'application/json',
20
- 'Content-Type': 'application/json'
21
- }
8
+ const data = await appFetch<FlatPage>(flatpage.getFlatPageByPk(pk), {
9
+ headers: {
10
+ Accept: 'application/json',
11
+ 'Content-Type': 'application/json'
22
12
  }
23
13
  });
24
14
 
@@ -26,18 +16,6 @@ const getFlatPageDataHandler = (
26
16
  };
27
17
  };
28
18
 
29
- export const getFlatPageData = ({
30
- pk,
31
- locale = ServerVariables.locale,
32
- currency = ServerVariables.currency
33
- }: {
34
- pk: number;
35
- locale?: string;
36
- currency?: string;
37
- }) => {
38
- return Cache.wrap(
39
- CacheKey.FlatPage(pk),
40
- locale,
41
- getFlatPageDataHandler(pk, locale, currency)
42
- );
19
+ export const getFlatPageData = ({ pk }: { pk: number }) => {
20
+ return Cache.wrap(CacheKey.FlatPage(pk), getFlatPageDataHandler(pk));
43
21
  };
@@ -1,21 +1,15 @@
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 { ServerVariables } from '../../utils/server-variables';
6
- import { form } from '../urls';
4
+ import appFetch from "../../utils/app-fetch";
5
+ import { form } from "../urls";
7
6
 
8
- const getFormDataHandler = (pk: number, locale: string, currency: string) => {
7
+ const getFormDataHandler = (pk: number) => {
9
8
  return async function () {
10
- const data = await appFetch<FormType>({
11
- url: form.getForm(pk),
12
- locale,
13
- currency,
14
- init: {
15
- headers: {
16
- Accept: 'application/json',
17
- 'Content-Type': 'application/json'
18
- }
9
+ const data = await appFetch<FormType>(form.getForm(pk), {
10
+ headers: {
11
+ Accept: 'application/json',
12
+ 'Content-Type': 'application/json'
19
13
  }
20
14
  });
21
15
 
@@ -23,18 +17,6 @@ const getFormDataHandler = (pk: number, locale: string, currency: string) => {
23
17
  };
24
18
  };
25
19
 
26
- export const getFormData = ({
27
- pk,
28
- locale = ServerVariables.locale,
29
- currency = ServerVariables.currency
30
- }: {
31
- pk: number;
32
- locale?: string;
33
- currency?: string;
34
- }) => {
35
- return Cache.wrap(
36
- CacheKey.Form(pk),
37
- locale,
38
- getFormDataHandler(pk, locale, currency)
39
- );
20
+ export const getFormData = ({ pk }: { pk: number }) => {
21
+ return Cache.wrap(CacheKey.Form(pk), getFormDataHandler(pk));
40
22
  };
@@ -2,42 +2,23 @@ import { landingpage } from '../urls';
2
2
  import { LandingPage } from '../../types/commerce/landingpage';
3
3
  import appFetch from '../../utils/app-fetch';
4
4
  import { Cache, CacheKey } from '../../lib/cache';
5
- import { ServerVariables } from '../../utils/server-variables';
6
5
 
7
- const getLandingPageHandler = (
8
- pk: number,
9
- locale: string,
10
- currency: string
11
- ) => {
6
+ const getLandingPageHandler = (pk: number) => {
12
7
  return async function () {
13
- const data = await appFetch<LandingPage>({
14
- url: landingpage.getLandingPageByPk(pk),
15
- locale,
16
- currency,
17
- init: {
8
+ const data = await appFetch<LandingPage>(
9
+ landingpage.getLandingPageByPk(pk),
10
+ {
18
11
  headers: {
19
12
  Accept: 'application/json',
20
13
  'Content-Type': 'application/json'
21
14
  }
22
15
  }
23
- });
16
+ );
24
17
 
25
18
  return data;
26
19
  };
27
20
  };
28
21
 
29
- export const getLandingPageData = ({
30
- pk,
31
- locale = ServerVariables.locale,
32
- currency = ServerVariables.currency
33
- }: {
34
- pk: number;
35
- locale?: string;
36
- currency?: string;
37
- }) => {
38
- return Cache.wrap(
39
- CacheKey.LandingPage(pk),
40
- locale,
41
- getLandingPageHandler(pk, locale, currency)
42
- );
22
+ export const getLandingPageData = ({ pk }: { pk: number }) => {
23
+ return Cache.wrap(CacheKey.LandingPage(pk), getLandingPageHandler(pk));
43
24
  };
@@ -5,30 +5,25 @@ import { generateCommerceSearchParams } from '../../utils';
5
5
  import appFetch, { FetchResponseType } from '../../utils/app-fetch';
6
6
  import { parse } from 'lossless-json';
7
7
  import logger from '../../utils/log';
8
- import { ServerVariables } from '../../utils/server-variables';
9
8
 
10
9
  const getListDataHandler = (
11
- locale,
12
- currency,
13
10
  searchParams: URLSearchParams,
14
11
  headers?: Record<string, string>
15
12
  ) => {
16
13
  return async function () {
17
14
  const params = generateCommerceSearchParams(searchParams);
18
15
 
19
- const rawData = await appFetch<string>({
20
- url: `${category.list}${params}`,
21
- locale,
22
- currency,
23
- init: {
16
+ const rawData = await appFetch<string>(
17
+ `${category.list}${params}`,
18
+ {
24
19
  headers: {
25
20
  Accept: 'application/json',
26
21
  'Content-Type': 'application/json',
27
22
  ...(headers ?? {})
28
23
  }
29
24
  },
30
- responseType: FetchResponseType.TEXT
31
- });
25
+ FetchResponseType.TEXT
26
+ );
32
27
 
33
28
  let data: GetCategoryResponse;
34
29
 
@@ -56,20 +51,15 @@ const getListDataHandler = (
56
51
  };
57
52
 
58
53
  export const getListData = async ({
59
- locale = ServerVariables.locale,
60
- currency = ServerVariables.currency,
61
54
  searchParams,
62
55
  headers
63
56
  }: {
64
- locale?: string;
65
- currency?: string;
66
57
  searchParams: URLSearchParams;
67
58
  headers?: Record<string, string>;
68
59
  }) => {
69
60
  return Cache.wrap(
70
61
  CacheKey.List(searchParams, headers),
71
- locale,
72
- getListDataHandler(locale, currency, searchParams, headers),
62
+ getListDataHandler(searchParams, headers),
73
63
  {
74
64
  expire: 300
75
65
  }
@@ -1,7 +1,6 @@
1
1
  import { Cache, CacheKey } from '../../lib/cache';
2
2
  import { MenuItemType } from '../../types';
3
3
  import appFetch from '../../utils/app-fetch';
4
- import { ServerVariables } from '../../utils/server-variables';
5
4
  import { misc } from '../urls';
6
5
 
7
6
  interface MenuResponse {
@@ -9,8 +8,6 @@ interface MenuResponse {
9
8
  }
10
9
 
11
10
  interface MenuHandlerParams {
12
- locale?: string;
13
- currency?: string;
14
11
  depth?: number;
15
12
  parent?: string;
16
13
  }
@@ -18,18 +15,9 @@ interface MenuHandlerParams {
18
15
  const DEFAULT_DEPTH = 3;
19
16
 
20
17
  const getMenuHandler =
21
- ({
22
- locale = ServerVariables.locale,
23
- currency = ServerVariables.currency,
24
- depth,
25
- parent
26
- }: MenuHandlerParams = {}) =>
18
+ ({ depth, parent }: MenuHandlerParams = { depth: DEFAULT_DEPTH }) =>
27
19
  async () => {
28
- const response = await appFetch<MenuResponse>({
29
- url: misc.menus(depth ?? DEFAULT_DEPTH, parent),
30
- locale,
31
- currency
32
- });
20
+ const response = await appFetch<MenuResponse>(misc.menus(depth, parent));
33
21
 
34
22
  return response?.menu;
35
23
  };
@@ -42,7 +30,6 @@ const getMenuHandler =
42
30
  export const getMenu = async (params?: MenuHandlerParams) => {
43
31
  return Cache.wrap(
44
32
  CacheKey.Menu(params?.depth ?? DEFAULT_DEPTH, params?.parent),
45
- params?.locale ?? ServerVariables.locale,
46
33
  getMenuHandler(params)
47
34
  );
48
35
  };
@@ -1,22 +1,20 @@
1
1
  import { Cache, CacheKey } from '../../lib/cache';
2
2
  import { product } from '../urls';
3
- import { ProductCategoryResult, ProductResult } from '../../types';
3
+ import {
4
+ BreadcrumbResultType,
5
+ ProductCategoryResult,
6
+ ProductResult
7
+ } from '../../types';
4
8
  import appFetch from '../../utils/app-fetch';
5
- import { ServerVariables } from '../../utils/server-variables';
6
- import logger from '../../utils/log';
7
9
 
8
10
  type GetProduct = {
9
11
  pk: number;
10
- locale?: string;
11
- currency?: string;
12
12
  searchParams?: URLSearchParams;
13
13
  groupProduct?: boolean;
14
14
  };
15
15
 
16
16
  const getProductDataHandler = ({
17
17
  pk,
18
- locale,
19
- currency,
20
18
  searchParams,
21
19
  groupProduct
22
20
  }: GetProduct) => {
@@ -33,53 +31,33 @@ const getProductDataHandler = ({
33
31
  .join('&');
34
32
  }
35
33
 
36
- const data = await appFetch<ProductResult>({
37
- url,
38
- locale,
39
- currency,
40
- init: {
41
- headers: {
42
- Accept: 'application/json',
43
- 'Content-Type': 'application/json'
44
- }
34
+ const data = await appFetch<ProductResult>(url, {
35
+ headers: {
36
+ Accept: 'application/json',
37
+ 'Content-Type': 'application/json'
45
38
  }
46
39
  });
47
40
 
48
41
  const categoryUrl = product.categoryUrl(data.product.pk);
49
42
 
50
- const productCategoryData = await appFetch<ProductCategoryResult>({
51
- url: categoryUrl,
52
- locale,
53
- currency,
54
- init: {
43
+ const productCategoryData = await appFetch<ProductCategoryResult>(
44
+ categoryUrl,
45
+ {
55
46
  headers: {
56
47
  Accept: 'application/json',
57
48
  'Content-Type': 'application/json'
58
49
  }
59
50
  }
60
- });
61
-
62
- const menuItemModel = productCategoryData?.results[0]?.menuitemmodel;
51
+ );
63
52
 
64
- if (!menuItemModel) {
65
- logger.warn('menuItemModel is undefined, skipping breadcrumbData fetch', {
66
- handler: 'getProductDataHandler',
67
- pk
68
- });
69
- return { data, breadcrumbData: undefined };
70
- }
71
-
72
- const breadcrumbUrl = product.breadcrumbUrl(menuItemModel);
53
+ const breadcrumbUrl = product.breadcrumbUrl(
54
+ productCategoryData.results[0].menuitemmodel
55
+ );
73
56
 
74
- const breadcrumbData = await appFetch<any>({
75
- url: breadcrumbUrl,
76
- locale,
77
- currency,
78
- init: {
79
- headers: {
80
- Accept: 'application/json',
81
- 'Content-Type': 'application/json'
82
- }
57
+ const breadcrumbData = await appFetch<any>(breadcrumbUrl, {
58
+ headers: {
59
+ Accept: 'application/json',
60
+ 'Content-Type': 'application/json'
83
61
  }
84
62
  });
85
63
 
@@ -92,8 +70,6 @@ const getProductDataHandler = ({
92
70
 
93
71
  export const getProductData = async ({
94
72
  pk,
95
- locale = ServerVariables.locale,
96
- currency = ServerVariables.currency,
97
73
  searchParams,
98
74
  groupProduct
99
75
  }: GetProduct) => {
@@ -102,8 +78,7 @@ export const getProductData = async ({
102
78
  pk,
103
79
  searchParams ?? new URLSearchParams()
104
80
  ),
105
- locale,
106
- getProductDataHandler({ pk, locale, currency, searchParams, groupProduct }),
81
+ getProductDataHandler({ pk, searchParams, groupProduct }),
107
82
  {
108
83
  expire: 300
109
84
  }
@@ -1,15 +1,23 @@
1
1
  import appFetch from '../../utils/app-fetch';
2
2
  import { Cache, CacheKey } from '../../lib/cache';
3
3
  import { misc } from '../../data/urls';
4
- import { ServerVariables } from '../../utils/server-variables';
4
+ import logger from '../../utils/log';
5
5
 
6
- interface SeoDataParams {
7
- url: string;
8
- locale?: string;
9
- currency?: string;
6
+ function getRootSeoDataHandler() {
7
+ return async function () {
8
+ let data = {};
9
+
10
+ try {
11
+ data = await appFetch<{ [key: string]: string }>(misc.cmsSeo('/'));
12
+ } catch (error) {
13
+ logger.error('Error while fetching root seo data', error);
14
+ }
15
+
16
+ return data;
17
+ };
10
18
  }
11
19
 
12
- function getSeoDataHandler({ url, locale, currency }: SeoDataParams) {
20
+ function getSeoDataHandler(url: string) {
13
21
  return async function () {
14
22
  let data = {} as {
15
23
  title: string;
@@ -19,7 +27,7 @@ function getSeoDataHandler({ url, locale, currency }: SeoDataParams) {
19
27
  };
20
28
 
21
29
  try {
22
- data = await appFetch({ url: misc.cmsSeo(url), locale, currency });
30
+ data = await appFetch(misc.cmsSeo(url));
23
31
  } catch (error) {
24
32
  // logger.error('Error while fetching seo data', { url, error });
25
33
  }
@@ -28,14 +36,13 @@ function getSeoDataHandler({ url, locale, currency }: SeoDataParams) {
28
36
  };
29
37
  }
30
38
 
31
- export const getSeoData = async (
32
- url,
33
- locale = ServerVariables.locale,
34
- currency = ServerVariables.currency
35
- ) => {
36
- return Cache.wrap(
37
- CacheKey.Seo(url),
38
- locale,
39
- getSeoDataHandler({ url, locale, currency })
40
- );
39
+ /**
40
+ * @deprecated Use getSeoData instead
41
+ */
42
+ export const getRootSeo = async () => {
43
+ return Cache.wrap(CacheKey.RootSeo, getRootSeoDataHandler());
44
+ };
45
+
46
+ export const getSeoData = async (url: string) => {
47
+ return Cache.wrap(CacheKey.Seo(url), getSeoDataHandler(url));
41
48
  };
@@ -4,30 +4,25 @@ import { GetCategoryResponse } from '../../types';
4
4
  import { generateCommerceSearchParams } from '../../utils';
5
5
  import appFetch from '../../utils/app-fetch';
6
6
  import header from '../../redux/reducers/header';
7
- import { ServerVariables } from '../../utils/server-variables';
8
7
 
9
8
  const getSpecialPageDataHandler = (
10
9
  pk: number,
11
- locale: string,
12
- currency: string,
13
10
  searchParams: URLSearchParams,
14
11
  headers?: Record<string, string>
15
12
  ) => {
16
13
  return async function () {
17
14
  const params = generateCommerceSearchParams(searchParams);
18
15
 
19
- const data: GetCategoryResponse = await appFetch({
20
- url: `${category.getSpecialPageByPk(pk)}${params}`,
21
- locale,
22
- currency,
23
- init: {
16
+ const data: GetCategoryResponse = await appFetch(
17
+ `${category.getSpecialPageByPk(pk)}${params}`,
18
+ {
24
19
  headers: {
25
20
  Accept: 'application/json',
26
21
  'Content-Type': 'application/json',
27
22
  ...(headers ?? {})
28
23
  }
29
24
  }
30
- });
25
+ );
31
26
 
32
27
  return data;
33
28
  };
@@ -35,21 +30,16 @@ const getSpecialPageDataHandler = (
35
30
 
36
31
  export const getSpecialPageData = async ({
37
32
  pk,
38
- locale = ServerVariables.locale,
39
- currency = ServerVariables.currency,
40
33
  searchParams,
41
34
  headers
42
35
  }: {
43
36
  pk: number;
44
- locale?: string;
45
- currency?: string;
46
37
  searchParams: URLSearchParams;
47
38
  headers?: Record<string, string>;
48
39
  }) => {
49
40
  return Cache.wrap(
50
41
  CacheKey.SpecialPage(pk, searchParams, headers),
51
- locale,
52
- getSpecialPageDataHandler(pk, locale, currency, searchParams, headers),
42
+ getSpecialPageDataHandler(pk, searchParams, headers),
53
43
  {
54
44
  expire: 300
55
45
  }
@@ -3,32 +3,25 @@ import 'server-only';
3
3
  import { CacheOptions, WidgetResultType } from '../../types';
4
4
  import appFetch from '../../utils/app-fetch';
5
5
  import { widgets } from '../urls';
6
- import { ServerVariables } from '../../utils/server-variables';
7
6
 
8
- const getWidgetDataHandler =
9
- (slug: string, locale: string, currency: string) => async () => {
10
- if (!slug) {
11
- return null;
12
- }
7
+ const getWidgetDataHandler = (slug: string) => async () => {
8
+ if (!slug) {
9
+ return null;
10
+ }
13
11
 
14
- return await appFetch({ url: widgets.getWidget(slug), locale, currency });
15
- };
12
+ return await appFetch(widgets.getWidget(slug));
13
+ };
16
14
 
17
15
  export const getWidgetData = async <T>({
18
16
  slug,
19
- locale = ServerVariables.locale,
20
- currency = ServerVariables.currency,
21
17
  cacheOptions
22
18
  }: {
23
19
  slug: string;
24
- locale?: string;
25
- currency?: string;
26
20
  cacheOptions?: CacheOptions;
27
21
  }): Promise<WidgetResultType<T>> => {
28
22
  return Cache.wrap(
29
23
  CacheKey.Widget(slug),
30
- locale,
31
- getWidgetDataHandler(slug, locale, currency),
24
+ getWidgetDataHandler(slug),
32
25
  cacheOptions
33
26
  );
34
27
  };