@akinon/next 1.42.0-rc.8 → 1.42.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 (47) hide show
  1. package/CHANGELOG.md +2 -53
  2. package/api/client.ts +9 -18
  3. package/assets/styles/index.scss +26 -50
  4. package/components/input.tsx +7 -20
  5. package/components/link.tsx +13 -17
  6. package/components/pagination.tsx +2 -1
  7. package/components/plugin-module.tsx +8 -3
  8. package/components/price.tsx +4 -10
  9. package/components/selected-payment-option-view.tsx +38 -26
  10. package/data/client/account.ts +9 -10
  11. package/data/client/api.ts +2 -1
  12. package/data/client/basket.ts +42 -0
  13. package/data/client/checkout.ts +3 -26
  14. package/data/server/category.ts +2 -2
  15. package/data/server/list.ts +2 -2
  16. package/data/server/product.ts +13 -15
  17. package/data/server/special-page.ts +2 -2
  18. package/data/urls.ts +5 -3
  19. package/hocs/server/with-segment-defaults.tsx +2 -2
  20. package/hooks/index.ts +1 -2
  21. package/hooks/use-payment-options.ts +1 -2
  22. package/lib/cache.ts +6 -18
  23. package/middlewares/default.ts +0 -9
  24. package/middlewares/pretty-url.ts +0 -4
  25. package/package.json +4 -5
  26. package/plugins.d.ts +0 -1
  27. package/redux/middlewares/checkout.ts +9 -40
  28. package/redux/reducers/checkout.ts +3 -9
  29. package/redux/reducers/config.ts +0 -2
  30. package/types/commerce/account.ts +0 -1
  31. package/types/commerce/address.ts +1 -1
  32. package/types/commerce/basket.ts +1 -0
  33. package/types/commerce/checkout.ts +0 -18
  34. package/types/commerce/misc.ts +0 -2
  35. package/types/commerce/order.ts +0 -7
  36. package/types/index.ts +2 -28
  37. package/utils/app-fetch.ts +1 -1
  38. package/utils/generate-commerce-search-params.ts +2 -6
  39. package/utils/index.ts +6 -27
  40. package/utils/server-translation.ts +1 -5
  41. package/with-pz-config.js +1 -11
  42. package/assets/styles/index.css +0 -49
  43. package/assets/styles/index.css.map +0 -1
  44. package/hooks/use-message-listener.ts +0 -24
  45. package/lib/cache-handler.mjs +0 -33
  46. package/routes/pretty-url.tsx +0 -194
  47. package/utils/redirection-iframe.ts +0 -85
package/CHANGELOG.md CHANGED
@@ -1,61 +1,10 @@
1
1
  # @akinon/next
2
2
 
3
- ## 1.42.0-rc.8
3
+ ## 1.42.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - d409996: ZERO-2781: Refactor buildClientRequestUrl function to support caching and options
8
-
9
- ## 1.42.0-rc.7
10
-
11
- ## 1.42.0-rc.6
12
-
13
- ### Minor Changes
14
-
15
- - 146ea39: ZERO-2774: Update imports
16
-
17
- ## 1.42.0-rc.5
18
-
19
- ## 1.42.0-rc.4
20
-
21
- ### Minor Changes
22
-
23
- - 46b7aad: ZERO-2775: Add condition and logger for menuitemmodel data
24
-
25
- ## 1.42.0-rc.3
26
-
27
- ### Minor Changes
28
-
29
- - fda5b92: ZERO-2725: fix invalid import
30
-
31
- ## 1.42.0-rc.2
32
-
33
- ## 1.42.0-rc.1
34
-
35
- ## 1.42.0-rc.0
36
-
37
- ### Minor Changes
38
-
39
- - 90282b5: ZERO-2729: Audit packages for yarn and npm and also update app-template
40
- - 572d2e8: ZERO-2667: Add iframe support for redirection payment methods
41
- - a4c8d6a: ZERO-2663: Fix the image url for gif and svgs and return them without options
42
- - c53ea3e: ZERO-2609: Reset additional form fields when selectedFormType is not company
43
- - 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.
44
- - 0d3a913: ZERO-2725: Update decimal scale in Price component
45
- - 1448a96: ZERO-2612: add errors type in CheckoutState
46
- - d3474c6: ZERO-2655: Add data source shipping option
47
- - 75080fd: ZERO-2630: Add max limit to postcode area
48
- - 91265bb: ZERO-2551: Improve pretty url and caching performance
49
- - bbe18b9: ZERO-2575: Fix build error
50
- - 98bb8dc: ZERO-2706: Cache getTranlations method
51
- - dcc8a15: ZERO-2694: added build step to RC branch pipeline
52
- - fad2768: ZERO-2739: add gpay to payment plugin map
53
- - dff0d59: ZERO-2659: add formData support to proxy api requests
54
- - beb499e: ZERO-2551: Add new tsconfig paths
55
- - c47be30: ZERO-2744: Update Order and OrderItem types
56
- - e9a46ac: ZERO-2738: add CVC input to registered cards in Masterpass
57
- - f046f8e: ZERO-2575: update version for react-number-format
58
- - 86d2531: ZERO-2693: resolve dependency collision warning for eslint-config-next
7
+ - 5ea00a6: ZERO-2761: Add multi basket package
59
8
 
60
9
  ## 1.41.0
61
10
 
package/api/client.ts CHANGED
@@ -78,13 +78,12 @@ 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
-
83
81
  if (req.method !== 'GET') {
84
- let body: Record<string, any> | FormData = {};
82
+ const formData = new URLSearchParams();
83
+ let body = {};
85
84
 
86
85
  try {
87
- body = isMultipartFormData ? await req.formData() : await req.json();
86
+ body = await req.json();
88
87
  } catch (error) {
89
88
  logger.error(
90
89
  `Client Proxy Request - Error while parsing request body to JSON`,
@@ -95,21 +94,13 @@ async function proxyRequest(...args) {
95
94
  );
96
95
  }
97
96
 
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
- });
97
+ Object.keys(body ?? {}).forEach((key) => {
98
+ if (body[key]) {
99
+ formData.append(key, body[key]);
100
+ }
101
+ });
108
102
 
109
- fetchOptions.body = !options.useFormData
110
- ? JSON.stringify(body)
111
- : formData;
112
- }
103
+ fetchOptions.body = !options.useFormData ? JSON.stringify(body) : formData;
113
104
  }
114
105
 
115
106
  let url = `${commerceUrl}/${slug.replace(/,/g, '/')}`;
@@ -1,53 +1,29 @@
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
- }
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
- }
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
+ }
@@ -1,29 +1,17 @@
1
1
  import clsx from 'clsx';
2
- import { forwardRef, FocusEvent, useState, Ref } from 'react';
2
+ import { forwardRef, FocusEvent, useState } from 'react';
3
3
  import { Controller } from 'react-hook-form';
4
- // @ts-ignore
5
- import { PatternFormat, PatternFormatProps } from 'react-number-format';
4
+ import NumberFormat, { NumberFormatProps } from 'react-number-format';
6
5
  import { InputProps } from '../types';
7
6
  import { twMerge } from 'tailwind-merge';
8
7
 
9
- const PatternFormatWithRef = forwardRef(
10
- (props: PatternFormatProps, ref: Ref<HTMLInputElement>) => {
11
- return <PatternFormat {...props} getInputRef={ref} />;
12
- }
13
- );
14
- PatternFormatWithRef.displayName = 'PatternFormatWithRef';
15
-
16
8
  export const Input = forwardRef<
17
9
  HTMLInputElement,
18
10
  InputProps &
19
11
  Pick<
20
- PatternFormatProps,
21
- 'mask' | 'allowEmptyFormatting' | 'onValueChange'
22
- > & {
23
- format?: string;
24
- defaultValue?: string;
25
- type?: string;
26
- }
12
+ NumberFormatProps,
13
+ 'format' | 'mask' | 'allowEmptyFormatting' | 'onValueChange'
14
+ >
27
15
  >((props, ref) => {
28
16
  const [focused, setFocused] = useState(false);
29
17
  const [hasValue, setHasValue] = useState(false);
@@ -49,7 +37,6 @@ export const Input = forwardRef<
49
37
  ),
50
38
  props.className
51
39
  );
52
-
53
40
  const inputProps: any = {
54
41
  id,
55
42
  ref,
@@ -92,14 +79,14 @@ export const Input = forwardRef<
92
79
  <Controller
93
80
  name={props.name ?? ''}
94
81
  control={props.control}
82
+ defaultValue={false}
95
83
  render={({ field }) => (
96
- <PatternFormatWithRef
84
+ <NumberFormat
97
85
  format={format}
98
86
  mask={mask ?? ''}
99
87
  {...rest}
100
88
  {...field}
101
89
  {...inputProps}
102
- type={props.type as 'text' | 'password' | 'tel'}
103
90
  />
104
91
  )}
105
92
  />
@@ -10,32 +10,28 @@ type LinkProps = Omit<
10
10
  React.AnchorHTMLAttributes<HTMLAnchorElement>,
11
11
  keyof NextLinkProps
12
12
  > &
13
- NextLinkProps & {
14
- href: string;
15
- };
13
+ NextLinkProps;
16
14
 
17
15
  export const Link = ({ children, href, ...rest }: LinkProps) => {
18
16
  const { locale, defaultLocaleValue, localeUrlStrategy } = useLocalization();
19
17
  const formattedHref = useMemo(() => {
20
- if (!href) {
21
- return '#';
18
+ if (typeof href !== 'string' || href.startsWith('http')) {
19
+ return href;
22
20
  }
23
21
 
24
- if (typeof href === 'string' && !href.startsWith('http')) {
25
- const pathnameWithoutLocale = href.replace(urlLocaleMatcherRegex, '');
26
- const hrefWithLocale = `/${locale}${pathnameWithoutLocale}`;
22
+ const pathnameWithoutLocale = href.replace(urlLocaleMatcherRegex, '');
23
+ const hrefWithLocale = `/${locale}${pathnameWithoutLocale}`;
27
24
 
28
- if (localeUrlStrategy === LocaleUrlStrategy.ShowAllLocales) {
29
- return hrefWithLocale;
30
- } else if (
31
- localeUrlStrategy === LocaleUrlStrategy.HideDefaultLocale &&
32
- locale !== defaultLocaleValue
33
- ) {
34
- return hrefWithLocale;
35
- }
25
+ if (localeUrlStrategy === LocaleUrlStrategy.ShowAllLocales) {
26
+ return hrefWithLocale;
27
+ } else if (
28
+ localeUrlStrategy === LocaleUrlStrategy.HideDefaultLocale &&
29
+ locale !== defaultLocaleValue
30
+ ) {
31
+ return hrefWithLocale;
36
32
  }
37
33
 
38
- return href;
34
+ return href || '#';
39
35
  }, [href, defaultLocaleValue, locale, localeUrlStrategy]);
40
36
 
41
37
  return (
@@ -1,9 +1,10 @@
1
1
  'use client';
2
2
 
3
3
  import { MouseEvent, useCallback, useEffect, useState } from 'react';
4
- import { PaginationProps } from '../types';
4
+ import { PaginationProps } from '@theme/components/types';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import clsx from 'clsx';
7
+
7
8
  import usePagination from '@akinon/next/hooks/use-pagination';
8
9
  import { useLocalization } from '@akinon/next/hooks';
9
10
  import { useRouter } from '@akinon/next/hooks';
@@ -18,7 +18,8 @@ enum Plugin {
18
18
  CreditPayment = 'pz-credit-payment',
19
19
  Masterpass = 'pz-masterpass',
20
20
  B2B = 'pz-b2b',
21
- Akifast = 'pz-akifast'
21
+ Akifast = 'pz-akifast',
22
+ MultiBasket = 'pz-multi-basket'
22
23
  }
23
24
 
24
25
  export enum Component {
@@ -41,7 +42,8 @@ export enum Component {
41
42
  MyQuotationsB2B = 'AccountMyQuotations',
42
43
  BasketB2B = 'BasketB2b',
43
44
  AkifastQuickLoginButton = 'QuickLoginButton',
44
- AkifastCheckoutButton = 'CheckoutButton'
45
+ AkifastCheckoutButton = 'CheckoutButton',
46
+ MultiBasket = 'MultiBasket'
45
47
  }
46
48
 
47
49
  const PluginComponents = new Map([
@@ -72,7 +74,8 @@ const PluginComponents = new Map([
72
74
  [
73
75
  Plugin.Akifast,
74
76
  [Component.AkifastQuickLoginButton, Component.AkifastCheckoutButton]
75
- ]
77
+ ],
78
+ [Plugin.MultiBasket, [Component.MultiBasket]]
76
79
  ]);
77
80
 
78
81
  const getPlugin = (component: Component) => {
@@ -133,6 +136,8 @@ export default function PluginModule({
133
136
  promise = import(`${'@akinon/pz-b2b'}`);
134
137
  } else if (plugin === Plugin.Akifast) {
135
138
  promise = import(`${'@akinon/pz-akifast'}`);
139
+ } else if (plugin === Plugin.MultiBasket) {
140
+ promise = import('@akinon/pz-multi-basket');
136
141
  }
137
142
  } catch (error) {
138
143
  logger.error(error);
@@ -1,13 +1,11 @@
1
1
  import { useMemo } from 'react';
2
- // @ts-ignore
3
- import { NumericFormat, NumericFormatProps } from 'react-number-format';
2
+ import NumberFormat, { NumberFormatProps } from 'react-number-format';
4
3
  import { getCurrency } from '@akinon/next/utils';
5
4
 
6
5
  import { useLocalization } from '@akinon/next/hooks';
7
6
  import { PriceProps } from '../types';
8
- import Settings from 'settings';
9
7
 
10
- export const Price = (props: NumericFormatProps & PriceProps) => {
8
+ export const Price = (props: NumberFormatProps & PriceProps) => {
11
9
  const {
12
10
  value,
13
11
  currencyCode,
@@ -29,10 +27,6 @@ export const Price = (props: NumericFormatProps & PriceProps) => {
29
27
  // TODO: This is very bad practice. It broke decimalScale.
30
28
  const _value = value?.toString().replace('.', ',');
31
29
 
32
- const currentCurrencyDecimalScale = Settings.localization.currencies.find(
33
- (currency) => currency.code === currencyCode_
34
- ).decimalScale;
35
-
36
30
  const currency = useMemo(
37
31
  () =>
38
32
  getCurrency({
@@ -45,14 +39,14 @@ export const Price = (props: NumericFormatProps & PriceProps) => {
45
39
  );
46
40
 
47
41
  return (
48
- <NumericFormat
42
+ <NumberFormat
49
43
  value={useNegative ? `-${useNegativeSpace}${_value}` : _value}
50
44
  {...{
51
45
  [useCurrencyAfterPrice ? 'suffix' : 'prefix']: currency
52
46
  }}
53
47
  displayType={displayType}
54
48
  thousandSeparator={thousandSeparator}
55
- decimalScale={currentCurrencyDecimalScale ?? decimalScale}
49
+ decimalScale={decimalScale}
56
50
  decimalSeparator={decimalSeparator}
57
51
  fixedDecimalScale={fixedDecimalScale}
58
52
  {...rest}
@@ -6,21 +6,6 @@ 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
-
24
9
  export default function SelectedPaymentOptionView() {
25
10
  const { payment_option } = useAppSelector(
26
11
  (state: RootState) => state.checkout.preOrder
@@ -29,7 +14,7 @@ export default function SelectedPaymentOptionView() {
29
14
  const Component = useMemo(
30
15
  () =>
31
16
  dynamic(
32
- async () => {
17
+ () => {
33
18
  const customOption = PaymentOptionViews.find(
34
19
  (opt) => opt.slug === payment_option.slug
35
20
  );
@@ -44,19 +29,46 @@ export default function SelectedPaymentOptionView() {
44
29
  });
45
30
  }
46
31
 
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}`
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`
52
56
  );
53
- return mod.default || fallbackView;
54
- } catch (error) {
55
- return fallbackView;
56
57
  }
57
- }
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) {}
58
68
 
59
- return fallbackView;
69
+ return promise
70
+ ? promise.then((mod) => mod.default).catch(() => () => null)
71
+ : new Promise<any>((resolve) => resolve(() => null));
60
72
  },
61
73
  { ssr: false }
62
74
  ),
@@ -123,16 +123,15 @@ 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, FormData>({
127
- query: (body) => {
128
- return {
129
- url: buildClientRequestUrl(account.sendContact, {
130
- useFormData: true
131
- }),
132
- method: 'POST',
133
- body
134
- };
135
- }
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
+ })
136
135
  }),
137
136
  cancelOrder: builder.mutation<void, AccountOrderCancellation>({
138
137
  query: ({ id, ...body }) => ({
@@ -9,7 +9,7 @@ import {
9
9
  } from '@reduxjs/toolkit/query/react';
10
10
  import settings from 'settings';
11
11
  import { getCookie } from '../../utils';
12
- import { RootState } from 'redux/store';
12
+ import { RootState } from '@theme/redux/store';
13
13
 
14
14
  interface CustomBaseQueryApi extends BaseQueryApi {
15
15
  getState: () => RootState;
@@ -67,6 +67,7 @@ export const api = createApi({
67
67
  baseQuery: customBaseQuery,
68
68
  tagTypes: [
69
69
  'Basket',
70
+ 'AllBaskets',
70
71
  'BasketB2b',
71
72
  'DraftsB2b',
72
73
  'Product',
@@ -24,6 +24,44 @@ export const basketApi = api.injectEndpoints({
24
24
  transformResponse: (response: { basket: Basket }) => response.basket,
25
25
  providesTags: ['Basket']
26
26
  }),
27
+ getBasketDetail: build.mutation<Basket, { namespace: string }>({
28
+ query: ({ namespace }) => ({
29
+ url: buildClientRequestUrl(basket.getBasketDetail(namespace), {
30
+ contentType: 'application/json'
31
+ }),
32
+ method: 'GET'
33
+ }),
34
+ invalidatesTags: ['AllBaskets']
35
+ }),
36
+ getAllBaskets: build.query<Basket[], void>({
37
+ query: () =>
38
+ buildClientRequestUrl(basket.getAllBaskets, {
39
+ contentType: 'application/json'
40
+ }),
41
+ transformResponse: (response: { baskets: Basket[] }) => response.baskets,
42
+ providesTags: ['AllBaskets']
43
+ }),
44
+ removeBasket: build.mutation<Basket, { pk: number }>({
45
+ query: ({ pk }) => ({
46
+ url: buildClientRequestUrl(basket.removeBasket(pk), {
47
+ contentType: 'application/json'
48
+ }),
49
+ method: 'DELETE',
50
+ body: { pk }
51
+ }),
52
+ invalidatesTags: ['AllBaskets', 'Basket']
53
+ }),
54
+ selectMainBasket: build.mutation<Basket, { pk: number }>({
55
+ query: ({ pk }) => ({
56
+ url: buildClientRequestUrl(basket.selectMainBasket(pk), {
57
+ contentType: 'application/json'
58
+ }),
59
+ method: 'POST',
60
+ body: { pk }
61
+ }),
62
+ transformResponse: (response: { baskets: Basket }) => response.baskets,
63
+ invalidatesTags: ['AllBaskets', 'Basket']
64
+ }),
27
65
  updateQuantity: build.mutation<
28
66
  UpdateQuantityResponse,
29
67
  UpdateQuantityRequest
@@ -75,6 +113,10 @@ export const basketApi = api.injectEndpoints({
75
113
 
76
114
  export const {
77
115
  useGetBasketQuery,
116
+ useGetBasketDetailMutation,
117
+ useGetAllBasketsQuery,
118
+ useRemoveBasketMutation,
119
+ useSelectMainBasketMutation,
78
120
  useUpdateQuantityMutation,
79
121
  useClearBasketMutation,
80
122
  useApplyVoucherCodeMutation,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  setBankAccounts,
3
- setCardType,
4
3
  setInstallmentOptions,
5
4
  setPaymentStepBusy,
6
5
  setSelectedBankAccountPk,
7
6
  setSelectedCreditPaymentPk,
8
- setShippingStepBusy
7
+ setShippingStepBusy,
8
+ setCardType
9
9
  } from '../../redux/reducers/checkout';
10
10
  import {
11
11
  CheckoutContext,
@@ -20,7 +20,6 @@ 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,
24
23
  setError,
25
24
  setOtpModalVisible
26
25
  } from '@akinon/pz-masterpass/src/redux/reducer';
@@ -114,8 +113,7 @@ const completeMasterpassPayment = async (
114
113
  ? await buildDirectPurchaseForm(commonFormValues, params)
115
114
  : await buildPurchaseForm({
116
115
  ...commonFormValues,
117
- selectedCard,
118
- cardCvc: params?.card_cvv
116
+ selectedCard
119
117
  });
120
118
 
121
119
  window.MFS?.[
@@ -153,10 +151,6 @@ const completeMasterpassPayment = async (
153
151
  return;
154
152
  }
155
153
 
156
- if (['5013', '5182'].includes(response.responseCode)) {
157
- dispatch(setCvcRequired(true));
158
- }
159
-
160
154
  if (
161
155
  response.token &&
162
156
  (response.responseCode == '0000' || response.responseCode == '')
@@ -379,22 +373,6 @@ export const checkoutApi = api.injectEndpoints({
379
373
  dispatch(setShippingStepBusy(false));
380
374
  }
381
375
  }),
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
- }),
398
376
  setRetailStore: build.mutation<CheckoutResponse, SetRetailStoreParams>({
399
377
  query: ({ retailStorePk, billingAddressPk }) => ({
400
378
  url: buildClientRequestUrl(
@@ -694,7 +672,6 @@ export const {
694
672
  useSetDeliveryOptionMutation,
695
673
  useSetAddressesMutation,
696
674
  useSetShippingOptionMutation,
697
- useSetDataSourceShippingOptionsMutation,
698
675
  useSetPaymentOptionMutation,
699
676
  useSetBinNumberMutation,
700
677
  useSetInstallmentOptionMutation,
@@ -8,7 +8,7 @@ import logger from '../../utils/log';
8
8
 
9
9
  function getCategoryDataHandler(
10
10
  pk: number,
11
- searchParams?: { [key: string]: string | string[] | undefined },
11
+ searchParams?: URLSearchParams,
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?: { [key: string]: string | string[] | undefined };
81
+ searchParams?: URLSearchParams;
82
82
  headers?: Record<string, string>;
83
83
  }) => {
84
84
  return Cache.wrap(