@akinon/next 1.43.0-rc.6 → 1.43.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 (46) hide show
  1. package/CHANGELOG.md +2 -98
  2. package/api/client.ts +9 -33
  3. package/assets/styles/index.scss +26 -50
  4. package/components/input.tsx +7 -21
  5. package/components/link.tsx +13 -17
  6. package/components/pagination.tsx +2 -1
  7. package/components/price.tsx +4 -11
  8. package/components/selected-payment-option-view.tsx +38 -26
  9. package/data/client/account.ts +9 -10
  10. package/data/client/address.ts +8 -32
  11. package/data/client/api.ts +1 -1
  12. package/data/client/checkout.ts +3 -26
  13. package/data/server/category.ts +2 -2
  14. package/data/server/list.ts +2 -2
  15. package/data/server/product.ts +13 -15
  16. package/data/server/special-page.ts +2 -2
  17. package/data/urls.ts +0 -2
  18. package/hocs/server/with-segment-defaults.tsx +2 -2
  19. package/hooks/index.ts +1 -2
  20. package/hooks/use-payment-options.ts +1 -2
  21. package/lib/cache.ts +6 -18
  22. package/middlewares/default.ts +2 -41
  23. package/middlewares/pretty-url.ts +0 -4
  24. package/middlewares/url-redirection.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/checkout.ts +0 -18
  33. package/types/commerce/misc.ts +0 -2
  34. package/types/commerce/order.ts +0 -12
  35. package/types/index.ts +2 -28
  36. package/utils/app-fetch.ts +1 -1
  37. package/utils/generate-commerce-search-params.ts +2 -6
  38. package/utils/index.ts +6 -27
  39. package/utils/server-translation.ts +1 -5
  40. package/with-pz-config.js +1 -11
  41. package/assets/styles/index.css +0 -49
  42. package/assets/styles/index.css.map +0 -1
  43. package/hooks/use-message-listener.ts +0 -24
  44. package/lib/cache-handler.mjs +0 -33
  45. package/routes/pretty-url.tsx +0 -194
  46. package/utils/redirection-iframe.ts +0 -85
@@ -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(
@@ -7,7 +7,7 @@ import { parse } from 'lossless-json';
7
7
  import logger from '../../utils/log';
8
8
 
9
9
  const getListDataHandler = (
10
- searchParams: { [key: string]: string | string[] | undefined },
10
+ searchParams: URLSearchParams,
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: { [key: string]: string | string[] | undefined };
57
+ searchParams: URLSearchParams;
58
58
  headers?: Record<string, string>;
59
59
  }) => {
60
60
  return Cache.wrap(
@@ -1,12 +1,15 @@
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 logger from '../../utils/log';
6
9
 
7
10
  type GetProduct = {
8
11
  pk: number;
9
- searchParams?: { [key: string]: string | string[] | undefined };
12
+ searchParams?: URLSearchParams;
10
13
  groupProduct?: boolean;
11
14
  };
12
15
 
@@ -47,17 +50,9 @@ const getProductDataHandler = ({
47
50
  }
48
51
  );
49
52
 
50
- const menuItemModel = productCategoryData?.results[0]?.menuitemmodel;
51
-
52
- if (!menuItemModel) {
53
- logger.warn('menuItemModel is undefined, skipping breadcrumbData fetch', {
54
- handler: 'getProductDataHandler',
55
- pk
56
- });
57
- return { data, breadcrumbData: undefined };
58
- }
59
-
60
- const breadcrumbUrl = product.breadcrumbUrl(menuItemModel);
53
+ const breadcrumbUrl = product.breadcrumbUrl(
54
+ productCategoryData.results[0].menuitemmodel
55
+ );
61
56
 
62
57
  const breadcrumbData = await appFetch<any>(breadcrumbUrl, {
63
58
  headers: {
@@ -79,7 +74,10 @@ export const getProductData = async ({
79
74
  groupProduct
80
75
  }: GetProduct) => {
81
76
  return Cache.wrap(
82
- CacheKey[groupProduct ? 'GroupProduct' : 'Product'](pk, searchParams ?? {}),
77
+ CacheKey[groupProduct ? 'GroupProduct' : 'Product'](
78
+ pk,
79
+ searchParams ?? new URLSearchParams()
80
+ ),
83
81
  getProductDataHandler({ pk, searchParams, groupProduct }),
84
82
  {
85
83
  expire: 300
@@ -7,7 +7,7 @@ import header from '../../redux/reducers/header';
7
7
 
8
8
  const getSpecialPageDataHandler = (
9
9
  pk: number,
10
- searchParams: { [key: string]: string | string[] | undefined },
10
+ searchParams: URLSearchParams,
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: { [key: string]: string | string[] | undefined };
37
+ searchParams: URLSearchParams;
38
38
  headers?: Record<string, string>;
39
39
  }) => {
40
40
  return Cache.wrap(
package/data/urls.ts CHANGED
@@ -83,8 +83,6 @@ export const checkout = {
83
83
  setDeliveryOption: '/orders/checkout/?page=DeliveryOptionSelectionPage',
84
84
  setAddresses: '/orders/checkout/?page=AddressSelectionPage',
85
85
  setShippingOption: '/orders/checkout/?page=ShippingOptionSelectionPage',
86
- setDataSourceShippingOption:
87
- '/orders/checkout/?page=DataSourceShippingOptionSelectionPage',
88
86
  setPaymentOption: '/orders/checkout/?page=PaymentOptionSelectionPage',
89
87
  setBinNumber: '/orders/checkout/?page=BinNumberPage',
90
88
  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 { getCachedTranslations } from '../../utils/server-translation';
5
+ import { getTranslations } 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 getCachedTranslations(params.locale);
53
+ const translations = await getTranslations(params.locale);
54
54
  componentProps.translations = translations;
55
55
 
56
56
  const locale = settings.localization.locales.find(
package/hooks/index.ts CHANGED
@@ -8,5 +8,4 @@ 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';
12
- export * from './use-message-listener';
11
+ export * from './use-pagination';
@@ -18,8 +18,7 @@ export const usePaymentOptions = () => {
18
18
  pay_on_delivery: 'pz-pay-on-delivery',
19
19
  bkm_express: 'pz-bkm',
20
20
  credit_payment: 'pz-credit-payment',
21
- masterpass: 'pz-masterpass',
22
- gpay: 'pz-gpay'
21
+ masterpass: 'pz-masterpass'
23
22
  };
24
23
 
25
24
  const isInitialTypeIncluded = (type: string) => initialTypes.has(type);
package/lib/cache.ts CHANGED
@@ -20,16 +20,13 @@ const hashCacheKey = (object?: Record<string, string>) => {
20
20
  return `_${encodeURIComponent(cacheKey)}`;
21
21
  };
22
22
  export const CacheKey = {
23
- List: (
24
- searchParams: { [key: string]: string | string[] | undefined },
25
- headers?: Record<string, string>
26
- ) =>
23
+ List: (searchParams: URLSearchParams, headers?: Record<string, string>) =>
27
24
  `list_${encodeURIComponent(JSON.stringify(searchParams))}${hashCacheKey(
28
25
  headers
29
26
  )}`,
30
27
  Category: (
31
28
  pk: number,
32
- searchParams?: { [key: string]: string | string[] | undefined },
29
+ searchParams?: URLSearchParams,
33
30
  headers?: Record<string, string>
34
31
  ) =>
35
32
  `category_${pk}_${encodeURIComponent(
@@ -38,20 +35,15 @@ export const CacheKey = {
38
35
  CategorySlug: (slug: string) => `category_${slug}`,
39
36
  SpecialPage: (
40
37
  pk: number,
41
- searchParams: { [key: string]: string | string[] | undefined },
38
+ searchParams: URLSearchParams,
42
39
  headers?: Record<string, string>
43
40
  ) =>
44
41
  `special_page_${pk}_${encodeURIComponent(
45
42
  JSON.stringify(searchParams)
46
43
  )}${hashCacheKey(headers)}`,
47
- Product: (
48
- pk: number,
49
- searchParams: { [key: string]: string | string[] | undefined }
50
- ) => `product_${pk}_${encodeURIComponent(JSON.stringify(searchParams))}`,
51
- GroupProduct: (
52
- pk: number,
53
- searchParams: { [key: string]: string | string[] | undefined }
54
- ) =>
44
+ Product: (pk: number, searchParams: URLSearchParams) =>
45
+ `product_${pk}_${encodeURIComponent(JSON.stringify(searchParams))}`,
46
+ GroupProduct: (pk: number, searchParams: URLSearchParams) =>
55
47
  `group_product_${pk}_${encodeURIComponent(JSON.stringify(searchParams))}`,
56
48
  FlatPage: (pk: number) => `flat_page_${pk}`,
57
49
  LandingPage: (pk: number) => `landing_page_${pk}`,
@@ -166,10 +158,6 @@ export class Cache {
166
158
  handler: () => Promise<T>,
167
159
  options?: CacheOptions
168
160
  ): Promise<T> {
169
- if (Settings.usePrettyUrlRoute) {
170
- return await handler();
171
- }
172
-
173
161
  const requiredVariables = [
174
162
  process.env.CACHE_HOST,
175
163
  process.env.CACHE_PORT,
@@ -84,44 +84,14 @@ const withPzDefault =
84
84
  req.nextUrl.pathname.includes('/orders/hooks/') ||
85
85
  req.nextUrl.pathname.includes('/orders/checkout-with-token/')
86
86
  ) {
87
- const segment = url.searchParams.get('segment');
88
- const currency = url.searchParams.get('currency')?.toLowerCase();
89
-
90
- const headers = {};
91
-
92
- if (segment) {
93
- headers['X-Segment-Id'] = segment;
94
- }
95
-
96
- if (currency) {
97
- headers['x-currency'] = currency;
98
- }
99
-
100
- const response = NextResponse.rewrite(
87
+ return NextResponse.rewrite(
101
88
  new URL(
102
89
  `${Settings.commerceUrl}${req.nextUrl.pathname.replace(
103
90
  urlLocaleMatcherRegex,
104
91
  ''
105
92
  )}`
106
- ),
107
- {
108
- headers
109
- }
93
+ )
110
94
  );
111
-
112
- if (segment) {
113
- response.cookies.set('pz-segment', segment);
114
- }
115
-
116
- if (currency) {
117
- response.cookies.set('pz-currency', currency, {
118
- sameSite: 'none',
119
- secure: true,
120
- expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 7) // 7 days
121
- });
122
- }
123
-
124
- return response;
125
95
  }
126
96
 
127
97
  if (req.nextUrl.pathname.startsWith('/orders/redirection/')) {
@@ -233,15 +203,6 @@ const withPzDefault =
233
203
  );
234
204
  }
235
205
 
236
- if (
237
- Settings.usePrettyUrlRoute &&
238
- url.searchParams.toString().length > 0
239
- ) {
240
- url.pathname =
241
- url.pathname +
242
- `searchparams|${url.searchParams.toString()}`;
243
- }
244
-
245
206
  Settings.rewrites.forEach((rewrite) => {
246
207
  url.pathname = url.pathname.replace(
247
208
  rewrite.source,
@@ -56,10 +56,6 @@ const resolvePrettyUrl = async (pathname: string, ip: string | null) => {
56
56
  const withPrettyUrl =
57
57
  (middleware: NextMiddleware) =>
58
58
  async (req: PzNextRequest, event: NextFetchEvent) => {
59
- if (Settings.usePrettyUrlRoute) {
60
- return middleware(req, event);
61
- }
62
-
63
59
  const url = req.nextUrl.clone();
64
60
  const matchedLanguagePrefix = url.pathname.match(
65
61
  urlLocaleMatcherRegex
@@ -11,10 +11,6 @@ import { ROUTES } from 'routes';
11
11
  const withUrlRedirection =
12
12
  (middleware: NextMiddleware) =>
13
13
  async (req: PzNextRequest, event: NextFetchEvent) => {
14
- if (settings.usePrettyUrlRoute) {
15
- return middleware(req, event);
16
- }
17
-
18
14
  const url = req.nextUrl.clone();
19
15
  const ip = req.headers.get('x-forwarded-for') ?? '';
20
16
  const pathnameWithoutLocale = url.pathname.replace(
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.43.0-rc.6",
4
+ "version": "1.43.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -20,22 +20,21 @@
20
20
  "@opentelemetry/sdk-trace-node": "1.19.0",
21
21
  "@opentelemetry/semantic-conventions": "1.19.0",
22
22
  "@reduxjs/toolkit": "1.9.7",
23
- "@neshca/cache-handler": "1.5.1",
24
23
  "cross-spawn": "7.0.3",
25
24
  "generic-pool": "3.9.0",
26
25
  "react-redux": "8.1.3",
27
26
  "react-string-replace": "1.1.1",
28
- "redis": "4.6.13",
29
- "semver": "7.6.2",
27
+ "redis": "4.5.1",
28
+ "semver": "7.5.4",
30
29
  "set-cookie-parser": "2.6.0"
31
30
  },
32
31
  "devDependencies": {
33
- "@akinon/eslint-plugin-projectzero": "1.43.0-rc.6",
34
32
  "@types/react-redux": "7.1.30",
35
33
  "@types/set-cookie-parser": "2.4.7",
36
34
  "@typescript-eslint/eslint-plugin": "6.7.4",
37
35
  "@typescript-eslint/parser": "6.7.4",
38
36
  "eslint": "^8.14.0",
37
+ "@akinon/eslint-plugin-projectzero": "1.43.0",
39
38
  "eslint-config-prettier": "8.5.0"
40
39
  }
41
40
  }
package/plugins.d.ts CHANGED
@@ -12,7 +12,6 @@ declare module '@akinon/pz-masterpass/src/utils' {
12
12
  declare module '@akinon/pz-masterpass/src/redux/reducer' {
13
13
  export const setError: any;
14
14
  export const setOtpModalVisible: any;
15
- export const setCvcRequired: any;
16
15
  }
17
16
 
18
17
  declare module '@akinon/pz-otp' {
@@ -16,7 +16,6 @@ import {
16
16
  setPreOrder,
17
17
  setRetailStores,
18
18
  setShippingOptions,
19
- setDataSourceShippingOptions,
20
19
  setShippingStepCompleted,
21
20
  setCreditPaymentOptions
22
21
  } from '../../redux/reducers/checkout';
@@ -27,11 +26,10 @@ import { getCookie, setCookie } from '../../utils';
27
26
  import settings from 'settings';
28
27
  import { LocaleUrlStrategy } from '../../localization';
29
28
  import { showMobile3dIframe } from '../../utils/mobile-3d-iframe';
30
- import { showRedirectionIframe } from '../../utils/redirection-iframe';
31
29
 
32
30
  interface CheckoutResult {
33
31
  payload: {
34
- errors?: Record<string, string[]>;
32
+ errors?: any;
35
33
  pre_order?: PreOrder;
36
34
  context_list?: CheckoutContext[];
37
35
  };
@@ -75,7 +73,6 @@ export const preOrderMiddleware: Middleware = ({
75
73
  deliveryOptions,
76
74
  addressList: addresses,
77
75
  shippingOptions,
78
- dataSourceShippingOptions,
79
76
  paymentOptions,
80
77
  installmentOptions
81
78
  } = getState().checkout;
@@ -128,22 +125,6 @@ export const preOrderMiddleware: Middleware = ({
128
125
  dispatch(apiEndpoints.setShippingOption.initiate(shippingOptions[0].pk));
129
126
  }
130
127
 
131
- if (
132
- dataSourceShippingOptions.length > 0 &&
133
- !preOrder.data_source_shipping_options
134
- ) {
135
- const selectedDataSourceShippingOptionsPks =
136
- dataSourceShippingOptions.map(
137
- (opt) => opt.data_source_shipping_options[0].pk
138
- );
139
-
140
- dispatch(
141
- apiEndpoints.setDataSourceShippingOptions.initiate(
142
- selectedDataSourceShippingOptionsPks
143
- )
144
- );
145
- }
146
-
147
128
  if (!preOrder.payment_option && paymentOptions.length > 0) {
148
129
  dispatch(apiEndpoints.setPaymentOption.initiate(paymentOptions[0].pk));
149
130
  }
@@ -182,7 +163,6 @@ export const contextListMiddleware: Middleware = ({
182
163
  if (result?.payload?.context_list) {
183
164
  result.payload.context_list.forEach((context) => {
184
165
  const redirectUrl = context.page_context.redirect_url;
185
- const isIframe = context.page_context.is_frame ?? false;
186
166
 
187
167
  if (redirectUrl) {
188
168
  const currentLocale = getCookie('pz-locale');
@@ -201,19 +181,16 @@ export const contextListMiddleware: Middleware = ({
201
181
  }
202
182
 
203
183
  const urlObj = new URL(url, window.location.origin);
204
- const isMobileDevice =
205
- isMobileApp ||
206
- /iPad|iPhone|iPod|Android/i.test(navigator.userAgent);
207
- const isIframePaymentOptionExcluded =
208
- !settings.checkout?.iframeExcludedPaymentOptions?.includes(
209
- result.payload?.pre_order?.payment_option?.slug
210
- );
211
184
  urlObj.searchParams.set('t', new Date().getTime().toString());
212
185
 
213
- if (isMobileDevice && !isIframePaymentOptionExcluded) {
186
+ if (
187
+ (isMobileApp ||
188
+ /iPad|iPhone|iPod|Android/i.test(navigator.userAgent)) &&
189
+ !settings.checkout?.iframeExcludedPaymentOptions?.includes(
190
+ result.payload?.pre_order?.payment_option?.slug
191
+ )
192
+ ) {
214
193
  showMobile3dIframe(urlObj.toString());
215
- } else if (isIframe && !isIframePaymentOptionExcluded) {
216
- showRedirectionIframe(urlObj.toString());
217
194
  } else {
218
195
  window.location.href = urlObj.toString();
219
196
  }
@@ -243,20 +220,12 @@ export const contextListMiddleware: Middleware = ({
243
220
  dispatch(setShippingOptions(context.page_context.shipping_options));
244
221
  }
245
222
 
246
- if (context.page_context.data_sources) {
247
- dispatch(
248
- setDataSourceShippingOptions(context.page_context.data_sources)
249
- );
250
- }
251
-
252
223
  if (context.page_context.payment_options) {
253
224
  dispatch(setPaymentOptions(context.page_context.payment_options));
254
225
  }
255
226
 
256
227
  if (context.page_context.credit_payment_options) {
257
- dispatch(
258
- setCreditPaymentOptions(context.page_context.credit_payment_options)
259
- );
228
+ dispatch(setCreditPaymentOptions(context.page_context.credit_payment_options));
260
229
  }
261
230
 
262
231
  if (context.page_context.payment_choices) {
@@ -14,12 +14,12 @@ import {
14
14
  CheckoutCreditPaymentOption,
15
15
  PreOrder,
16
16
  RetailStore,
17
- ShippingOption,
18
- DataSource
17
+ ShippingOption
19
18
  } from '../../types';
20
19
 
21
20
  export interface CheckoutState {
22
- errors: Record<string, string[]>;
21
+ // TODO: Add types
22
+ errors: any;
23
23
  hasGiftBox: boolean;
24
24
  canGuestPurchase: boolean;
25
25
  steps: {
@@ -37,7 +37,6 @@ export interface CheckoutState {
37
37
  addressList: Address[];
38
38
  deliveryOptions: DeliveryOption[];
39
39
  shippingOptions: ShippingOption[];
40
- dataSourceShippingOptions: DataSource[];
41
40
  paymentOptions: PaymentOption[];
42
41
  creditPaymentOptions: CheckoutCreditPaymentOption[];
43
42
  selectedCreditPaymentPk: number;
@@ -69,7 +68,6 @@ const initialState: CheckoutState = {
69
68
  addressList: [],
70
69
  deliveryOptions: [],
71
70
  shippingOptions: [],
72
- dataSourceShippingOptions: [],
73
71
  paymentOptions: [],
74
72
  creditPaymentOptions: [],
75
73
  selectedCreditPaymentPk: null,
@@ -124,9 +122,6 @@ const checkoutSlice = createSlice({
124
122
  setShippingOptions(state, { payload }) {
125
123
  state.shippingOptions = payload;
126
124
  },
127
- setDataSourceShippingOptions(state, { payload }) {
128
- state.dataSourceShippingOptions = payload;
129
- },
130
125
  setPaymentOptions(state, { payload }) {
131
126
  state.paymentOptions = payload;
132
127
  },
@@ -174,7 +169,6 @@ export const {
174
169
  setAddressList,
175
170
  setDeliveryOptions,
176
171
  setShippingOptions,
177
- setDataSourceShippingOptions,
178
172
  setPaymentOptions,
179
173
  setCreditPaymentOptions,
180
174
  setSelectedCreditPaymentPk,
@@ -6,8 +6,6 @@ import { Config } from '../../types';
6
6
  const initialState: Config = {
7
7
  user_phone_regex: '^(05)\\d{9}$',
8
8
  user_phone_format: '05999999999',
9
- user_post_code_regex: '^\\d{5}$',
10
- user_post_code_format: '99999',
11
9
  country: {
12
10
  pk: 1,
13
11
  name: 'Türkiye',
@@ -61,5 +61,4 @@ export type ContactFormType = {
61
61
  order?: string;
62
62
  country_code?: string;
63
63
  order_needed?: boolean;
64
- file?: FileList
65
64
  };
@@ -17,7 +17,7 @@ export type AddressFormType = {
17
17
  line: string;
18
18
  postcode: string;
19
19
  company_name?: string;
20
- tax_no?: string;
20
+ tax_no?: number;
21
21
  tax_office?: string;
22
22
  e_bill_taxpayer?: boolean;
23
23
  country_code?: string;
@@ -33,23 +33,6 @@ export interface ShippingOption {
33
33
  slug: string;
34
34
  }
35
35
 
36
- export interface DataSource {
37
- pk: number;
38
- name: string;
39
- data_source_shipping_options: DataSourceShippingOption[];
40
- }
41
-
42
- export interface DataSourceShippingOption {
43
- pk: number;
44
- shipping_amount: string;
45
- shipping_option_name: string;
46
- shipping_option_logo: string | null;
47
- data_source: {
48
- pk: number;
49
- title: string | null;
50
- };
51
- }
52
-
53
36
  export interface CheckoutAddressType {
54
37
  label: string;
55
38
  text: string;
@@ -95,7 +78,6 @@ export interface PreOrder {
95
78
  retail_store?: RetailStore;
96
79
  gift_box?: GiftBox;
97
80
  credit_payment_option?: CheckoutCreditPaymentOption;
98
- data_source_shipping_options: any;
99
81
  }
100
82
 
101
83
  export interface GuestLoginFormParams {
@@ -2,8 +2,6 @@ import { District } from './address';
2
2
  export interface Config {
3
3
  user_phone_regex: string;
4
4
  user_phone_format: string;
5
- user_post_code_regex: string;
6
- user_post_code_format: string;
7
5
  country: {
8
6
  pk: number;
9
7
  name: string;
@@ -52,10 +52,6 @@ export interface OrderItem {
52
52
  quantity: string;
53
53
  unit_price: string;
54
54
  total_amount: string;
55
- attributes: {
56
- gift_note: string;
57
- [key: string]: any;
58
- };
59
55
  }
60
56
 
61
57
  export interface Order {
@@ -109,14 +105,6 @@ export interface Order {
109
105
  shipping_option: number;
110
106
  tracking_number: string;
111
107
  tracking_url: string;
112
- [key: string]: any;
113
- bank: {
114
- pk: number;
115
- name: string;
116
- slug: string;
117
- logo: string;
118
- [key: string]: any;
119
- };
120
108
  }
121
109
 
122
110
  export interface Quotations {