@cimplify/sdk 0.11.0 → 0.12.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/dist/react.d.mts +8 -2
- package/dist/react.d.ts +8 -2
- package/dist/react.js +417 -291
- package/dist/react.mjs +417 -291
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/registry/bookings-page.json +1 -1
- package/registry/category-filter.json +1 -1
- package/registry/date-slot-picker.json +1 -1
- package/registry/discount-input.json +1 -1
- package/registry/order-history-page.json +1 -1
- package/registry/product-image-gallery.json +1 -1
- package/registry/search-input.json +1 -1
- package/registry/search-page.json +1 -1
- package/registry/slot-picker.json +1 -1
- package/registry/staff-picker.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -7,6 +7,9 @@ import { twMerge } from 'tailwind-merge';
|
|
|
7
7
|
import { RadioGroup } from '@base-ui/react/radio-group';
|
|
8
8
|
import { Radio } from '@base-ui/react/radio';
|
|
9
9
|
import { Checkbox } from '@base-ui/react/checkbox';
|
|
10
|
+
import { Field } from '@base-ui/react/field';
|
|
11
|
+
import { Input } from '@base-ui/react/input';
|
|
12
|
+
import { Tabs } from '@base-ui/react/tabs';
|
|
10
13
|
|
|
11
14
|
// src/ads/index.tsx
|
|
12
15
|
|
|
@@ -9166,33 +9169,45 @@ function ProductImageGallery({
|
|
|
9166
9169
|
)
|
|
9167
9170
|
}
|
|
9168
9171
|
),
|
|
9169
|
-
normalizedImages.length > 1 && /* @__PURE__ */ jsx(
|
|
9170
|
-
|
|
9172
|
+
normalizedImages.length > 1 && /* @__PURE__ */ jsx(
|
|
9173
|
+
RadioGroup,
|
|
9171
9174
|
{
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
"data-cimplify-image-gallery-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9175
|
+
"aria-label": `${productName} image thumbnails`,
|
|
9176
|
+
value: String(selectedImage),
|
|
9177
|
+
onValueChange: (value) => setSelectedImage(Number(value)),
|
|
9178
|
+
"data-cimplify-image-gallery-thumbnails": true,
|
|
9179
|
+
style: { display: "flex", gap: "0.5rem", marginTop: "0.75rem" },
|
|
9180
|
+
children: normalizedImages.map((image, index) => {
|
|
9181
|
+
const isSelected = selectedImage === index;
|
|
9182
|
+
return /* @__PURE__ */ jsx(
|
|
9183
|
+
Radio.Root,
|
|
9184
|
+
{
|
|
9185
|
+
value: String(index),
|
|
9186
|
+
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
9187
|
+
"data-cimplify-image-gallery-thumb": true,
|
|
9188
|
+
"data-selected": isSelected || void 0,
|
|
9189
|
+
style: {
|
|
9190
|
+
width: "4rem",
|
|
9191
|
+
height: "4rem",
|
|
9192
|
+
overflow: "hidden",
|
|
9193
|
+
padding: 0,
|
|
9194
|
+
border: "none",
|
|
9195
|
+
cursor: "pointer"
|
|
9196
|
+
},
|
|
9197
|
+
children: /* @__PURE__ */ jsx(
|
|
9198
|
+
"img",
|
|
9199
|
+
{
|
|
9200
|
+
src: image,
|
|
9201
|
+
alt: "",
|
|
9202
|
+
style: { width: "100%", height: "100%", objectFit: "cover" }
|
|
9203
|
+
}
|
|
9204
|
+
)
|
|
9205
|
+
},
|
|
9206
|
+
`${image}-${index}`
|
|
9207
|
+
);
|
|
9208
|
+
})
|
|
9209
|
+
}
|
|
9210
|
+
)
|
|
9196
9211
|
] });
|
|
9197
9212
|
}
|
|
9198
9213
|
function CartLineItemRow({
|
|
@@ -9803,6 +9818,26 @@ function ProductGrid({
|
|
|
9803
9818
|
)
|
|
9804
9819
|
] });
|
|
9805
9820
|
}
|
|
9821
|
+
var SearchIcon = () => /* @__PURE__ */ jsxs(
|
|
9822
|
+
"svg",
|
|
9823
|
+
{
|
|
9824
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9825
|
+
width: "16",
|
|
9826
|
+
height: "16",
|
|
9827
|
+
viewBox: "0 0 24 24",
|
|
9828
|
+
fill: "none",
|
|
9829
|
+
stroke: "currentColor",
|
|
9830
|
+
strokeWidth: "2",
|
|
9831
|
+
strokeLinecap: "round",
|
|
9832
|
+
strokeLinejoin: "round",
|
|
9833
|
+
"aria-hidden": "true",
|
|
9834
|
+
"data-cimplify-search-icon": true,
|
|
9835
|
+
children: [
|
|
9836
|
+
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
|
|
9837
|
+
/* @__PURE__ */ jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
9838
|
+
]
|
|
9839
|
+
}
|
|
9840
|
+
);
|
|
9806
9841
|
function SearchInput({
|
|
9807
9842
|
placeholder = "Search products...",
|
|
9808
9843
|
searchOptions,
|
|
@@ -9813,42 +9848,58 @@ function SearchInput({
|
|
|
9813
9848
|
classNames
|
|
9814
9849
|
}) {
|
|
9815
9850
|
const { results, isLoading, query, setQuery, clear } = useSearch(searchOptions);
|
|
9816
|
-
const
|
|
9817
|
-
(
|
|
9818
|
-
setQuery(
|
|
9851
|
+
const handleValueChange = useCallback(
|
|
9852
|
+
(value) => {
|
|
9853
|
+
setQuery(value);
|
|
9819
9854
|
},
|
|
9820
9855
|
[setQuery]
|
|
9821
9856
|
);
|
|
9822
9857
|
return /* @__PURE__ */ jsxs(
|
|
9823
|
-
|
|
9858
|
+
Field.Root,
|
|
9824
9859
|
{
|
|
9825
9860
|
"data-cimplify-search": true,
|
|
9826
9861
|
className: cn(className, classNames?.root),
|
|
9827
9862
|
style: { position: "relative" },
|
|
9828
9863
|
children: [
|
|
9829
|
-
/* @__PURE__ */ jsx(
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9864
|
+
/* @__PURE__ */ jsx(Field.Label, { className: "sr-only", children: "Search products" }),
|
|
9865
|
+
/* @__PURE__ */ jsxs("div", { style: { position: "relative", display: "flex", alignItems: "center" }, children: [
|
|
9866
|
+
/* @__PURE__ */ jsx(
|
|
9867
|
+
"span",
|
|
9868
|
+
{
|
|
9869
|
+
"data-cimplify-search-icon-wrapper": true,
|
|
9870
|
+
style: {
|
|
9871
|
+
position: "absolute",
|
|
9872
|
+
left: "0.5rem",
|
|
9873
|
+
pointerEvents: "none",
|
|
9874
|
+
display: "flex",
|
|
9875
|
+
alignItems: "center"
|
|
9876
|
+
},
|
|
9877
|
+
children: /* @__PURE__ */ jsx(SearchIcon, {})
|
|
9878
|
+
}
|
|
9879
|
+
),
|
|
9880
|
+
/* @__PURE__ */ jsx(
|
|
9881
|
+
Input,
|
|
9882
|
+
{
|
|
9883
|
+
type: "search",
|
|
9884
|
+
value: query,
|
|
9885
|
+
onValueChange: handleValueChange,
|
|
9886
|
+
placeholder,
|
|
9887
|
+
"data-cimplify-search-input": true,
|
|
9888
|
+
className: classNames?.input
|
|
9889
|
+
}
|
|
9890
|
+
),
|
|
9891
|
+
query.length > 0 && /* @__PURE__ */ jsx(
|
|
9892
|
+
"button",
|
|
9893
|
+
{
|
|
9894
|
+
type: "button",
|
|
9895
|
+
onClick: clear,
|
|
9896
|
+
"data-cimplify-search-clear": true,
|
|
9897
|
+
className: classNames?.clearButton,
|
|
9898
|
+
"aria-label": "Clear search",
|
|
9899
|
+
children: "\xD7"
|
|
9900
|
+
}
|
|
9901
|
+
)
|
|
9902
|
+
] }),
|
|
9852
9903
|
showResults && query.length > 0 && /* @__PURE__ */ jsxs("div", { "data-cimplify-search-results": true, className: classNames?.results, children: [
|
|
9853
9904
|
isLoading && /* @__PURE__ */ jsx("div", { "data-cimplify-search-loading": true, className: classNames?.loading, "aria-busy": "true", children: "Searching..." }),
|
|
9854
9905
|
!isLoading && results.length === 0 && query.length >= 2 && /* @__PURE__ */ jsx("div", { "data-cimplify-search-empty": true, className: classNames?.empty, children: "No results found" }),
|
|
@@ -9868,6 +9919,7 @@ function SearchInput({
|
|
|
9868
9919
|
}
|
|
9869
9920
|
);
|
|
9870
9921
|
}
|
|
9922
|
+
var ALL_VALUE = "__all__";
|
|
9871
9923
|
function CategoryFilter({
|
|
9872
9924
|
selectedId = null,
|
|
9873
9925
|
onSelect,
|
|
@@ -9877,9 +9929,9 @@ function CategoryFilter({
|
|
|
9877
9929
|
classNames
|
|
9878
9930
|
}) {
|
|
9879
9931
|
const { categories, isLoading } = useCategories();
|
|
9880
|
-
const
|
|
9881
|
-
(
|
|
9882
|
-
onSelect(
|
|
9932
|
+
const handleValueChange = useCallback(
|
|
9933
|
+
(value) => {
|
|
9934
|
+
onSelect(value === ALL_VALUE ? null : String(value));
|
|
9883
9935
|
},
|
|
9884
9936
|
[onSelect]
|
|
9885
9937
|
);
|
|
@@ -9893,45 +9945,45 @@ function CategoryFilter({
|
|
|
9893
9945
|
}
|
|
9894
9946
|
);
|
|
9895
9947
|
}
|
|
9896
|
-
return /* @__PURE__ */
|
|
9897
|
-
|
|
9948
|
+
return /* @__PURE__ */ jsx(
|
|
9949
|
+
Tabs.Root,
|
|
9898
9950
|
{
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
"
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
|
|
9951
|
+
value: selectedId ?? ALL_VALUE,
|
|
9952
|
+
onValueChange: handleValueChange,
|
|
9953
|
+
children: /* @__PURE__ */ jsxs(
|
|
9954
|
+
Tabs.List,
|
|
9955
|
+
{
|
|
9956
|
+
"data-cimplify-category-filter": true,
|
|
9957
|
+
"aria-label": "Filter by category",
|
|
9958
|
+
className: cn(className, classNames?.root),
|
|
9959
|
+
children: [
|
|
9960
|
+
/* @__PURE__ */ jsx(
|
|
9961
|
+
Tabs.Tab,
|
|
9962
|
+
{
|
|
9963
|
+
value: ALL_VALUE,
|
|
9964
|
+
"data-cimplify-category-filter-item": true,
|
|
9965
|
+
"data-selected": selectedId === null || void 0,
|
|
9966
|
+
className: cn(classNames?.item, classNames?.allButton),
|
|
9967
|
+
children: allLabel
|
|
9968
|
+
}
|
|
9969
|
+
),
|
|
9970
|
+
categories.map((category) => /* @__PURE__ */ jsxs(
|
|
9971
|
+
Tabs.Tab,
|
|
9972
|
+
{
|
|
9973
|
+
value: category.id,
|
|
9974
|
+
"data-cimplify-category-filter-item": true,
|
|
9975
|
+
"data-selected": selectedId === category.id || void 0,
|
|
9976
|
+
className: classNames?.item,
|
|
9977
|
+
children: [
|
|
9978
|
+
category.name,
|
|
9979
|
+
showCounts && category.product_count != null && /* @__PURE__ */ jsx("span", { "data-cimplify-category-count": true, className: classNames?.count, children: category.product_count })
|
|
9980
|
+
]
|
|
9981
|
+
},
|
|
9982
|
+
category.id
|
|
9983
|
+
))
|
|
9984
|
+
]
|
|
9985
|
+
}
|
|
9986
|
+
)
|
|
9935
9987
|
}
|
|
9936
9988
|
);
|
|
9937
9989
|
}
|
|
@@ -9974,50 +10026,74 @@ function DiscountInput({
|
|
|
9974
10026
|
[handleApply]
|
|
9975
10027
|
);
|
|
9976
10028
|
const isApplied = appliedValidation?.is_eligible === true;
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10029
|
+
const hasError = !!error || !!appliedValidation && !appliedValidation.is_eligible;
|
|
10030
|
+
const errorMessage = error ? error.message : appliedValidation && !appliedValidation.is_eligible ? appliedValidation.ineligibility_reason ?? "This code is not valid." : void 0;
|
|
10031
|
+
return /* @__PURE__ */ jsxs(
|
|
10032
|
+
Field.Root,
|
|
10033
|
+
{
|
|
10034
|
+
"data-cimplify-discount": true,
|
|
10035
|
+
invalid: hasError,
|
|
10036
|
+
disabled: isApplied,
|
|
10037
|
+
className: cn(className, classNames?.root),
|
|
10038
|
+
children: [
|
|
10039
|
+
/* @__PURE__ */ jsxs("div", { "data-cimplify-discount-form": true, children: [
|
|
10040
|
+
/* @__PURE__ */ jsx(
|
|
10041
|
+
Input,
|
|
10042
|
+
{
|
|
10043
|
+
type: "text",
|
|
10044
|
+
value: code,
|
|
10045
|
+
onValueChange: (value) => setCode(value),
|
|
10046
|
+
onKeyDown: handleKeyDown,
|
|
10047
|
+
placeholder,
|
|
10048
|
+
"data-cimplify-discount-input": true,
|
|
10049
|
+
className: classNames?.input,
|
|
10050
|
+
"aria-label": "Discount code"
|
|
10051
|
+
}
|
|
10052
|
+
),
|
|
10053
|
+
isApplied ? /* @__PURE__ */ jsx(
|
|
10054
|
+
"button",
|
|
10055
|
+
{
|
|
10056
|
+
type: "button",
|
|
10057
|
+
onClick: handleClear,
|
|
10058
|
+
"data-cimplify-discount-clear": true,
|
|
10059
|
+
className: classNames?.button,
|
|
10060
|
+
children: "Remove"
|
|
10061
|
+
}
|
|
10062
|
+
) : /* @__PURE__ */ jsx(
|
|
10063
|
+
"button",
|
|
10064
|
+
{
|
|
10065
|
+
type: "button",
|
|
10066
|
+
onClick: handleApply,
|
|
10067
|
+
disabled: isValidating || code.trim().length === 0,
|
|
10068
|
+
"data-cimplify-discount-apply": true,
|
|
10069
|
+
className: classNames?.button,
|
|
10070
|
+
children: isValidating ? "Checking..." : "Apply"
|
|
10071
|
+
}
|
|
10072
|
+
)
|
|
10073
|
+
] }),
|
|
10074
|
+
hasError && errorMessage && /* @__PURE__ */ jsx(
|
|
10075
|
+
Field.Error,
|
|
10076
|
+
{
|
|
10077
|
+
match: true,
|
|
10078
|
+
"data-cimplify-discount-error": true,
|
|
10079
|
+
className: classNames?.error,
|
|
10080
|
+
children: errorMessage
|
|
10081
|
+
}
|
|
10082
|
+
),
|
|
10083
|
+
isApplied && appliedValidation.discount_amount && /* @__PURE__ */ jsxs(
|
|
10084
|
+
Field.Description,
|
|
10085
|
+
{
|
|
10086
|
+
"data-cimplify-discount-success": true,
|
|
10087
|
+
className: classNames?.success,
|
|
10088
|
+
children: [
|
|
10089
|
+
/* @__PURE__ */ jsx("span", { children: "Discount applied" }),
|
|
10090
|
+
/* @__PURE__ */ jsx(Price, { amount: appliedValidation.discount_amount, prefix: "-" })
|
|
10091
|
+
]
|
|
10092
|
+
}
|
|
10093
|
+
)
|
|
10094
|
+
]
|
|
10095
|
+
}
|
|
10096
|
+
);
|
|
10021
10097
|
}
|
|
10022
10098
|
function CategoryGrid({
|
|
10023
10099
|
categories: categoriesProp,
|
|
@@ -10464,6 +10540,9 @@ function formatTime(timeStr) {
|
|
|
10464
10540
|
}
|
|
10465
10541
|
return timeStr;
|
|
10466
10542
|
}
|
|
10543
|
+
function slotToValue(slot) {
|
|
10544
|
+
return `${slot.start_time}|${slot.end_time}`;
|
|
10545
|
+
}
|
|
10467
10546
|
function SlotPicker({
|
|
10468
10547
|
slots: slotsProp,
|
|
10469
10548
|
serviceId,
|
|
@@ -10508,29 +10587,49 @@ function SlotPicker({
|
|
|
10508
10587
|
);
|
|
10509
10588
|
}
|
|
10510
10589
|
const groups = groupByTimeOfDay ? groupSlots(slots) : [{ label: "", slots }];
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
},
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
|
|
10533
|
-
|
|
10590
|
+
const slotsByValue = /* @__PURE__ */ new Map();
|
|
10591
|
+
for (const slot of slots) {
|
|
10592
|
+
slotsByValue.set(slotToValue(slot), slot);
|
|
10593
|
+
}
|
|
10594
|
+
const selectedValue = selectedSlot ? slotToValue(selectedSlot) : "";
|
|
10595
|
+
return /* @__PURE__ */ jsx(
|
|
10596
|
+
RadioGroup,
|
|
10597
|
+
{
|
|
10598
|
+
"data-cimplify-slot-picker": true,
|
|
10599
|
+
className: cn(className, classNames?.root),
|
|
10600
|
+
value: selectedValue,
|
|
10601
|
+
onValueChange: (value) => {
|
|
10602
|
+
const slot = slotsByValue.get(value);
|
|
10603
|
+
if (slot?.is_available) {
|
|
10604
|
+
onSlotSelect?.(slot);
|
|
10605
|
+
}
|
|
10606
|
+
},
|
|
10607
|
+
children: groups.map((group) => /* @__PURE__ */ jsxs("div", { "data-cimplify-slot-group": true, className: classNames?.group, children: [
|
|
10608
|
+
group.label && /* @__PURE__ */ jsx("div", { "data-cimplify-slot-group-label": true, className: classNames?.groupLabel, children: group.label }),
|
|
10609
|
+
group.slots.map((slot) => {
|
|
10610
|
+
const value = slotToValue(slot);
|
|
10611
|
+
const isSelected = selectedSlot?.start_time === slot.start_time && selectedSlot?.end_time === slot.end_time;
|
|
10612
|
+
return /* @__PURE__ */ jsxs(
|
|
10613
|
+
Radio.Root,
|
|
10614
|
+
{
|
|
10615
|
+
value,
|
|
10616
|
+
disabled: !slot.is_available,
|
|
10617
|
+
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
10618
|
+
"data-cimplify-slot": true,
|
|
10619
|
+
"data-selected": isSelected || void 0,
|
|
10620
|
+
"data-unavailable": !slot.is_available || void 0,
|
|
10621
|
+
className: classNames?.slot,
|
|
10622
|
+
children: [
|
|
10623
|
+
/* @__PURE__ */ jsx("span", { "data-cimplify-slot-time": true, className: classNames?.slotTime, children: formatTime(slot.start_time) }),
|
|
10624
|
+
showPrice && slot.price && /* @__PURE__ */ jsx("span", { "data-cimplify-slot-price": true, className: classNames?.slotPrice, children: /* @__PURE__ */ jsx(Price, { amount: slot.price }) })
|
|
10625
|
+
]
|
|
10626
|
+
},
|
|
10627
|
+
value
|
|
10628
|
+
);
|
|
10629
|
+
})
|
|
10630
|
+
] }, group.label || "all"))
|
|
10631
|
+
}
|
|
10632
|
+
);
|
|
10534
10633
|
}
|
|
10535
10634
|
function formatDate(dateStr) {
|
|
10536
10635
|
const date = /* @__PURE__ */ new Date(dateStr + "T00:00:00");
|
|
@@ -10593,8 +10692,10 @@ function DateSlotPicker({
|
|
|
10593
10692
|
const handleNext = useCallback(() => {
|
|
10594
10693
|
setOffset((prev) => prev + daysToShow);
|
|
10595
10694
|
}, [daysToShow]);
|
|
10596
|
-
const
|
|
10597
|
-
|
|
10695
|
+
const handleDateChange = useCallback((value) => {
|
|
10696
|
+
if (typeof value === "string") {
|
|
10697
|
+
setSelectedDate(value);
|
|
10698
|
+
}
|
|
10598
10699
|
}, []);
|
|
10599
10700
|
const handleSlotSelect = useCallback(
|
|
10600
10701
|
(slot) => {
|
|
@@ -10602,72 +10703,79 @@ function DateSlotPicker({
|
|
|
10602
10703
|
},
|
|
10603
10704
|
[onSlotSelect, selectedDate]
|
|
10604
10705
|
);
|
|
10605
|
-
return /* @__PURE__ */ jsxs(
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
|
|
10613
|
-
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
date:
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10706
|
+
return /* @__PURE__ */ jsxs(
|
|
10707
|
+
Tabs.Root,
|
|
10708
|
+
{
|
|
10709
|
+
value: selectedDate,
|
|
10710
|
+
onValueChange: handleDateChange,
|
|
10711
|
+
"data-cimplify-date-slot-picker": true,
|
|
10712
|
+
className: cn(className, classNames?.root),
|
|
10713
|
+
children: [
|
|
10714
|
+
/* @__PURE__ */ jsxs("div", { "data-cimplify-date-nav": true, className: classNames?.nav, children: [
|
|
10715
|
+
/* @__PURE__ */ jsx(
|
|
10716
|
+
"button",
|
|
10717
|
+
{
|
|
10718
|
+
type: "button",
|
|
10719
|
+
onClick: handlePrev,
|
|
10720
|
+
disabled: offset === 0,
|
|
10721
|
+
"data-cimplify-date-nav-prev": true,
|
|
10722
|
+
className: classNames?.navButton,
|
|
10723
|
+
children: "\u2190"
|
|
10724
|
+
}
|
|
10725
|
+
),
|
|
10726
|
+
/* @__PURE__ */ jsx(
|
|
10727
|
+
"button",
|
|
10728
|
+
{
|
|
10729
|
+
type: "button",
|
|
10730
|
+
onClick: handleNext,
|
|
10731
|
+
"data-cimplify-date-nav-next": true,
|
|
10732
|
+
className: classNames?.navButton,
|
|
10733
|
+
children: "\u2192"
|
|
10734
|
+
}
|
|
10735
|
+
)
|
|
10736
|
+
] }),
|
|
10737
|
+
/* @__PURE__ */ jsx(Tabs.List, { "data-cimplify-date-strip": true, className: classNames?.dateStrip, children: dateRange.dates.map((date) => {
|
|
10738
|
+
const dayInfo = availabilityMap.get(date);
|
|
10739
|
+
const hasAvailability = dayInfo?.has_availability !== false;
|
|
10740
|
+
const isSelected = selectedDate === date;
|
|
10741
|
+
return /* @__PURE__ */ jsx(
|
|
10742
|
+
Tabs.Tab,
|
|
10743
|
+
{
|
|
10744
|
+
value: date,
|
|
10745
|
+
"data-cimplify-date-button": true,
|
|
10746
|
+
"data-selected": isSelected || void 0,
|
|
10747
|
+
"data-available": hasAvailability || void 0,
|
|
10748
|
+
"data-fully-booked": !hasAvailability || void 0,
|
|
10749
|
+
className: classNames?.dateButton,
|
|
10750
|
+
children: formatDate(date)
|
|
10751
|
+
},
|
|
10752
|
+
date
|
|
10753
|
+
);
|
|
10754
|
+
}) }),
|
|
10755
|
+
availabilityLoading && /* @__PURE__ */ jsx(
|
|
10756
|
+
"div",
|
|
10757
|
+
{
|
|
10758
|
+
"data-cimplify-date-slot-loading": true,
|
|
10759
|
+
"aria-busy": "true",
|
|
10760
|
+
className: classNames?.loading
|
|
10761
|
+
}
|
|
10762
|
+
),
|
|
10763
|
+
/* @__PURE__ */ jsx("div", { "data-cimplify-date-slots": true, className: classNames?.slots, children: /* @__PURE__ */ jsx(
|
|
10764
|
+
SlotPicker,
|
|
10765
|
+
{
|
|
10766
|
+
serviceId,
|
|
10767
|
+
date: selectedDate,
|
|
10768
|
+
participantCount,
|
|
10769
|
+
selectedSlot,
|
|
10770
|
+
onSlotSelect: handleSlotSelect,
|
|
10771
|
+
showPrice
|
|
10772
|
+
}
|
|
10773
|
+
) })
|
|
10774
|
+
]
|
|
10775
|
+
}
|
|
10776
|
+
);
|
|
10670
10777
|
}
|
|
10778
|
+
var ANY_VALUE = "__any__";
|
|
10671
10779
|
function StaffPicker({
|
|
10672
10780
|
staff,
|
|
10673
10781
|
selectedStaffId,
|
|
@@ -10677,44 +10785,56 @@ function StaffPicker({
|
|
|
10677
10785
|
className,
|
|
10678
10786
|
classNames
|
|
10679
10787
|
}) {
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
className: classNames?.option,
|
|
10690
|
-
children: /* @__PURE__ */ jsx("span", { "data-cimplify-staff-name": true, className: classNames?.name, children: anyLabel })
|
|
10691
|
-
}
|
|
10692
|
-
),
|
|
10693
|
-
staff.map((member) => /* @__PURE__ */ jsxs(
|
|
10694
|
-
"button",
|
|
10695
|
-
{
|
|
10696
|
-
type: "button",
|
|
10697
|
-
onClick: () => onStaffSelect?.(member.id),
|
|
10698
|
-
"data-cimplify-staff-option": true,
|
|
10699
|
-
"data-selected": selectedStaffId === member.id || void 0,
|
|
10700
|
-
className: classNames?.option,
|
|
10701
|
-
children: [
|
|
10702
|
-
member.avatar_url && /* @__PURE__ */ jsx(
|
|
10703
|
-
"img",
|
|
10704
|
-
{
|
|
10705
|
-
src: member.avatar_url,
|
|
10706
|
-
alt: member.name,
|
|
10707
|
-
"data-cimplify-staff-avatar": true,
|
|
10708
|
-
className: classNames?.avatar
|
|
10709
|
-
}
|
|
10710
|
-
),
|
|
10711
|
-
/* @__PURE__ */ jsx("span", { "data-cimplify-staff-name": true, className: classNames?.name, children: member.name }),
|
|
10712
|
-
member.bio && /* @__PURE__ */ jsx("span", { "data-cimplify-staff-bio": true, className: classNames?.bio, children: member.bio })
|
|
10713
|
-
]
|
|
10788
|
+
const groupValue = selectedStaffId === null ? ANY_VALUE : selectedStaffId ?? "";
|
|
10789
|
+
return /* @__PURE__ */ jsxs(
|
|
10790
|
+
RadioGroup,
|
|
10791
|
+
{
|
|
10792
|
+
"data-cimplify-staff-picker": true,
|
|
10793
|
+
className: cn(className, classNames?.root),
|
|
10794
|
+
value: groupValue,
|
|
10795
|
+
onValueChange: (value) => {
|
|
10796
|
+
onStaffSelect?.(value === ANY_VALUE ? null : value);
|
|
10714
10797
|
},
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10798
|
+
children: [
|
|
10799
|
+
showAnyOption && /* @__PURE__ */ jsx(
|
|
10800
|
+
Radio.Root,
|
|
10801
|
+
{
|
|
10802
|
+
value: ANY_VALUE,
|
|
10803
|
+
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
10804
|
+
"data-cimplify-staff-option": true,
|
|
10805
|
+
"data-selected": selectedStaffId === null || void 0,
|
|
10806
|
+
"data-any": true,
|
|
10807
|
+
className: classNames?.option,
|
|
10808
|
+
children: /* @__PURE__ */ jsx("span", { "data-cimplify-staff-name": true, className: classNames?.name, children: anyLabel })
|
|
10809
|
+
}
|
|
10810
|
+
),
|
|
10811
|
+
staff.map((member) => /* @__PURE__ */ jsxs(
|
|
10812
|
+
Radio.Root,
|
|
10813
|
+
{
|
|
10814
|
+
value: member.id,
|
|
10815
|
+
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
10816
|
+
"data-cimplify-staff-option": true,
|
|
10817
|
+
"data-selected": selectedStaffId === member.id || void 0,
|
|
10818
|
+
className: classNames?.option,
|
|
10819
|
+
children: [
|
|
10820
|
+
member.avatar_url && /* @__PURE__ */ jsx(
|
|
10821
|
+
"img",
|
|
10822
|
+
{
|
|
10823
|
+
src: member.avatar_url,
|
|
10824
|
+
alt: member.name,
|
|
10825
|
+
"data-cimplify-staff-avatar": true,
|
|
10826
|
+
className: classNames?.avatar
|
|
10827
|
+
}
|
|
10828
|
+
),
|
|
10829
|
+
/* @__PURE__ */ jsx("span", { "data-cimplify-staff-name": true, className: classNames?.name, children: member.name }),
|
|
10830
|
+
member.bio && /* @__PURE__ */ jsx("span", { "data-cimplify-staff-bio": true, className: classNames?.bio, children: member.bio })
|
|
10831
|
+
]
|
|
10832
|
+
},
|
|
10833
|
+
member.id
|
|
10834
|
+
))
|
|
10835
|
+
]
|
|
10836
|
+
}
|
|
10837
|
+
);
|
|
10718
10838
|
}
|
|
10719
10839
|
var STATUS_LABELS3 = {
|
|
10720
10840
|
pending: "Pending",
|
|
@@ -11386,10 +11506,10 @@ function OrderDetailPage({
|
|
|
11386
11506
|
] });
|
|
11387
11507
|
}
|
|
11388
11508
|
var STATUS_FILTERS = [
|
|
11389
|
-
{ label: "All", value: void 0 },
|
|
11390
|
-
{ label: "Active", value: "confirmed" },
|
|
11391
|
-
{ label: "Completed", value: "completed" },
|
|
11392
|
-
{ label: "Cancelled", value: "cancelled" }
|
|
11509
|
+
{ label: "All", value: void 0, tabValue: "all" },
|
|
11510
|
+
{ label: "Active", value: "confirmed", tabValue: "confirmed" },
|
|
11511
|
+
{ label: "Completed", value: "completed", tabValue: "completed" },
|
|
11512
|
+
{ label: "Cancelled", value: "cancelled", tabValue: "cancelled" }
|
|
11393
11513
|
];
|
|
11394
11514
|
function OrderHistoryPage({
|
|
11395
11515
|
title = "Order History",
|
|
@@ -11403,6 +11523,10 @@ function OrderHistoryPage({
|
|
|
11403
11523
|
}) {
|
|
11404
11524
|
const [statusFilter, setStatusFilter] = useState(void 0);
|
|
11405
11525
|
const [selectedOrder, setSelectedOrder] = useState(null);
|
|
11526
|
+
const handleTabChange = useCallback((value) => {
|
|
11527
|
+
const filter = STATUS_FILTERS.find((f) => f.tabValue === value);
|
|
11528
|
+
setStatusFilter(filter?.value);
|
|
11529
|
+
}, []);
|
|
11406
11530
|
const handleOrderClick = useCallback(
|
|
11407
11531
|
(order) => {
|
|
11408
11532
|
if (onOrderNavigate) {
|
|
@@ -11416,6 +11540,7 @@ function OrderHistoryPage({
|
|
|
11416
11540
|
const handleBack = useCallback(() => {
|
|
11417
11541
|
setSelectedOrder(null);
|
|
11418
11542
|
}, []);
|
|
11543
|
+
const activeTabValue = STATUS_FILTERS.find((f) => f.value === statusFilter)?.tabValue ?? "all";
|
|
11419
11544
|
if (selectedOrder && !onOrderNavigate) {
|
|
11420
11545
|
return /* @__PURE__ */ jsx("div", { "data-cimplify-order-history-page": true, className: cn(className, classNames?.root), children: /* @__PURE__ */ jsxs("div", { "data-cimplify-order-history-detail": true, className: classNames?.detail, children: [
|
|
11421
11546
|
/* @__PURE__ */ jsx(
|
|
@@ -11433,20 +11558,17 @@ function OrderHistoryPage({
|
|
|
11433
11558
|
}
|
|
11434
11559
|
return /* @__PURE__ */ jsxs("div", { "data-cimplify-order-history-page": true, className: cn(className, classNames?.root), children: [
|
|
11435
11560
|
/* @__PURE__ */ jsx("div", { "data-cimplify-order-history-header": true, className: classNames?.header, children: /* @__PURE__ */ jsx("h1", { "data-cimplify-order-history-title": true, className: classNames?.title, children: title }) }),
|
|
11436
|
-
showFilters && /* @__PURE__ */ jsx(
|
|
11437
|
-
|
|
11561
|
+
showFilters && /* @__PURE__ */ jsx(Tabs.Root, { value: activeTabValue, onValueChange: handleTabChange, children: /* @__PURE__ */ jsx(Tabs.List, { "data-cimplify-order-history-filters": true, className: classNames?.filters, children: STATUS_FILTERS.map((filter) => /* @__PURE__ */ jsx(
|
|
11562
|
+
Tabs.Tab,
|
|
11438
11563
|
{
|
|
11439
|
-
|
|
11440
|
-
role: "tab",
|
|
11441
|
-
"aria-selected": statusFilter === filter.value,
|
|
11442
|
-
onClick: () => setStatusFilter(filter.value),
|
|
11564
|
+
value: filter.tabValue,
|
|
11443
11565
|
"data-cimplify-order-filter": true,
|
|
11444
11566
|
"data-selected": statusFilter === filter.value || void 0,
|
|
11445
11567
|
className: classNames?.filterButton,
|
|
11446
11568
|
children: filter.label
|
|
11447
11569
|
},
|
|
11448
|
-
filter.
|
|
11449
|
-
)) }),
|
|
11570
|
+
filter.tabValue
|
|
11571
|
+
)) }) }),
|
|
11450
11572
|
/* @__PURE__ */ jsx("div", { "data-cimplify-order-history-list": true, className: classNames?.list, children: /* @__PURE__ */ jsx(
|
|
11451
11573
|
OrderHistory,
|
|
11452
11574
|
{
|
|
@@ -11474,7 +11596,7 @@ function SearchPage({
|
|
|
11474
11596
|
/* @__PURE__ */ jsx("div", { "data-cimplify-search-page-header": true, className: classNames?.header, children: /* @__PURE__ */ jsx("h1", { "data-cimplify-search-page-title": true, className: classNames?.title, children: title }) }),
|
|
11475
11597
|
/* @__PURE__ */ jsxs("div", { "data-cimplify-search-page-input": true, className: classNames?.inputContainer, children: [
|
|
11476
11598
|
/* @__PURE__ */ jsx(
|
|
11477
|
-
|
|
11599
|
+
Input,
|
|
11478
11600
|
{
|
|
11479
11601
|
type: "search",
|
|
11480
11602
|
value: query,
|
|
@@ -11816,20 +11938,24 @@ function BookingsPage({
|
|
|
11816
11938
|
}
|
|
11817
11939
|
return /* @__PURE__ */ jsxs("div", { "data-cimplify-bookings-page": true, className: cn(className, classNames?.root), children: [
|
|
11818
11940
|
/* @__PURE__ */ jsx("div", { "data-cimplify-bookings-header": true, className: classNames?.header, children: /* @__PURE__ */ jsx("h1", { "data-cimplify-bookings-title": true, className: classNames?.title, children: title }) }),
|
|
11819
|
-
showFilters && /* @__PURE__ */ jsx(
|
|
11820
|
-
|
|
11941
|
+
showFilters && /* @__PURE__ */ jsx(
|
|
11942
|
+
Tabs.Root,
|
|
11821
11943
|
{
|
|
11822
|
-
|
|
11823
|
-
|
|
11824
|
-
"
|
|
11825
|
-
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11944
|
+
value: filter,
|
|
11945
|
+
onValueChange: (value) => setFilter(value),
|
|
11946
|
+
children: /* @__PURE__ */ jsx(Tabs.List, { "data-cimplify-bookings-filters": true, className: classNames?.filters, children: BOOKING_FILTERS.map((f) => /* @__PURE__ */ jsx(
|
|
11947
|
+
Tabs.Tab,
|
|
11948
|
+
{
|
|
11949
|
+
value: f.value,
|
|
11950
|
+
"data-cimplify-booking-filter": true,
|
|
11951
|
+
"data-selected": filter === f.value || void 0,
|
|
11952
|
+
className: classNames?.filterButton,
|
|
11953
|
+
children: f.label
|
|
11954
|
+
},
|
|
11955
|
+
f.value
|
|
11956
|
+
)) })
|
|
11957
|
+
}
|
|
11958
|
+
),
|
|
11833
11959
|
/* @__PURE__ */ jsx("div", { "data-cimplify-bookings-list": true, className: classNames?.list, children: /* @__PURE__ */ jsx(
|
|
11834
11960
|
BookingList,
|
|
11835
11961
|
{
|