@akinon/next 1.19.4 → 1.21.0-rc.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,5 +1,17 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.21.0-rc.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 26a74c9: ZERO-2436: Add getCoupons and setCoupon API endpoints
8
+
9
+ ## 1.20.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 86a9561: ZERO-2416: Update translations and refactor my quotations
14
+
3
15
  ## 1.19.4
4
16
 
5
17
  ## 1.19.3
File without changes
File without changes
File without changes
package/bin/pz-postdev.js CHANGED
File without changes
File without changes
File without changes
File without changes
package/bin/pz-predev.js CHANGED
File without changes
File without changes
@@ -26,6 +26,14 @@ interface GetOrdersParams {
26
26
  export interface GetQuotationsResponse {
27
27
  count: number;
28
28
  results: Quotations[];
29
+ next: string | null;
30
+ previous: string | null;
31
+ }
32
+
33
+ export interface GetQuotationsParams {
34
+ page?: number;
35
+ status?: string;
36
+ limit?: number;
29
37
  }
30
38
 
31
39
  export type PasswordResetType = {
@@ -111,8 +119,9 @@ const accountApi = api.injectEndpoints({
111
119
  account.getOrders({ page, limit, createdDate, endDate })
112
120
  )
113
121
  }),
114
- getQuotations: builder.query<GetQuotationsResponse, void>({
115
- query: () => buildClientRequestUrl(account.getQuotations)
122
+ getQuotations: builder.query<GetQuotationsResponse, GetQuotationsParams>({
123
+ query: ({ page, status, limit }) =>
124
+ buildClientRequestUrl(account.getQuotations(page, status, limit))
116
125
  }),
117
126
  sendContact: builder.mutation<void, ContactFormType>({
118
127
  query: (body) => ({
@@ -177,6 +177,27 @@ export const checkoutApi = api.injectEndpoints({
177
177
  responseType: 'text'
178
178
  })
179
179
  }),
180
+ getCoupons: build.query<CheckoutResponse, void>({
181
+ query: () => ({
182
+ url: buildClientRequestUrl(checkout.couponSelectionPage)
183
+ })
184
+ }),
185
+
186
+ setCoupon: build.mutation<CheckoutResponse, { pk: number; action: string }>(
187
+ {
188
+ query: ({ pk, action }) => ({
189
+ url: buildClientRequestUrl(checkout.couponSelectionPage, {
190
+ useFormData: true
191
+ }),
192
+ method: 'POST',
193
+ body: {
194
+ coupon: pk,
195
+ action
196
+ }
197
+ }),
198
+ invalidatesTags: ['Basket']
199
+ }
200
+ ),
180
201
  completeCreditCardPayment: build.mutation<
181
202
  CheckoutResponse,
182
203
  CompleteCreditCardParams
@@ -630,6 +651,8 @@ export const {
630
651
  useFetchCheckoutResultQuery,
631
652
  useGet3dRedirectFormQuery,
632
653
  useGetContractQuery,
654
+ useGetCouponsQuery,
655
+ useSetCouponMutation,
633
656
  useCompleteCreditCardPaymentMutation,
634
657
  useCompleteFundsTransferMutation,
635
658
  useGuestLoginMutation,
package/data/urls.ts CHANGED
@@ -27,7 +27,10 @@ export const account = {
27
27
  `/users/orders/?page=${page || 1}&limit=${limit || 12} ${
28
28
  createdDate ? `&created_date__gte=${createdDate}` : ''
29
29
  } ${endDate ? `&created_date__lte=${endDate}` : ''}`,
30
- getQuotations: '/b2b/my-quotations',
30
+ getQuotations: (page?: number, status?: string, limit?: number) =>
31
+ `/b2b/my-quotations/?page=${page || 1}` +
32
+ (status ? `&status=${status}` : '') +
33
+ (limit ? `&limit=${limit}` : ''),
31
34
  sendContact: '/users/contact-us',
32
35
  passwordReset: (slug: string) => `/users/reset/${slug}`,
33
36
  anonymize: '/users/anonymize/',
@@ -100,7 +103,8 @@ export const checkout = {
100
103
  '/orders/checkout/?page=ConfirmationPaymentCompletePage',
101
104
  completeLoyaltyPayment: '/orders/checkout/?page=LoyaltyPaymentSelectedPage',
102
105
  loyaltyMoneyUsage: '/orders/checkout/?page=LoyaltyMoneyUsagePage',
103
- setOrderNote: '/orders/checkout/?page=OrderNotePage'
106
+ setOrderNote: '/orders/checkout/?page=OrderNotePage',
107
+ couponSelectionPage: '/orders/checkout/?page=CouponSelectionPage'
104
108
  };
105
109
 
106
110
  export const flatpage = {
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.19.4",
4
+ "version": "1.21.0-rc.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -31,7 +31,7 @@
31
31
  "@typescript-eslint/eslint-plugin": "6.7.4",
32
32
  "@typescript-eslint/parser": "6.7.4",
33
33
  "eslint": "^8.14.0",
34
- "@akinon/eslint-plugin-projectzero": "1.19.4",
34
+ "@akinon/eslint-plugin-projectzero": "1.21.0-rc.0",
35
35
  "eslint-config-prettier": "8.5.0"
36
36
  }
37
37
  }