@autobusal/order-confirm 1.1.3 → 1.2.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 +4 -0
- package/OrderConfirm.tsx +18 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
- Announces `purchase` on arrival, for a **purchased** order only — a reservation is not revenue and a cancelled attempt certainly is not. Cleared as it fires, so refreshing this page (a plain URL with the buyer's order number on it) cannot report the same sale twice.
|
|
6
|
+
|
|
3
7
|
All notable changes to this package are documented here. This project follows
|
|
4
8
|
[Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
|
|
5
9
|
|
package/OrderConfirm.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import Reason from './Reason';
|
|
|
9
9
|
import Telegram from './Telegram/Telegram';
|
|
10
10
|
import { Title, Actions } from './styles';
|
|
11
11
|
import { useUserStore } from '@autobusal/providers/stores/user';
|
|
12
|
+
import { flush } from '@autobusal/providers/Setup/commerce';
|
|
12
13
|
|
|
13
14
|
interface Props {
|
|
14
15
|
t: TFunction<'common'>
|
|
@@ -38,6 +39,23 @@ const OrderConfirm = ({ t }: Props): (JSX.Element | null) => {
|
|
|
38
39
|
|
|
39
40
|
const { data: UserData } = useUserStore();
|
|
40
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Edited: Ferjolt Ozuni - Date: 2026-08-05
|
|
44
|
+
*
|
|
45
|
+
* Only a PURCHASE counts. A reservation is not revenue and a cancelled
|
|
46
|
+
* attempt certainly is not, and reporting either as a sale is the kind of
|
|
47
|
+
* error that is never noticed because the number only ever looks good.
|
|
48
|
+
*
|
|
49
|
+
* flush() clears as it fires, so refreshing this page - which a buyer
|
|
50
|
+
* reasonably might, it is a plain URL with their order number on it -
|
|
51
|
+
* cannot report the same sale twice.
|
|
52
|
+
*/
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (type === 'purchased' && hash) {
|
|
55
|
+
flush(hash);
|
|
56
|
+
}
|
|
57
|
+
}, [type, hash]);
|
|
58
|
+
|
|
41
59
|
const isAllowed = ['reserved', 'cancelled', 'purchased'].includes(String(type));
|
|
42
60
|
|
|
43
61
|
if (!isAllowed) {
|