@autobusal/routes-order 1.33.7 → 1.33.8

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.33.8 (2026-08-28)
4
+
5
+ - usePostOrder replays the stored referral token as `referral`, so widget/link arrivals attribute their affiliate at checkout.
6
+
3
7
  ## 1.33.7 (2026-08-26)
4
8
 
5
9
  - Seat-selection add-on: checkout reads settings addons.seats - picking turns optional with the fee on the CTA and a live summary line; submission strips unpicked (zero) seat fields and sends addon_seats only when a hand-picked seat remains. Fixes the return-leg picked-seat list rebuilding from the departure's on re-pick.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/routes-order",
3
- "version": "1.33.7",
3
+ "version": "1.33.8",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"
package/services.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useMutation, UseMutationResult, useQuery, UseQueryResult } from '@tanstack/react-query';
2
2
  import { AxiosError } from 'axios';
3
- import { apiClient } from '@autobusal/providers';
3
+ import { apiClient, storedReferral } from '@autobusal/providers';
4
4
  import { RoutesSearchForm } from '@autobusal/routes-search/types';
5
5
  import { FoundData, FlexOffer } from '@autobusal/providers/types/routes';
6
6
  import { CouponData } from '@autobusal/providers/types/orders';
@@ -224,6 +224,21 @@ export const usePostOrder = (
224
224
  order.action = action;
225
225
  }
226
226
 
227
+ /*
228
+ * Edited: Claude - Date: 2026-08-28
229
+ *
230
+ * The referral token minted when this visitor arrived through ?ref=
231
+ * (providers useReferralTouch) - replayed under the exact field name
232
+ * obtapi's Attribution::FIELD declares. Expiry is checked client-side
233
+ * only to avoid sending a corpse; the server re-validates everything
234
+ * and a stale or self-referred token simply attributes nothing.
235
+ */
236
+ const referral = storedReferral();
237
+
238
+ if (referral !== null) {
239
+ order.referral = referral.token;
240
+ }
241
+
227
242
  if (data !== undefined) {
228
243
  Object.keys(data).forEach(index => {
229
244
  order[index] = data[index as keyof typeof data];