@akinon/next 1.20.0 → 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,11 @@
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
+
3
9
  ## 1.20.0
4
10
 
5
11
  ### Minor Changes
@@ -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
@@ -103,7 +103,8 @@ export const checkout = {
103
103
  '/orders/checkout/?page=ConfirmationPaymentCompletePage',
104
104
  completeLoyaltyPayment: '/orders/checkout/?page=LoyaltyPaymentSelectedPage',
105
105
  loyaltyMoneyUsage: '/orders/checkout/?page=LoyaltyMoneyUsagePage',
106
- setOrderNote: '/orders/checkout/?page=OrderNotePage'
106
+ setOrderNote: '/orders/checkout/?page=OrderNotePage',
107
+ couponSelectionPage: '/orders/checkout/?page=CouponSelectionPage'
107
108
  };
108
109
 
109
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.20.0",
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.20.0",
34
+ "@akinon/eslint-plugin-projectzero": "1.21.0-rc.0",
35
35
  "eslint-config-prettier": "8.5.0"
36
36
  }
37
37
  }