@akinon/next 1.15.0 → 1.16.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/.gitattributes +15 -15
- package/CHANGELOG.md +7 -0
- package/assets/styles/index.scss +28 -28
- package/bin/pz-install-plugins.js +5 -2
- package/components/image.tsx +8 -0
- package/components/index.ts +18 -18
- package/components/modal.tsx +66 -66
- package/components/plugin-module.tsx +8 -11
- package/components/selected-payment-option-view.tsx +1 -5
- package/data/client/address.ts +107 -107
- package/data/client/b2b.ts +106 -106
- package/data/client/checkout.ts +516 -516
- package/hooks/use-payment-options.ts +0 -2
- package/instrumentation/index.ts +5 -0
- package/instrumentation/node.ts +20 -0
- package/package.json +7 -2
- package/plugins.js +0 -1
- package/redux/middlewares/checkout.ts +265 -265
- package/redux/reducers/index.ts +14 -14
- package/types/commerce/b2b.ts +117 -117
- package/utils/generate-commerce-search-params.ts +22 -22
- package/utils/get-currency.ts +29 -29
- package/with-pz-config.js +2 -2
- package/.editorconfig +0 -7
package/data/client/b2b.ts
CHANGED
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
import { buildClientRequestUrl } from '../../utils';
|
|
2
|
-
import { api } from './api';
|
|
3
|
-
import { b2b } from '../urls';
|
|
4
|
-
import {
|
|
5
|
-
Basket,
|
|
6
|
-
BasketParams,
|
|
7
|
-
BasketResponse,
|
|
8
|
-
Division,
|
|
9
|
-
DraftResponse,
|
|
10
|
-
GetResponse,
|
|
11
|
-
LoadBasketParams,
|
|
12
|
-
SaveBasketParams,
|
|
13
|
-
UpdateProductParams,
|
|
14
|
-
DeleteProductParams,
|
|
15
|
-
CreateQuotationParams
|
|
16
|
-
} from '../../types';
|
|
17
|
-
|
|
18
|
-
const b2bApi = api.injectEndpoints({
|
|
19
|
-
endpoints: (build) => ({
|
|
20
|
-
getBasketB2b: build.query<BasketResponse, void>({
|
|
21
|
-
query: () =>
|
|
22
|
-
buildClientRequestUrl(b2b.basket, {
|
|
23
|
-
contentType: 'application/json'
|
|
24
|
-
}),
|
|
25
|
-
providesTags: ['BasketB2b']
|
|
26
|
-
}),
|
|
27
|
-
getDivisions: build.query<GetResponse<Division>, void>({
|
|
28
|
-
query: () => buildClientRequestUrl(b2b.divisions)
|
|
29
|
-
}),
|
|
30
|
-
addToBasket: build.mutation<BasketResponse, BasketParams>({
|
|
31
|
-
query: (body) => ({
|
|
32
|
-
url: buildClientRequestUrl(b2b.basket, {
|
|
33
|
-
contentType: 'application/json'
|
|
34
|
-
}),
|
|
35
|
-
method: 'POST',
|
|
36
|
-
body
|
|
37
|
-
})
|
|
38
|
-
}),
|
|
39
|
-
saveBasket: build.mutation<BasketResponse, SaveBasketParams>({
|
|
40
|
-
query: (body) => ({
|
|
41
|
-
url: buildClientRequestUrl(b2b.saveBasket, {
|
|
42
|
-
contentType: 'application/json'
|
|
43
|
-
}),
|
|
44
|
-
method: 'POST',
|
|
45
|
-
body
|
|
46
|
-
}),
|
|
47
|
-
invalidatesTags: ['BasketB2b', 'DraftsB2b']
|
|
48
|
-
}),
|
|
49
|
-
getDrafts: build.query<DraftResponse[], void>({
|
|
50
|
-
query: () => buildClientRequestUrl(b2b.draftBaskets),
|
|
51
|
-
providesTags: ['DraftsB2b']
|
|
52
|
-
}),
|
|
53
|
-
loadBasket: build.mutation<string, number>({
|
|
54
|
-
query: (id) => ({
|
|
55
|
-
url: buildClientRequestUrl(b2b.loadBasket(id), {
|
|
56
|
-
contentType: 'application/json'
|
|
57
|
-
}),
|
|
58
|
-
method: 'POST'
|
|
59
|
-
}),
|
|
60
|
-
invalidatesTags: ['BasketB2b']
|
|
61
|
-
}),
|
|
62
|
-
updateProduct: build.mutation<Basket, UpdateProductParams>({
|
|
63
|
-
query: (body) => ({
|
|
64
|
-
url: buildClientRequestUrl(b2b.basket, {
|
|
65
|
-
contentType: 'application/json'
|
|
66
|
-
}),
|
|
67
|
-
method: 'PUT',
|
|
68
|
-
body
|
|
69
|
-
}),
|
|
70
|
-
invalidatesTags: ['BasketB2b']
|
|
71
|
-
}),
|
|
72
|
-
deleteProduct: build.mutation<Basket, DeleteProductParams>({
|
|
73
|
-
query: (body) => ({
|
|
74
|
-
url: buildClientRequestUrl(b2b.basket, {
|
|
75
|
-
contentType: 'application/json'
|
|
76
|
-
}),
|
|
77
|
-
method: 'DELETE',
|
|
78
|
-
body
|
|
79
|
-
}),
|
|
80
|
-
invalidatesTags: ['BasketB2b']
|
|
81
|
-
}),
|
|
82
|
-
createQuotation: build.mutation<BasketResponse, CreateQuotationParams>({
|
|
83
|
-
query: (body) => ({
|
|
84
|
-
url: buildClientRequestUrl(b2b.myQuotations, {
|
|
85
|
-
contentType: 'application/json'
|
|
86
|
-
}),
|
|
87
|
-
method: 'POST',
|
|
88
|
-
body
|
|
89
|
-
}),
|
|
90
|
-
invalidatesTags: ['BasketB2b', 'DraftsB2b']
|
|
91
|
-
}),
|
|
92
|
-
}),
|
|
93
|
-
overrideExisting: true
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
export const {
|
|
97
|
-
useGetBasketB2bQuery,
|
|
98
|
-
useLazyGetDivisionsQuery,
|
|
99
|
-
useAddToBasketMutation,
|
|
100
|
-
useSaveBasketMutation,
|
|
101
|
-
useGetDraftsQuery,
|
|
102
|
-
useLoadBasketMutation,
|
|
103
|
-
useUpdateProductMutation,
|
|
104
|
-
useDeleteProductMutation,
|
|
105
|
-
useCreateQuotationMutation
|
|
106
|
-
} = b2bApi;
|
|
1
|
+
import { buildClientRequestUrl } from '../../utils';
|
|
2
|
+
import { api } from './api';
|
|
3
|
+
import { b2b } from '../urls';
|
|
4
|
+
import {
|
|
5
|
+
Basket,
|
|
6
|
+
BasketParams,
|
|
7
|
+
BasketResponse,
|
|
8
|
+
Division,
|
|
9
|
+
DraftResponse,
|
|
10
|
+
GetResponse,
|
|
11
|
+
LoadBasketParams,
|
|
12
|
+
SaveBasketParams,
|
|
13
|
+
UpdateProductParams,
|
|
14
|
+
DeleteProductParams,
|
|
15
|
+
CreateQuotationParams
|
|
16
|
+
} from '../../types';
|
|
17
|
+
|
|
18
|
+
const b2bApi = api.injectEndpoints({
|
|
19
|
+
endpoints: (build) => ({
|
|
20
|
+
getBasketB2b: build.query<BasketResponse, void>({
|
|
21
|
+
query: () =>
|
|
22
|
+
buildClientRequestUrl(b2b.basket, {
|
|
23
|
+
contentType: 'application/json'
|
|
24
|
+
}),
|
|
25
|
+
providesTags: ['BasketB2b']
|
|
26
|
+
}),
|
|
27
|
+
getDivisions: build.query<GetResponse<Division>, void>({
|
|
28
|
+
query: () => buildClientRequestUrl(b2b.divisions)
|
|
29
|
+
}),
|
|
30
|
+
addToBasket: build.mutation<BasketResponse, BasketParams>({
|
|
31
|
+
query: (body) => ({
|
|
32
|
+
url: buildClientRequestUrl(b2b.basket, {
|
|
33
|
+
contentType: 'application/json'
|
|
34
|
+
}),
|
|
35
|
+
method: 'POST',
|
|
36
|
+
body
|
|
37
|
+
})
|
|
38
|
+
}),
|
|
39
|
+
saveBasket: build.mutation<BasketResponse, SaveBasketParams>({
|
|
40
|
+
query: (body) => ({
|
|
41
|
+
url: buildClientRequestUrl(b2b.saveBasket, {
|
|
42
|
+
contentType: 'application/json'
|
|
43
|
+
}),
|
|
44
|
+
method: 'POST',
|
|
45
|
+
body
|
|
46
|
+
}),
|
|
47
|
+
invalidatesTags: ['BasketB2b', 'DraftsB2b']
|
|
48
|
+
}),
|
|
49
|
+
getDrafts: build.query<DraftResponse[], void>({
|
|
50
|
+
query: () => buildClientRequestUrl(b2b.draftBaskets),
|
|
51
|
+
providesTags: ['DraftsB2b']
|
|
52
|
+
}),
|
|
53
|
+
loadBasket: build.mutation<string, number>({
|
|
54
|
+
query: (id) => ({
|
|
55
|
+
url: buildClientRequestUrl(b2b.loadBasket(id), {
|
|
56
|
+
contentType: 'application/json'
|
|
57
|
+
}),
|
|
58
|
+
method: 'POST'
|
|
59
|
+
}),
|
|
60
|
+
invalidatesTags: ['BasketB2b']
|
|
61
|
+
}),
|
|
62
|
+
updateProduct: build.mutation<Basket, UpdateProductParams>({
|
|
63
|
+
query: (body) => ({
|
|
64
|
+
url: buildClientRequestUrl(b2b.basket, {
|
|
65
|
+
contentType: 'application/json'
|
|
66
|
+
}),
|
|
67
|
+
method: 'PUT',
|
|
68
|
+
body
|
|
69
|
+
}),
|
|
70
|
+
invalidatesTags: ['BasketB2b']
|
|
71
|
+
}),
|
|
72
|
+
deleteProduct: build.mutation<Basket, DeleteProductParams>({
|
|
73
|
+
query: (body) => ({
|
|
74
|
+
url: buildClientRequestUrl(b2b.basket, {
|
|
75
|
+
contentType: 'application/json'
|
|
76
|
+
}),
|
|
77
|
+
method: 'DELETE',
|
|
78
|
+
body
|
|
79
|
+
}),
|
|
80
|
+
invalidatesTags: ['BasketB2b']
|
|
81
|
+
}),
|
|
82
|
+
createQuotation: build.mutation<BasketResponse, CreateQuotationParams>({
|
|
83
|
+
query: (body) => ({
|
|
84
|
+
url: buildClientRequestUrl(b2b.myQuotations, {
|
|
85
|
+
contentType: 'application/json'
|
|
86
|
+
}),
|
|
87
|
+
method: 'POST',
|
|
88
|
+
body
|
|
89
|
+
}),
|
|
90
|
+
invalidatesTags: ['BasketB2b', 'DraftsB2b']
|
|
91
|
+
}),
|
|
92
|
+
}),
|
|
93
|
+
overrideExisting: true
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export const {
|
|
97
|
+
useGetBasketB2bQuery,
|
|
98
|
+
useLazyGetDivisionsQuery,
|
|
99
|
+
useAddToBasketMutation,
|
|
100
|
+
useSaveBasketMutation,
|
|
101
|
+
useGetDraftsQuery,
|
|
102
|
+
useLoadBasketMutation,
|
|
103
|
+
useUpdateProductMutation,
|
|
104
|
+
useDeleteProductMutation,
|
|
105
|
+
useCreateQuotationMutation
|
|
106
|
+
} = b2bApi;
|