@autobusal/order-confirm 1.1.2 → 1.1.3
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 +12 -0
- package/OrderConfirm.tsx +32 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this package are documented here. This project follows
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
|
|
5
5
|
|
|
6
|
+
## [1.1.3] - 2026-08-01
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- **The confirmation moves on to the order after five seconds**, where the
|
|
11
|
+
tickets and the invoice actually are. A dead-end success page turned
|
|
12
|
+
downloading the thing you had just bought into a hunt. Only for purchased
|
|
13
|
+
and reserved: a cancellation has nothing to go to, and bouncing someone
|
|
14
|
+
off a notice they may still be reading would be its own small insult.
|
|
15
|
+
Cleared on unmount, so pressing a button first does not leave a second
|
|
16
|
+
navigation queued behind the one you chose.
|
|
17
|
+
|
|
6
18
|
## [1.1.2] - 2026-07-30
|
|
7
19
|
|
|
8
20
|
### Fixed
|
package/OrderConfirm.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
1
2
|
import { TFunction } from 'i18next';
|
|
2
3
|
import { useSearchParams, useParams, useNavigate, Navigate } from 'react-router-dom';
|
|
3
4
|
import { AiOutlineCheck } from 'react-icons/ai';
|
|
@@ -22,6 +23,10 @@ const escapeHtml = (value: string): string => (
|
|
|
22
23
|
}[char] as string))
|
|
23
24
|
);
|
|
24
25
|
|
|
26
|
+
// long enough to read the confirmation and its order number, short enough
|
|
27
|
+
// that nobody wonders whether the page has finished
|
|
28
|
+
const REDIRECT_AFTER = 5000;
|
|
29
|
+
|
|
25
30
|
const OrderConfirm = ({ t }: Props): (JSX.Element | null) => {
|
|
26
31
|
const [ searchParams ] = useSearchParams();
|
|
27
32
|
|
|
@@ -39,13 +44,39 @@ const OrderConfirm = ({ t }: Props): (JSX.Element | null) => {
|
|
|
39
44
|
return <Navigate to="/" />;
|
|
40
45
|
}
|
|
41
46
|
|
|
47
|
+
const destination = UserData ? '/account/orders' : `/viewtrip/${ hash }`;
|
|
48
|
+
|
|
42
49
|
const onManage = (): void => {
|
|
43
50
|
// a logged-in user shouldn't be sent to the public order-lookup form (which
|
|
44
51
|
// email-gates access to their OWN order) - send them into their account
|
|
45
52
|
// orders where the order is listed. Guests use the public lookup.
|
|
46
|
-
navigate(
|
|
53
|
+
navigate(destination);
|
|
47
54
|
};
|
|
48
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Edited: Ferjolt Ozuni - Date: 2026-08-01
|
|
58
|
+
*
|
|
59
|
+
* Read the confirmation, then go to the order itself - where the tickets
|
|
60
|
+
* and the invoice actually are. Leaving people on a dead-end success page
|
|
61
|
+
* turned downloading the thing they had just bought into a hunt.
|
|
62
|
+
*
|
|
63
|
+
* Only for the outcomes that produce an order to go TO. A cancellation
|
|
64
|
+
* has nothing to download, and bouncing someone off a cancellation notice
|
|
65
|
+
* they may still be reading would be its own small insult.
|
|
66
|
+
*
|
|
67
|
+
* Cleared on unmount, so pressing a button first does not leave a second
|
|
68
|
+
* navigation queued behind the one the user chose.
|
|
69
|
+
*/
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (type !== 'purchased' && type !== 'reserved') {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const timer = setTimeout(() => navigate(destination), REDIRECT_AFTER);
|
|
76
|
+
|
|
77
|
+
return () => clearTimeout(timer);
|
|
78
|
+
}, [ type, destination, navigate ]);
|
|
79
|
+
|
|
49
80
|
const onBack = (): void => {
|
|
50
81
|
navigate(UserData ? '/account' : '/');
|
|
51
82
|
};
|