@akinon/next 1.41.0 → 1.42.0-rc.1

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 (42) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/api/client.ts +18 -9
  3. package/assets/styles/index.css +49 -0
  4. package/assets/styles/index.css.map +1 -0
  5. package/assets/styles/index.scss +50 -26
  6. package/components/input.tsx +20 -7
  7. package/components/link.tsx +17 -13
  8. package/components/price.tsx +10 -4
  9. package/components/selected-payment-option-view.tsx +26 -38
  10. package/data/client/account.ts +10 -9
  11. package/data/client/checkout.ts +26 -3
  12. package/data/server/category.ts +2 -2
  13. package/data/server/list.ts +2 -2
  14. package/data/server/product.ts +2 -5
  15. package/data/server/special-page.ts +2 -2
  16. package/data/urls.ts +2 -0
  17. package/hocs/server/with-segment-defaults.tsx +2 -2
  18. package/hooks/index.ts +2 -1
  19. package/hooks/use-message-listener.ts +24 -0
  20. package/hooks/use-payment-options.ts +2 -1
  21. package/lib/cache-handler.mjs +33 -0
  22. package/lib/cache.ts +18 -6
  23. package/middlewares/default.ts +9 -0
  24. package/middlewares/pretty-url.ts +4 -0
  25. package/package.json +5 -4
  26. package/plugins.d.ts +1 -0
  27. package/redux/middlewares/checkout.ts +40 -9
  28. package/redux/reducers/checkout.ts +9 -3
  29. package/redux/reducers/config.ts +2 -0
  30. package/routes/pretty-url.tsx +194 -0
  31. package/types/commerce/account.ts +1 -0
  32. package/types/commerce/address.ts +1 -1
  33. package/types/commerce/checkout.ts +18 -0
  34. package/types/commerce/misc.ts +2 -0
  35. package/types/commerce/order.ts +7 -0
  36. package/types/index.ts +9 -1
  37. package/utils/app-fetch.ts +1 -1
  38. package/utils/generate-commerce-search-params.ts +6 -2
  39. package/utils/index.ts +6 -0
  40. package/utils/redirection-iframe.ts +85 -0
  41. package/utils/server-translation.ts +5 -1
  42. package/with-pz-config.js +11 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.42.0-rc.1
4
+
5
+ ## 1.42.0-rc.0
6
+
7
+ ### Minor Changes
8
+
9
+ - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
10
+ - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
11
+ - a4c8d6a: ZERO-2663: Fix the image url for gif and svgs and return them without options
12
+ - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
13
+ - c53ef7b: 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.
14
+ - 0d3a913: ZERO-2725: Update decimal scale in Price component
15
+ - 1448a96: ZERO-2612: add errors type in CheckoutState
16
+ - d3474c6: ZERO-2655: Add data source shipping option
17
+ - 75080fd: ZERO-2630: Add max limit to postcode area
18
+ - 91265bb: ZERO-2551: Improve pretty url and caching performance
19
+ - bbe18b9: ZERO-2575: Fix build error
20
+ - 98bb8dc: ZERO-2706: Cache getTranlations method
21
+ - dcc8a15: ZERO-2694: added build step to RC branch pipeline
22
+ - fad2768: ZERO-2739: add gpay to payment plugin map
23
+ - dff0d59: ZERO-2659: add formData support to proxy api requests
24
+ - beb499e: ZERO-2551: Add new tsconfig paths
25
+ - c47be30: ZERO-2744: Update Order and OrderItem types
26
+ - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
27
+ - f046f8e: ZERO-2575: update version for react-number-format
28
+ - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
29
+
3
30
  ## 1.41.0
4
31
 
5
32
  ### Minor Changes
package/api/client.ts CHANGED
@@ -78,12 +78,13 @@ async function proxyRequest(...args) {
78
78
  fetchOptions.headers['Content-Type'] = options.contentType;
79
79
  }
80
80
 
81
+ const isMultipartFormData = req.headers.get('content-type')?.includes('multipart/form-data;');
82
+
81
83
  if (req.method !== 'GET') {
82
- const formData = new URLSearchParams();
83
- let body = {};
84
+ let body: Record<string, any> | FormData = {};
84
85
 
85
86
  try {
86
- body = await req.json();
87
+ body = isMultipartFormData ? await req.formData() : await req.json();
87
88
  } catch (error) {
88
89
  logger.error(
89
90
  `Client Proxy Request - Error while parsing request body to JSON`,
@@ -94,13 +95,21 @@ async function proxyRequest(...args) {
94
95
  );
95
96
  }
96
97
 
97
- Object.keys(body ?? {}).forEach((key) => {
98
- if (body[key]) {
99
- formData.append(key, body[key]);
100
- }
101
- });
98
+ if (isMultipartFormData) {
99
+ fetchOptions.body = body as FormData;
100
+ } else {
101
+ const formData = new FormData();
102
+
103
+ Object.keys(body ?? {}).forEach((key) => {
104
+ if (body[key]) {
105
+ formData.append(key, body[key]);
106
+ }
107
+ });
102
108
 
103
- fetchOptions.body = !options.useFormData ? JSON.stringify(body) : formData;
109
+ fetchOptions.body = !options.useFormData
110
+ ? JSON.stringify(body)
111
+ : formData;
112
+ }
104
113
  }
105
114
 
106
115
  let url = `${commerceUrl}/${slug.replace(/,/g, '/')}`;
@@ -0,0 +1,49 @@
1
+ .checkout-payment-iframe-wrapper {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ border: none;
8
+ z-index: 1000;
9
+ background-color: white;
10
+ }
11
+ .checkout-payment-iframe-wrapper iframe {
12
+ width: 100%;
13
+ height: 100%;
14
+ border: none;
15
+ background-color: white;
16
+ }
17
+ .checkout-payment-iframe-wrapper .close-button {
18
+ position: fixed;
19
+ top: 16px;
20
+ right: 16px;
21
+ width: 32px;
22
+ height: 32px;
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: center;
26
+ z-index: 1001;
27
+ }
28
+
29
+ .checkout-payment-redirection-iframe-wrapper {
30
+ width: 100%;
31
+ position: relative;
32
+ }
33
+ .checkout-payment-redirection-iframe-wrapper iframe {
34
+ width: 100%;
35
+ height: 100%;
36
+ border: none;
37
+ background-color: white;
38
+ }
39
+ .checkout-payment-redirection-iframe-wrapper .close-button {
40
+ position: absolute;
41
+ top: 16px;
42
+ right: 16px;
43
+ width: 32px;
44
+ height: 32px;
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ z-index: 1001;
49
+ }/*# sourceMappingURL=index.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.scss","index.css"],"names":[],"mappings":"AAAA;EACE,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,YAAA;EACA,aAAA;EACA,uBAAA;ACCF;ADCE;EACE,WAAA;EACA,YAAA;EACA,YAAA;EACA,uBAAA;ACCJ;ADEE;EACE,eAAA;EACA,SAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,uBAAA;EACA,aAAA;ACAJ;;ADIA;EACE,WAAA;EACA,kBAAA;ACDF;ADGE;EACE,WAAA;EACA,YAAA;EACA,YAAA;EACA,uBAAA;ACDJ;ADIE;EACE,kBAAA;EACA,SAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,uBAAA;EACA,aAAA;ACFJ","file":"index.css"}
@@ -1,29 +1,53 @@
1
1
  .checkout-payment-iframe-wrapper {
2
- position: fixed;
3
- top: 0;
4
- left: 0;
5
- width: 100%;
6
- height: 100%;
7
- border: none;
8
- z-index: 1000;
9
- background-color: white;
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ border: none;
8
+ z-index: 1000;
9
+ background-color: white;
10
10
 
11
- iframe {
12
- width: 100%;
13
- height: 100%;
14
- border: none;
15
- background-color: white;
16
- }
11
+ iframe {
12
+ width: 100%;
13
+ height: 100%;
14
+ border: none;
15
+ background-color: white;
16
+ }
17
17
 
18
- .close-button {
19
- position: fixed;
20
- top: 16px;
21
- right: 16px;
22
- width: 32px;
23
- height: 32px;
24
- display: flex;
25
- align-items: center;
26
- justify-content: center;
27
- z-index: 1001;
28
- }
29
- }
18
+ .close-button {
19
+ position: fixed;
20
+ top: 16px;
21
+ right: 16px;
22
+ width: 32px;
23
+ height: 32px;
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ z-index: 1001;
28
+ }
29
+ }
30
+
31
+ .checkout-payment-redirection-iframe-wrapper {
32
+ width: 100%;
33
+ position: relative;
34
+
35
+ iframe {
36
+ width: 100%;
37
+ height: 100%;
38
+ border: none;
39
+ background-color: white;
40
+ }
41
+
42
+ .close-button {
43
+ position: absolute;
44
+ top: 16px;
45
+ right: 16px;
46
+ width: 32px;
47
+ height: 32px;
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ z-index: 1001;
52
+ }
53
+ }
@@ -1,17 +1,29 @@
1
1
  import clsx from 'clsx';
2
- import { forwardRef, FocusEvent, useState } from 'react';
2
+ import { forwardRef, FocusEvent, useState, Ref } from 'react';
3
3
  import { Controller } from 'react-hook-form';
4
- import NumberFormat, { NumberFormatProps } from 'react-number-format';
4
+ // @ts-ignore
5
+ import { PatternFormat, PatternFormatProps } from 'react-number-format';
5
6
  import { InputProps } from '../types';
6
7
  import { twMerge } from 'tailwind-merge';
7
8
 
9
+ const PatternFormatWithRef = forwardRef(
10
+ (props: PatternFormatProps, ref: Ref<HTMLInputElement>) => {
11
+ return <PatternFormat {...props} getInputRef={ref} />;
12
+ }
13
+ );
14
+ PatternFormatWithRef.displayName = 'PatternFormatWithRef';
15
+
8
16
  export const Input = forwardRef<
9
17
  HTMLInputElement,
10
18
  InputProps &
11
19
  Pick<
12
- NumberFormatProps,
13
- 'format' | 'mask' | 'allowEmptyFormatting' | 'onValueChange'
14
- >
20
+ PatternFormatProps,
21
+ 'mask' | 'allowEmptyFormatting' | 'onValueChange'
22
+ > & {
23
+ format?: string;
24
+ defaultValue?: string;
25
+ type?: string;
26
+ }
15
27
  >((props, ref) => {
16
28
  const [focused, setFocused] = useState(false);
17
29
  const [hasValue, setHasValue] = useState(false);
@@ -37,6 +49,7 @@ export const Input = forwardRef<
37
49
  ),
38
50
  props.className
39
51
  );
52
+
40
53
  const inputProps: any = {
41
54
  id,
42
55
  ref,
@@ -79,14 +92,14 @@ export const Input = forwardRef<
79
92
  <Controller
80
93
  name={props.name ?? ''}
81
94
  control={props.control}
82
- defaultValue={false}
83
95
  render={({ field }) => (
84
- <NumberFormat
96
+ <PatternFormatWithRef
85
97
  format={format}
86
98
  mask={mask ?? ''}
87
99
  {...rest}
88
100
  {...field}
89
101
  {...inputProps}
102
+ type={props.type as 'text' | 'password' | 'tel'}
90
103
  />
91
104
  )}
92
105
  />
@@ -10,28 +10,32 @@ type LinkProps = Omit<
10
10
  React.AnchorHTMLAttributes<HTMLAnchorElement>,
11
11
  keyof NextLinkProps
12
12
  > &
13
- NextLinkProps;
13
+ NextLinkProps & {
14
+ href: string;
15
+ };
14
16
 
15
17
  export const Link = ({ children, href, ...rest }: LinkProps) => {
16
18
  const { locale, defaultLocaleValue, localeUrlStrategy } = useLocalization();
17
19
  const formattedHref = useMemo(() => {
18
- if (typeof href !== 'string' || href.startsWith('http')) {
19
- return href;
20
+ if (!href) {
21
+ return '#';
20
22
  }
21
23
 
22
- const pathnameWithoutLocale = href.replace(urlLocaleMatcherRegex, '');
23
- const hrefWithLocale = `/${locale}${pathnameWithoutLocale}`;
24
+ if (typeof href === 'string' && !href.startsWith('http')) {
25
+ const pathnameWithoutLocale = href.replace(urlLocaleMatcherRegex, '');
26
+ const hrefWithLocale = `/${locale}${pathnameWithoutLocale}`;
24
27
 
25
- if (localeUrlStrategy === LocaleUrlStrategy.ShowAllLocales) {
26
- return hrefWithLocale;
27
- } else if (
28
- localeUrlStrategy === LocaleUrlStrategy.HideDefaultLocale &&
29
- locale !== defaultLocaleValue
30
- ) {
31
- return hrefWithLocale;
28
+ if (localeUrlStrategy === LocaleUrlStrategy.ShowAllLocales) {
29
+ return hrefWithLocale;
30
+ } else if (
31
+ localeUrlStrategy === LocaleUrlStrategy.HideDefaultLocale &&
32
+ locale !== defaultLocaleValue
33
+ ) {
34
+ return hrefWithLocale;
35
+ }
32
36
  }
33
37
 
34
- return href || '#';
38
+ return href;
35
39
  }, [href, defaultLocaleValue, locale, localeUrlStrategy]);
36
40
 
37
41
  return (
@@ -1,11 +1,13 @@
1
1
  import { useMemo } from 'react';
2
- import NumberFormat, { NumberFormatProps } from 'react-number-format';
2
+ // @ts-ignore
3
+ import { NumericFormat, NumericFormatProps } from 'react-number-format';
3
4
  import { getCurrency } from '@akinon/next/utils';
4
5
 
5
6
  import { useLocalization } from '@akinon/next/hooks';
6
7
  import { PriceProps } from '../types';
8
+ import Settings from '@theme/settings';
7
9
 
8
- export const Price = (props: NumberFormatProps & PriceProps) => {
10
+ export const Price = (props: NumericFormatProps & PriceProps) => {
9
11
  const {
10
12
  value,
11
13
  currencyCode,
@@ -27,6 +29,10 @@ export const Price = (props: NumberFormatProps & PriceProps) => {
27
29
  // TODO: This is very bad practice. It broke decimalScale.
28
30
  const _value = value?.toString().replace('.', ',');
29
31
 
32
+ const currentCurrencyDecimalScale = Settings.localization.currencies.find(
33
+ (currency) => currency.code === currencyCode_
34
+ ).decimalScale;
35
+
30
36
  const currency = useMemo(
31
37
  () =>
32
38
  getCurrency({
@@ -39,14 +45,14 @@ export const Price = (props: NumberFormatProps & PriceProps) => {
39
45
  );
40
46
 
41
47
  return (
42
- <NumberFormat
48
+ <NumericFormat
43
49
  value={useNegative ? `-${useNegativeSpace}${_value}` : _value}
44
50
  {...{
45
51
  [useCurrencyAfterPrice ? 'suffix' : 'prefix']: currency
46
52
  }}
47
53
  displayType={displayType}
48
54
  thousandSeparator={thousandSeparator}
49
- decimalScale={decimalScale}
55
+ decimalScale={currentCurrencyDecimalScale ?? decimalScale}
50
56
  decimalSeparator={decimalSeparator}
51
57
  fixedDecimalScale={fixedDecimalScale}
52
58
  {...rest}
@@ -6,6 +6,21 @@ import dynamic from 'next/dynamic';
6
6
  import { PaymentOptionViews } from 'views/checkout/steps/payment';
7
7
  import { useMemo } from 'react';
8
8
 
9
+ const fallbackView = () => <div />;
10
+
11
+ const paymentTypeToView = {
12
+ bkm_express: 'bkm',
13
+ credit_card: 'credit-card',
14
+ credit_payment: 'credit-payment',
15
+ funds_transfer: 'funds-transfer',
16
+ gpay: 'gpay',
17
+ loyalty_money: 'loyalty',
18
+ masterpass: 'credit-card',
19
+ pay_on_delivery: 'pay-on-delivery',
20
+ redirection: 'redirection'
21
+ // Add other mappings as needed
22
+ };
23
+
9
24
  export default function SelectedPaymentOptionView() {
10
25
  const { payment_option } = useAppSelector(
11
26
  (state: RootState) => state.checkout.preOrder
@@ -14,7 +29,7 @@ export default function SelectedPaymentOptionView() {
14
29
  const Component = useMemo(
15
30
  () =>
16
31
  dynamic(
17
- () => {
32
+ async () => {
18
33
  const customOption = PaymentOptionViews.find(
19
34
  (opt) => opt.slug === payment_option.slug
20
35
  );
@@ -29,46 +44,19 @@ export default function SelectedPaymentOptionView() {
29
44
  });
30
45
  }
31
46
 
32
- let promise: any;
33
-
34
- try {
35
- if (payment_option.payment_type === 'credit_card') {
36
- promise = import(
37
- `views/checkout/steps/payment/options/credit-card`
38
- );
39
- } else if (payment_option.payment_type === 'funds_transfer') {
40
- promise = import(
41
- `views/checkout/steps/payment/options/funds-transfer`
42
- );
43
- } else if (payment_option.payment_type === 'redirection') {
44
- promise = import(
45
- `views/checkout/steps/payment/options/redirection`
46
- );
47
- } else if (payment_option.payment_type === 'pay_on_delivery') {
48
- promise = import(
49
- `views/checkout/steps/payment/options/pay-on-delivery`
50
- );
51
- } else if (payment_option.payment_type === 'loyalty_money') {
52
- promise = import(`views/checkout/steps/payment/options/loyalty`);
53
- } else if (payment_option.payment_type === 'masterpass') {
54
- promise = import(
55
- `views/checkout/steps/payment/options/credit-card`
47
+ const view = paymentTypeToView[payment_option.payment_type];
48
+ if (view) {
49
+ try {
50
+ const mod = await import(
51
+ `views/checkout/steps/payment/options/${view}`
56
52
  );
53
+ return mod.default || fallbackView;
54
+ } catch (error) {
55
+ return fallbackView;
57
56
  }
58
- // else if (payment_option.payment_type === 'credit_payment') {
59
- // promise = import(`views/checkout/steps/payment/options/credit-payment`);
60
- // }
61
- // else if (payment_option.payment_type === 'gpay') {
62
- // promise = import(`views/checkout/steps/payment/options/gpay`);
63
- // }
64
- // else if (payment_option.payment_type === 'bkm_express') {
65
- // promise = import(`views/checkout/steps/payment/options/bkm`);
66
- // }
67
- } catch (error) {}
57
+ }
68
58
 
69
- return promise
70
- ? promise.then((mod) => mod.default).catch(() => () => null)
71
- : new Promise<any>((resolve) => resolve(() => null));
59
+ return fallbackView;
72
60
  },
73
61
  { ssr: false }
74
62
  ),
@@ -123,15 +123,16 @@ const accountApi = api.injectEndpoints({
123
123
  query: ({ page, status, limit }) =>
124
124
  buildClientRequestUrl(account.getQuotations(page, status, limit))
125
125
  }),
126
- sendContact: builder.mutation<void, ContactFormType>({
127
- query: (body) => ({
128
- url: buildClientRequestUrl(account.sendContact, {
129
- contentType: 'application/json',
130
- responseType: 'text'
131
- }),
132
- method: 'POST',
133
- body
134
- })
126
+ sendContact: builder.mutation<void, FormData>({
127
+ query: (body) => {
128
+ return {
129
+ url: buildClientRequestUrl(account.sendContact, {
130
+ useFormData: true
131
+ }),
132
+ method: 'POST',
133
+ body
134
+ };
135
+ }
135
136
  }),
136
137
  cancelOrder: builder.mutation<void, AccountOrderCancellation>({
137
138
  query: ({ id, ...body }) => ({
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  setBankAccounts,
3
+ setCardType,
3
4
  setInstallmentOptions,
4
5
  setPaymentStepBusy,
5
6
  setSelectedBankAccountPk,
6
7
  setSelectedCreditPaymentPk,
7
- setShippingStepBusy,
8
- setCardType
8
+ setShippingStepBusy
9
9
  } from '../../redux/reducers/checkout';
10
10
  import {
11
11
  CheckoutContext,
@@ -20,6 +20,7 @@ import { AppDispatch, AppStore, store } from 'redux/store';
20
20
  import settings from 'settings';
21
21
  import { showMobile3dIframe } from '../../utils/mobile-3d-iframe';
22
22
  import {
23
+ setCvcRequired,
23
24
  setError,
24
25
  setOtpModalVisible
25
26
  } from '@akinon/pz-masterpass/src/redux/reducer';
@@ -113,7 +114,8 @@ const completeMasterpassPayment = async (
113
114
  ? await buildDirectPurchaseForm(commonFormValues, params)
114
115
  : await buildPurchaseForm({
115
116
  ...commonFormValues,
116
- selectedCard
117
+ selectedCard,
118
+ cardCvc: params?.card_cvv
117
119
  });
118
120
 
119
121
  window.MFS?.[
@@ -151,6 +153,10 @@ const completeMasterpassPayment = async (
151
153
  return;
152
154
  }
153
155
 
156
+ if (['5013', '5182'].includes(response.responseCode)) {
157
+ dispatch(setCvcRequired(true));
158
+ }
159
+
154
160
  if (
155
161
  response.token &&
156
162
  (response.responseCode == '0000' || response.responseCode == '')
@@ -373,6 +379,22 @@ export const checkoutApi = api.injectEndpoints({
373
379
  dispatch(setShippingStepBusy(false));
374
380
  }
375
381
  }),
382
+ setDataSourceShippingOptions: build.mutation<CheckoutResponse, number[]>({
383
+ query: (pks) => ({
384
+ url: buildClientRequestUrl(checkout.setDataSourceShippingOption, {
385
+ useFormData: true
386
+ }),
387
+ method: 'POST',
388
+ body: {
389
+ data_source_shipping_options: JSON.stringify(pks)
390
+ }
391
+ }),
392
+ async onQueryStarted(arg, { dispatch, queryFulfilled }) {
393
+ dispatch(setShippingStepBusy(true));
394
+ await queryFulfilled;
395
+ dispatch(setShippingStepBusy(false));
396
+ }
397
+ }),
376
398
  setRetailStore: build.mutation<CheckoutResponse, SetRetailStoreParams>({
377
399
  query: ({ retailStorePk, billingAddressPk }) => ({
378
400
  url: buildClientRequestUrl(
@@ -672,6 +694,7 @@ export const {
672
694
  useSetDeliveryOptionMutation,
673
695
  useSetAddressesMutation,
674
696
  useSetShippingOptionMutation,
697
+ useSetDataSourceShippingOptionsMutation,
675
698
  useSetPaymentOptionMutation,
676
699
  useSetBinNumberMutation,
677
700
  useSetInstallmentOptionMutation,
@@ -8,7 +8,7 @@ import logger from '../../utils/log';
8
8
 
9
9
  function getCategoryDataHandler(
10
10
  pk: number,
11
- searchParams?: URLSearchParams,
11
+ searchParams?: { [key: string]: string | string[] | undefined },
12
12
  headers?: Record<string, string>
13
13
  ) {
14
14
  return async function () {
@@ -78,7 +78,7 @@ export const getCategoryData = ({
78
78
  headers
79
79
  }: {
80
80
  pk: number;
81
- searchParams?: URLSearchParams;
81
+ searchParams?: { [key: string]: string | string[] | undefined };
82
82
  headers?: Record<string, string>;
83
83
  }) => {
84
84
  return Cache.wrap(
@@ -7,7 +7,7 @@ import { parse } from 'lossless-json';
7
7
  import logger from '../../utils/log';
8
8
 
9
9
  const getListDataHandler = (
10
- searchParams: URLSearchParams,
10
+ searchParams: { [key: string]: string | string[] | undefined },
11
11
  headers?: Record<string, string>
12
12
  ) => {
13
13
  return async function () {
@@ -54,7 +54,7 @@ export const getListData = async ({
54
54
  searchParams,
55
55
  headers
56
56
  }: {
57
- searchParams: URLSearchParams;
57
+ searchParams: { [key: string]: string | string[] | undefined };
58
58
  headers?: Record<string, string>;
59
59
  }) => {
60
60
  return Cache.wrap(
@@ -9,7 +9,7 @@ import appFetch from '../../utils/app-fetch';
9
9
 
10
10
  type GetProduct = {
11
11
  pk: number;
12
- searchParams?: URLSearchParams;
12
+ searchParams?: { [key: string]: string | string[] | undefined };
13
13
  groupProduct?: boolean;
14
14
  };
15
15
 
@@ -74,10 +74,7 @@ export const getProductData = async ({
74
74
  groupProduct
75
75
  }: GetProduct) => {
76
76
  return Cache.wrap(
77
- CacheKey[groupProduct ? 'GroupProduct' : 'Product'](
78
- pk,
79
- searchParams ?? new URLSearchParams()
80
- ),
77
+ CacheKey[groupProduct ? 'GroupProduct' : 'Product'](pk, searchParams ?? {}),
81
78
  getProductDataHandler({ pk, searchParams, groupProduct }),
82
79
  {
83
80
  expire: 300
@@ -7,7 +7,7 @@ import header from '../../redux/reducers/header';
7
7
 
8
8
  const getSpecialPageDataHandler = (
9
9
  pk: number,
10
- searchParams: URLSearchParams,
10
+ searchParams: { [key: string]: string | string[] | undefined },
11
11
  headers?: Record<string, string>
12
12
  ) => {
13
13
  return async function () {
@@ -34,7 +34,7 @@ export const getSpecialPageData = async ({
34
34
  headers
35
35
  }: {
36
36
  pk: number;
37
- searchParams: URLSearchParams;
37
+ searchParams: { [key: string]: string | string[] | undefined };
38
38
  headers?: Record<string, string>;
39
39
  }) => {
40
40
  return Cache.wrap(
package/data/urls.ts CHANGED
@@ -79,6 +79,8 @@ export const checkout = {
79
79
  setDeliveryOption: '/orders/checkout/?page=DeliveryOptionSelectionPage',
80
80
  setAddresses: '/orders/checkout/?page=AddressSelectionPage',
81
81
  setShippingOption: '/orders/checkout/?page=ShippingOptionSelectionPage',
82
+ setDataSourceShippingOption:
83
+ '/orders/checkout/?page=DataSourceShippingOptionSelectionPage',
82
84
  setPaymentOption: '/orders/checkout/?page=PaymentOptionSelectionPage',
83
85
  setBinNumber: '/orders/checkout/?page=BinNumberPage',
84
86
  setMasterpassBinNumber: '/orders/checkout/?page=MasterpassBinNumberPage',
@@ -2,7 +2,7 @@ import settings from 'settings';
2
2
  import { LayoutProps, PageProps, RootLayoutProps } from '../../types';
3
3
  import { redirect } from 'next/navigation';
4
4
  import { ServerVariables } from '../../utils/server-variables';
5
- import { getTranslations } from '../../utils/server-translation';
5
+ import { getCachedTranslations } from '../../utils/server-translation';
6
6
  import { ROUTES } from 'routes';
7
7
  import logger from '../../utils/log';
8
8
 
@@ -50,7 +50,7 @@ const addRootLayoutProps = async (componentProps: RootLayoutProps) => {
50
50
  return redirect(ROUTES.HOME);
51
51
  }
52
52
 
53
- const translations = await getTranslations(params.locale);
53
+ const translations = await getCachedTranslations(params.locale);
54
54
  componentProps.translations = translations;
55
55
 
56
56
  const locale = settings.localization.locales.find(
package/hooks/index.ts CHANGED
@@ -8,4 +8,5 @@ export * from './use-media-query';
8
8
  export * from './use-on-click-outside';
9
9
  export * from './use-mobile-iframe-handler';
10
10
  export * from './use-payment-options';
11
- export * from './use-pagination';
11
+ export * from './use-pagination';
12
+ export * from './use-message-listener';