@artisanpack-ui/ecommerce-storefront-react 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +67 -2
- package/dist/Addresses-D3ESHG3L.mjs +27 -0
- package/dist/Addresses-D3ESHG3L.mjs.map +1 -0
- package/dist/CategoryShow-OAGROEMA.mjs +12 -0
- package/dist/CategoryShow-OAGROEMA.mjs.map +1 -0
- package/dist/Claim-CJ4UOAUD.mjs +22 -0
- package/dist/Claim-CJ4UOAUD.mjs.map +1 -0
- package/dist/Confirmation-TLMMBPWS.mjs +20 -0
- package/dist/Confirmation-TLMMBPWS.mjs.map +1 -0
- package/dist/Dashboard-ARXORMTL.mjs +24 -0
- package/dist/Dashboard-ARXORMTL.mjs.map +1 -0
- package/dist/Downloads-CEQBY7JO.mjs +25 -0
- package/dist/Downloads-CEQBY7JO.mjs.map +1 -0
- package/dist/Index-KRR3Q7EJ.mjs +12 -0
- package/dist/Index-KRR3Q7EJ.mjs.map +1 -0
- package/dist/Index-RLQFEBTX.mjs +22 -0
- package/dist/Index-RLQFEBTX.mjs.map +1 -0
- package/dist/Index-WDJYGR5Q.mjs +12 -0
- package/dist/Index-WDJYGR5Q.mjs.map +1 -0
- package/dist/Index-XYU5QLUT.mjs +23 -0
- package/dist/Index-XYU5QLUT.mjs.map +1 -0
- package/dist/Lookup-QNUQKUID.mjs +19 -0
- package/dist/Lookup-QNUQKUID.mjs.map +1 -0
- package/dist/OrderShow-RYTP62YA.mjs +27 -0
- package/dist/OrderShow-RYTP62YA.mjs.map +1 -0
- package/dist/Orders-LZW57GE6.mjs +25 -0
- package/dist/Orders-LZW57GE6.mjs.map +1 -0
- package/dist/Profile-ZAAWFCAL.mjs +25 -0
- package/dist/Profile-ZAAWFCAL.mjs.map +1 -0
- package/dist/Show-LFWUO3KR.mjs +14 -0
- package/dist/Show-LFWUO3KR.mjs.map +1 -0
- package/dist/TagShow-FXKXRGY2.mjs +12 -0
- package/dist/TagShow-FXKXRGY2.mjs.map +1 -0
- package/dist/chunk-5UUNH3EH.mjs +1888 -0
- package/dist/chunk-5UUNH3EH.mjs.map +1 -0
- package/dist/chunk-A3MMQ2RY.mjs +183 -0
- package/dist/chunk-A3MMQ2RY.mjs.map +1 -0
- package/dist/chunk-ABGPTZ3Q.mjs +198 -0
- package/dist/chunk-ABGPTZ3Q.mjs.map +1 -0
- package/dist/chunk-BJ3FJFZQ.mjs +32 -0
- package/dist/chunk-BJ3FJFZQ.mjs.map +1 -0
- package/dist/chunk-BSASRFQ7.mjs +89 -0
- package/dist/chunk-BSASRFQ7.mjs.map +1 -0
- package/dist/chunk-CGCW3555.mjs +148 -0
- package/dist/chunk-CGCW3555.mjs.map +1 -0
- package/dist/chunk-DWR23FJD.mjs +643 -0
- package/dist/chunk-DWR23FJD.mjs.map +1 -0
- package/dist/chunk-ENY3MH2W.mjs +148 -0
- package/dist/chunk-ENY3MH2W.mjs.map +1 -0
- package/dist/chunk-EWJLRWPO.mjs +280 -0
- package/dist/chunk-EWJLRWPO.mjs.map +1 -0
- package/dist/chunk-FL5XL3ET.mjs +212 -0
- package/dist/chunk-FL5XL3ET.mjs.map +1 -0
- package/dist/chunk-FOOP6UK3.mjs +218 -0
- package/dist/chunk-FOOP6UK3.mjs.map +1 -0
- package/dist/chunk-HCC7GTVO.mjs +115 -0
- package/dist/chunk-HCC7GTVO.mjs.map +1 -0
- package/dist/chunk-HXZMY3GE.mjs +2331 -0
- package/dist/chunk-HXZMY3GE.mjs.map +1 -0
- package/dist/chunk-IOL2YQ62.mjs +109 -0
- package/dist/chunk-IOL2YQ62.mjs.map +1 -0
- package/dist/chunk-JH7SFSZA.mjs +104 -0
- package/dist/chunk-JH7SFSZA.mjs.map +1 -0
- package/dist/chunk-JJOPX4PI.mjs +205 -0
- package/dist/chunk-JJOPX4PI.mjs.map +1 -0
- package/dist/chunk-LT3GG7YQ.mjs +32 -0
- package/dist/chunk-LT3GG7YQ.mjs.map +1 -0
- package/dist/chunk-MZFULGDI.mjs +267 -0
- package/dist/chunk-MZFULGDI.mjs.map +1 -0
- package/dist/chunk-O4WPMMSH.mjs +58 -0
- package/dist/chunk-O4WPMMSH.mjs.map +1 -0
- package/dist/chunk-OU3WYFIH.mjs +397 -0
- package/dist/chunk-OU3WYFIH.mjs.map +1 -0
- package/dist/chunk-P3NIV4YG.mjs +998 -0
- package/dist/chunk-P3NIV4YG.mjs.map +1 -0
- package/dist/chunk-PEBBSZ5R.mjs +201 -0
- package/dist/chunk-PEBBSZ5R.mjs.map +1 -0
- package/dist/chunk-T5OWL6EG.mjs +73 -0
- package/dist/chunk-T5OWL6EG.mjs.map +1 -0
- package/dist/chunk-THPUK35U.mjs +132 -0
- package/dist/chunk-THPUK35U.mjs.map +1 -0
- package/dist/chunk-TPOKMH5E.mjs +142 -0
- package/dist/chunk-TPOKMH5E.mjs.map +1 -0
- package/dist/chunk-VX5TEJNU.mjs +1898 -0
- package/dist/chunk-VX5TEJNU.mjs.map +1 -0
- package/dist/chunk-WUL34MB2.mjs +268 -0
- package/dist/chunk-WUL34MB2.mjs.map +1 -0
- package/dist/chunk-WYGOMIZK.mjs +140 -0
- package/dist/chunk-WYGOMIZK.mjs.map +1 -0
- package/dist/chunk-Y2IOBBN7.mjs +127 -0
- package/dist/chunk-Y2IOBBN7.mjs.map +1 -0
- package/dist/chunk-Y5BRPEHA.mjs +54 -0
- package/dist/chunk-Y5BRPEHA.mjs.map +1 -0
- package/dist/index.d.ts +4607 -0
- package/dist/index.mjs +1515 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +112 -4
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Price,
|
|
3
|
+
cx,
|
|
4
|
+
getRegistries
|
|
5
|
+
} from "./chunk-VX5TEJNU.mjs";
|
|
6
|
+
|
|
7
|
+
// src/components/RatingSummary.tsx
|
|
8
|
+
import { __ } from "@artisanpack-ui/ecommerce-storefront-core";
|
|
9
|
+
import { Icon, Rating } from "@artisanpack-ui/react";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var SAFE_HREF = /^(?:https?:\/\/|\/(?!\/)|#|\?)/i;
|
|
12
|
+
function RatingSummary({
|
|
13
|
+
rating,
|
|
14
|
+
hideEmpty = false,
|
|
15
|
+
compact = false,
|
|
16
|
+
href,
|
|
17
|
+
className
|
|
18
|
+
}) {
|
|
19
|
+
if (rating.count <= 0) {
|
|
20
|
+
return hideEmpty ? null : /* @__PURE__ */ jsx("span", { className: cx("ec-rating", "ec-rating--empty", className), "data-rating-summary": "empty", children: __("No reviews yet") });
|
|
21
|
+
}
|
|
22
|
+
const target = void 0 === href ? rating.href : href;
|
|
23
|
+
const linked = null !== target && "" !== target && SAFE_HREF.test(target);
|
|
24
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
compact ? /* @__PURE__ */ jsx("span", { className: "ec-rating__star", "aria-hidden": "true", "data-rating-star": "", children: /* @__PURE__ */ jsx(Icon, { name: "star" }) }) : /* @__PURE__ */ jsx("span", { className: "ec-rating__stars", "aria-hidden": "true", "data-rating-stars": rating.starValue, children: /* @__PURE__ */ jsx(Rating, { value: rating.starValue, readonly: true, size: "sm" }) }),
|
|
26
|
+
/* @__PURE__ */ jsx("span", { className: "ec-rating__average", "aria-hidden": "true", children: rating.formatted }),
|
|
27
|
+
/* @__PURE__ */ jsx("span", { className: "ec-rating__count", "aria-hidden": "true", children: compact ? __("(:count)", { count: rating.count }) : rating.countText }),
|
|
28
|
+
linked ? null : /* @__PURE__ */ jsx("span", { className: "apui-sr-only", children: rating.spokenLabel })
|
|
29
|
+
] });
|
|
30
|
+
const attributes = {
|
|
31
|
+
className: cx("ec-rating", className),
|
|
32
|
+
"data-compact": compact ? "" : void 0,
|
|
33
|
+
"data-rating-summary": ""
|
|
34
|
+
};
|
|
35
|
+
return linked ? /* @__PURE__ */ jsx("a", { ...attributes, href: target, "aria-label": rating.spokenLabel, children: content }) : /* @__PURE__ */ jsx("span", { ...attributes, children: content });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/components/StockStatus.tsx
|
|
39
|
+
import { Badge } from "@artisanpack-ui/react";
|
|
40
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
41
|
+
function StockStatus({
|
|
42
|
+
stock,
|
|
43
|
+
compact = false,
|
|
44
|
+
className,
|
|
45
|
+
...rest
|
|
46
|
+
}) {
|
|
47
|
+
if (compact && "in_stock" === stock.status) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return compact ? /* @__PURE__ */ jsx2(
|
|
51
|
+
Badge,
|
|
52
|
+
{
|
|
53
|
+
...rest,
|
|
54
|
+
variant: "ghost",
|
|
55
|
+
color: stock.color,
|
|
56
|
+
dot: true,
|
|
57
|
+
className: cx("ec-stock", className),
|
|
58
|
+
"data-stock-status": stock.status,
|
|
59
|
+
children: stock.label
|
|
60
|
+
}
|
|
61
|
+
) : /* @__PURE__ */ jsx2(
|
|
62
|
+
Badge,
|
|
63
|
+
{
|
|
64
|
+
...rest,
|
|
65
|
+
variant: "soft",
|
|
66
|
+
color: stock.color,
|
|
67
|
+
leadingIcon: stock.icon,
|
|
68
|
+
className: cx("ec-stock", className),
|
|
69
|
+
"data-stock-status": stock.status,
|
|
70
|
+
children: stock.label
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/components/ProductCard.tsx
|
|
76
|
+
import { __ as __2 } from "@artisanpack-ui/ecommerce-storefront-core";
|
|
77
|
+
import { Badge as Badge2, Button, Icon as Icon2 } from "@artisanpack-ui/react";
|
|
78
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
79
|
+
function ProductCard({
|
|
80
|
+
card,
|
|
81
|
+
showPrice = true,
|
|
82
|
+
showRating = true,
|
|
83
|
+
onQuickAdd,
|
|
84
|
+
quickAddPending = false,
|
|
85
|
+
className,
|
|
86
|
+
...rest
|
|
87
|
+
}) {
|
|
88
|
+
const Heading = `h${Math.max(2, Math.min(6, card.headingLevel))}`;
|
|
89
|
+
const onSale = card.onSale;
|
|
90
|
+
const actions = card.actions.map((key) => ({ key, entry: getRegistries().productCardActions.get(key) })).filter((action) => void 0 !== action.entry);
|
|
91
|
+
const showsStock = "in_stock" !== card.stock.status;
|
|
92
|
+
return /* @__PURE__ */ jsxs2(
|
|
93
|
+
"article",
|
|
94
|
+
{
|
|
95
|
+
...rest,
|
|
96
|
+
className: cx("apui-card ec-product-card", className),
|
|
97
|
+
"data-surface": "default",
|
|
98
|
+
"data-interactive": "",
|
|
99
|
+
"data-product-card": card.id,
|
|
100
|
+
"data-sold-out": card.soldOut ? "" : void 0,
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ jsxs2("div", { className: "ec-product-card__media", "data-scope": "card", "data-part": "media", children: [
|
|
103
|
+
null !== card.image ? /* @__PURE__ */ jsx3(
|
|
104
|
+
"img",
|
|
105
|
+
{
|
|
106
|
+
src: card.image.url,
|
|
107
|
+
srcSet: card.image.srcset ?? void 0,
|
|
108
|
+
sizes: null !== card.image.srcset ? "(min-width: 1024px) 25vw, (min-width: 640px) 33vw, 50vw" : void 0,
|
|
109
|
+
width: card.image.width ?? 600,
|
|
110
|
+
height: card.image.height ?? 600,
|
|
111
|
+
alt: card.image.alt,
|
|
112
|
+
loading: "lazy",
|
|
113
|
+
decoding: "async"
|
|
114
|
+
}
|
|
115
|
+
) : /* @__PURE__ */ jsx3("div", { className: "ec-product-card__placeholder", "aria-hidden": "true", children: /* @__PURE__ */ jsx3(Icon2, { name: "image" }) }),
|
|
116
|
+
onSale || card.badges.length > 0 ? /* @__PURE__ */ jsxs2("div", { className: "ec-product-card__badges", "data-product-card-badges": "", children: [
|
|
117
|
+
onSale ? /* @__PURE__ */ jsx3(Badge2, { variant: "solid", color: "error", children: __2("Sale") }) : null,
|
|
118
|
+
card.badges.map((badge) => /* @__PURE__ */ jsx3(Badge2, { variant: "solid", color: "neutral", children: badge }, badge))
|
|
119
|
+
] }) : null,
|
|
120
|
+
actions.length > 0 ? /* @__PURE__ */ jsx3("div", { className: "ec-product-card__actions", "data-product-card-actions": "", children: actions.map(({ key, entry }) => {
|
|
121
|
+
const Action = entry.component;
|
|
122
|
+
return /* @__PURE__ */ jsx3(Action, { card }, key);
|
|
123
|
+
}) }) : null
|
|
124
|
+
] }),
|
|
125
|
+
/* @__PURE__ */ jsxs2("div", { className: "ec-product-card__body", children: [
|
|
126
|
+
null !== card.category && "" !== card.category ? /* @__PURE__ */ jsx3("p", { className: "ec-product-card__category", "data-product-card-category": "", children: card.category }) : null,
|
|
127
|
+
/* @__PURE__ */ jsx3(Heading, { className: "ec-product-card__name", children: null !== card.url ? /* @__PURE__ */ jsxs2("a", { href: card.url, "data-product-link": "", children: [
|
|
128
|
+
card.name,
|
|
129
|
+
"options" === card.cta ? /* @__PURE__ */ jsxs2("span", { className: "apui-sr-only", children: [
|
|
130
|
+
": ",
|
|
131
|
+
__2("Choose options")
|
|
132
|
+
] }) : null
|
|
133
|
+
] }) : card.name }),
|
|
134
|
+
showPrice ? /* @__PURE__ */ jsx3(Price, { price: card.price, saleBadge: false }) : null,
|
|
135
|
+
showRating && card.rating.count > 0 || showsStock ? /* @__PURE__ */ jsxs2("div", { className: "ec-product-card__meta", children: [
|
|
136
|
+
showRating ? /* @__PURE__ */ jsx3(RatingSummary, { rating: card.rating, href: null, hideEmpty: true, compact: true }) : null,
|
|
137
|
+
/* @__PURE__ */ jsx3(StockStatus, { stock: card.stock, compact: true })
|
|
138
|
+
] }) : null,
|
|
139
|
+
"add" === card.cta ? /* @__PURE__ */ jsx3("div", { className: "ec-product-card__cta", "data-cta": "add", children: /* @__PURE__ */ jsxs2(
|
|
140
|
+
Button,
|
|
141
|
+
{
|
|
142
|
+
variant: "outline",
|
|
143
|
+
color: "neutral",
|
|
144
|
+
size: "sm",
|
|
145
|
+
leadingIcon: "plus",
|
|
146
|
+
disabled: quickAddPending,
|
|
147
|
+
onClick: () => onQuickAdd?.(card),
|
|
148
|
+
"data-quick-add": card.id,
|
|
149
|
+
children: [
|
|
150
|
+
__2("Add to cart"),
|
|
151
|
+
/* @__PURE__ */ jsxs2("span", { className: "apui-sr-only", children: [
|
|
152
|
+
": ",
|
|
153
|
+
card.name
|
|
154
|
+
] })
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
) }) : "options" === card.cta ? /* @__PURE__ */ jsx3("div", { className: "ec-product-card__cta", "data-cta": "options", "aria-hidden": "true", children: /* @__PURE__ */ jsxs2(
|
|
158
|
+
"span",
|
|
159
|
+
{
|
|
160
|
+
className: "apui-button",
|
|
161
|
+
"data-variant": "outline",
|
|
162
|
+
"data-color": "neutral",
|
|
163
|
+
"data-size": "sm",
|
|
164
|
+
"data-product-card-options": "",
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ jsx3("span", { "data-scope": "button", "data-part": "icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx3(Icon2, { name: "plus" }) }),
|
|
167
|
+
/* @__PURE__ */ jsx3("span", { "data-scope": "button", "data-part": "label", children: __2("Choose options") })
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
) }) : "sold_out" === card.cta ? /* @__PURE__ */ jsx3("div", { className: "ec-product-card__cta", "data-cta": "sold_out", children: /* @__PURE__ */ jsxs2(
|
|
171
|
+
Button,
|
|
172
|
+
{
|
|
173
|
+
variant: "outline",
|
|
174
|
+
color: "neutral",
|
|
175
|
+
size: "sm",
|
|
176
|
+
disabled: true,
|
|
177
|
+
"data-product-card-sold-out": "",
|
|
178
|
+
children: [
|
|
179
|
+
__2("Sold out"),
|
|
180
|
+
/* @__PURE__ */ jsxs2("span", { className: "apui-sr-only", children: [
|
|
181
|
+
": ",
|
|
182
|
+
card.name
|
|
183
|
+
] })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
) }) : null
|
|
187
|
+
] })
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export {
|
|
194
|
+
RatingSummary,
|
|
195
|
+
StockStatus,
|
|
196
|
+
ProductCard
|
|
197
|
+
};
|
|
198
|
+
//# sourceMappingURL=chunk-ABGPTZ3Q.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/RatingSummary.tsx","../src/components/StockStatus.tsx","../src/components/ProductCard.tsx"],"sourcesContent":["/**\n * `ec-rating`: a product's average rating and review count.\n *\n * Mirrors ecommerce-storefront-livewire's `<x-artisanpack-ec-rating-summary>`.\n * With a link it reads as one spoken label (\"Rated 4.5 out of 5, 12\n * reviews\"); without one, the label is screen-reader text.\n *\n * @since 1.0.0\n */\n\nimport { __, type StorefrontRatingSummary } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Icon, Rating } from '@artisanpack-ui/react';\nimport type { ReactElement } from 'react';\n\nimport { cx } from '../internal/classes';\n\n/**\n * Props for {@link RatingSummary}.\n *\n * @since 1.0.0\n */\nexport interface RatingSummaryProps {\n /** The rating, as the presenter sends it. */\n rating: StorefrontRatingSummary;\n /** Draws nothing instead of \"No reviews yet\" when there are none. */\n hideEmpty?: boolean;\n /** One star, the average and \"(12)\", for product cards. */\n compact?: boolean;\n /** Links to this URL instead of the rating's `href`; null for no link. */\n href?: string | null;\n className?: string;\n}\n\nconst SAFE_HREF = /^(?:https?:\\/\\/|\\/(?!\\/)|#|\\?)/i;\n\n/**\n * A rating summary.\n *\n * @since 1.0.0\n *\n * @param props - The rating.\n * @returns The summary, or nothing.\n */\nexport function RatingSummary({\n rating,\n hideEmpty = false,\n compact = false,\n href,\n className,\n}: RatingSummaryProps): ReactElement | null {\n if (rating.count <= 0) {\n return hideEmpty ? null : (\n <span className={cx('ec-rating', 'ec-rating--empty', className)} data-rating-summary=\"empty\">\n {__('No reviews yet')}\n </span>\n );\n }\n\n const target = undefined === href ? rating.href : href;\n const linked = null !== target && '' !== target && SAFE_HREF.test(target);\n\n const content = (\n <>\n {compact ? (\n <span className=\"ec-rating__star\" aria-hidden=\"true\" data-rating-star=\"\">\n <Icon name=\"star\" />\n </span>\n ) : (\n <span className=\"ec-rating__stars\" aria-hidden=\"true\" data-rating-stars={rating.starValue}>\n <Rating value={rating.starValue} readonly size=\"sm\" />\n </span>\n )}\n <span className=\"ec-rating__average\" aria-hidden=\"true\">\n {rating.formatted}\n </span>\n <span className=\"ec-rating__count\" aria-hidden=\"true\">\n {compact ? __('(:count)', { count: rating.count }) : rating.countText}\n </span>\n {linked ? null : <span className=\"apui-sr-only\">{rating.spokenLabel}</span>}\n </>\n );\n\n const attributes = {\n className: cx('ec-rating', className),\n 'data-compact': compact ? '' : undefined,\n 'data-rating-summary': '',\n };\n\n return linked ? (\n <a {...attributes} href={target} aria-label={rating.spokenLabel}>\n {content}\n </a>\n ) : (\n <span {...attributes}>{content}</span>\n );\n}\n","/**\n * `ec-stock`: a product's stock status badge.\n *\n * Mirrors ecommerce-storefront-livewire's `<x-artisanpack-ec-stock-status>`:\n * a soft badge with the status icon, or (compact, on product cards) a ghost\n * badge with a dot that only shows when the product isn't simply in stock.\n *\n * @since 1.0.0\n */\n\nimport type { StorefrontStockStatus } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Badge } from '@artisanpack-ui/react';\nimport type { HTMLAttributes, ReactElement } from 'react';\n\nimport { cx } from '../internal/classes';\n\n/**\n * Props for {@link StockStatus}.\n *\n * @since 1.0.0\n */\nexport interface StockStatusProps extends HTMLAttributes<HTMLSpanElement> {\n /** The stock status, with its label, icon and color. */\n stock: StorefrontStockStatus;\n /** The product card's dot badge, hidden while in stock. */\n compact?: boolean;\n}\n\n/**\n * A stock status.\n *\n * @since 1.0.0\n *\n * @param props - The status.\n * @returns The badge, or nothing when compact and in stock.\n */\nexport function StockStatus({\n stock,\n compact = false,\n className,\n ...rest\n}: StockStatusProps): ReactElement | null {\n if (compact && 'in_stock' === stock.status) {\n return null;\n }\n\n return compact ? (\n <Badge\n {...rest}\n variant=\"ghost\"\n color={stock.color}\n dot\n className={cx('ec-stock', className)}\n data-stock-status={stock.status}\n >\n {stock.label}\n </Badge>\n ) : (\n <Badge\n {...rest}\n variant=\"soft\"\n color={stock.color}\n leadingIcon={stock.icon}\n className={cx('ec-stock', className)}\n data-stock-status={stock.status}\n >\n {stock.label}\n </Badge>\n );\n}\n","/**\n * `ec-product-card`: a product in a grid.\n *\n * Mirrors ecommerce-storefront-livewire's `<x-artisanpack-ec-product-card>`:\n * the image (or a placeholder) with sale and custom badges and any card\n * actions, the category, the name linking to the product, the price, the\n * rating and stock, and the call to action: \"Add to cart\" (quick add),\n * \"Choose options\" (drawn, not a control: the name's link carries it) or\n * a disabled \"Sold out\".\n *\n * Card actions come from the `productCardActions` client registry, keyed by\n * the card's `actions`; each gets the card as `card`.\n *\n * @since 1.0.0\n */\n\nimport { __, type StorefrontProductCard } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Badge, Button, Icon } from '@artisanpack-ui/react';\nimport type { HTMLAttributes, ReactElement } from 'react';\n\nimport { cx } from '../internal/classes';\nimport { getRegistries } from '../registries';\nimport { Price } from './Price';\nimport { RatingSummary } from './RatingSummary';\nimport { StockStatus } from './StockStatus';\n\n/**\n * Props for {@link ProductCard}.\n *\n * @since 1.0.0\n */\nexport interface ProductCardProps extends HTMLAttributes<HTMLElement> {\n /** The card, as the presenter sends it. */\n card: StorefrontProductCard;\n /** Shows the price. Default true. */\n showPrice?: boolean;\n /** Shows the rating. Default true. */\n showRating?: boolean;\n /** Quick add: called with the card when \"Add to cart\" is pressed. */\n onQuickAdd?: (card: StorefrontProductCard) => void;\n /** Disables \"Add to cart\" while the quick add is on its way. */\n quickAddPending?: boolean;\n}\n\n/**\n * A product card.\n *\n * @since 1.0.0\n *\n * @param props - The card and options.\n * @returns The card.\n */\nexport function ProductCard({\n card,\n showPrice = true,\n showRating = true,\n onQuickAdd,\n quickAddPending = false,\n className,\n ...rest\n}: ProductCardProps): ReactElement {\n const Heading = `h${Math.max(2, Math.min(6, card.headingLevel))}` as 'h2';\n const onSale = card.onSale;\n const actions = card.actions\n .map((key) => ({ key, entry: getRegistries().productCardActions.get(key) }))\n .filter((action) => undefined !== action.entry);\n const showsStock = 'in_stock' !== card.stock.status;\n\n return (\n <article\n {...rest}\n className={cx('apui-card ec-product-card', className)}\n data-surface=\"default\"\n data-interactive=\"\"\n data-product-card={card.id}\n data-sold-out={card.soldOut ? '' : undefined}\n >\n <div className=\"ec-product-card__media\" data-scope=\"card\" data-part=\"media\">\n {null !== card.image ? (\n <img\n src={card.image.url}\n srcSet={card.image.srcset ?? undefined}\n sizes={\n null !== card.image.srcset\n ? '(min-width: 1024px) 25vw, (min-width: 640px) 33vw, 50vw'\n : undefined\n }\n width={card.image.width ?? 600}\n height={card.image.height ?? 600}\n alt={card.image.alt}\n loading=\"lazy\"\n decoding=\"async\"\n />\n ) : (\n <div className=\"ec-product-card__placeholder\" aria-hidden=\"true\">\n <Icon name=\"image\" />\n </div>\n )}\n\n {onSale || card.badges.length > 0 ? (\n <div className=\"ec-product-card__badges\" data-product-card-badges=\"\">\n {onSale ? (\n <Badge variant=\"solid\" color=\"error\">\n {__('Sale')}\n </Badge>\n ) : null}\n {card.badges.map((badge) => (\n <Badge key={badge} variant=\"solid\" color=\"neutral\">\n {badge}\n </Badge>\n ))}\n </div>\n ) : null}\n\n {actions.length > 0 ? (\n <div className=\"ec-product-card__actions\" data-product-card-actions=\"\">\n {actions.map(({ key, entry }) => {\n const Action = entry!.component;\n\n return <Action key={key} card={card} />;\n })}\n </div>\n ) : null}\n </div>\n\n <div className=\"ec-product-card__body\">\n {null !== card.category && '' !== card.category ? (\n <p className=\"ec-product-card__category\" data-product-card-category=\"\">\n {card.category}\n </p>\n ) : null}\n\n <Heading className=\"ec-product-card__name\">\n {null !== card.url ? (\n <a href={card.url} data-product-link=\"\">\n {card.name}\n {'options' === card.cta ? (\n <span className=\"apui-sr-only\">: {__('Choose options')}</span>\n ) : null}\n </a>\n ) : (\n card.name\n )}\n </Heading>\n\n {showPrice ? <Price price={card.price} saleBadge={false} /> : null}\n\n {(showRating && card.rating.count > 0) || showsStock ? (\n <div className=\"ec-product-card__meta\">\n {showRating ? (\n <RatingSummary rating={card.rating} href={null} hideEmpty compact />\n ) : null}\n <StockStatus stock={card.stock} compact />\n </div>\n ) : null}\n\n {'add' === card.cta ? (\n <div className=\"ec-product-card__cta\" data-cta=\"add\">\n <Button\n variant=\"outline\"\n color=\"neutral\"\n size=\"sm\"\n leadingIcon=\"plus\"\n disabled={quickAddPending}\n onClick={() => onQuickAdd?.(card)}\n data-quick-add={card.id}\n >\n {__('Add to cart')}\n <span className=\"apui-sr-only\">: {card.name}</span>\n </Button>\n </div>\n ) : 'options' === card.cta ? (\n <div className=\"ec-product-card__cta\" data-cta=\"options\" aria-hidden=\"true\">\n <span\n className=\"apui-button\"\n data-variant=\"outline\"\n data-color=\"neutral\"\n data-size=\"sm\"\n data-product-card-options=\"\"\n >\n <span data-scope=\"button\" data-part=\"icon\" aria-hidden=\"true\">\n <Icon name=\"plus\" />\n </span>\n <span data-scope=\"button\" data-part=\"label\">\n {__('Choose options')}\n </span>\n </span>\n </div>\n ) : 'sold_out' === card.cta ? (\n <div className=\"ec-product-card__cta\" data-cta=\"sold_out\">\n <Button\n variant=\"outline\"\n color=\"neutral\"\n size=\"sm\"\n disabled\n data-product-card-sold-out=\"\"\n >\n {__('Sold out')}\n <span className=\"apui-sr-only\">: {card.name}</span>\n </Button>\n </div>\n ) : null}\n </div>\n </article>\n );\n}\n"],"mappings":";;;;;;;AAUA,SAAS,UAAwC;AACjD,SAAS,MAAM,cAAc;AAyCvB,SAUF,UAVE,KAUF,YAVE;AAnBN,IAAM,YAAY;AAUX,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,YAAY;AAAA,EACZ,UAAU;AAAA,EACV;AAAA,EACA;AACF,GAA4C;AAC1C,MAAI,OAAO,SAAS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,gBAAAF,KAAC,UAAK,cAAW,UAAS,aAAU,SACjC,UAAAI,IAAG,gBAAgB,GACtB;AAAA;AAAA;AAAA,UACF,GACF,IACE,eAAe,KAAK,MACtB,gBAAAJ,KAAC,SAAI,WAAU,wBAAuB,YAAS,YAC7C,0BAAAC;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,OAAM;AAAA,cACN,MAAK;AAAA,cACL,UAAQ;AAAA,cACR,8BAA2B;AAAA,cAE1B;AAAA,gBAAAG,IAAG,UAAU;AAAA,gBACd,gBAAAH,MAAC,UAAK,WAAU,gBAAe;AAAA;AAAA,kBAAG,KAAK;AAAA,mBAAK;AAAA;AAAA;AAAA,UAC9C,GACF,IACE;AAAA,WACN;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["jsx","__","Badge","Icon","jsx","jsxs","Icon","Badge","__"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CatalogListing,
|
|
3
|
+
StorefrontBreadcrumbs
|
|
4
|
+
} from "./chunk-P3NIV4YG.mjs";
|
|
5
|
+
import {
|
|
6
|
+
storefrontLayout
|
|
7
|
+
} from "./chunk-VX5TEJNU.mjs";
|
|
8
|
+
|
|
9
|
+
// src/pages/Catalog/Index.tsx
|
|
10
|
+
import { PageHeader } from "@artisanpack-ui/react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
function CatalogIndex({ header, listing }) {
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", { className: "ec-page", "data-catalog-page": "", children: [
|
|
14
|
+
/* @__PURE__ */ jsx(
|
|
15
|
+
PageHeader,
|
|
16
|
+
{
|
|
17
|
+
title: header.title,
|
|
18
|
+
description: header.description ?? void 0,
|
|
19
|
+
level: 1,
|
|
20
|
+
className: "ec-page__header",
|
|
21
|
+
breadcrumbs: /* @__PURE__ */ jsx(StorefrontBreadcrumbs, { items: header.breadcrumbs })
|
|
22
|
+
}
|
|
23
|
+
),
|
|
24
|
+
/* @__PURE__ */ jsx(CatalogListing, { listing })
|
|
25
|
+
] });
|
|
26
|
+
}
|
|
27
|
+
CatalogIndex.layout = storefrontLayout;
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
CatalogIndex
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=chunk-BJ3FJFZQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/pages/Catalog/Index.tsx"],"sourcesContent":["/**\n * `EcommerceStorefront/Catalog/Index`: the catalog page.\n *\n * Mirrors ecommerce-storefront-livewire's `pages/catalog`: the design-system\n * PageHeader (the breadcrumbs, the \"All products\" title and the\n * `catalog.description` line), then the product listing.\n *\n * @since 1.0.0\n */\n\nimport type { CatalogIndexPageProps } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { PageHeader } from '@artisanpack-ui/react';\nimport type { ReactElement } from 'react';\n\nimport { CatalogListing } from '../../catalog/CatalogListing';\nimport { StorefrontBreadcrumbs } from '../../catalog/StorefrontBreadcrumbs';\nimport { storefrontLayout } from '../../layout/StorefrontLayout';\n\n/**\n * The catalog page.\n *\n * @since 1.0.0\n *\n * @param props - The page's props.\n * @returns The page.\n */\nexport default function CatalogIndex({ header, listing }: CatalogIndexPageProps): ReactElement {\n return (\n <div className=\"ec-page\" data-catalog-page=\"\">\n <PageHeader\n title={header.title}\n description={header.description ?? undefined}\n level={1}\n className=\"ec-page__header\"\n breadcrumbs={<StorefrontBreadcrumbs items={header.breadcrumbs} />}\n />\n\n <CatalogListing listing={listing} />\n </div>\n );\n}\n\nCatalogIndex.layout = storefrontLayout;\n"],"mappings":";;;;;;;;;AAWA,SAAS,kBAAkB;AAiBvB,SAMiB,KANjB;AAFW,SAAR,aAA8B,EAAE,QAAQ,QAAQ,GAAwC;AAC7F,SACE,qBAAC,SAAI,WAAU,WAAU,qBAAkB,IACzC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,OAAO;AAAA,QACd,aAAa,OAAO,eAAe;AAAA,QACnC,OAAO;AAAA,QACP,WAAU;AAAA,QACV,aAAa,oBAAC,yBAAsB,OAAO,OAAO,aAAa;AAAA;AAAA,IACjE;AAAA,IAEA,oBAAC,kBAAe,SAAkB;AAAA,KACpC;AAEJ;AAEA,aAAa,SAAS;","names":[]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OrderDetails,
|
|
3
|
+
OrderStatusBadge
|
|
4
|
+
} from "./chunk-FL5XL3ET.mjs";
|
|
5
|
+
|
|
6
|
+
// src/order/OrderConfirmation.tsx
|
|
7
|
+
import { __ } from "@artisanpack-ui/ecommerce-storefront-core";
|
|
8
|
+
import { Alert, Button, Card, Icon } from "@artisanpack-ui/react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
function OrderConfirmation({
|
|
11
|
+
order,
|
|
12
|
+
accountUrl,
|
|
13
|
+
downloadsUrl,
|
|
14
|
+
registerUrl,
|
|
15
|
+
lookupUrl,
|
|
16
|
+
catalogUrl,
|
|
17
|
+
showTitle = true
|
|
18
|
+
}) {
|
|
19
|
+
const Heading = showTitle ? "h1" : "h2";
|
|
20
|
+
return /* @__PURE__ */ jsxs("div", { className: "ec-confirmation", "data-order-confirmation": order.id, children: [
|
|
21
|
+
/* @__PURE__ */ jsxs("div", { className: "ec-confirmation__header", "data-order-confirmation-header": "", children: [
|
|
22
|
+
/* @__PURE__ */ jsx(Icon, { name: "circle-check", variant: "tile", color: "success", size: "lg" }),
|
|
23
|
+
/* @__PURE__ */ jsx(Heading, { className: "ec-confirmation__title", children: __("Thank you for your order") }),
|
|
24
|
+
/* @__PURE__ */ jsx("p", { className: "ec-confirmation__lead", children: __("We've sent a confirmation to :email.", { email: order.email }) })
|
|
25
|
+
] }),
|
|
26
|
+
/* @__PURE__ */ jsx(Card, { className: "ec-confirmation__strip", "data-order-confirmation-strip": "", children: /* @__PURE__ */ jsxs("dl", { className: "ec-confirmation__facts", children: [
|
|
27
|
+
/* @__PURE__ */ jsxs("div", { className: "ec-confirmation__fact", children: [
|
|
28
|
+
/* @__PURE__ */ jsx("dt", { children: __("Order number") }),
|
|
29
|
+
/* @__PURE__ */ jsx("dd", { className: "ec-confirmation__number", "data-order-number": "", children: /* @__PURE__ */ jsx("bdi", { children: order.number }) })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { className: "ec-confirmation__fact", children: [
|
|
32
|
+
/* @__PURE__ */ jsx("dt", { children: __("Placed") }),
|
|
33
|
+
/* @__PURE__ */ jsx("dd", { children: order.date })
|
|
34
|
+
] }),
|
|
35
|
+
/* @__PURE__ */ jsxs("div", { className: "ec-confirmation__fact", children: [
|
|
36
|
+
/* @__PURE__ */ jsx("dt", { children: __("Status") }),
|
|
37
|
+
/* @__PURE__ */ jsx("dd", { children: /* @__PURE__ */ jsx(OrderStatusBadge, { status: order.status }) })
|
|
38
|
+
] })
|
|
39
|
+
] }) }),
|
|
40
|
+
null !== registerUrl || null !== lookupUrl ? /* @__PURE__ */ jsxs("div", { className: "ec-confirmation__hints", "data-order-guest-hints": "", children: [
|
|
41
|
+
null !== registerUrl ? /* @__PURE__ */ jsx(
|
|
42
|
+
Alert,
|
|
43
|
+
{
|
|
44
|
+
color: "info",
|
|
45
|
+
icon: "user",
|
|
46
|
+
title: __("Create an account to track orders"),
|
|
47
|
+
description: __("Use :email to see this order and your future orders in one place.", {
|
|
48
|
+
email: order.email
|
|
49
|
+
}),
|
|
50
|
+
"data-order-hint": "register",
|
|
51
|
+
actions: /* @__PURE__ */ jsx(Button, { color: "primary", size: "sm", href: registerUrl, children: __("Create an account") })
|
|
52
|
+
}
|
|
53
|
+
) : null,
|
|
54
|
+
null !== lookupUrl ? /* @__PURE__ */ jsx(
|
|
55
|
+
Alert,
|
|
56
|
+
{
|
|
57
|
+
icon: "search",
|
|
58
|
+
title: __("Look up this order later"),
|
|
59
|
+
description: __("Find it any time with your email and order number :number.", {
|
|
60
|
+
number: order.number
|
|
61
|
+
}),
|
|
62
|
+
"data-order-hint": "lookup",
|
|
63
|
+
actions: /* @__PURE__ */ jsx(Button, { variant: "outline", color: "neutral", size: "sm", href: lookupUrl, children: __("Order lookup") })
|
|
64
|
+
}
|
|
65
|
+
) : null
|
|
66
|
+
] }) : null,
|
|
67
|
+
/* @__PURE__ */ jsx(OrderDetails, { order, downloadsUrl }),
|
|
68
|
+
null !== accountUrl || null !== catalogUrl ? /* @__PURE__ */ jsxs("div", { className: "ec-confirmation__actions", "data-order-confirmation-actions": "", children: [
|
|
69
|
+
null !== accountUrl ? /* @__PURE__ */ jsx(Button, { size: "lg", color: "primary", href: accountUrl, "data-order-account-link": "", children: __("View in your account") }) : null,
|
|
70
|
+
null !== catalogUrl ? /* @__PURE__ */ jsx(
|
|
71
|
+
Button,
|
|
72
|
+
{
|
|
73
|
+
size: "lg",
|
|
74
|
+
variant: "outline",
|
|
75
|
+
color: "neutral",
|
|
76
|
+
href: catalogUrl,
|
|
77
|
+
leadingIcon: "arrow-left",
|
|
78
|
+
"data-order-continue": "",
|
|
79
|
+
children: __("Continue shopping")
|
|
80
|
+
}
|
|
81
|
+
) : null
|
|
82
|
+
] }) : null
|
|
83
|
+
] });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
OrderConfirmation
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=chunk-BSASRFQ7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/order/OrderConfirmation.tsx"],"sourcesContent":["/**\n * An order's confirmation.\n *\n * Mirrors ecommerce-storefront-livewire's `order/confirmation`: a success\n * check icon tile, \"Thank you for your order\" (the page's h1, else an h2)\n * and the confirmation email line, then a Card meta strip (order number,\n * placed date, status Badge). Guests then see two Alerts: \"Create an\n * account to track orders\" and \"Look up this order later\". Then the order\n * details, then \"View in your account\" (the owner) and \"Continue shopping\".\n *\n * @since 1.0.0\n */\n\nimport { __, type OrderConfirmationProps } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Alert, Button, Card, Icon } from '@artisanpack-ui/react';\nimport type { ReactElement } from 'react';\n\nimport { OrderDetails, OrderStatusBadge } from './OrderDetails';\n\n/**\n * Props for {@link OrderConfirmation}.\n *\n * `owner` comes with the page's props, but the view, like the Livewire one,\n * decides on the guest hints from `registerUrl` and `lookupUrl`, which the\n * server leaves null for the order's owner.\n *\n * @since 1.0.0\n */\nexport interface OrderConfirmationViewProps extends OrderConfirmationProps {\n /** Make the heading the page's h1; else it is an h2. */\n showTitle?: boolean;\n}\n\n/**\n * The confirmation.\n *\n * @since 1.0.0\n *\n * @param props - The order and its links.\n * @returns The confirmation.\n */\nexport function OrderConfirmation({\n order,\n accountUrl,\n downloadsUrl,\n registerUrl,\n lookupUrl,\n catalogUrl,\n showTitle = true,\n}: OrderConfirmationViewProps): ReactElement {\n const Heading = showTitle ? 'h1' : 'h2';\n\n return (\n <div className=\"ec-confirmation\" data-order-confirmation={order.id}>\n <div className=\"ec-confirmation__header\" data-order-confirmation-header=\"\">\n <Icon name=\"circle-check\" variant=\"tile\" color=\"success\" size=\"lg\" />\n\n <Heading className=\"ec-confirmation__title\">{__('Thank you for your order')}</Heading>\n\n <p className=\"ec-confirmation__lead\">\n {__(\"We've sent a confirmation to :email.\", { email: order.email })}\n </p>\n </div>\n\n <Card className=\"ec-confirmation__strip\" data-order-confirmation-strip=\"\">\n <dl className=\"ec-confirmation__facts\">\n <div className=\"ec-confirmation__fact\">\n <dt>{__('Order number')}</dt>\n <dd className=\"ec-confirmation__number\" data-order-number=\"\">\n <bdi>{order.number}</bdi>\n </dd>\n </div>\n\n <div className=\"ec-confirmation__fact\">\n <dt>{__('Placed')}</dt>\n <dd>{order.date}</dd>\n </div>\n\n <div className=\"ec-confirmation__fact\">\n <dt>{__('Status')}</dt>\n <dd>\n <OrderStatusBadge status={order.status} />\n </dd>\n </div>\n </dl>\n </Card>\n\n {null !== registerUrl || null !== lookupUrl ? (\n <div className=\"ec-confirmation__hints\" data-order-guest-hints=\"\">\n {null !== registerUrl ? (\n <Alert\n color=\"info\"\n icon=\"user\"\n title={__('Create an account to track orders')}\n description={__('Use :email to see this order and your future orders in one place.', {\n email: order.email,\n })}\n data-order-hint=\"register\"\n actions={\n <Button color=\"primary\" size=\"sm\" href={registerUrl}>\n {__('Create an account')}\n </Button>\n }\n />\n ) : null}\n\n {null !== lookupUrl ? (\n <Alert\n icon=\"search\"\n title={__('Look up this order later')}\n description={__('Find it any time with your email and order number :number.', {\n number: order.number,\n })}\n data-order-hint=\"lookup\"\n actions={\n <Button variant=\"outline\" color=\"neutral\" size=\"sm\" href={lookupUrl}>\n {__('Order lookup')}\n </Button>\n }\n />\n ) : null}\n </div>\n ) : null}\n\n <OrderDetails order={order} downloadsUrl={downloadsUrl} />\n\n {null !== accountUrl || null !== catalogUrl ? (\n <div className=\"ec-confirmation__actions\" data-order-confirmation-actions=\"\">\n {null !== accountUrl ? (\n <Button size=\"lg\" color=\"primary\" href={accountUrl} data-order-account-link=\"\">\n {__('View in your account')}\n </Button>\n ) : null}\n\n {null !== catalogUrl ? (\n <Button\n size=\"lg\"\n variant=\"outline\"\n color=\"neutral\"\n href={catalogUrl}\n leadingIcon=\"arrow-left\"\n data-order-continue=\"\"\n >\n {__('Continue shopping')}\n </Button>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;AAaA,SAAS,UAAuC;AAChD,SAAS,OAAO,QAAQ,MAAM,YAAY;AAwCpC,SACE,KADF;AAbC,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AACd,GAA6C;AAC3C,QAAM,UAAU,YAAY,OAAO;AAEnC,SACE,qBAAC,SAAI,WAAU,mBAAkB,2BAAyB,MAAM,IAC9D;AAAA,yBAAC,SAAI,WAAU,2BAA0B,kCAA+B,IACtE;AAAA,0BAAC,QAAK,MAAK,gBAA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Aa,GAAG,8DAA8D;AAAA,YAC5E,QAAQ,MAAM;AAAA,UAChB,CAAC;AAAA,UACD,mBAAgB;AAAA,UAChB,SACE,oBAAC,UAAO,SAAQ,WAAU,OAAM,WAAU,MAAK,MAAK,MAAM,WACvD,aAAG,cAAc,GACpB;AAAA;AAAA,MAEJ,IACE;AAAA,OACN,IACE;AAAA,IAEJ,oBAAC,gBAAa,OAAc,cAA4B;AAAA,IAEvD,SAAS,cAAc,SAAS,aAC/B,qBAAC,SAAI,WAAU,4BAA2B,mCAAgC,IACvE;AAAA,eAAS,aACR,oBAAC,UAAO,MAAK,MAAK,OAAM,WAAU,MAAM,YAAY,2BAAwB,IACzE,aAAG,sBAAsB,GAC5B,IACE;AAAA,MAEH,SAAS,aACR;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,MAAM;AAAA,UACN,aAAY;AAAA,UACZ,uBAAoB;AAAA,UAEnB,aAAG,mBAAmB;AAAA;AAAA,MACzB,IACE;AAAA,OACN,IACE;AAAA,KACN;AAEJ;","names":[]}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ErrorSummary,
|
|
3
|
+
useFieldIds
|
|
4
|
+
} from "./chunk-Y5BRPEHA.mjs";
|
|
5
|
+
import {
|
|
6
|
+
Field
|
|
7
|
+
} from "./chunk-WYGOMIZK.mjs";
|
|
8
|
+
import {
|
|
9
|
+
usePageErrors
|
|
10
|
+
} from "./chunk-VX5TEJNU.mjs";
|
|
11
|
+
|
|
12
|
+
// src/account/AccountClaim.tsx
|
|
13
|
+
import {
|
|
14
|
+
__,
|
|
15
|
+
trans_choice
|
|
16
|
+
} from "@artisanpack-ui/ecommerce-storefront-core";
|
|
17
|
+
import { Alert, Button, Card } from "@artisanpack-ui/react";
|
|
18
|
+
import { router } from "@inertiajs/react";
|
|
19
|
+
import { useState } from "react";
|
|
20
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
function AccountClaim({
|
|
22
|
+
claimUrl,
|
|
23
|
+
ordersUrl,
|
|
24
|
+
claimed,
|
|
25
|
+
failure
|
|
26
|
+
}) {
|
|
27
|
+
const errors = usePageErrors();
|
|
28
|
+
const fieldIds = useFieldIds("ec-account-claim", {
|
|
29
|
+
order_number: "number",
|
|
30
|
+
postal_code: "postcode"
|
|
31
|
+
});
|
|
32
|
+
const [orderNumber, setOrderNumber] = useState("");
|
|
33
|
+
const [postalCode, setPostalCode] = useState("");
|
|
34
|
+
const [processing, setProcessing] = useState(false);
|
|
35
|
+
const [submission, setSubmission] = useState(0);
|
|
36
|
+
const submit = (event) => {
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
if (null === claimUrl) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
router.post(
|
|
42
|
+
claimUrl,
|
|
43
|
+
{ order_number: orderNumber, postal_code: postalCode },
|
|
44
|
+
{
|
|
45
|
+
preserveScroll: true,
|
|
46
|
+
onStart: () => setProcessing(true),
|
|
47
|
+
onSuccess: (page) => {
|
|
48
|
+
if (null !== page.props.claimed) {
|
|
49
|
+
setOrderNumber("");
|
|
50
|
+
setPostalCode("");
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
onFinish: () => {
|
|
54
|
+
setProcessing(false);
|
|
55
|
+
setSubmission((count) => count + 1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
return /* @__PURE__ */ jsxs("div", { className: "ec-claim", "data-account-claim": "", children: [
|
|
61
|
+
/* @__PURE__ */ jsx("p", { className: "ec-claim__lead", children: __(
|
|
62
|
+
"Ordered before you had an account? Enter the order number and the postcode it was shipped to, and we'll add your guest orders placed with this email address to your account."
|
|
63
|
+
) }),
|
|
64
|
+
/* @__PURE__ */ jsx("div", { role: "alert", "aria-live": "assertive", className: "ec-claim__region", children: null !== failure ? /* @__PURE__ */ jsx(Alert, { color: "error", icon: "circle-alert", title: failure, "data-account-claim-failure": "" }) : null }),
|
|
65
|
+
/* @__PURE__ */ jsx("div", { "aria-live": "polite", className: "ec-claim__region", children: null !== claimed ? /* @__PURE__ */ jsx(
|
|
66
|
+
Alert,
|
|
67
|
+
{
|
|
68
|
+
color: "success",
|
|
69
|
+
icon: "circle-check",
|
|
70
|
+
title: 1 === claimed.count ? __("Order :number is now in your account", { number: claimed.number }) : trans_choice(
|
|
71
|
+
":count order is now in your account|:count orders are now in your account",
|
|
72
|
+
claimed.count,
|
|
73
|
+
{ count: claimed.count }
|
|
74
|
+
),
|
|
75
|
+
description: 1 === claimed.count ? __("You'll find it in your order history.") : __("You'll find them in your order history."),
|
|
76
|
+
"data-account-claim-success": "",
|
|
77
|
+
...null !== ordersUrl ? {
|
|
78
|
+
actions: /* @__PURE__ */ jsx(
|
|
79
|
+
Button,
|
|
80
|
+
{
|
|
81
|
+
variant: "outline",
|
|
82
|
+
color: "neutral",
|
|
83
|
+
size: "sm",
|
|
84
|
+
href: ordersUrl,
|
|
85
|
+
"data-account-claim-orders": "",
|
|
86
|
+
children: __("View orders")
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
} : {}
|
|
90
|
+
}
|
|
91
|
+
) : null }),
|
|
92
|
+
/* @__PURE__ */ jsx(Card, { className: "ec-claim__card", children: /* @__PURE__ */ jsxs("form", { onSubmit: submit, className: "ec-claim__form", noValidate: true, "data-account-claim-form": "", children: [
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
ErrorSummary,
|
|
95
|
+
{
|
|
96
|
+
id: "ec-account-claim",
|
|
97
|
+
errors,
|
|
98
|
+
fieldIds,
|
|
99
|
+
submission
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ jsxs("div", { className: "ec-claim__fields", children: [
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
Field,
|
|
105
|
+
{
|
|
106
|
+
id: fieldIds.order_number,
|
|
107
|
+
name: "order_number",
|
|
108
|
+
label: __("Order number"),
|
|
109
|
+
autoComplete: "off",
|
|
110
|
+
required: true,
|
|
111
|
+
error: errors.order_number ?? null,
|
|
112
|
+
value: orderNumber,
|
|
113
|
+
onValueChange: setOrderNumber,
|
|
114
|
+
attributes: { className: "ec-claim__number", spellCheck: false }
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
/* @__PURE__ */ jsx(
|
|
118
|
+
Field,
|
|
119
|
+
{
|
|
120
|
+
id: fieldIds.postal_code,
|
|
121
|
+
name: "postal_code",
|
|
122
|
+
label: __("Shipping postcode"),
|
|
123
|
+
autoComplete: "postal-code",
|
|
124
|
+
required: true,
|
|
125
|
+
error: errors.postal_code ?? null,
|
|
126
|
+
value: postalCode,
|
|
127
|
+
onValueChange: setPostalCode
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] }),
|
|
131
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
132
|
+
Button,
|
|
133
|
+
{
|
|
134
|
+
type: "submit",
|
|
135
|
+
color: "primary",
|
|
136
|
+
disabled: processing || null === claimUrl,
|
|
137
|
+
"data-account-claim-submit": "",
|
|
138
|
+
children: __("Claim orders")
|
|
139
|
+
}
|
|
140
|
+
) })
|
|
141
|
+
] }) })
|
|
142
|
+
] });
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export {
|
|
146
|
+
AccountClaim
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=chunk-CGCW3555.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/account/AccountClaim.tsx"],"sourcesContent":["/**\n * Claiming guest orders.\n *\n * Mirrors ecommerce-storefront-livewire's `account/claim`: the lead line,\n * then a success Alert after a claim (\"Order {number} is now in your\n * account\", or how many joined, with an outline \"View orders\") in a polite\n * live region, or an error Alert in an assertive one. The form sits in a\n * Card: the order number and shipping postcode, then \"Claim orders\".\n *\n * The form posts `order_number` and `postal_code` to `claimUrl`, which\n * redirects back with `claimed` or `failure`.\n *\n * @since 1.0.0\n */\n\nimport {\n __,\n trans_choice,\n type AccountClaimProps,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Alert, Button, Card } from '@artisanpack-ui/react';\nimport { router } from '@inertiajs/react';\nimport { useState, type FormEvent, type ReactElement } from 'react';\n\nimport { Field } from '../components/Field';\nimport { ErrorSummary } from '../internal/ErrorSummary';\nimport { useFieldIds } from '../internal/fieldIds';\nimport { usePageErrors } from '../useStorefront';\n\n/**\n * Props for {@link AccountClaim}.\n *\n * @since 1.0.0\n */\nexport type AccountClaimViewProps = Omit<AccountClaimProps, 'shell'>;\n\n/**\n * The claim page's body.\n *\n * @since 1.0.0\n *\n * @param props - Where to post, the orders link and the last claim's result.\n * @returns The claim form.\n */\nexport function AccountClaim({\n claimUrl,\n ordersUrl,\n claimed,\n failure,\n}: AccountClaimViewProps): ReactElement {\n const errors = usePageErrors();\n const fieldIds = useFieldIds('ec-account-claim', {\n order_number: 'number',\n postal_code: 'postcode',\n });\n const [orderNumber, setOrderNumber] = useState('');\n const [postalCode, setPostalCode] = useState('');\n const [processing, setProcessing] = useState(false);\n const [submission, setSubmission] = useState(0);\n\n const submit = (event: FormEvent<HTMLFormElement>): void => {\n event.preventDefault();\n\n if (null === claimUrl) {\n return;\n }\n\n router.post(\n claimUrl,\n { order_number: orderNumber, postal_code: postalCode },\n {\n preserveScroll: true,\n onStart: () => setProcessing(true),\n onSuccess: (page) => {\n // A claim that worked clears the form for the next one.\n if (null !== (page.props as Partial<AccountClaimViewProps>).claimed) {\n setOrderNumber('');\n setPostalCode('');\n }\n },\n onFinish: () => {\n setProcessing(false);\n setSubmission((count) => count + 1);\n },\n },\n );\n };\n\n return (\n <div className=\"ec-claim\" data-account-claim=\"\">\n <p className=\"ec-claim__lead\">\n {__(\n \"Ordered before you had an account? Enter the order number and the postcode it was shipped to, and we'll add your guest orders placed with this email address to your account.\",\n )}\n </p>\n\n <div role=\"alert\" aria-live=\"assertive\" className=\"ec-claim__region\">\n {null !== failure ? (\n <Alert color=\"error\" icon=\"circle-alert\" title={failure} data-account-claim-failure=\"\" />\n ) : null}\n </div>\n\n <div aria-live=\"polite\" className=\"ec-claim__region\">\n {null !== claimed ? (\n <Alert\n color=\"success\"\n icon=\"circle-check\"\n title={\n 1 === claimed.count\n ? __('Order :number is now in your account', { number: claimed.number })\n : trans_choice(\n ':count order is now in your account|:count orders are now in your account',\n claimed.count,\n { count: claimed.count },\n )\n }\n description={\n 1 === claimed.count\n ? __(\"You'll find it in your order history.\")\n : __(\"You'll find them in your order history.\")\n }\n data-account-claim-success=\"\"\n {...(null !== ordersUrl\n ? {\n actions: (\n <Button\n variant=\"outline\"\n color=\"neutral\"\n size=\"sm\"\n href={ordersUrl}\n data-account-claim-orders=\"\"\n >\n {__('View orders')}\n </Button>\n ),\n }\n : {})}\n />\n ) : null}\n </div>\n\n <Card className=\"ec-claim__card\">\n <form onSubmit={submit} className=\"ec-claim__form\" noValidate data-account-claim-form=\"\">\n <ErrorSummary\n id=\"ec-account-claim\"\n errors={errors}\n fieldIds={fieldIds}\n submission={submission}\n />\n\n <div className=\"ec-claim__fields\">\n <Field\n id={fieldIds.order_number}\n name=\"order_number\"\n label={__('Order number')}\n autoComplete=\"off\"\n required\n error={errors.order_number ?? null}\n value={orderNumber}\n onValueChange={setOrderNumber}\n attributes={{ className: 'ec-claim__number', spellCheck: false }}\n />\n <Field\n id={fieldIds.postal_code}\n name=\"postal_code\"\n label={__('Shipping postcode')}\n autoComplete=\"postal-code\"\n required\n error={errors.postal_code ?? null}\n value={postalCode}\n onValueChange={setPostalCode}\n />\n </div>\n\n <div>\n <Button\n type=\"submit\"\n color=\"primary\"\n disabled={processing || null === claimUrl}\n data-account-claim-submit=\"\"\n >\n {__('Claim orders')}\n </Button>\n </div>\n </form>\n </Card>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAeA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,OAAO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