@numueg/theme-sdk 0.5.0 → 0.5.1
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/dist/index.cjs +11 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +11 -10
- package/dist/index.mjs.map +1 -1
- package/dist/validation.cjs +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ var MAX_BLOCK_DEPTH = 5;
|
|
|
7
7
|
|
|
8
8
|
// src/validation/index.ts
|
|
9
9
|
var THEME_CONTRACT_VERSION = 1;
|
|
10
|
-
var SDK_VERSION = "0.5.
|
|
10
|
+
var SDK_VERSION = "0.5.1" ;
|
|
11
11
|
var REQUIRED_TEMPLATES = [
|
|
12
12
|
"home",
|
|
13
13
|
"product",
|
|
@@ -707,7 +707,7 @@ function useOrder(id) {
|
|
|
707
707
|
const [tick, setTick] = useState(0);
|
|
708
708
|
useEffect(() => {
|
|
709
709
|
if (typeof window === "undefined") return;
|
|
710
|
-
if (!
|
|
710
|
+
if (!id) {
|
|
711
711
|
setOrder(null);
|
|
712
712
|
setError(null);
|
|
713
713
|
setLoading(false);
|
|
@@ -718,14 +718,15 @@ function useOrder(id) {
|
|
|
718
718
|
setError(null);
|
|
719
719
|
void (async () => {
|
|
720
720
|
try {
|
|
721
|
-
const
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
721
|
+
const trackUrl = `/api/storefront/track/${encodeURIComponent(id)}`;
|
|
722
|
+
let res = customer ? await fetch(`/api/customer/me/orders/${encodeURIComponent(id)}`, {
|
|
723
|
+
method: "GET",
|
|
724
|
+
credentials: "include",
|
|
725
|
+
cache: "no-store"
|
|
726
|
+
}) : await fetch(trackUrl, { cache: "no-store" });
|
|
727
|
+
if (!res.ok && customer) {
|
|
728
|
+
res = await fetch(trackUrl, { cache: "no-store" });
|
|
729
|
+
}
|
|
729
730
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
730
731
|
const body = unwrap(await res.json());
|
|
731
732
|
if (cancelled) return;
|