@numueg/theme-cli 0.5.0 → 0.6.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 +22 -0
- package/dist/index.js +817 -405
- package/package.json +2 -1
- package/templates/scaffold/index.html +13 -0
- package/templates/scaffold/package.json +27 -0
- package/templates/scaffold/schemas/sections/about_section.json +23 -0
- package/templates/scaffold/schemas/sections/account.json +8 -0
- package/templates/scaffold/schemas/sections/cart_summary.json +12 -0
- package/templates/scaffold/schemas/sections/categories.json +9 -0
- package/templates/scaffold/schemas/sections/featured_collection.json +14 -0
- package/templates/scaffold/schemas/sections/footer.json +14 -0
- package/templates/scaffold/schemas/sections/frequently_bought.json +10 -0
- package/templates/scaffold/schemas/sections/header.json +14 -0
- package/templates/scaffold/schemas/sections/hero.json +15 -0
- package/templates/scaffold/schemas/sections/image_with_text.json +19 -0
- package/templates/scaffold/schemas/sections/marquee.json +9 -0
- package/templates/scaffold/schemas/sections/newsletter.json +11 -0
- package/templates/scaffold/schemas/sections/not_found.json +12 -0
- package/templates/scaffold/schemas/sections/order_confirmation.json +9 -0
- package/templates/scaffold/schemas/sections/product_details.json +12 -0
- package/templates/scaffold/schemas/sections/product_grid.json +12 -0
- package/templates/scaffold/schemas/sections/promo_banner.json +13 -0
- package/templates/scaffold/schemas/sections/rich_text.json +17 -0
- package/templates/scaffold/schemas/sections/search_results.json +11 -0
- package/templates/scaffold/schemas/sections/size_chart.json +9 -0
- package/templates/scaffold/schemas/sections/testimonials.json +22 -0
- package/templates/scaffold/settings_schema.json +35 -0
- package/templates/scaffold/src/dev-entry.tsx +244 -0
- package/templates/scaffold/src/lib/CouponForm.tsx +90 -0
- package/templates/scaffold/src/lib/EditableText.tsx +178 -0
- package/templates/scaffold/src/lib/ProductCard.tsx +99 -0
- package/templates/scaffold/src/lib/cartUI.ts +43 -0
- package/templates/scaffold/src/lib/i18n.ts +17 -0
- package/templates/scaffold/src/lib/section.ts +12 -0
- package/templates/scaffold/src/main.tsx +230 -0
- package/templates/scaffold/src/sections/Footer.tsx +161 -0
- package/templates/scaffold/src/sections/Header.tsx +453 -0
- package/templates/scaffold/src/sections/about_section.tsx +104 -0
- package/templates/scaffold/src/sections/account.tsx +422 -0
- package/templates/scaffold/src/sections/cart_summary.tsx +169 -0
- package/templates/scaffold/src/sections/categories.tsx +57 -0
- package/templates/scaffold/src/sections/featured_collection.tsx +109 -0
- package/templates/scaffold/src/sections/frequently_bought.tsx +187 -0
- package/templates/scaffold/src/sections/hero.tsx +133 -0
- package/templates/scaffold/src/sections/image_with_text.tsx +105 -0
- package/templates/scaffold/src/sections/marquee.tsx +45 -0
- package/templates/scaffold/src/sections/newsletter.tsx +79 -0
- package/templates/scaffold/src/sections/not_found.tsx +56 -0
- package/templates/scaffold/src/sections/order_confirmation.tsx +127 -0
- package/templates/scaffold/src/sections/product_details.tsx +517 -0
- package/templates/scaffold/src/sections/product_grid.tsx +147 -0
- package/templates/scaffold/src/sections/promo_banner.tsx +80 -0
- package/templates/scaffold/src/sections/rich_text.tsx +51 -0
- package/templates/scaffold/src/sections/search_results.tsx +93 -0
- package/templates/scaffold/src/sections/size_chart.tsx +109 -0
- package/templates/scaffold/src/sections/testimonials.tsx +112 -0
- package/templates/scaffold/styles.css +2404 -0
- package/templates/scaffold/templates/error.html +13 -0
- package/templates/scaffold/templates/loading.html +11 -0
- package/templates/scaffold/theme.json +224 -0
- package/templates/scaffold/tsconfig.json +22 -0
- package/templates/scaffold/vite.config.ts +16 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { EditableText } from "../lib/EditableText";
|
|
2
|
+
import type { EmpSectionProps } from "../lib/section";
|
|
3
|
+
|
|
4
|
+
interface NotFoundSettings {
|
|
5
|
+
code?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
message?: string;
|
|
8
|
+
cta_text?: string;
|
|
9
|
+
cta_link?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** 404 page body — oversized code numeral, message and a CTA back to the shop. */
|
|
13
|
+
export default function NotFound({ id, settings }: EmpSectionProps) {
|
|
14
|
+
const s = settings as NotFoundSettings;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<section
|
|
18
|
+
className="nt-container"
|
|
19
|
+
style={{ paddingBlock: "6rem", textAlign: "center" }}
|
|
20
|
+
>
|
|
21
|
+
<p
|
|
22
|
+
className="nt-display"
|
|
23
|
+
style={{ fontSize: "clamp(4rem, 18vw, 9rem)", lineHeight: 1 }}
|
|
24
|
+
>
|
|
25
|
+
{s.code || "404"}
|
|
26
|
+
</p>
|
|
27
|
+
<EditableText
|
|
28
|
+
as="h1"
|
|
29
|
+
className="nt-heading"
|
|
30
|
+
sectionId={id}
|
|
31
|
+
settingId="title"
|
|
32
|
+
value={s.title ?? "الصفحة غير موجودة"}
|
|
33
|
+
style={{ marginBottom: "0.75rem" }}
|
|
34
|
+
/>
|
|
35
|
+
<EditableText
|
|
36
|
+
as="p"
|
|
37
|
+
className="nt-muted"
|
|
38
|
+
sectionId={id}
|
|
39
|
+
settingId="message"
|
|
40
|
+
value={
|
|
41
|
+
s.message ??
|
|
42
|
+
"يبدو أن الصفحة التي تبحث عنها غير متاحة أو تم نقلها."
|
|
43
|
+
}
|
|
44
|
+
style={{ marginBottom: "2rem" }}
|
|
45
|
+
/>
|
|
46
|
+
<a className="nt-btn" href={s.cta_link || "/products"}>
|
|
47
|
+
<EditableText
|
|
48
|
+
as="span"
|
|
49
|
+
sectionId={id}
|
|
50
|
+
settingId="cta_text"
|
|
51
|
+
value={s.cta_text ?? "العودة للتسوق"}
|
|
52
|
+
/>
|
|
53
|
+
</a>
|
|
54
|
+
</section>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useOrder,
|
|
3
|
+
usePage,
|
|
4
|
+
useLocalization,
|
|
5
|
+
} from "@numueg/theme-sdk";
|
|
6
|
+
import { EditableText } from "../lib/EditableText";
|
|
7
|
+
import type { EmpSectionProps } from "../lib/section";
|
|
8
|
+
|
|
9
|
+
interface OcSettings {
|
|
10
|
+
title?: string;
|
|
11
|
+
subtitle?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Order confirmation / thank-you page. The storefront passes the order id via
|
|
16
|
+
* `page.data.order_id` (or the page handle); `useOrder` fetches the detail.
|
|
17
|
+
*/
|
|
18
|
+
export default function OrderConfirmation({ id, settings }: EmpSectionProps) {
|
|
19
|
+
const s = settings as OcSettings;
|
|
20
|
+
const page = usePage();
|
|
21
|
+
const orderId =
|
|
22
|
+
(page?.data?.order_id as string | undefined) ?? page?.handle ?? null;
|
|
23
|
+
const { order, loading } = useOrder(orderId);
|
|
24
|
+
const { formatMoney } = useLocalization();
|
|
25
|
+
|
|
26
|
+
if (loading) {
|
|
27
|
+
return (
|
|
28
|
+
<section className="nt-page nt-container">
|
|
29
|
+
<p className="nt-placeholder">جارٍ تحميل طلبك…</p>
|
|
30
|
+
</section>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!order) {
|
|
35
|
+
return (
|
|
36
|
+
<section className="nt-page nt-container">
|
|
37
|
+
<div className="nt-oc">
|
|
38
|
+
<h1 className="nt-display-sm" style={{ marginBottom: "0.5rem" }}>
|
|
39
|
+
لم يتم العثور على الطلب
|
|
40
|
+
</h1>
|
|
41
|
+
<p className="nt-muted" style={{ marginBottom: "1.5rem" }}>
|
|
42
|
+
راجع بريد التأكيد للوصول إلى رابط طلبك.
|
|
43
|
+
</p>
|
|
44
|
+
<a className="nt-btn-outline" href="/">
|
|
45
|
+
العودة للرئيسية
|
|
46
|
+
</a>
|
|
47
|
+
</div>
|
|
48
|
+
</section>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const items = (order.line_items as Array<Record<string, unknown>>) ?? [];
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<section className="nt-container" style={{ paddingBlock: "4rem" }}>
|
|
56
|
+
<div className="nt-oc">
|
|
57
|
+
<div className="nt-oc__icon">
|
|
58
|
+
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true">
|
|
59
|
+
<path d="M20 6 9 17l-5-5" />
|
|
60
|
+
</svg>
|
|
61
|
+
</div>
|
|
62
|
+
<EditableText
|
|
63
|
+
as="h1"
|
|
64
|
+
className="nt-display-sm"
|
|
65
|
+
sectionId={id}
|
|
66
|
+
settingId="title"
|
|
67
|
+
value={s.title || "شكراً لطلبك!"}
|
|
68
|
+
style={{ marginBottom: "0.5rem" }}
|
|
69
|
+
/>
|
|
70
|
+
<EditableText
|
|
71
|
+
as="p"
|
|
72
|
+
className="nt-muted"
|
|
73
|
+
sectionId={id}
|
|
74
|
+
settingId="subtitle"
|
|
75
|
+
value={s.subtitle || "تم استلام طلبك بنجاح. هنبعتلك تأكيد على بريدك."}
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<div className="nt-oc__card">
|
|
79
|
+
<div className="nt-oc__row">
|
|
80
|
+
<span className="nt-muted">رقم الطلب</span>
|
|
81
|
+
<span className="nt-mono" style={{ fontWeight: 800 }}>
|
|
82
|
+
#{order.order_number}
|
|
83
|
+
</span>
|
|
84
|
+
</div>
|
|
85
|
+
<div className="nt-oc__row">
|
|
86
|
+
<span className="nt-muted">الحالة</span>
|
|
87
|
+
<span style={{ fontWeight: 700, textTransform: "capitalize" }}>
|
|
88
|
+
{order.status}
|
|
89
|
+
</span>
|
|
90
|
+
</div>
|
|
91
|
+
<div className="nt-oc__row">
|
|
92
|
+
<span className="nt-muted">الإجمالي</span>
|
|
93
|
+
<span style={{ fontWeight: 800 }}>
|
|
94
|
+
{formatMoney(order.total, order.currency)}
|
|
95
|
+
</span>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
{items.length > 0 ? (
|
|
100
|
+
<ul className="nt-oc__items">
|
|
101
|
+
{items.map((it, i) => {
|
|
102
|
+
const name =
|
|
103
|
+
(it.name as string) || (it.title as string) || "منتج";
|
|
104
|
+
const qty = (it.quantity as number) ?? 1;
|
|
105
|
+
const price = (it.price as number) ?? 0;
|
|
106
|
+
return (
|
|
107
|
+
<li className="nt-oc__item" key={i}>
|
|
108
|
+
<span>
|
|
109
|
+
{name}{" "}
|
|
110
|
+
<span className="nt-muted" style={{ fontSize: "0.75rem" }}>
|
|
111
|
+
× {qty}
|
|
112
|
+
</span>
|
|
113
|
+
</span>
|
|
114
|
+
<span>{formatMoney(price * qty, order.currency)}</span>
|
|
115
|
+
</li>
|
|
116
|
+
);
|
|
117
|
+
})}
|
|
118
|
+
</ul>
|
|
119
|
+
) : null}
|
|
120
|
+
|
|
121
|
+
<a className="nt-btn" href="/products">
|
|
122
|
+
متابعة التسوق
|
|
123
|
+
</a>
|
|
124
|
+
</div>
|
|
125
|
+
</section>
|
|
126
|
+
);
|
|
127
|
+
}
|