@orunelle/theme-runtime 2.0.0-alpha.14 → 2.0.0-alpha.15
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/host/preview/src/surface.tsx +68 -7
- package/dist/tanstack/data.d.ts +62 -0
- package/dist/tanstack/data.d.ts.map +1 -1
- package/dist/tanstack/data.js +122 -0
- package/dist/tanstack/index.d.ts +2 -1
- package/dist/tanstack/index.d.ts.map +1 -1
- package/dist/tanstack/index.js +2 -1
- package/dist/tanstack/queries.d.ts +63 -0
- package/dist/tanstack/queries.d.ts.map +1 -1
- package/dist/tanstack/queries.js +22 -0
- package/package.json +5 -5
|
@@ -148,6 +148,65 @@ function PreviewSurface({ bootstrap }: { bootstrap: PreviewBootstrap }) {
|
|
|
148
148
|
};
|
|
149
149
|
const { Layout } = resolved.components;
|
|
150
150
|
const roots = configuration.templates[view.template]?.roots;
|
|
151
|
+
// Templates without sections preview with the theme's own page for that
|
|
152
|
+
// kind (sample data), so choosing "collection" or "page" shows that page.
|
|
153
|
+
const ar = view.locale === "ar";
|
|
154
|
+
const {
|
|
155
|
+
ProductPage,
|
|
156
|
+
CatalogPage,
|
|
157
|
+
ContentPage,
|
|
158
|
+
} = resolved.components as Partial<typeof resolved.components>;
|
|
159
|
+
const samplePagination = {
|
|
160
|
+
page: 1,
|
|
161
|
+
limit: Math.max(1, products.length),
|
|
162
|
+
total: products.length,
|
|
163
|
+
pages: 1,
|
|
164
|
+
};
|
|
165
|
+
const firstCollection = bootstrap.resources.find(
|
|
166
|
+
(resource) => resource.kind === "collection",
|
|
167
|
+
);
|
|
168
|
+
const templatePage = roots?.length
|
|
169
|
+
? null
|
|
170
|
+
: kind === "product" && selected && ProductPage
|
|
171
|
+
? (
|
|
172
|
+
<ProductPage
|
|
173
|
+
product={selected}
|
|
174
|
+
variants={[]}
|
|
175
|
+
related={products.filter((p) => p.id !== selected.id).slice(0, 4)}
|
|
176
|
+
/>
|
|
177
|
+
)
|
|
178
|
+
: (kind === "collection" || kind === "search") && CatalogPage
|
|
179
|
+
? (
|
|
180
|
+
<CatalogPage
|
|
181
|
+
data={{
|
|
182
|
+
kind: "catalog",
|
|
183
|
+
title:
|
|
184
|
+
kind === "search"
|
|
185
|
+
? ar
|
|
186
|
+
? "نتائج البحث"
|
|
187
|
+
: "Search results"
|
|
188
|
+
: (firstCollection?.name[view.locale] ??
|
|
189
|
+
(ar ? "مجموعة تجريبية" : "Sample collection")),
|
|
190
|
+
products,
|
|
191
|
+
pagination: samplePagination,
|
|
192
|
+
}}
|
|
193
|
+
/>
|
|
194
|
+
)
|
|
195
|
+
: kind === "page" && ContentPage
|
|
196
|
+
? (
|
|
197
|
+
<ContentPage
|
|
198
|
+
data={{
|
|
199
|
+
kind: "content",
|
|
200
|
+
title: ar ? "صفحة تجريبية" : "Sample page",
|
|
201
|
+
paragraphs: [
|
|
202
|
+
ar
|
|
203
|
+
? "هذه معاينة لقالب الصفحة. يظهر هنا محتوى صفحات متجرك مثل سياسة الشحن أو صفحة من نحن."
|
|
204
|
+
: "This previews the page template. Your store's pages, such as the shipping policy or About page, appear here.",
|
|
205
|
+
],
|
|
206
|
+
}}
|
|
207
|
+
/>
|
|
208
|
+
)
|
|
209
|
+
: null;
|
|
151
210
|
const fallback = (
|
|
152
211
|
<p role="status">
|
|
153
212
|
{view.locale === "ar"
|
|
@@ -177,7 +236,7 @@ function PreviewSurface({ bootstrap }: { bootstrap: PreviewBootstrap }) {
|
|
|
177
236
|
>
|
|
178
237
|
<PreviewBoundary key={sequence} failed={bridge.renderFailed}>
|
|
179
238
|
<Layout>
|
|
180
|
-
{roots?.length === 0 && (
|
|
239
|
+
{roots?.length === 0 && !templatePage && (
|
|
181
240
|
<p className="sample-notice" role="status">
|
|
182
241
|
{view.locale === "ar"
|
|
183
242
|
? "لا توجد أقسام؛ أضف قسمًا من المحرر."
|
|
@@ -194,12 +253,14 @@ function PreviewSurface({ bootstrap }: { bootstrap: PreviewBootstrap }) {
|
|
|
194
253
|
: "This resource is unavailable in the preview; its reference is retained."}
|
|
195
254
|
</p>
|
|
196
255
|
)}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
256
|
+
{templatePage ?? (
|
|
257
|
+
<ThemeComposition
|
|
258
|
+
scope="template"
|
|
259
|
+
name={view.template}
|
|
260
|
+
fallback={fallback}
|
|
261
|
+
{...(selected ? { productId: selected.id } : {})}
|
|
262
|
+
/>
|
|
263
|
+
)}
|
|
203
264
|
{kind === "cart" && (
|
|
204
265
|
<section className="account-page">
|
|
205
266
|
<h1>
|
package/dist/tanstack/data.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type RoutePageData } from "@orunelle/theme-sdk";
|
|
3
|
+
import type { BlogPost, BlogPostPage, StoreMenu, StorePage } from "@orunelle/theme-sdk";
|
|
3
4
|
export declare const getStorefront: import("@tanstack/react-start").OptionalFetcher<undefined, undefined, import("@orunelle/theme-contract").StorefrontContext>;
|
|
4
5
|
declare const inputSchema: z.ZodObject<{
|
|
5
6
|
kind: z.ZodEnum<["home", "catalog", "categories", "category", "collections", "collection", "search", "product", "content"]>;
|
|
@@ -40,5 +41,66 @@ export declare const getPublicPage: import("@tanstack/react-start").RequiredFetc
|
|
|
40
41
|
page?: number | undefined;
|
|
41
42
|
q?: string | undefined;
|
|
42
43
|
}>, Promise<RoutePageData>>;
|
|
44
|
+
export declare const getStorePage: import("@tanstack/react-start").RequiredFetcher<undefined, z.ZodObject<{
|
|
45
|
+
handle: z.ZodString;
|
|
46
|
+
locale: z.ZodEnum<["en", "ar"]>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
locale: "en" | "ar";
|
|
49
|
+
handle: string;
|
|
50
|
+
}, {
|
|
51
|
+
locale: "en" | "ar";
|
|
52
|
+
handle: string;
|
|
53
|
+
}>, Promise<StorePage | null>>;
|
|
54
|
+
/** Handles and titles of the store's published pages; null without a store. */
|
|
55
|
+
export declare const getStorePages: import("@tanstack/react-start").RequiredFetcher<undefined, z.ZodObject<{
|
|
56
|
+
locale: z.ZodEnum<["en", "ar"]>;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
locale: "en" | "ar";
|
|
59
|
+
}, {
|
|
60
|
+
locale: "en" | "ar";
|
|
61
|
+
}>, Promise<{
|
|
62
|
+
handle: string;
|
|
63
|
+
title: string;
|
|
64
|
+
}[] | null>>;
|
|
65
|
+
export declare const getStoreMenu: import("@tanstack/react-start").RequiredFetcher<undefined, z.ZodObject<{
|
|
66
|
+
handle: z.ZodString;
|
|
67
|
+
locale: z.ZodEnum<["en", "ar"]>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
locale: "en" | "ar";
|
|
70
|
+
handle: string;
|
|
71
|
+
}, {
|
|
72
|
+
locale: "en" | "ar";
|
|
73
|
+
handle: string;
|
|
74
|
+
}>, Promise<StoreMenu | null>>;
|
|
75
|
+
export declare const getBlogPosts: import("@tanstack/react-start").RequiredFetcher<undefined, z.ZodObject<{
|
|
76
|
+
locale: z.ZodEnum<["en", "ar"]>;
|
|
77
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
78
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
79
|
+
tag: z.ZodDefault<z.ZodString>;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
locale: "en" | "ar";
|
|
82
|
+
page: number;
|
|
83
|
+
limit: number;
|
|
84
|
+
tag: string;
|
|
85
|
+
}, {
|
|
86
|
+
locale: "en" | "ar";
|
|
87
|
+
page?: number | undefined;
|
|
88
|
+
limit?: number | undefined;
|
|
89
|
+
tag?: string | undefined;
|
|
90
|
+
}>, Promise<BlogPostPage>>;
|
|
91
|
+
export declare const getBlogPost: import("@tanstack/react-start").RequiredFetcher<undefined, z.ZodObject<{
|
|
92
|
+
handle: z.ZodString;
|
|
93
|
+
locale: z.ZodEnum<["en", "ar"]>;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
locale: "en" | "ar";
|
|
96
|
+
handle: string;
|
|
97
|
+
}, {
|
|
98
|
+
locale: "en" | "ar";
|
|
99
|
+
handle: string;
|
|
100
|
+
}>, Promise<BlogPost | null>>;
|
|
101
|
+
export declare const getBlogTags: import("@tanstack/react-start").OptionalFetcher<undefined, undefined, Promise<{
|
|
102
|
+
tag: string;
|
|
103
|
+
count: number;
|
|
104
|
+
}[]>>;
|
|
43
105
|
export {};
|
|
44
106
|
//# sourceMappingURL=data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/tanstack/data.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,OAAO,EAGL,KAAK,aAAa,EAGnB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/tanstack/data.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,OAAO,EAGL,KAAK,aAAa,EAGnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EAEZ,SAAS,EACT,SAAS,EACV,MAAM,qBAAqB,CAAC;AAsH7B,eAAO,MAAM,aAAa,6HAEzB,CAAC;AACF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;EAgBf,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;2BAgNtB,CAAC;AA0DL,eAAO,MAAM,YAAY;;;;;;;;;8BAcrB,CAAC;AAEL,+EAA+E;AAC/E,eAAO,MAAM,aAAa;;;;;;;YAEqB,MAAM;WAAS,MAAM;YAKhE,CAAC;AAEL,eAAO,MAAM,YAAY;;;;;;;;;8BAMrB,CAAC;AAcL,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;0BAarB,CAAC;AAEL,eAAO,MAAM,WAAW;;;;;;;;;6BAYpB,CAAC;AAEL,eAAO,MAAM,WAAW;SAAsE,MAAM;WAAS,MAAM;KAIjH,CAAC"}
|
package/dist/tanstack/data.js
CHANGED
|
@@ -318,3 +318,125 @@ export const getPublicPage = createServerFn({ method: "GET" })
|
|
|
318
318
|
throw error;
|
|
319
319
|
}
|
|
320
320
|
});
|
|
321
|
+
const text = z.object({ en: z.string(), ar: z.string() }).partial();
|
|
322
|
+
const doc = z.array(z.any()).default([]);
|
|
323
|
+
const body = z.object({ en: doc, ar: doc }).partial();
|
|
324
|
+
const seo = z.object({ title: text.optional(), description: text.optional() }).partial();
|
|
325
|
+
const pageSchema = z.object({ handle: z.string(), title: text, body, seo: seo.optional(), updatedAt: z.string().default("") });
|
|
326
|
+
const postSchema = z.object({
|
|
327
|
+
handle: z.string(),
|
|
328
|
+
title: text,
|
|
329
|
+
excerpt: text.optional(),
|
|
330
|
+
body: body.optional(),
|
|
331
|
+
seo: seo.optional(),
|
|
332
|
+
cover: z.string().default(""),
|
|
333
|
+
author: z.string().default(""),
|
|
334
|
+
tags: z.array(z.string()).default([]),
|
|
335
|
+
publishedAt: z.string().default(""),
|
|
336
|
+
});
|
|
337
|
+
const menuItem = z.lazy(() => z.object({ label: z.string(), href: z.string(), children: z.array(menuItem).optional() }));
|
|
338
|
+
const menuSchema = z.object({ handle: z.string(), title: z.string(), items: z.array(menuItem) });
|
|
339
|
+
function say(value, lang) {
|
|
340
|
+
return (lang === "ar" ? value?.ar || value?.en : value?.en || value?.ar) ?? "";
|
|
341
|
+
}
|
|
342
|
+
function pickDoc(value, lang) {
|
|
343
|
+
const primary = lang === "ar" ? value?.ar : value?.en;
|
|
344
|
+
const other = lang === "ar" ? value?.en : value?.ar;
|
|
345
|
+
return ((primary?.length ? primary : other) ?? []);
|
|
346
|
+
}
|
|
347
|
+
/** GETs a storefront path; null on 404, throws on other failures. */
|
|
348
|
+
async function read(path, params = {}) {
|
|
349
|
+
const { binding } = resolve();
|
|
350
|
+
if (!binding)
|
|
351
|
+
return null;
|
|
352
|
+
const url = new URL(apiStoreUrl(binding, path));
|
|
353
|
+
for (const [key, value] of Object.entries(params))
|
|
354
|
+
if (value)
|
|
355
|
+
url.searchParams.set(key, value);
|
|
356
|
+
const response = await serverFetch(url, { headers: { accept: "application/json" } }, binding.brokerToken);
|
|
357
|
+
if (response.status === 404)
|
|
358
|
+
return null;
|
|
359
|
+
if (!response.ok)
|
|
360
|
+
throw new Error(`Store content request failed: ${response.status}`);
|
|
361
|
+
return (await response.json());
|
|
362
|
+
}
|
|
363
|
+
const handle = z.string().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(160);
|
|
364
|
+
const lang = z.enum(["en", "ar"]);
|
|
365
|
+
export const getStorePage = createServerFn({ method: "GET" })
|
|
366
|
+
.validator(z.object({ handle, locale: lang }))
|
|
367
|
+
.handler(async ({ data }) => {
|
|
368
|
+
const result = await read(`/pages/${data.handle}`);
|
|
369
|
+
const parsed = result ? pageSchema.safeParse(result.data) : null;
|
|
370
|
+
if (!parsed?.success)
|
|
371
|
+
return null;
|
|
372
|
+
const page = parsed.data;
|
|
373
|
+
return {
|
|
374
|
+
handle: page.handle,
|
|
375
|
+
title: say(page.title, data.locale),
|
|
376
|
+
body: pickDoc(page.body, data.locale),
|
|
377
|
+
seo: { title: say(page.seo?.title, data.locale), description: say(page.seo?.description, data.locale) },
|
|
378
|
+
updatedAt: page.updatedAt,
|
|
379
|
+
};
|
|
380
|
+
});
|
|
381
|
+
/** Handles and titles of the store's published pages; null without a store. */
|
|
382
|
+
export const getStorePages = createServerFn({ method: "GET" })
|
|
383
|
+
.validator(z.object({ locale: lang }))
|
|
384
|
+
.handler(async ({ data }) => {
|
|
385
|
+
const result = await read("/pages");
|
|
386
|
+
const parsed = result ? z.array(z.object({ handle: z.string(), title: text })).safeParse(result.data) : null;
|
|
387
|
+
if (!parsed?.success)
|
|
388
|
+
return null;
|
|
389
|
+
return parsed.data.map((p) => ({ handle: p.handle, title: say(p.title, data.locale) }));
|
|
390
|
+
});
|
|
391
|
+
export const getStoreMenu = createServerFn({ method: "GET" })
|
|
392
|
+
.validator(z.object({ handle: z.string().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(60), locale: lang }))
|
|
393
|
+
.handler(async ({ data }) => {
|
|
394
|
+
const result = await read(`/menus/${data.handle}`, { locale: data.locale });
|
|
395
|
+
const parsed = result ? menuSchema.safeParse(result.data) : null;
|
|
396
|
+
return parsed?.success ? parsed.data : null;
|
|
397
|
+
});
|
|
398
|
+
function summary(post, locale) {
|
|
399
|
+
return {
|
|
400
|
+
handle: post.handle,
|
|
401
|
+
title: say(post.title, locale),
|
|
402
|
+
excerpt: say(post.excerpt, locale),
|
|
403
|
+
cover: post.cover,
|
|
404
|
+
author: post.author,
|
|
405
|
+
tags: post.tags,
|
|
406
|
+
publishedAt: post.publishedAt,
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
export const getBlogPosts = createServerFn({ method: "GET" })
|
|
410
|
+
.validator(z.object({ locale: lang, page: z.number().int().min(1).max(10000).default(1), limit: z.number().int().min(1).max(50).default(12), tag: z.string().max(40).default("") }))
|
|
411
|
+
.handler(async ({ data }) => {
|
|
412
|
+
const result = await read("/blog/posts", { page: String(data.page), limit: String(data.limit), tag: data.tag });
|
|
413
|
+
const parsed = result ? z.array(postSchema).safeParse(result.data) : null;
|
|
414
|
+
if (!result || !parsed?.success)
|
|
415
|
+
return { items: [], page: data.page, pages: 0, total: 0 };
|
|
416
|
+
const pagination = result.meta?.pagination;
|
|
417
|
+
return {
|
|
418
|
+
items: parsed.data.map((p) => summary(p, data.locale)),
|
|
419
|
+
page: pagination?.page ?? data.page,
|
|
420
|
+
pages: pagination?.pages ?? 1,
|
|
421
|
+
total: pagination?.total ?? parsed.data.length,
|
|
422
|
+
};
|
|
423
|
+
});
|
|
424
|
+
export const getBlogPost = createServerFn({ method: "GET" })
|
|
425
|
+
.validator(z.object({ handle, locale: lang }))
|
|
426
|
+
.handler(async ({ data }) => {
|
|
427
|
+
const result = await read(`/blog/posts/${data.handle}`);
|
|
428
|
+
const parsed = result ? postSchema.safeParse(result.data) : null;
|
|
429
|
+
if (!parsed?.success)
|
|
430
|
+
return null;
|
|
431
|
+
const post = parsed.data;
|
|
432
|
+
return {
|
|
433
|
+
...summary(post, data.locale),
|
|
434
|
+
body: pickDoc(post.body, data.locale),
|
|
435
|
+
seo: { title: say(post.seo?.title, data.locale), description: say(post.seo?.description, data.locale) },
|
|
436
|
+
};
|
|
437
|
+
});
|
|
438
|
+
export const getBlogTags = createServerFn({ method: "GET" }).handler(async () => {
|
|
439
|
+
const result = await read("/blog/tags");
|
|
440
|
+
const parsed = result ? z.array(z.object({ tag: z.string(), count: z.number() })).safeParse(result.data) : null;
|
|
441
|
+
return parsed?.success ? parsed.data : [];
|
|
442
|
+
});
|
package/dist/tanstack/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { getStorefront, getPublicPage } from "./data.js";
|
|
2
2
|
export type { PublicInput } from "./data.js";
|
|
3
|
-
export {
|
|
3
|
+
export { getStorePage, getStorePages, getStoreMenu, getBlogPosts, getBlogPost, getBlogTags } from "./data.js";
|
|
4
|
+
export { pageQuery, storePageQuery, storePagesQuery, storeMenuQuery, blogPostsQuery, blogPostQuery, blogTagsQuery, } from "./queries.js";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tanstack/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tanstack/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC9G,OAAO,EACL,SAAS,EACT,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,cAAc,CAAC"}
|
package/dist/tanstack/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { getStorefront, getPublicPage } from "./data.js";
|
|
2
|
-
export {
|
|
2
|
+
export { getStorePage, getStorePages, getStoreMenu, getBlogPosts, getBlogPost, getBlogTags } from "./data.js";
|
|
3
|
+
export { pageQuery, storePageQuery, storePagesQuery, storeMenuQuery, blogPostsQuery, blogPostQuery, blogTagsQuery, } from "./queries.js";
|
|
@@ -3,4 +3,67 @@ import { type PublicInput } from "./data.js";
|
|
|
3
3
|
export declare function pageQuery(context: StorefrontContext, input: PublicInput): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@orunelle/theme-sdk").RoutePageData, Error, import("@orunelle/theme-sdk").RoutePageData, readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown]>, "queryFn", "strictly"> & {
|
|
4
4
|
queryFn?: import("@tanstack/react-query").QueryFunction<import("@orunelle/theme-sdk").RoutePageData, readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], never>;
|
|
5
5
|
} & import("@tanstack/react-query").QueryKeyWithDataTag<readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], import("@orunelle/theme-sdk").RoutePageData, Error>;
|
|
6
|
+
type Locale = "en" | "ar";
|
|
7
|
+
/** A store page by handle; null when the store has none (or it's hidden). */
|
|
8
|
+
export declare function storePageQuery(context: StorefrontContext, input: {
|
|
9
|
+
handle: string;
|
|
10
|
+
locale: Locale;
|
|
11
|
+
}): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@orunelle/theme-sdk").StorePage | null, Error, import("@orunelle/theme-sdk").StorePage | null, readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown]>, "queryFn", "strictly"> & {
|
|
12
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<import("@orunelle/theme-sdk").StorePage | null, readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], never>;
|
|
13
|
+
} & import("@tanstack/react-query").QueryKeyWithDataTag<readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], import("@orunelle/theme-sdk").StorePage | null, Error>;
|
|
14
|
+
/** The store's published pages (handle and title); null without a store. */
|
|
15
|
+
export declare function storePagesQuery(context: StorefrontContext, input: {
|
|
16
|
+
locale: Locale;
|
|
17
|
+
}): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
|
|
18
|
+
handle: string;
|
|
19
|
+
title: string;
|
|
20
|
+
}[] | null, Error, {
|
|
21
|
+
handle: string;
|
|
22
|
+
title: string;
|
|
23
|
+
}[] | null, readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown]>, "queryFn", "strictly"> & {
|
|
24
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<{
|
|
25
|
+
handle: string;
|
|
26
|
+
title: string;
|
|
27
|
+
}[] | null, readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], never>;
|
|
28
|
+
} & import("@tanstack/react-query").QueryKeyWithDataTag<readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], {
|
|
29
|
+
handle: string;
|
|
30
|
+
title: string;
|
|
31
|
+
}[] | null, Error>;
|
|
32
|
+
/** A store menu ("main-menu", "footer-menu"…); null until the merchant creates it. */
|
|
33
|
+
export declare function storeMenuQuery(context: StorefrontContext, input: {
|
|
34
|
+
handle: string;
|
|
35
|
+
locale: Locale;
|
|
36
|
+
}): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@orunelle/theme-sdk").StoreMenu | null, Error, import("@orunelle/theme-sdk").StoreMenu | null, readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown]>, "queryFn", "strictly"> & {
|
|
37
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<import("@orunelle/theme-sdk").StoreMenu | null, readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], never>;
|
|
38
|
+
} & import("@tanstack/react-query").QueryKeyWithDataTag<readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], import("@orunelle/theme-sdk").StoreMenu | null, Error>;
|
|
39
|
+
export declare function blogPostsQuery(context: StorefrontContext, input: {
|
|
40
|
+
locale: Locale;
|
|
41
|
+
page?: number;
|
|
42
|
+
limit?: number;
|
|
43
|
+
tag?: string;
|
|
44
|
+
}): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@orunelle/theme-sdk").BlogPostPage, Error, import("@orunelle/theme-sdk").BlogPostPage, readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown]>, "queryFn", "strictly"> & {
|
|
45
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<import("@orunelle/theme-sdk").BlogPostPage, readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], never>;
|
|
46
|
+
} & import("@tanstack/react-query").QueryKeyWithDataTag<readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], import("@orunelle/theme-sdk").BlogPostPage, Error>;
|
|
47
|
+
export declare function blogPostQuery(context: StorefrontContext, input: {
|
|
48
|
+
handle: string;
|
|
49
|
+
locale: Locale;
|
|
50
|
+
}): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@orunelle/theme-sdk").BlogPost | null, Error, import("@orunelle/theme-sdk").BlogPost | null, readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown]>, "queryFn", "strictly"> & {
|
|
51
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<import("@orunelle/theme-sdk").BlogPost | null, readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], never>;
|
|
52
|
+
} & import("@tanstack/react-query").QueryKeyWithDataTag<readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], import("@orunelle/theme-sdk").BlogPost | null, Error>;
|
|
53
|
+
export declare function blogTagsQuery(context: StorefrontContext): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
|
|
54
|
+
tag: string;
|
|
55
|
+
count: number;
|
|
56
|
+
}[], Error, {
|
|
57
|
+
tag: string;
|
|
58
|
+
count: number;
|
|
59
|
+
}[], readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown]>, "queryFn", "strictly"> & {
|
|
60
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<{
|
|
61
|
+
tag: string;
|
|
62
|
+
count: number;
|
|
63
|
+
}[], readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], never>;
|
|
64
|
+
} & import("@tanstack/react-query").QueryKeyWithDataTag<readonly ["storefront", string, string, "en" | "ar", string, string, string, number, "public" | "preview", string, unknown], {
|
|
65
|
+
tag: string;
|
|
66
|
+
count: number;
|
|
67
|
+
}[], Error>;
|
|
68
|
+
export {};
|
|
6
69
|
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/tanstack/queries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/tanstack/queries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAG5D,wBAAgB,SAAS,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,WAAW;;yOAIvE;AAED,KAAK,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1B,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;;4OAEnG;AACD,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;mBAEpF;AACD,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;;4OAEnG;AACD,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE;;wOAEhI;AACD,wBAAgB,aAAa,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;;2OAElG;AACD,wBAAgB,aAAa,CAAC,OAAO,EAAE,iBAAiB;;;;;;;;;;;;;;YAEvD"}
|
package/dist/tanstack/queries.js
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import { publicQuery } from "@orunelle/theme-sdk/query";
|
|
2
2
|
import { getPublicPage } from "./data.js";
|
|
3
|
+
import { getBlogPost, getBlogPosts, getBlogTags, getStoreMenu, getStorePage, getStorePages } from "./data.js";
|
|
3
4
|
export function pageQuery(context, input) {
|
|
4
5
|
return publicQuery(context, "page", input, (signal) => getPublicPage({ data: input, signal }));
|
|
5
6
|
}
|
|
7
|
+
/** A store page by handle; null when the store has none (or it's hidden). */
|
|
8
|
+
export function storePageQuery(context, input) {
|
|
9
|
+
return publicQuery(context, "store-page", input, (signal) => getStorePage({ data: input, signal }));
|
|
10
|
+
}
|
|
11
|
+
/** The store's published pages (handle and title); null without a store. */
|
|
12
|
+
export function storePagesQuery(context, input) {
|
|
13
|
+
return publicQuery(context, "store-pages", input, (signal) => getStorePages({ data: input, signal }));
|
|
14
|
+
}
|
|
15
|
+
/** A store menu ("main-menu", "footer-menu"…); null until the merchant creates it. */
|
|
16
|
+
export function storeMenuQuery(context, input) {
|
|
17
|
+
return publicQuery(context, "store-menu", input, (signal) => getStoreMenu({ data: input, signal }));
|
|
18
|
+
}
|
|
19
|
+
export function blogPostsQuery(context, input) {
|
|
20
|
+
return publicQuery(context, "blog-posts", input, (signal) => getBlogPosts({ data: input, signal }));
|
|
21
|
+
}
|
|
22
|
+
export function blogPostQuery(context, input) {
|
|
23
|
+
return publicQuery(context, "blog-post", input, (signal) => getBlogPost({ data: input, signal }));
|
|
24
|
+
}
|
|
25
|
+
export function blogTagsQuery(context) {
|
|
26
|
+
return publicQuery(context, "blog-tags", null, (signal) => getBlogTags({ signal }));
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orunelle/theme-runtime",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.15",
|
|
4
4
|
"description": "Orunelle theme runtime: Vite/TanStack integration, local preview host and the orunelle-theme CLI",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://orunelle.com",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"react-dom": "19.3.1",
|
|
65
65
|
"@tanstack/router-generator": "1.167.46",
|
|
66
66
|
"sanitize-html": "2.18.2",
|
|
67
|
-
"@orunelle/theme-sdk": "2.0.0-alpha.
|
|
68
|
-
"@orunelle/theme-engine": "2.0.0-alpha.
|
|
69
|
-
"@orunelle/theme-
|
|
70
|
-
"@orunelle/theme-
|
|
67
|
+
"@orunelle/theme-sdk": "2.0.0-alpha.15",
|
|
68
|
+
"@orunelle/theme-engine": "2.0.0-alpha.15",
|
|
69
|
+
"@orunelle/theme-editor": "2.0.0-alpha.15",
|
|
70
|
+
"@orunelle/theme-contract": "2.0.0-alpha.15"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"vite": "8.3.6",
|