@akinon/next 1.123.0-rc.0 → 1.123.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,28 +1,16 @@
1
1
  # @akinon/next
2
2
 
3
- ## 1.123.0-rc.0
3
+ ## 1.123.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
7
  - 8218dafa: ZERO-4160: Refactor oauth-login middleware to use fetch for login and callback responses
8
- - ZERO-4160: Enhance oauth-login middleware with improved request handling and logging
9
- - b55acb76: ZERO-2577: Fix pagination bug and update usePagination hook and ensure pagination controls rendering correctly
8
+ - 2a8ddcf6: ZERO-4111: Add total balance field to store credit localization and update related components
10
9
  - 8a7fd0f4: ZERO-4065: Add '[segment]' to skipSegments in route generation
11
- - 760258c1: ZERO-4160: Enhance oauth-login middleware to handle fetch errors and improve response handling
12
10
  - 36143125: ZERO-3987: Add barcode scanner functionality with modal and button
13
11
  - f7e0f646: ZERO-4032: Add bfcache-headers middleware, integrate it into the default chain, and introduce a new environment variable for control.
14
12
  - 94a86fcc: ZERO-4065: Expand skipSegments array to include additional segments for route generation
15
- - 143be2b9: ZERO-3457: Crop styles are customizable and logic improved for rendering similar products modal
16
13
  - bcaad120: ZERO-4158: Add logging for OAuth login and callback redirects
17
- - cd68a97a: ZERO-4126: Enhance error handling in appFetch and related data handlers to throw notFound on 404 and 422 errors
18
- - 9f8cd3bc: ZERO-3449: AI Search Active Filters & Crop Style changes have been implemented
19
- - bfafa3f4: ZERO-4160: Refactor oauth-login middleware to use fetchCommerce for API calls and improve cookie handling
20
- - d99a6a7d: ZERO-3457_1: Fixed the settings prop and made sure everything is customizable.
21
- - 591e345e: ZERO-3855: Enhance credit card payment handling in checkout middlewares
22
- - 4de5303c: ZERO-2504: add cookie filter to api client request
23
- - 95b139dc: ZERO-3795: Remove duplicate entry for SavedCard in PluginComponents map
24
- - 3909d322: Edit the duplicate Plugin.SimilarProducts in the plugin-module.
25
- - e18836b2: ZERO-4160: Restore scope in Sentry addon configuration in akinon.json
26
14
 
27
15
  ## 1.122.0
28
16
 
@@ -114,6 +114,7 @@ const PluginComponents = new Map([
114
114
  ]
115
115
  ],
116
116
  [Plugin.SavedCard, [Component.SavedCard, Component.IyzicoSavedCard]],
117
+ [Plugin.SavedCard, [Component.SavedCard]],
117
118
  [Plugin.FlowPayment, [Component.FlowPayment]],
118
119
  [
119
120
  Plugin.VirtualTryOn,
@@ -7,6 +7,7 @@ import {
7
7
  AccountOrderCancellation,
8
8
  AccountOrderCancellationReason,
9
9
  ContactFormType,
10
+ LoyaltyBalanceItem,
10
11
  Order,
11
12
  Quotations
12
13
  } from '../../types';
@@ -220,7 +221,10 @@ const accountApi = api.injectEndpoints({
220
221
  method: 'PATCH'
221
222
  })
222
223
  }),
223
- getLoyaltyBalance: builder.query<{ balance: number }, void>({
224
+ getLoyaltyBalance: builder.query<
225
+ { balance: number; balances?: LoyaltyBalanceItem[] },
226
+ void
227
+ >({
224
228
  query: () => buildClientRequestUrl(account.loyaltyBalance)
225
229
  }),
226
230
  getLoyaltyTransactions: builder.query<LoyaltyTransactions, void>({
@@ -10,6 +10,7 @@ import {
10
10
  } from '../../redux/reducers/checkout';
11
11
  import {
12
12
  CheckoutContext,
13
+ AccountUsage,
13
14
  ExtraField,
14
15
  GuestLoginFormParams,
15
16
  Order,
@@ -776,16 +777,28 @@ export const checkoutApi = api.injectEndpoints({
776
777
  url: buildCheckoutRequestUrl(checkout.loyaltyMoneyUsage)
777
778
  })
778
779
  }),
779
- payWithLoyaltyBalance: build.mutation<any, string>({
780
- query: (amount) => ({
781
- url: buildCheckoutRequestUrl(checkout.loyaltyMoneyUsage, {
782
- useFormData: true
783
- }),
784
- method: 'POST',
785
- body: {
786
- loyalty_amount_to_use: amount
787
- }
788
- }),
780
+ payWithLoyaltyBalance: build.mutation<
781
+ any,
782
+ string | { account_usages: AccountUsage[] }
783
+ >({
784
+ query: (params) => {
785
+ const isAccountUsages =
786
+ typeof params === 'object' && 'account_usages' in params;
787
+
788
+ return {
789
+ url: buildCheckoutRequestUrl(checkout.loyaltyMoneyUsage, {
790
+ useFormData: true
791
+ }),
792
+ method: 'POST',
793
+ body: isAccountUsages
794
+ ? {
795
+ account_usages: JSON.stringify(params.account_usages)
796
+ }
797
+ : {
798
+ loyalty_amount_to_use: params
799
+ }
800
+ };
801
+ },
789
802
  async onQueryStarted(arg, { dispatch, queryFulfilled }) {
790
803
  dispatch(setPaymentStepBusy(true));
791
804
  dispatch(setPaymentOptions([]));
package/data/urls.ts CHANGED
@@ -183,11 +183,7 @@ export const product = {
183
183
  breadcrumbUrl: (menuitemmodel: string) =>
184
184
  `/menus/generate_breadcrumb/?item=${menuitemmodel}&generator_name=menu_item`,
185
185
  bundleProduct: (productPk: string, queryString: string) =>
186
- `/bundle-product/${productPk}/?${queryString}`,
187
- similarProducts: (params?: string) =>
188
- `/similar-products${params ? `?${params}` : ''}`,
189
- similarProductsList: (params?: string) =>
190
- `/similar-product-list${params ? `?${params}` : ''}`
186
+ `/bundle-product/${productPk}/?${queryString}`
191
187
  };
192
188
 
193
189
  export const wishlist = {
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.123.0-rc.0",
4
+ "version": "1.123.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -35,7 +35,7 @@
35
35
  "set-cookie-parser": "2.6.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@akinon/eslint-plugin-projectzero": "1.123.0-rc.0",
38
+ "@akinon/eslint-plugin-projectzero": "1.123.0",
39
39
  "@babel/core": "7.26.10",
40
40
  "@babel/preset-env": "7.26.9",
41
41
  "@babel/preset-typescript": "7.27.0",
package/plugins.d.ts CHANGED
@@ -37,16 +37,6 @@ declare module '@akinon/pz-cybersource-uc/src/redux/middleware' {
37
37
  export default middleware as any;
38
38
  }
39
39
 
40
- declare module '@akinon/pz-apple-pay' {}
41
-
42
- declare module '@akinon/pz-similar-products' {
43
- export const SimilarProductsModal: any;
44
- export const SimilarProductsFilterSidebar: any;
45
- export const SimilarProductsResultsGrid: any;
46
- export const SimilarProductsPlugin: any;
47
- export const SimilarProductsButtonPlugin: any;
48
- }
49
-
50
40
  declare module '@akinon/pz-cybersource-uc/src/redux/reducer' {
51
41
  export default reducer as any;
52
42
  }
package/plugins.js CHANGED
@@ -16,7 +16,6 @@ module.exports = [
16
16
  'pz-tabby-extension',
17
17
  'pz-apple-pay',
18
18
  'pz-tamara-extension',
19
- 'pz-similar-products',
20
19
  'pz-cybersource-uc',
21
20
  'pz-hepsipay',
22
21
  'pz-flow-payment',
@@ -14,6 +14,7 @@ import {
14
14
  setHasGiftBox,
15
15
  setInstallmentOptions,
16
16
  setLoyaltyBalance,
17
+ setLoyaltyBalances,
17
18
  setPaymentChoices,
18
19
  setPaymentOptions,
19
20
  setRetailStores,
@@ -208,25 +209,15 @@ export const contextListMiddleware: Middleware = ({
208
209
  (ctx) => ctx.page_name === 'DeliveryOptionSelectionPage'
209
210
  )
210
211
  ) {
211
- const isCreditCardPayment =
212
- preOrder?.payment_option?.payment_type === 'credit_card' ||
213
- preOrder?.payment_option?.payment_type === 'masterpass';
214
-
215
212
  if (context.page_context.card_type) {
216
213
  dispatch(setCardType(context.page_context.card_type));
217
- } else if (isCreditCardPayment) {
218
- dispatch(setCardType(null));
219
214
  }
220
215
 
221
216
  if (
222
217
  context.page_context.installments &&
223
218
  preOrder?.payment_option?.payment_type !== 'masterpass_rest'
224
219
  ) {
225
- if (!isCreditCardPayment || context.page_context.card_type) {
226
- dispatch(
227
- setInstallmentOptions(context.page_context.installments)
228
- );
229
- }
220
+ dispatch(setInstallmentOptions(context.page_context.installments));
230
221
  }
231
222
  }
232
223
 
@@ -234,6 +225,14 @@ export const contextListMiddleware: Middleware = ({
234
225
  dispatch(setLoyaltyBalance(context.page_context.balance));
235
226
  }
236
227
 
228
+ if (context.page_context.balances) {
229
+ dispatch(setLoyaltyBalances(context.page_context.balances));
230
+ }
231
+
232
+ if (context.page_context.accounts) {
233
+ dispatch(setLoyaltyBalances(context.page_context.accounts));
234
+ }
235
+
237
236
  if (context.page_context.retail_stores) {
238
237
  dispatch(setRetailStores(context.page_context.retail_stores));
239
238
  }
@@ -14,17 +14,9 @@ export const installmentOptionMiddleware: Middleware = ({
14
14
  return result;
15
15
  }
16
16
 
17
- const { installmentOptions, cardType } = getState().checkout;
17
+ const { installmentOptions } = getState().checkout;
18
18
  const { endpoints: apiEndpoints } = checkoutApi;
19
19
 
20
- const isCreditCardPayment =
21
- preOrder?.payment_option?.payment_type === 'credit_card' ||
22
- preOrder?.payment_option?.payment_type === 'masterpass';
23
-
24
- if (isCreditCardPayment && !cardType) {
25
- return result;
26
- }
27
-
28
20
  if (
29
21
  !preOrder?.installment &&
30
22
  preOrder?.payment_option?.payment_type !== 'saved_card' &&
@@ -9,6 +9,7 @@ import {
9
9
  CreditCardType,
10
10
  DeliveryOption,
11
11
  InstallmentOption,
12
+ LoyaltyBalanceItem,
12
13
  PaymentChoice,
13
14
  PaymentOption,
14
15
  CheckoutCreditPaymentOption,
@@ -49,6 +50,7 @@ export interface CheckoutState {
49
50
  bankAccounts: BankAccount[];
50
51
  selectedBankAccountPk: number;
51
52
  loyaltyBalance?: string;
53
+ loyaltyBalances?: LoyaltyBalanceItem[];
52
54
  retailStores: RetailStore[];
53
55
  attributeBasedShippingOptions: AttributeBasedShippingOption[];
54
56
  selectedShippingOptions: Record<string, number>;
@@ -188,6 +190,9 @@ const checkoutSlice = createSlice({
188
190
  setLoyaltyBalance(state, { payload }) {
189
191
  state.loyaltyBalance = payload;
190
192
  },
193
+ setLoyaltyBalances(state, { payload }) {
194
+ state.loyaltyBalances = payload;
195
+ },
191
196
  setRetailStores(state, { payload }) {
192
197
  state.retailStores = payload;
193
198
  },
@@ -234,6 +239,7 @@ export const {
234
239
  setBankAccounts,
235
240
  setSelectedBankAccountPk,
236
241
  setLoyaltyBalance,
242
+ setLoyaltyBalances,
237
243
  setRetailStores,
238
244
  setAttributeBasedShippingOptions,
239
245
  setSelectedShippingOptions,
@@ -67,6 +67,18 @@ export interface CheckoutPaymentOption {
67
67
  viewProps?: any;
68
68
  }
69
69
 
70
+ export interface LoyaltyBalanceItem {
71
+ label_id: number | null;
72
+ label: string | null;
73
+ balance: string;
74
+ currency?: string;
75
+ }
76
+
77
+ export interface AccountUsage {
78
+ label_id: number | null;
79
+ amount: number;
80
+ }
81
+
70
82
  export interface GiftBox {
71
83
  note: string;
72
84
  gift_video: boolean;
@@ -90,6 +102,7 @@ export interface PreOrder {
90
102
  notes?: string;
91
103
  user_phone_number?: string;
92
104
  loyalty_money?: string;
105
+ loyalty_account_usages?: AccountUsage[];
93
106
  currency_type_label?: string;
94
107
  is_guest?: boolean;
95
108
  is_post_order?: boolean;
@@ -150,6 +163,8 @@ export interface CheckoutContext {
150
163
  redirect_url?: string;
151
164
  context_data?: any;
152
165
  balance?: string;
166
+ balances?: LoyaltyBalanceItem[];
167
+ accounts?: LoyaltyBalanceItem[];
153
168
  attribute_based_shipping_options?: AttributeBasedShippingOption[];
154
169
  paymentData?: any;
155
170
  paymentMethod?: string;
package/types/index.ts CHANGED
@@ -83,12 +83,6 @@ export interface Settings {
83
83
  };
84
84
  usePrettyUrlRoute?: boolean;
85
85
  commerceUrl: string;
86
- /**
87
- * This option allows you to track Sentry events on the client side, in addition to server and edge environments.
88
- *
89
- * It overrides process.env.NEXT_PUBLIC_SENTRY_DSN and process.env.SENTRY_DSN.
90
- */
91
- sentryDsn?: string;
92
86
  redis: {
93
87
  defaultExpirationTime: number;
94
88
  };
@@ -2,7 +2,6 @@ import Settings from 'settings';
2
2
  import logger from '../utils/log';
3
3
  import { headers, cookies } from 'next/headers';
4
4
  import { ServerVariables } from './server-variables';
5
- import { notFound } from 'next/navigation';
6
5
 
7
6
  export enum FetchResponseType {
8
7
  JSON = 'json',
@@ -61,15 +60,13 @@ const appFetch = async <T>({
61
60
  status = req.status;
62
61
  logger.debug(`FETCH END ${url}`, { status: req.status, ip });
63
62
 
64
- if (req.ok) {
65
- if (responseType === FetchResponseType.JSON) {
66
- response = (await req.json()) as T;
67
- } else {
68
- response = (await req.text()) as unknown as T;
69
- }
70
-
71
- logger.trace(`FETCH RESPONSE`, { url, response, ip });
63
+ if (responseType === FetchResponseType.JSON) {
64
+ response = (await req.json()) as T;
65
+ } else {
66
+ response = (await req.text()) as unknown as T;
72
67
  }
68
+
69
+ logger.trace(`FETCH RESPONSE`, { url, response, ip });
73
70
  } catch (error) {
74
71
  const logType = status === 500 ? 'fatal' : 'error';
75
72
 
@@ -78,10 +75,6 @@ const appFetch = async <T>({
78
75
  }
79
76
  }
80
77
 
81
- if (status === 422) {
82
- notFound();
83
- }
84
-
85
78
  return response;
86
79
  };
87
80