@akinon/next 1.119.0-rc.3 → 1.119.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 +1 -64
- package/bin/pz-generate-routes.js +1 -10
- package/components/plugin-module.tsx +2 -2
- package/data/client/account.ts +1 -12
- package/data/client/checkout.ts +70 -100
- package/data/urls.ts +1 -5
- package/lib/cache-handler.mjs +2 -8
- package/lib/cache.ts +3 -8
- package/middlewares/complete-gpay.ts +5 -6
- package/middlewares/complete-masterpass.ts +5 -6
- package/middlewares/complete-wallet.ts +5 -6
- package/middlewares/default.ts +19 -62
- package/middlewares/index.ts +1 -3
- package/middlewares/masterpass-rest-callback.ts +8 -13
- package/middlewares/redirection-payment.ts +5 -6
- package/middlewares/saved-card-redirection.ts +5 -6
- package/middlewares/three-d-redirection.ts +5 -6
- package/middlewares/wallet-complete-redirection.ts +5 -6
- package/package.json +2 -2
- package/plugins.d.ts +0 -10
- package/plugins.js +0 -1
- package/redux/middlewares/checkout.ts +1 -11
- package/redux/middlewares/pre-order/installment-option.ts +1 -9
- package/types/index.ts +0 -6
- package/utils/app-fetch.ts +6 -13
- package/utils/index.ts +1 -21
- package/utils/mobile-3d-iframe.ts +2 -8
- package/utils/redirection-iframe.ts +2 -8
- package/with-pz-config.js +4 -1
- package/api/barcode-search.ts +0 -59
- package/middlewares/bfcache-headers.ts +0 -18
- package/utils/get-checkout-path.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,69 +1,6 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
-
## 1.119.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- cd68a97a: ZERO-4126: Enhance error handling in appFetch and related data handlers to throw notFound on 404 and 422 errors
|
|
8
|
-
|
|
9
|
-
## 1.119.0-rc.2
|
|
10
|
-
|
|
11
|
-
### Minor Changes
|
|
12
|
-
|
|
13
|
-
- 31b4a266: ZERO-4102: Add support for post-checkout redirect in middleware
|
|
14
|
-
- d2c0e759: ZERO-3684: Handle cross-origin iframe access in iframeURLChange function
|
|
15
|
-
- aef81c5d: ZERO-4034: Refactor checkout API to use dynamic store imports for improved performance
|
|
16
|
-
- b55acb76: ZERO-2577: Fix pagination bug and update usePagination hook and ensure pagination controls rendering correctly
|
|
17
|
-
- 8a7fd0f4: ZERO-4065: Add '[segment]' to skipSegments in route generation
|
|
18
|
-
- 36143125: ZERO-3987: Add barcode scanner functionality with modal and button
|
|
19
|
-
- 0754c835: ZERO-4063: Add support for optional Redis password in cache handlers
|
|
20
|
-
- f7e0f646: ZERO-4032: Add bfcache-headers middleware, integrate it into the default chain, and introduce a new environment variable for control.
|
|
21
|
-
- 94a86fcc: ZERO-4065: Expand skipSegments array to include additional segments for route generation
|
|
22
|
-
- 143be2b9: ZERO-3457: Crop styles are customizable and logic improved for rendering similar products modal
|
|
23
|
-
- 9f8cd3bc: ZERO-3449: AI Search Active Filters & Crop Style changes have been implemented
|
|
24
|
-
- 49c82e1a: ZERO-4047: Remove Sentry configuration from default Next.js config
|
|
25
|
-
- a9f5cdb1: ZERO-4102: Fix post-checkout condition to additionally check for empty search parameters.
|
|
26
|
-
- d99a6a7d: ZERO-3457_1: Fixed the settings prop and made sure everything is customizable.
|
|
27
|
-
- d7e5178b: ZERO-3985: Add query string handling for orders redirection in middleware
|
|
28
|
-
- 591e345e: ZERO-3855: Enhance credit card payment handling in checkout middlewares
|
|
29
|
-
- 01ee41f1: ZERO-4102: Implement a post-checkout flow by dynamically determining checkout paths and managing a pz-post-checkout-flow cookie.
|
|
30
|
-
- 4de5303c: ZERO-2504: add cookie filter to api client request
|
|
31
|
-
- b59fdd1c: ZERO-4009: Add password reset token validation
|
|
32
|
-
- 95b139dc: ZERO-3795: Remove duplicate entry for SavedCard in PluginComponents map
|
|
33
|
-
- c6c5c1cd: ZERO-4128: Use cookies API for pz-pos-error to ensure delivery on 303 redirects
|
|
34
|
-
- 3909d322: Edit the duplicate Plugin.SimilarProducts in the plugin-module.
|
|
35
|
-
|
|
36
|
-
## 1.119.0-rc.1
|
|
37
|
-
|
|
38
|
-
### Minor Changes
|
|
39
|
-
|
|
40
|
-
- c6c5c1cd: ZERO-4128: Use cookies API for pz-pos-error to ensure delivery on 303 redirects
|
|
41
|
-
|
|
42
|
-
## 1.119.0-rc.0
|
|
43
|
-
|
|
44
|
-
### Minor Changes
|
|
45
|
-
|
|
46
|
-
- 31b4a266: ZERO-4102: Add support for post-checkout redirect in middleware
|
|
47
|
-
- d2c0e759: ZERO-3684: Handle cross-origin iframe access in iframeURLChange function
|
|
48
|
-
- aef81c5d: ZERO-4034: Refactor checkout API to use dynamic store imports for improved performance
|
|
49
|
-
- b55acb76: ZERO-2577: Fix pagination bug and update usePagination hook and ensure pagination controls rendering correctly
|
|
50
|
-
- 8a7fd0f4: ZERO-4065: Add '[segment]' to skipSegments in route generation
|
|
51
|
-
- 36143125: ZERO-3987: Add barcode scanner functionality with modal and button
|
|
52
|
-
- 0754c835: ZERO-4063: Add support for optional Redis password in cache handlers
|
|
53
|
-
- f7e0f646: ZERO-4032: Add bfcache-headers middleware, integrate it into the default chain, and introduce a new environment variable for control.
|
|
54
|
-
- 94a86fcc: ZERO-4065: Expand skipSegments array to include additional segments for route generation
|
|
55
|
-
- 143be2b9: ZERO-3457: Crop styles are customizable and logic improved for rendering similar products modal
|
|
56
|
-
- 9f8cd3bc: ZERO-3449: AI Search Active Filters & Crop Style changes have been implemented
|
|
57
|
-
- 49c82e1a: ZERO-4047: Remove Sentry configuration from default Next.js config
|
|
58
|
-
- a9f5cdb1: ZERO-4102: Fix post-checkout condition to additionally check for empty search parameters.
|
|
59
|
-
- d99a6a7d: ZERO-3457_1: Fixed the settings prop and made sure everything is customizable.
|
|
60
|
-
- d7e5178b: ZERO-3985: Add query string handling for orders redirection in middleware
|
|
61
|
-
- 591e345e: ZERO-3855: Enhance credit card payment handling in checkout middlewares
|
|
62
|
-
- 01ee41f1: ZERO-4102: Implement a post-checkout flow by dynamically determining checkout paths and managing a pz-post-checkout-flow cookie.
|
|
63
|
-
- 4de5303c: ZERO-2504: add cookie filter to api client request
|
|
64
|
-
- b59fdd1c: ZERO-4009: Add password reset token validation
|
|
65
|
-
- 95b139dc: ZERO-3795: Remove duplicate entry for SavedCard in PluginComponents map
|
|
66
|
-
- 3909d322: Edit the duplicate Plugin.SimilarProducts in the plugin-module.
|
|
3
|
+
## 1.119.0
|
|
67
4
|
|
|
68
5
|
## 1.118.0
|
|
69
6
|
|
|
@@ -25,16 +25,7 @@ const generateRoutes = () => {
|
|
|
25
25
|
const routes = [];
|
|
26
26
|
const excludedDirs = ['api', 'pz-not-found'];
|
|
27
27
|
|
|
28
|
-
const skipSegments = [
|
|
29
|
-
'[commerce]',
|
|
30
|
-
'[locale]',
|
|
31
|
-
'[currency]',
|
|
32
|
-
'[session]',
|
|
33
|
-
'[segment]',
|
|
34
|
-
'[url]',
|
|
35
|
-
'[theme]',
|
|
36
|
-
'[member_type]'
|
|
37
|
-
];
|
|
28
|
+
const skipSegments = ['[commerce]', '[locale]', '[currency]'];
|
|
38
29
|
const skipCatchAllRoutes = ['[...prettyurl]', '[...not_found]'];
|
|
39
30
|
|
|
40
31
|
const walkDirectory = (dir, basePath = '') => {
|
|
@@ -55,7 +55,6 @@ export enum Component {
|
|
|
55
55
|
SavedCard = 'SavedCardOption',
|
|
56
56
|
VirtualTryOnPlugin = 'VirtualTryOnPlugin',
|
|
57
57
|
BasketVirtualTryOn = 'BasketVirtualTryOn',
|
|
58
|
-
BarcodeScannerPlugin = 'BarcodeScannerPlugin',
|
|
59
58
|
IyzicoSavedCard = 'IyzicoSavedCardOption',
|
|
60
59
|
Hepsipay = 'Hepsipay',
|
|
61
60
|
FlowPayment = 'FlowPayment',
|
|
@@ -114,10 +113,11 @@ const PluginComponents = new Map([
|
|
|
114
113
|
]
|
|
115
114
|
],
|
|
116
115
|
[Plugin.SavedCard, [Component.SavedCard, Component.IyzicoSavedCard]],
|
|
116
|
+
[Plugin.SavedCard, [Component.SavedCard]],
|
|
117
117
|
[Plugin.FlowPayment, [Component.FlowPayment]],
|
|
118
118
|
[
|
|
119
119
|
Plugin.VirtualTryOn,
|
|
120
|
-
[Component.VirtualTryOnPlugin, Component.BasketVirtualTryOn
|
|
120
|
+
[Component.VirtualTryOnPlugin, Component.BasketVirtualTryOn]
|
|
121
121
|
],
|
|
122
122
|
[Plugin.Hepsipay, [Component.Hepsipay]],
|
|
123
123
|
[Plugin.MasterpassRest, [Component.MasterpassRest]],
|
package/data/client/account.ts
CHANGED
|
@@ -77,10 +77,6 @@ interface LoyaltyTransactions {
|
|
|
77
77
|
}[];
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
interface PasswordResetValidateResponse {
|
|
81
|
-
validlink: boolean;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
80
|
const accountApi = api.injectEndpoints({
|
|
85
81
|
endpoints: (builder) => ({
|
|
86
82
|
updatePassword: builder.mutation<void, AccountChangePasswordFormType>({
|
|
@@ -225,12 +221,6 @@ const accountApi = api.injectEndpoints({
|
|
|
225
221
|
}),
|
|
226
222
|
getLoyaltyTransactions: builder.query<LoyaltyTransactions, void>({
|
|
227
223
|
query: () => buildClientRequestUrl(account.loyaltyTransactions)
|
|
228
|
-
}),
|
|
229
|
-
getValidatePasswordResetToken: builder.query<
|
|
230
|
-
PasswordResetValidateResponse,
|
|
231
|
-
string
|
|
232
|
-
>({
|
|
233
|
-
query: (slug) => buildClientRequestUrl(account.passwordReset(slug))
|
|
234
224
|
})
|
|
235
225
|
}),
|
|
236
226
|
overrideExisting: true
|
|
@@ -257,6 +247,5 @@ export const {
|
|
|
257
247
|
usePasswordResetMutation,
|
|
258
248
|
useAnonymizeMutation,
|
|
259
249
|
useGetLoyaltyBalanceQuery,
|
|
260
|
-
useGetLoyaltyTransactionsQuery
|
|
261
|
-
useGetValidatePasswordResetTokenQuery
|
|
250
|
+
useGetLoyaltyTransactionsQuery
|
|
262
251
|
} = accountApi;
|
package/data/client/checkout.ts
CHANGED
|
@@ -17,10 +17,10 @@ import {
|
|
|
17
17
|
SendSmsType,
|
|
18
18
|
VerifySmsType
|
|
19
19
|
} from '../../types';
|
|
20
|
-
import { buildClientRequestUrl
|
|
20
|
+
import { buildClientRequestUrl } from '../../utils';
|
|
21
21
|
import { api } from './api';
|
|
22
22
|
import { checkout } from '../urls';
|
|
23
|
-
import
|
|
23
|
+
import { AppDispatch, AppStore, store } from 'redux/store';
|
|
24
24
|
import settings from 'settings';
|
|
25
25
|
import { showMobile3dIframe } from '../../utils/mobile-3d-iframe';
|
|
26
26
|
import {
|
|
@@ -33,11 +33,6 @@ import {
|
|
|
33
33
|
buildPurchaseForm
|
|
34
34
|
} from '@akinon/pz-masterpass/src/utils';
|
|
35
35
|
|
|
36
|
-
const getStore = async (): Promise<AppStore> => {
|
|
37
|
-
const { store } = await import('redux/store');
|
|
38
|
-
return store;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
36
|
interface CheckoutResponse {
|
|
42
37
|
pre_order?: PreOrder;
|
|
43
38
|
errors: {
|
|
@@ -87,18 +82,6 @@ export interface PayOnDeliveryParams {
|
|
|
87
82
|
paymentType: string;
|
|
88
83
|
}
|
|
89
84
|
|
|
90
|
-
const buildCheckoutRequestUrl = (
|
|
91
|
-
path: string,
|
|
92
|
-
options?: Parameters<typeof buildClientRequestUrl>[1]
|
|
93
|
-
) => {
|
|
94
|
-
const effectivePath =
|
|
95
|
-
getCookie('pz-post-checkout-flow') === 'true' &&
|
|
96
|
-
/^\/orders\/checkout(\/|\?|$)/.test(path)
|
|
97
|
-
? path.replace('/orders/checkout', '/orders/post-checkout')
|
|
98
|
-
: path;
|
|
99
|
-
return buildClientRequestUrl(effectivePath, options);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
85
|
const completeMasterpassPayment = async (
|
|
103
86
|
params: CompleteCreditCardParams,
|
|
104
87
|
dispatch: AppDispatch,
|
|
@@ -198,41 +181,41 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
198
181
|
endpoints: (build) => ({
|
|
199
182
|
fetchCheckout: build.query<CheckoutResponse, void>({
|
|
200
183
|
query: () => ({
|
|
201
|
-
url:
|
|
184
|
+
url: buildClientRequestUrl(checkout.fetchCheckout, {})
|
|
202
185
|
}),
|
|
203
186
|
providesTags: ['Checkout']
|
|
204
187
|
}),
|
|
205
188
|
resetCheckoutState: build.query<CheckoutResponse, void>({
|
|
206
189
|
query: () => ({
|
|
207
|
-
url:
|
|
190
|
+
url: buildClientRequestUrl(checkout.guestLogin, {})
|
|
208
191
|
})
|
|
209
192
|
}),
|
|
210
193
|
fetchCheckoutResult: build.query<{ order: Order }, string>({
|
|
211
194
|
query: (token: string) =>
|
|
212
|
-
|
|
195
|
+
buildClientRequestUrl(checkout.fetchCheckoutResult(token))
|
|
213
196
|
}),
|
|
214
197
|
get3dRedirectForm: build.query<{ result: string }, void>({
|
|
215
198
|
query: () =>
|
|
216
|
-
|
|
199
|
+
buildClientRequestUrl(checkout.get3dRedirectForm, {
|
|
217
200
|
responseType: 'text'
|
|
218
201
|
})
|
|
219
202
|
}),
|
|
220
203
|
getContract: build.query<GetContractResponse, string>({
|
|
221
204
|
query: (slug: string) =>
|
|
222
|
-
|
|
205
|
+
buildClientRequestUrl(checkout.getContract(slug), {
|
|
223
206
|
responseType: 'text'
|
|
224
207
|
})
|
|
225
208
|
}),
|
|
226
209
|
getCoupons: build.query<CheckoutResponse, void>({
|
|
227
210
|
query: () => ({
|
|
228
|
-
url:
|
|
211
|
+
url: buildClientRequestUrl(checkout.couponSelectionPage)
|
|
229
212
|
})
|
|
230
213
|
}),
|
|
231
214
|
|
|
232
215
|
setCoupon: build.mutation<CheckoutResponse, { pk: number; action: string }>(
|
|
233
216
|
{
|
|
234
217
|
query: ({ pk, action }) => ({
|
|
235
|
-
url:
|
|
218
|
+
url: buildClientRequestUrl(checkout.couponSelectionPage, {
|
|
236
219
|
useFormData: true
|
|
237
220
|
}),
|
|
238
221
|
method: 'POST',
|
|
@@ -248,32 +231,25 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
248
231
|
CheckoutResponse,
|
|
249
232
|
CompleteCreditCardParams
|
|
250
233
|
>({
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
},
|
|
261
|
-
_queryApi,
|
|
262
|
-
_extraOptions,
|
|
263
|
-
baseQuery
|
|
264
|
-
) {
|
|
265
|
-
const reduxStore = await getStore();
|
|
234
|
+
query: ({
|
|
235
|
+
card_holder,
|
|
236
|
+
card_cvv,
|
|
237
|
+
card_number,
|
|
238
|
+
card_month,
|
|
239
|
+
card_year,
|
|
240
|
+
use_three_d = true,
|
|
241
|
+
save = undefined
|
|
242
|
+
}) => {
|
|
266
243
|
const paymentOption =
|
|
267
|
-
|
|
244
|
+
store.getState().checkout?.preOrder?.payment_option;
|
|
268
245
|
|
|
269
246
|
if (paymentOption?.payment_type === 'masterpass') {
|
|
270
|
-
|
|
271
|
-
url:
|
|
247
|
+
return {
|
|
248
|
+
url: buildClientRequestUrl(checkout.getMasterpassOrderNo, {
|
|
272
249
|
useFormData: true
|
|
273
250
|
}),
|
|
274
251
|
method: 'POST'
|
|
275
|
-
}
|
|
276
|
-
return result as { data: CheckoutResponse } | { error: any };
|
|
252
|
+
};
|
|
277
253
|
}
|
|
278
254
|
|
|
279
255
|
const body: Record<string, string> = {
|
|
@@ -290,19 +266,18 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
290
266
|
body.save = save ? '1' : '0';
|
|
291
267
|
}
|
|
292
268
|
|
|
293
|
-
|
|
294
|
-
url:
|
|
269
|
+
return {
|
|
270
|
+
url: buildClientRequestUrl(checkout.completeCreditCardPayment, {
|
|
295
271
|
useFormData: true
|
|
296
272
|
}),
|
|
297
273
|
method: 'POST',
|
|
298
274
|
body
|
|
299
|
-
}
|
|
300
|
-
return result as { data: CheckoutResponse } | { error: any };
|
|
275
|
+
};
|
|
301
276
|
},
|
|
302
277
|
async onQueryStarted(args, { dispatch, queryFulfilled }) {
|
|
303
278
|
dispatch(setPaymentStepBusy(true));
|
|
304
279
|
const { data } = await queryFulfilled;
|
|
305
|
-
const reduxStore = await
|
|
280
|
+
const reduxStore = (await import('redux/store')).store;
|
|
306
281
|
const completePaymentContext = data?.context_list?.find(
|
|
307
282
|
(context) => context?.page_name === 'MasterpassCompletePage'
|
|
308
283
|
);
|
|
@@ -327,7 +302,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
327
302
|
}
|
|
328
303
|
>({
|
|
329
304
|
query: ({ token }) => ({
|
|
330
|
-
url:
|
|
305
|
+
url: buildClientRequestUrl(checkout.completeMasterpassPayment, {
|
|
331
306
|
useFormData: true
|
|
332
307
|
}),
|
|
333
308
|
method: 'POST',
|
|
@@ -344,7 +319,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
344
319
|
}),
|
|
345
320
|
completeFundsTransfer: build.mutation<CheckoutResponse, void>({
|
|
346
321
|
query: () => ({
|
|
347
|
-
url:
|
|
322
|
+
url: buildClientRequestUrl(checkout.completeFundsTransfer, {
|
|
348
323
|
useFormData: true
|
|
349
324
|
}),
|
|
350
325
|
method: 'POST',
|
|
@@ -361,7 +336,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
361
336
|
}),
|
|
362
337
|
guestLogin: build.mutation<CheckoutResponse, GuestLoginFormParams>({
|
|
363
338
|
query: ({ user_email, phone_number }) => ({
|
|
364
|
-
url:
|
|
339
|
+
url: buildClientRequestUrl(checkout.guestLogin, {
|
|
365
340
|
useFormData: true
|
|
366
341
|
}),
|
|
367
342
|
method: 'POST',
|
|
@@ -374,7 +349,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
374
349
|
}),
|
|
375
350
|
setDeliveryOption: build.mutation<CheckoutResponse, number>({
|
|
376
351
|
query: (pk: number) => ({
|
|
377
|
-
url:
|
|
352
|
+
url: buildClientRequestUrl(checkout.setDeliveryOption, {
|
|
378
353
|
useFormData: true
|
|
379
354
|
}),
|
|
380
355
|
method: 'POST',
|
|
@@ -390,7 +365,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
390
365
|
}),
|
|
391
366
|
setAddresses: build.mutation<CheckoutResponse, SetAddressesParams>({
|
|
392
367
|
query: ({ shippingAddressPk, billingAddressPk }) => ({
|
|
393
|
-
url:
|
|
368
|
+
url: buildClientRequestUrl(checkout.setAddresses, {
|
|
394
369
|
useFormData: true
|
|
395
370
|
}),
|
|
396
371
|
method: 'POST',
|
|
@@ -407,7 +382,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
407
382
|
}),
|
|
408
383
|
setShippingOption: build.mutation<CheckoutResponse, number>({
|
|
409
384
|
query: (pk: number) => ({
|
|
410
|
-
url:
|
|
385
|
+
url: buildClientRequestUrl(checkout.setShippingOption, {
|
|
411
386
|
useFormData: true
|
|
412
387
|
}),
|
|
413
388
|
method: 'POST',
|
|
@@ -423,7 +398,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
423
398
|
}),
|
|
424
399
|
setDataSourceShippingOptions: build.mutation<CheckoutResponse, number[]>({
|
|
425
400
|
query: (pks) => ({
|
|
426
|
-
url:
|
|
401
|
+
url: buildClientRequestUrl(checkout.setDataSourceShippingOption, {
|
|
427
402
|
useFormData: true
|
|
428
403
|
}),
|
|
429
404
|
method: 'POST',
|
|
@@ -439,7 +414,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
439
414
|
}),
|
|
440
415
|
setRetailStore: build.mutation<CheckoutResponse, SetRetailStoreParams>({
|
|
441
416
|
query: ({ retailStorePk, billingAddressPk }) => ({
|
|
442
|
-
url:
|
|
417
|
+
url: buildClientRequestUrl(
|
|
443
418
|
'/orders/checkout?page=RetailStoreSelectionPage',
|
|
444
419
|
{
|
|
445
420
|
useFormData: true
|
|
@@ -454,13 +429,13 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
454
429
|
}),
|
|
455
430
|
fetchPaymentOptions: build.query<CheckoutResponse, void>({
|
|
456
431
|
query: () => ({
|
|
457
|
-
url:
|
|
432
|
+
url: buildClientRequestUrl(checkout.setPaymentOption)
|
|
458
433
|
}),
|
|
459
434
|
providesTags: ['PaymentOptions']
|
|
460
435
|
}),
|
|
461
436
|
setPaymentOption: build.mutation<CheckoutResponse, number>({
|
|
462
437
|
query: (pk: number) => ({
|
|
463
|
-
url:
|
|
438
|
+
url: buildClientRequestUrl(checkout.setPaymentOption, {
|
|
464
439
|
useFormData: true
|
|
465
440
|
}),
|
|
466
441
|
method: 'POST',
|
|
@@ -486,7 +461,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
486
461
|
}
|
|
487
462
|
>({
|
|
488
463
|
query: ({ payment_option: pk, validationURL }) => ({
|
|
489
|
-
url:
|
|
464
|
+
url: buildClientRequestUrl(checkout.setWalletSelectionPage, {
|
|
490
465
|
useFormData: true
|
|
491
466
|
}),
|
|
492
467
|
method: 'POST',
|
|
@@ -510,7 +485,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
510
485
|
}
|
|
511
486
|
>({
|
|
512
487
|
query: (requestBody) => ({
|
|
513
|
-
url:
|
|
488
|
+
url: buildClientRequestUrl(checkout.setWalletPaymentPage, {
|
|
514
489
|
useFormData: true
|
|
515
490
|
}),
|
|
516
491
|
method: 'POST',
|
|
@@ -531,7 +506,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
531
506
|
}
|
|
532
507
|
>({
|
|
533
508
|
query: ({ success, ...additionalParams }) => ({
|
|
534
|
-
url:
|
|
509
|
+
url: buildClientRequestUrl(checkout.setWalletCompletePage, {
|
|
535
510
|
useFormData: true
|
|
536
511
|
}),
|
|
537
512
|
method: 'POST',
|
|
@@ -547,25 +522,23 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
547
522
|
}
|
|
548
523
|
}),
|
|
549
524
|
setBinNumber: build.mutation<CheckoutResponse, string>({
|
|
550
|
-
|
|
551
|
-
const reduxStore = await getStore();
|
|
525
|
+
query: (binNumber: string) => {
|
|
552
526
|
const paymentOption =
|
|
553
|
-
|
|
527
|
+
store.getState().checkout?.preOrder?.payment_option;
|
|
554
528
|
const binNumberUrl =
|
|
555
529
|
paymentOption?.payment_type === 'masterpass'
|
|
556
530
|
? checkout.setMasterpassBinNumber
|
|
557
531
|
: checkout.setBinNumber;
|
|
558
532
|
|
|
559
|
-
|
|
560
|
-
url:
|
|
533
|
+
return {
|
|
534
|
+
url: buildClientRequestUrl(binNumberUrl, {
|
|
561
535
|
useFormData: true
|
|
562
536
|
}),
|
|
563
537
|
method: 'POST',
|
|
564
538
|
body: {
|
|
565
539
|
bin_number: binNumber
|
|
566
540
|
}
|
|
567
|
-
}
|
|
568
|
-
return result as { data: CheckoutResponse } | { error: any };
|
|
541
|
+
};
|
|
569
542
|
},
|
|
570
543
|
async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
|
571
544
|
dispatch(setPaymentStepBusy(true));
|
|
@@ -575,25 +548,22 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
575
548
|
}
|
|
576
549
|
}),
|
|
577
550
|
setInstallmentOption: build.mutation<CheckoutResponse, number>({
|
|
578
|
-
|
|
579
|
-
const reduxStore = await getStore();
|
|
551
|
+
query: (pk: number) => {
|
|
580
552
|
const paymentOption =
|
|
581
|
-
|
|
553
|
+
store.getState().checkout?.preOrder?.payment_option;
|
|
582
554
|
const installmentOption =
|
|
583
555
|
paymentOption?.payment_type === 'masterpass'
|
|
584
556
|
? checkout.setMasterPassInstallmentOption
|
|
585
557
|
: checkout.setInstallmentOption;
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
url: buildCheckoutRequestUrl(installmentOption, {
|
|
558
|
+
return {
|
|
559
|
+
url: buildClientRequestUrl(installmentOption, {
|
|
589
560
|
useFormData: true
|
|
590
561
|
}),
|
|
591
562
|
method: 'POST',
|
|
592
563
|
body: {
|
|
593
564
|
installment: String(pk)
|
|
594
565
|
}
|
|
595
|
-
}
|
|
596
|
-
return result as { data: CheckoutResponse } | { error: any };
|
|
566
|
+
};
|
|
597
567
|
},
|
|
598
568
|
async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
|
599
569
|
dispatch(setPaymentStepBusy(true));
|
|
@@ -603,7 +573,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
603
573
|
}),
|
|
604
574
|
setFundsTransferOption: build.mutation<CheckoutResponse, number>({
|
|
605
575
|
query: (pk: number) => ({
|
|
606
|
-
url:
|
|
576
|
+
url: buildClientRequestUrl(checkout.setFundsTransferOption, {
|
|
607
577
|
useFormData: true
|
|
608
578
|
}),
|
|
609
579
|
method: 'POST',
|
|
@@ -620,7 +590,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
620
590
|
}),
|
|
621
591
|
setCreditPaymentOption: build.mutation<CheckoutResponse, number>({
|
|
622
592
|
query: (pk: number) => ({
|
|
623
|
-
url:
|
|
593
|
+
url: buildClientRequestUrl(checkout.setCreditPaymentOption, {
|
|
624
594
|
useFormData: true
|
|
625
595
|
}),
|
|
626
596
|
method: 'POST',
|
|
@@ -637,7 +607,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
637
607
|
}),
|
|
638
608
|
confirmationCreditPayment: build.mutation<CheckoutResponse, void>({
|
|
639
609
|
query: () => ({
|
|
640
|
-
url:
|
|
610
|
+
url: buildClientRequestUrl(checkout.confirmationCreditPayment, {
|
|
641
611
|
useFormData: true
|
|
642
612
|
}),
|
|
643
613
|
method: 'POST',
|
|
@@ -653,7 +623,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
653
623
|
}),
|
|
654
624
|
completeRedirectionPayment: build.mutation<CheckoutResponse, void>({
|
|
655
625
|
query: () => ({
|
|
656
|
-
url:
|
|
626
|
+
url: buildClientRequestUrl(checkout.completeRedirectionPayment, {
|
|
657
627
|
useFormData: true
|
|
658
628
|
}),
|
|
659
629
|
method: 'POST',
|
|
@@ -669,7 +639,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
669
639
|
}),
|
|
670
640
|
applePaymentSelect: build.mutation<CheckoutResponse, ApplePaySelectParams>({
|
|
671
641
|
query: ({ agreement, validationURL }) => ({
|
|
672
|
-
url:
|
|
642
|
+
url: buildClientRequestUrl(checkout.confirmationPaymentSelect, {
|
|
673
643
|
useFormData: true
|
|
674
644
|
}),
|
|
675
645
|
method: 'POST',
|
|
@@ -686,7 +656,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
686
656
|
}),
|
|
687
657
|
appleQuery: build.mutation<CheckoutResponse, ApplePayQueryParams>({
|
|
688
658
|
query: ({ agreement, paymentToken }) => ({
|
|
689
|
-
url:
|
|
659
|
+
url: buildClientRequestUrl(checkout.confirmationQuery, {
|
|
690
660
|
useFormData: true
|
|
691
661
|
}),
|
|
692
662
|
method: 'POST',
|
|
@@ -703,7 +673,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
703
673
|
}),
|
|
704
674
|
completeConfirmation: build.mutation<CheckoutResponse, void>({
|
|
705
675
|
query: () => ({
|
|
706
|
-
url:
|
|
676
|
+
url: buildClientRequestUrl(checkout.confirmationComplete, {
|
|
707
677
|
useFormData: true
|
|
708
678
|
}),
|
|
709
679
|
method: 'POST',
|
|
@@ -722,7 +692,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
722
692
|
PayOnDeliveryParams
|
|
723
693
|
>({
|
|
724
694
|
query: ({ paymentType }) => ({
|
|
725
|
-
url:
|
|
695
|
+
url: buildClientRequestUrl(
|
|
726
696
|
`${checkout.fetchCheckout}?page=PayOnDeliveryPage`,
|
|
727
697
|
{ useFormData: true }
|
|
728
698
|
),
|
|
@@ -740,7 +710,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
740
710
|
}),
|
|
741
711
|
setPayOnDeliveryChoice: build.mutation<CheckoutResponse, string>({
|
|
742
712
|
query: (body) => ({
|
|
743
|
-
url:
|
|
713
|
+
url: buildClientRequestUrl(
|
|
744
714
|
`${checkout.fetchCheckout}?page=PayOnDeliveryPaymentChoicePage`,
|
|
745
715
|
{ useFormData: true }
|
|
746
716
|
),
|
|
@@ -757,7 +727,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
757
727
|
}),
|
|
758
728
|
completeLoyaltyPayment: build.mutation<CheckoutResponse, void>({
|
|
759
729
|
query: () => ({
|
|
760
|
-
url:
|
|
730
|
+
url: buildClientRequestUrl(checkout.completeLoyaltyPayment, {
|
|
761
731
|
useFormData: true
|
|
762
732
|
}),
|
|
763
733
|
method: 'POST',
|
|
@@ -773,12 +743,12 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
773
743
|
}),
|
|
774
744
|
getCheckoutLoyaltyBalance: build.query<CheckoutResponse, void>({
|
|
775
745
|
query: () => ({
|
|
776
|
-
url:
|
|
746
|
+
url: buildClientRequestUrl(checkout.loyaltyMoneyUsage)
|
|
777
747
|
})
|
|
778
748
|
}),
|
|
779
749
|
payWithLoyaltyBalance: build.mutation<any, string>({
|
|
780
750
|
query: (amount) => ({
|
|
781
|
-
url:
|
|
751
|
+
url: buildClientRequestUrl(checkout.loyaltyMoneyUsage, {
|
|
782
752
|
useFormData: true
|
|
783
753
|
}),
|
|
784
754
|
method: 'POST',
|
|
@@ -809,7 +779,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
809
779
|
}),
|
|
810
780
|
setOrderNote: build.mutation<CheckoutResponse, string>({
|
|
811
781
|
query: (notes) => ({
|
|
812
|
-
url:
|
|
782
|
+
url: buildClientRequestUrl(checkout.setOrderNote, {
|
|
813
783
|
useFormData: true
|
|
814
784
|
}),
|
|
815
785
|
method: 'POST',
|
|
@@ -829,7 +799,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
829
799
|
};
|
|
830
800
|
|
|
831
801
|
return {
|
|
832
|
-
url:
|
|
802
|
+
url: buildClientRequestUrl(checkout.deliveryBagsPage, {
|
|
833
803
|
useFormData: true
|
|
834
804
|
}),
|
|
835
805
|
method: 'POST',
|
|
@@ -842,7 +812,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
842
812
|
Record<string, number>
|
|
843
813
|
>({
|
|
844
814
|
query: (options) => ({
|
|
845
|
-
url:
|
|
815
|
+
url: buildClientRequestUrl(checkout.setAttributeBasedShippingOption, {
|
|
846
816
|
useFormData: true
|
|
847
817
|
}),
|
|
848
818
|
method: 'POST',
|
|
@@ -861,7 +831,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
861
831
|
{ extra_field: ExtraField }
|
|
862
832
|
>({
|
|
863
833
|
query: ({ extra_field }) => ({
|
|
864
|
-
url:
|
|
834
|
+
url: buildClientRequestUrl(checkout.setOrderSelectionPage, {
|
|
865
835
|
useFormData: true
|
|
866
836
|
}),
|
|
867
837
|
method: 'POST',
|
|
@@ -872,7 +842,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
872
842
|
}),
|
|
873
843
|
fetchLoyaltyData: build.query<CheckoutResponse, void>({
|
|
874
844
|
query: () => ({
|
|
875
|
-
url:
|
|
845
|
+
url: buildClientRequestUrl(checkout.loyaltyCardPage, {
|
|
876
846
|
accept: 'application/json',
|
|
877
847
|
contentType: 'application/json'
|
|
878
848
|
}),
|
|
@@ -881,7 +851,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
881
851
|
}),
|
|
882
852
|
setLoyaltyData: build.mutation<CheckoutResponse, number | string>({
|
|
883
853
|
query: (amount) => ({
|
|
884
|
-
url:
|
|
854
|
+
url: buildClientRequestUrl(checkout.loyaltyCardPage, {
|
|
885
855
|
useFormData: true
|
|
886
856
|
}),
|
|
887
857
|
method: 'POST',
|
|
@@ -892,7 +862,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
892
862
|
}),
|
|
893
863
|
sendSms: build.mutation<CheckoutResponse, SendSmsType>({
|
|
894
864
|
query: (body) => ({
|
|
895
|
-
url:
|
|
865
|
+
url: buildClientRequestUrl(checkout.sendSmsPage, {
|
|
896
866
|
useFormData: true
|
|
897
867
|
}),
|
|
898
868
|
method: 'POST',
|
|
@@ -901,7 +871,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
901
871
|
}),
|
|
902
872
|
verifySms: build.mutation<CheckoutResponse, VerifySmsType>({
|
|
903
873
|
query: (body) => ({
|
|
904
|
-
url:
|
|
874
|
+
url: buildClientRequestUrl(checkout.verifySmsPage, {
|
|
905
875
|
useFormData: true
|
|
906
876
|
}),
|
|
907
877
|
method: 'POST',
|
|
@@ -917,7 +887,7 @@ export const checkoutApi = api.injectEndpoints({
|
|
|
917
887
|
});
|
|
918
888
|
|
|
919
889
|
return {
|
|
920
|
-
url:
|
|
890
|
+
url: buildClientRequestUrl(checkout.saveSampleProducts),
|
|
921
891
|
method: 'POST',
|
|
922
892
|
body: formData
|
|
923
893
|
};
|
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 = {
|