PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
← All changes | resources/js/components/classifications/ClassificationLandingPageField.tsx +14 -20 3.0.4 → 3.0.16 View file →
@@ -36,16 +36,15 @@
36 36 const raw = metadata?.landing_page_id;
37 37 if (raw == null || raw === "") {
38 38 return null;
39 39 }
40 - const n =
41 - typeof raw === "number" ? raw : parseInt(String(raw).trim(), 10);
40 + const n = typeof raw === "number" ? raw : parseInt(String(raw).trim(), 10);
42 41 return Number.isFinite(n) && n > 0 ? n : null;
43 42 }
44 43
45 -export async function fetchPublishedPagePermalink(pageId: number): Promise<
46 - string | null
47 -> {
44 +export async function fetchPublishedPagePermalink(
45 + pageId: number,
46 +): Promise<string | null> {
48 47 if (!pageId) {
49 48 return null;
50 49 }
51 50 const nonce = window.yatraAdmin?.nonce || "";
@@ -93,11 +92,9 @@
93 92 const data = await res.json();
94 93 const items = Array.isArray(data) ? data : [];
95 94 const totalRaw = res.headers.get("X-WP-Total");
96 95 const total =
97 - totalRaw !== null && totalRaw !== ""
98 - ? parseInt(totalRaw, 10)
99 - : null;
96 + totalRaw !== null && totalRaw !== "" ? parseInt(totalRaw, 10) : null;
100 97
101 98 return { items, total: Number.isFinite(total) ? total : null };
102 99 }
103 100
@@ -104,18 +101,15 @@
104 101 async function fetchSinglePublishedPage(
105 102 pageId: number,
106 103 ): Promise<WpPageSearchItem | null> {
107 104 const nonce = window.yatraAdmin?.nonce || "";
108 - const res = await fetch(
109 - `${restRoot()}wp/v2/pages/${pageId}?context=embed`,
110 - {
111 - credentials: "same-origin",
112 - headers: {
113 - "X-WP-Nonce": nonce,
114 - Accept: "application/json",
115 - },
105 + const res = await fetch(`${restRoot()}wp/v2/pages/${pageId}?context=embed`, {
106 + credentials: "same-origin",
107 + headers: {
108 + "X-WP-Nonce": nonce,
109 + Accept: "application/json",
116 110 },
117 - );
111 + });
118 112 if (!res.ok) {
119 113 return null;
120 114 }
121 115 const data = await res.json();
@@ -162,9 +156,9 @@
162 156 selectId = "yatra-classification-landing-page",
163 157 }: ClassificationLandingPageFieldProps) {
164 158 const moduleOn = Boolean(
165 159 typeof window !== "undefined" &&
166 - window.yatraAdmin?.customLandingPagesModuleEnabled,
160 + window.yatraAdmin?.customLandingPagesModuleEnabled,
167 161 );
168 162
169 163 const [pages, setPages] = useState<WpPageSearchItem[]>([]);
170 164 const [loading, setLoading] = useState(true);
@@ -288,10 +282,9 @@
288 282 {__("— Default Yatra URL (no custom page) —", "yatra")}
289 283 </option>
290 284 {pages.map((p) => {
291 285 const id = Number(p.id);
292 - const label =
293 - parsePageTitle(p) || __("(no title)", "yatra");
286 + const label = parsePageTitle(p) || __("(no title)", "yatra");
294 287
295 288 return (
296 289 <option key={id} value={String(id)}>
297 290 {label}
@@ -302,8 +295,9 @@
302 295 )}
303 296 {totalPublished !== null && totalPublished > 100 && !loading && (
304 297 <p className="text-xs text-gray-500 dark:text-gray-400">
305 298 {sprintf(
299 + // translators: %d: total number of published pages on the site.
306 300 __(
307 301 "Showing the first 100 published pages (of %d). Change the selection in WordPress → Pages if yours is not listed.",
308 302 "yatra",
309 303 ),