@cimplify/sdk 0.11.0 → 0.12.1
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 +413 -296
- package/dist/react.mjs +413 -296
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/registry/add-on-selector.json +1 -1
- package/registry/bookings-page.json +1 -1
- package/registry/bundle-selector.json +1 -1
- package/registry/category-filter.json +1 -1
- package/registry/composite-selector.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/registry/variant-selector.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
|
|
|
@@ -8002,7 +8005,6 @@ function VariantSelector({
|
|
|
8002
8005
|
Radio.Root,
|
|
8003
8006
|
{
|
|
8004
8007
|
value: value.id,
|
|
8005
|
-
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
8006
8008
|
"data-cimplify-variant-option": true,
|
|
8007
8009
|
"data-selected": isSelected || void 0,
|
|
8008
8010
|
className: cn(
|
|
@@ -8050,7 +8052,6 @@ function VariantSelector({
|
|
|
8050
8052
|
Radio.Root,
|
|
8051
8053
|
{
|
|
8052
8054
|
value: variant.id,
|
|
8053
|
-
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
8054
8055
|
"data-cimplify-variant-option": true,
|
|
8055
8056
|
"data-selected": isSelected || void 0,
|
|
8056
8057
|
className: cn(
|
|
@@ -8208,7 +8209,6 @@ function AddOnSelector({
|
|
|
8208
8209
|
checked: isSelected,
|
|
8209
8210
|
onCheckedChange: (checked) => handleCheckedChange(addOn, option.id, checked),
|
|
8210
8211
|
value: option.id,
|
|
8211
|
-
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
8212
8212
|
"data-cimplify-addon-option": true,
|
|
8213
8213
|
"data-selected": isSelected || void 0,
|
|
8214
8214
|
className: cn(
|
|
@@ -8449,7 +8449,6 @@ function BundleComponentCard({
|
|
|
8449
8449
|
Radio.Root,
|
|
8450
8450
|
{
|
|
8451
8451
|
value: variant.id,
|
|
8452
|
-
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
8453
8452
|
"data-cimplify-bundle-variant-option": true,
|
|
8454
8453
|
"data-selected": isSelected || void 0,
|
|
8455
8454
|
className: cn(
|
|
@@ -8695,7 +8694,6 @@ function CompositeSelector({
|
|
|
8695
8694
|
checked: isSelected,
|
|
8696
8695
|
onCheckedChange: () => toggleComponent(group, component),
|
|
8697
8696
|
value: component.id,
|
|
8698
|
-
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
8699
8697
|
"data-cimplify-composite-component": true,
|
|
8700
8698
|
"data-selected": isSelected || void 0,
|
|
8701
8699
|
className: cn(
|
|
@@ -9166,33 +9164,44 @@ function ProductImageGallery({
|
|
|
9166
9164
|
)
|
|
9167
9165
|
}
|
|
9168
9166
|
),
|
|
9169
|
-
normalizedImages.length > 1 && /* @__PURE__ */ jsx(
|
|
9170
|
-
|
|
9167
|
+
normalizedImages.length > 1 && /* @__PURE__ */ jsx(
|
|
9168
|
+
RadioGroup,
|
|
9171
9169
|
{
|
|
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
|
-
|
|
9170
|
+
"aria-label": `${productName} image thumbnails`,
|
|
9171
|
+
value: String(selectedImage),
|
|
9172
|
+
onValueChange: (value) => setSelectedImage(Number(value)),
|
|
9173
|
+
"data-cimplify-image-gallery-thumbnails": true,
|
|
9174
|
+
style: { display: "flex", gap: "0.5rem", marginTop: "0.75rem" },
|
|
9175
|
+
children: normalizedImages.map((image, index) => {
|
|
9176
|
+
const isSelected = selectedImage === index;
|
|
9177
|
+
return /* @__PURE__ */ jsx(
|
|
9178
|
+
Radio.Root,
|
|
9179
|
+
{
|
|
9180
|
+
value: String(index),
|
|
9181
|
+
"data-cimplify-image-gallery-thumb": true,
|
|
9182
|
+
"data-selected": isSelected || void 0,
|
|
9183
|
+
style: {
|
|
9184
|
+
width: "4rem",
|
|
9185
|
+
height: "4rem",
|
|
9186
|
+
overflow: "hidden",
|
|
9187
|
+
padding: 0,
|
|
9188
|
+
border: "none",
|
|
9189
|
+
cursor: "pointer"
|
|
9190
|
+
},
|
|
9191
|
+
children: /* @__PURE__ */ jsx(
|
|
9192
|
+
"img",
|
|
9193
|
+
{
|
|
9194
|
+
src: image,
|
|
9195
|
+
alt: "",
|
|
9196
|
+
style: { width: "100%", height: "100%", objectFit: "cover" }
|
|
9197
|
+
}
|
|
9198
|
+
)
|
|
9199
|
+
},
|
|
9200
|
+
`${image}-${index}`
|
|
9201
|
+
);
|
|
9202
|
+
})
|
|
9203
|
+
}
|
|
9204
|
+
)
|
|
9196
9205
|
] });
|
|
9197
9206
|
}
|
|
9198
9207
|
function CartLineItemRow({
|
|
@@ -9803,6 +9812,26 @@ function ProductGrid({
|
|
|
9803
9812
|
)
|
|
9804
9813
|
] });
|
|
9805
9814
|
}
|
|
9815
|
+
var SearchIcon = () => /* @__PURE__ */ jsxs(
|
|
9816
|
+
"svg",
|
|
9817
|
+
{
|
|
9818
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9819
|
+
width: "16",
|
|
9820
|
+
height: "16",
|
|
9821
|
+
viewBox: "0 0 24 24",
|
|
9822
|
+
fill: "none",
|
|
9823
|
+
stroke: "currentColor",
|
|
9824
|
+
strokeWidth: "2",
|
|
9825
|
+
strokeLinecap: "round",
|
|
9826
|
+
strokeLinejoin: "round",
|
|
9827
|
+
"aria-hidden": "true",
|
|
9828
|
+
"data-cimplify-search-icon": true,
|
|
9829
|
+
children: [
|
|
9830
|
+
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
|
|
9831
|
+
/* @__PURE__ */ jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
9832
|
+
]
|
|
9833
|
+
}
|
|
9834
|
+
);
|
|
9806
9835
|
function SearchInput({
|
|
9807
9836
|
placeholder = "Search products...",
|
|
9808
9837
|
searchOptions,
|
|
@@ -9813,42 +9842,58 @@ function SearchInput({
|
|
|
9813
9842
|
classNames
|
|
9814
9843
|
}) {
|
|
9815
9844
|
const { results, isLoading, query, setQuery, clear } = useSearch(searchOptions);
|
|
9816
|
-
const
|
|
9817
|
-
(
|
|
9818
|
-
setQuery(
|
|
9845
|
+
const handleValueChange = useCallback(
|
|
9846
|
+
(value) => {
|
|
9847
|
+
setQuery(value);
|
|
9819
9848
|
},
|
|
9820
9849
|
[setQuery]
|
|
9821
9850
|
);
|
|
9822
9851
|
return /* @__PURE__ */ jsxs(
|
|
9823
|
-
|
|
9852
|
+
Field.Root,
|
|
9824
9853
|
{
|
|
9825
9854
|
"data-cimplify-search": true,
|
|
9826
9855
|
className: cn(className, classNames?.root),
|
|
9827
9856
|
style: { position: "relative" },
|
|
9828
9857
|
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
|
-
|
|
9858
|
+
/* @__PURE__ */ jsx(Field.Label, { className: "sr-only", children: "Search products" }),
|
|
9859
|
+
/* @__PURE__ */ jsxs("div", { style: { position: "relative", display: "flex", alignItems: "center" }, children: [
|
|
9860
|
+
/* @__PURE__ */ jsx(
|
|
9861
|
+
"span",
|
|
9862
|
+
{
|
|
9863
|
+
"data-cimplify-search-icon-wrapper": true,
|
|
9864
|
+
style: {
|
|
9865
|
+
position: "absolute",
|
|
9866
|
+
left: "0.5rem",
|
|
9867
|
+
pointerEvents: "none",
|
|
9868
|
+
display: "flex",
|
|
9869
|
+
alignItems: "center"
|
|
9870
|
+
},
|
|
9871
|
+
children: /* @__PURE__ */ jsx(SearchIcon, {})
|
|
9872
|
+
}
|
|
9873
|
+
),
|
|
9874
|
+
/* @__PURE__ */ jsx(
|
|
9875
|
+
Input,
|
|
9876
|
+
{
|
|
9877
|
+
type: "search",
|
|
9878
|
+
value: query,
|
|
9879
|
+
onValueChange: handleValueChange,
|
|
9880
|
+
placeholder,
|
|
9881
|
+
"data-cimplify-search-input": true,
|
|
9882
|
+
className: classNames?.input
|
|
9883
|
+
}
|
|
9884
|
+
),
|
|
9885
|
+
query.length > 0 && /* @__PURE__ */ jsx(
|
|
9886
|
+
"button",
|
|
9887
|
+
{
|
|
9888
|
+
type: "button",
|
|
9889
|
+
onClick: clear,
|
|
9890
|
+
"data-cimplify-search-clear": true,
|
|
9891
|
+
className: classNames?.clearButton,
|
|
9892
|
+
"aria-label": "Clear search",
|
|
9893
|
+
children: "\xD7"
|
|
9894
|
+
}
|
|
9895
|
+
)
|
|
9896
|
+
] }),
|
|
9852
9897
|
showResults && query.length > 0 && /* @__PURE__ */ jsxs("div", { "data-cimplify-search-results": true, className: classNames?.results, children: [
|
|
9853
9898
|
isLoading && /* @__PURE__ */ jsx("div", { "data-cimplify-search-loading": true, className: classNames?.loading, "aria-busy": "true", children: "Searching..." }),
|
|
9854
9899
|
!isLoading && results.length === 0 && query.length >= 2 && /* @__PURE__ */ jsx("div", { "data-cimplify-search-empty": true, className: classNames?.empty, children: "No results found" }),
|
|
@@ -9868,6 +9913,7 @@ function SearchInput({
|
|
|
9868
9913
|
}
|
|
9869
9914
|
);
|
|
9870
9915
|
}
|
|
9916
|
+
var ALL_VALUE = "__all__";
|
|
9871
9917
|
function CategoryFilter({
|
|
9872
9918
|
selectedId = null,
|
|
9873
9919
|
onSelect,
|
|
@@ -9877,9 +9923,9 @@ function CategoryFilter({
|
|
|
9877
9923
|
classNames
|
|
9878
9924
|
}) {
|
|
9879
9925
|
const { categories, isLoading } = useCategories();
|
|
9880
|
-
const
|
|
9881
|
-
(
|
|
9882
|
-
onSelect(
|
|
9926
|
+
const handleValueChange = useCallback(
|
|
9927
|
+
(value) => {
|
|
9928
|
+
onSelect(value === ALL_VALUE ? null : String(value));
|
|
9883
9929
|
},
|
|
9884
9930
|
[onSelect]
|
|
9885
9931
|
);
|
|
@@ -9893,45 +9939,45 @@ function CategoryFilter({
|
|
|
9893
9939
|
}
|
|
9894
9940
|
);
|
|
9895
9941
|
}
|
|
9896
|
-
return /* @__PURE__ */
|
|
9897
|
-
|
|
9942
|
+
return /* @__PURE__ */ jsx(
|
|
9943
|
+
Tabs.Root,
|
|
9898
9944
|
{
|
|
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
|
-
|
|
9945
|
+
value: selectedId ?? ALL_VALUE,
|
|
9946
|
+
onValueChange: handleValueChange,
|
|
9947
|
+
children: /* @__PURE__ */ jsxs(
|
|
9948
|
+
Tabs.List,
|
|
9949
|
+
{
|
|
9950
|
+
"data-cimplify-category-filter": true,
|
|
9951
|
+
"aria-label": "Filter by category",
|
|
9952
|
+
className: cn(className, classNames?.root),
|
|
9953
|
+
children: [
|
|
9954
|
+
/* @__PURE__ */ jsx(
|
|
9955
|
+
Tabs.Tab,
|
|
9956
|
+
{
|
|
9957
|
+
value: ALL_VALUE,
|
|
9958
|
+
"data-cimplify-category-filter-item": true,
|
|
9959
|
+
"data-selected": selectedId === null || void 0,
|
|
9960
|
+
className: cn(classNames?.item, classNames?.allButton),
|
|
9961
|
+
children: allLabel
|
|
9962
|
+
}
|
|
9963
|
+
),
|
|
9964
|
+
categories.map((category) => /* @__PURE__ */ jsxs(
|
|
9965
|
+
Tabs.Tab,
|
|
9966
|
+
{
|
|
9967
|
+
value: category.id,
|
|
9968
|
+
"data-cimplify-category-filter-item": true,
|
|
9969
|
+
"data-selected": selectedId === category.id || void 0,
|
|
9970
|
+
className: classNames?.item,
|
|
9971
|
+
children: [
|
|
9972
|
+
category.name,
|
|
9973
|
+
showCounts && category.product_count != null && /* @__PURE__ */ jsx("span", { "data-cimplify-category-count": true, className: classNames?.count, children: category.product_count })
|
|
9974
|
+
]
|
|
9975
|
+
},
|
|
9976
|
+
category.id
|
|
9977
|
+
))
|
|
9978
|
+
]
|
|
9979
|
+
}
|
|
9980
|
+
)
|
|
9935
9981
|
}
|
|
9936
9982
|
);
|
|
9937
9983
|
}
|
|
@@ -9974,50 +10020,74 @@ function DiscountInput({
|
|
|
9974
10020
|
[handleApply]
|
|
9975
10021
|
);
|
|
9976
10022
|
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
|
-
|
|
10023
|
+
const hasError = !!error || !!appliedValidation && !appliedValidation.is_eligible;
|
|
10024
|
+
const errorMessage = error ? error.message : appliedValidation && !appliedValidation.is_eligible ? appliedValidation.ineligibility_reason ?? "This code is not valid." : void 0;
|
|
10025
|
+
return /* @__PURE__ */ jsxs(
|
|
10026
|
+
Field.Root,
|
|
10027
|
+
{
|
|
10028
|
+
"data-cimplify-discount": true,
|
|
10029
|
+
invalid: hasError,
|
|
10030
|
+
disabled: isApplied,
|
|
10031
|
+
className: cn(className, classNames?.root),
|
|
10032
|
+
children: [
|
|
10033
|
+
/* @__PURE__ */ jsxs("div", { "data-cimplify-discount-form": true, children: [
|
|
10034
|
+
/* @__PURE__ */ jsx(
|
|
10035
|
+
Input,
|
|
10036
|
+
{
|
|
10037
|
+
type: "text",
|
|
10038
|
+
value: code,
|
|
10039
|
+
onValueChange: (value) => setCode(value),
|
|
10040
|
+
onKeyDown: handleKeyDown,
|
|
10041
|
+
placeholder,
|
|
10042
|
+
"data-cimplify-discount-input": true,
|
|
10043
|
+
className: classNames?.input,
|
|
10044
|
+
"aria-label": "Discount code"
|
|
10045
|
+
}
|
|
10046
|
+
),
|
|
10047
|
+
isApplied ? /* @__PURE__ */ jsx(
|
|
10048
|
+
"button",
|
|
10049
|
+
{
|
|
10050
|
+
type: "button",
|
|
10051
|
+
onClick: handleClear,
|
|
10052
|
+
"data-cimplify-discount-clear": true,
|
|
10053
|
+
className: classNames?.button,
|
|
10054
|
+
children: "Remove"
|
|
10055
|
+
}
|
|
10056
|
+
) : /* @__PURE__ */ jsx(
|
|
10057
|
+
"button",
|
|
10058
|
+
{
|
|
10059
|
+
type: "button",
|
|
10060
|
+
onClick: handleApply,
|
|
10061
|
+
disabled: isValidating || code.trim().length === 0,
|
|
10062
|
+
"data-cimplify-discount-apply": true,
|
|
10063
|
+
className: classNames?.button,
|
|
10064
|
+
children: isValidating ? "Checking..." : "Apply"
|
|
10065
|
+
}
|
|
10066
|
+
)
|
|
10067
|
+
] }),
|
|
10068
|
+
hasError && errorMessage && /* @__PURE__ */ jsx(
|
|
10069
|
+
Field.Error,
|
|
10070
|
+
{
|
|
10071
|
+
match: true,
|
|
10072
|
+
"data-cimplify-discount-error": true,
|
|
10073
|
+
className: classNames?.error,
|
|
10074
|
+
children: errorMessage
|
|
10075
|
+
}
|
|
10076
|
+
),
|
|
10077
|
+
isApplied && appliedValidation.discount_amount && /* @__PURE__ */ jsxs(
|
|
10078
|
+
Field.Description,
|
|
10079
|
+
{
|
|
10080
|
+
"data-cimplify-discount-success": true,
|
|
10081
|
+
className: classNames?.success,
|
|
10082
|
+
children: [
|
|
10083
|
+
/* @__PURE__ */ jsx("span", { children: "Discount applied" }),
|
|
10084
|
+
/* @__PURE__ */ jsx(Price, { amount: appliedValidation.discount_amount, prefix: "-" })
|
|
10085
|
+
]
|
|
10086
|
+
}
|
|
10087
|
+
)
|
|
10088
|
+
]
|
|
10089
|
+
}
|
|
10090
|
+
);
|
|
10021
10091
|
}
|
|
10022
10092
|
function CategoryGrid({
|
|
10023
10093
|
categories: categoriesProp,
|
|
@@ -10464,6 +10534,9 @@ function formatTime(timeStr) {
|
|
|
10464
10534
|
}
|
|
10465
10535
|
return timeStr;
|
|
10466
10536
|
}
|
|
10537
|
+
function slotToValue(slot) {
|
|
10538
|
+
return `${slot.start_time}|${slot.end_time}`;
|
|
10539
|
+
}
|
|
10467
10540
|
function SlotPicker({
|
|
10468
10541
|
slots: slotsProp,
|
|
10469
10542
|
serviceId,
|
|
@@ -10508,29 +10581,48 @@ function SlotPicker({
|
|
|
10508
10581
|
);
|
|
10509
10582
|
}
|
|
10510
10583
|
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
|
-
|
|
10584
|
+
const slotsByValue = /* @__PURE__ */ new Map();
|
|
10585
|
+
for (const slot of slots) {
|
|
10586
|
+
slotsByValue.set(slotToValue(slot), slot);
|
|
10587
|
+
}
|
|
10588
|
+
const selectedValue = selectedSlot ? slotToValue(selectedSlot) : "";
|
|
10589
|
+
return /* @__PURE__ */ jsx(
|
|
10590
|
+
RadioGroup,
|
|
10591
|
+
{
|
|
10592
|
+
"data-cimplify-slot-picker": true,
|
|
10593
|
+
className: cn(className, classNames?.root),
|
|
10594
|
+
value: selectedValue,
|
|
10595
|
+
onValueChange: (value) => {
|
|
10596
|
+
const slot = slotsByValue.get(value);
|
|
10597
|
+
if (slot?.is_available) {
|
|
10598
|
+
onSlotSelect?.(slot);
|
|
10599
|
+
}
|
|
10600
|
+
},
|
|
10601
|
+
children: groups.map((group) => /* @__PURE__ */ jsxs("div", { "data-cimplify-slot-group": true, className: classNames?.group, children: [
|
|
10602
|
+
group.label && /* @__PURE__ */ jsx("div", { "data-cimplify-slot-group-label": true, className: classNames?.groupLabel, children: group.label }),
|
|
10603
|
+
group.slots.map((slot) => {
|
|
10604
|
+
const value = slotToValue(slot);
|
|
10605
|
+
const isSelected = selectedSlot?.start_time === slot.start_time && selectedSlot?.end_time === slot.end_time;
|
|
10606
|
+
return /* @__PURE__ */ jsxs(
|
|
10607
|
+
Radio.Root,
|
|
10608
|
+
{
|
|
10609
|
+
value,
|
|
10610
|
+
disabled: !slot.is_available,
|
|
10611
|
+
"data-cimplify-slot": true,
|
|
10612
|
+
"data-selected": isSelected || void 0,
|
|
10613
|
+
"data-unavailable": !slot.is_available || void 0,
|
|
10614
|
+
className: classNames?.slot,
|
|
10615
|
+
children: [
|
|
10616
|
+
/* @__PURE__ */ jsx("span", { "data-cimplify-slot-time": true, className: classNames?.slotTime, children: formatTime(slot.start_time) }),
|
|
10617
|
+
showPrice && slot.price && /* @__PURE__ */ jsx("span", { "data-cimplify-slot-price": true, className: classNames?.slotPrice, children: /* @__PURE__ */ jsx(Price, { amount: slot.price }) })
|
|
10618
|
+
]
|
|
10619
|
+
},
|
|
10620
|
+
value
|
|
10621
|
+
);
|
|
10622
|
+
})
|
|
10623
|
+
] }, group.label || "all"))
|
|
10624
|
+
}
|
|
10625
|
+
);
|
|
10534
10626
|
}
|
|
10535
10627
|
function formatDate(dateStr) {
|
|
10536
10628
|
const date = /* @__PURE__ */ new Date(dateStr + "T00:00:00");
|
|
@@ -10593,8 +10685,10 @@ function DateSlotPicker({
|
|
|
10593
10685
|
const handleNext = useCallback(() => {
|
|
10594
10686
|
setOffset((prev) => prev + daysToShow);
|
|
10595
10687
|
}, [daysToShow]);
|
|
10596
|
-
const
|
|
10597
|
-
|
|
10688
|
+
const handleDateChange = useCallback((value) => {
|
|
10689
|
+
if (typeof value === "string") {
|
|
10690
|
+
setSelectedDate(value);
|
|
10691
|
+
}
|
|
10598
10692
|
}, []);
|
|
10599
10693
|
const handleSlotSelect = useCallback(
|
|
10600
10694
|
(slot) => {
|
|
@@ -10602,72 +10696,79 @@ function DateSlotPicker({
|
|
|
10602
10696
|
},
|
|
10603
10697
|
[onSlotSelect, selectedDate]
|
|
10604
10698
|
);
|
|
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
|
-
|
|
10699
|
+
return /* @__PURE__ */ jsxs(
|
|
10700
|
+
Tabs.Root,
|
|
10701
|
+
{
|
|
10702
|
+
value: selectedDate,
|
|
10703
|
+
onValueChange: handleDateChange,
|
|
10704
|
+
"data-cimplify-date-slot-picker": true,
|
|
10705
|
+
className: cn(className, classNames?.root),
|
|
10706
|
+
children: [
|
|
10707
|
+
/* @__PURE__ */ jsxs("div", { "data-cimplify-date-nav": true, className: classNames?.nav, children: [
|
|
10708
|
+
/* @__PURE__ */ jsx(
|
|
10709
|
+
"button",
|
|
10710
|
+
{
|
|
10711
|
+
type: "button",
|
|
10712
|
+
onClick: handlePrev,
|
|
10713
|
+
disabled: offset === 0,
|
|
10714
|
+
"data-cimplify-date-nav-prev": true,
|
|
10715
|
+
className: classNames?.navButton,
|
|
10716
|
+
children: "\u2190"
|
|
10717
|
+
}
|
|
10718
|
+
),
|
|
10719
|
+
/* @__PURE__ */ jsx(
|
|
10720
|
+
"button",
|
|
10721
|
+
{
|
|
10722
|
+
type: "button",
|
|
10723
|
+
onClick: handleNext,
|
|
10724
|
+
"data-cimplify-date-nav-next": true,
|
|
10725
|
+
className: classNames?.navButton,
|
|
10726
|
+
children: "\u2192"
|
|
10727
|
+
}
|
|
10728
|
+
)
|
|
10729
|
+
] }),
|
|
10730
|
+
/* @__PURE__ */ jsx(Tabs.List, { "data-cimplify-date-strip": true, className: classNames?.dateStrip, children: dateRange.dates.map((date) => {
|
|
10731
|
+
const dayInfo = availabilityMap.get(date);
|
|
10732
|
+
const hasAvailability = dayInfo?.has_availability !== false;
|
|
10733
|
+
const isSelected = selectedDate === date;
|
|
10734
|
+
return /* @__PURE__ */ jsx(
|
|
10735
|
+
Tabs.Tab,
|
|
10736
|
+
{
|
|
10737
|
+
value: date,
|
|
10738
|
+
"data-cimplify-date-button": true,
|
|
10739
|
+
"data-selected": isSelected || void 0,
|
|
10740
|
+
"data-available": hasAvailability || void 0,
|
|
10741
|
+
"data-fully-booked": !hasAvailability || void 0,
|
|
10742
|
+
className: classNames?.dateButton,
|
|
10743
|
+
children: formatDate(date)
|
|
10744
|
+
},
|
|
10745
|
+
date
|
|
10746
|
+
);
|
|
10747
|
+
}) }),
|
|
10748
|
+
availabilityLoading && /* @__PURE__ */ jsx(
|
|
10749
|
+
"div",
|
|
10750
|
+
{
|
|
10751
|
+
"data-cimplify-date-slot-loading": true,
|
|
10752
|
+
"aria-busy": "true",
|
|
10753
|
+
className: classNames?.loading
|
|
10754
|
+
}
|
|
10755
|
+
),
|
|
10756
|
+
/* @__PURE__ */ jsx("div", { "data-cimplify-date-slots": true, className: classNames?.slots, children: /* @__PURE__ */ jsx(
|
|
10757
|
+
SlotPicker,
|
|
10758
|
+
{
|
|
10759
|
+
serviceId,
|
|
10760
|
+
date: selectedDate,
|
|
10761
|
+
participantCount,
|
|
10762
|
+
selectedSlot,
|
|
10763
|
+
onSlotSelect: handleSlotSelect,
|
|
10764
|
+
showPrice
|
|
10765
|
+
}
|
|
10766
|
+
) })
|
|
10767
|
+
]
|
|
10768
|
+
}
|
|
10769
|
+
);
|
|
10670
10770
|
}
|
|
10771
|
+
var ANY_VALUE = "__any__";
|
|
10671
10772
|
function StaffPicker({
|
|
10672
10773
|
staff,
|
|
10673
10774
|
selectedStaffId,
|
|
@@ -10677,44 +10778,54 @@ function StaffPicker({
|
|
|
10677
10778
|
className,
|
|
10678
10779
|
classNames
|
|
10679
10780
|
}) {
|
|
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
|
-
]
|
|
10781
|
+
const groupValue = selectedStaffId === null ? ANY_VALUE : selectedStaffId ?? "";
|
|
10782
|
+
return /* @__PURE__ */ jsxs(
|
|
10783
|
+
RadioGroup,
|
|
10784
|
+
{
|
|
10785
|
+
"data-cimplify-staff-picker": true,
|
|
10786
|
+
className: cn(className, classNames?.root),
|
|
10787
|
+
value: groupValue,
|
|
10788
|
+
onValueChange: (value) => {
|
|
10789
|
+
onStaffSelect?.(value === ANY_VALUE ? null : value);
|
|
10714
10790
|
},
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10791
|
+
children: [
|
|
10792
|
+
showAnyOption && /* @__PURE__ */ jsx(
|
|
10793
|
+
Radio.Root,
|
|
10794
|
+
{
|
|
10795
|
+
value: ANY_VALUE,
|
|
10796
|
+
"data-cimplify-staff-option": true,
|
|
10797
|
+
"data-selected": selectedStaffId === null || void 0,
|
|
10798
|
+
"data-any": true,
|
|
10799
|
+
className: classNames?.option,
|
|
10800
|
+
children: /* @__PURE__ */ jsx("span", { "data-cimplify-staff-name": true, className: classNames?.name, children: anyLabel })
|
|
10801
|
+
}
|
|
10802
|
+
),
|
|
10803
|
+
staff.map((member) => /* @__PURE__ */ jsxs(
|
|
10804
|
+
Radio.Root,
|
|
10805
|
+
{
|
|
10806
|
+
value: member.id,
|
|
10807
|
+
"data-cimplify-staff-option": true,
|
|
10808
|
+
"data-selected": selectedStaffId === member.id || void 0,
|
|
10809
|
+
className: classNames?.option,
|
|
10810
|
+
children: [
|
|
10811
|
+
member.avatar_url && /* @__PURE__ */ jsx(
|
|
10812
|
+
"img",
|
|
10813
|
+
{
|
|
10814
|
+
src: member.avatar_url,
|
|
10815
|
+
alt: member.name,
|
|
10816
|
+
"data-cimplify-staff-avatar": true,
|
|
10817
|
+
className: classNames?.avatar
|
|
10818
|
+
}
|
|
10819
|
+
),
|
|
10820
|
+
/* @__PURE__ */ jsx("span", { "data-cimplify-staff-name": true, className: classNames?.name, children: member.name }),
|
|
10821
|
+
member.bio && /* @__PURE__ */ jsx("span", { "data-cimplify-staff-bio": true, className: classNames?.bio, children: member.bio })
|
|
10822
|
+
]
|
|
10823
|
+
},
|
|
10824
|
+
member.id
|
|
10825
|
+
))
|
|
10826
|
+
]
|
|
10827
|
+
}
|
|
10828
|
+
);
|
|
10718
10829
|
}
|
|
10719
10830
|
var STATUS_LABELS3 = {
|
|
10720
10831
|
pending: "Pending",
|
|
@@ -11386,10 +11497,10 @@ function OrderDetailPage({
|
|
|
11386
11497
|
] });
|
|
11387
11498
|
}
|
|
11388
11499
|
var STATUS_FILTERS = [
|
|
11389
|
-
{ label: "All", value: void 0 },
|
|
11390
|
-
{ label: "Active", value: "confirmed" },
|
|
11391
|
-
{ label: "Completed", value: "completed" },
|
|
11392
|
-
{ label: "Cancelled", value: "cancelled" }
|
|
11500
|
+
{ label: "All", value: void 0, tabValue: "all" },
|
|
11501
|
+
{ label: "Active", value: "confirmed", tabValue: "confirmed" },
|
|
11502
|
+
{ label: "Completed", value: "completed", tabValue: "completed" },
|
|
11503
|
+
{ label: "Cancelled", value: "cancelled", tabValue: "cancelled" }
|
|
11393
11504
|
];
|
|
11394
11505
|
function OrderHistoryPage({
|
|
11395
11506
|
title = "Order History",
|
|
@@ -11403,6 +11514,10 @@ function OrderHistoryPage({
|
|
|
11403
11514
|
}) {
|
|
11404
11515
|
const [statusFilter, setStatusFilter] = useState(void 0);
|
|
11405
11516
|
const [selectedOrder, setSelectedOrder] = useState(null);
|
|
11517
|
+
const handleTabChange = useCallback((value) => {
|
|
11518
|
+
const filter = STATUS_FILTERS.find((f) => f.tabValue === value);
|
|
11519
|
+
setStatusFilter(filter?.value);
|
|
11520
|
+
}, []);
|
|
11406
11521
|
const handleOrderClick = useCallback(
|
|
11407
11522
|
(order) => {
|
|
11408
11523
|
if (onOrderNavigate) {
|
|
@@ -11416,6 +11531,7 @@ function OrderHistoryPage({
|
|
|
11416
11531
|
const handleBack = useCallback(() => {
|
|
11417
11532
|
setSelectedOrder(null);
|
|
11418
11533
|
}, []);
|
|
11534
|
+
const activeTabValue = STATUS_FILTERS.find((f) => f.value === statusFilter)?.tabValue ?? "all";
|
|
11419
11535
|
if (selectedOrder && !onOrderNavigate) {
|
|
11420
11536
|
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
11537
|
/* @__PURE__ */ jsx(
|
|
@@ -11433,20 +11549,17 @@ function OrderHistoryPage({
|
|
|
11433
11549
|
}
|
|
11434
11550
|
return /* @__PURE__ */ jsxs("div", { "data-cimplify-order-history-page": true, className: cn(className, classNames?.root), children: [
|
|
11435
11551
|
/* @__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
|
-
|
|
11552
|
+
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(
|
|
11553
|
+
Tabs.Tab,
|
|
11438
11554
|
{
|
|
11439
|
-
|
|
11440
|
-
role: "tab",
|
|
11441
|
-
"aria-selected": statusFilter === filter.value,
|
|
11442
|
-
onClick: () => setStatusFilter(filter.value),
|
|
11555
|
+
value: filter.tabValue,
|
|
11443
11556
|
"data-cimplify-order-filter": true,
|
|
11444
11557
|
"data-selected": statusFilter === filter.value || void 0,
|
|
11445
11558
|
className: classNames?.filterButton,
|
|
11446
11559
|
children: filter.label
|
|
11447
11560
|
},
|
|
11448
|
-
filter.
|
|
11449
|
-
)) }),
|
|
11561
|
+
filter.tabValue
|
|
11562
|
+
)) }) }),
|
|
11450
11563
|
/* @__PURE__ */ jsx("div", { "data-cimplify-order-history-list": true, className: classNames?.list, children: /* @__PURE__ */ jsx(
|
|
11451
11564
|
OrderHistory,
|
|
11452
11565
|
{
|
|
@@ -11474,7 +11587,7 @@ function SearchPage({
|
|
|
11474
11587
|
/* @__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
11588
|
/* @__PURE__ */ jsxs("div", { "data-cimplify-search-page-input": true, className: classNames?.inputContainer, children: [
|
|
11476
11589
|
/* @__PURE__ */ jsx(
|
|
11477
|
-
|
|
11590
|
+
Input,
|
|
11478
11591
|
{
|
|
11479
11592
|
type: "search",
|
|
11480
11593
|
value: query,
|
|
@@ -11816,20 +11929,24 @@ function BookingsPage({
|
|
|
11816
11929
|
}
|
|
11817
11930
|
return /* @__PURE__ */ jsxs("div", { "data-cimplify-bookings-page": true, className: cn(className, classNames?.root), children: [
|
|
11818
11931
|
/* @__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
|
-
|
|
11932
|
+
showFilters && /* @__PURE__ */ jsx(
|
|
11933
|
+
Tabs.Root,
|
|
11821
11934
|
{
|
|
11822
|
-
|
|
11823
|
-
|
|
11824
|
-
"
|
|
11825
|
-
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11935
|
+
value: filter,
|
|
11936
|
+
onValueChange: (value) => setFilter(value),
|
|
11937
|
+
children: /* @__PURE__ */ jsx(Tabs.List, { "data-cimplify-bookings-filters": true, className: classNames?.filters, children: BOOKING_FILTERS.map((f) => /* @__PURE__ */ jsx(
|
|
11938
|
+
Tabs.Tab,
|
|
11939
|
+
{
|
|
11940
|
+
value: f.value,
|
|
11941
|
+
"data-cimplify-booking-filter": true,
|
|
11942
|
+
"data-selected": filter === f.value || void 0,
|
|
11943
|
+
className: classNames?.filterButton,
|
|
11944
|
+
children: f.label
|
|
11945
|
+
},
|
|
11946
|
+
f.value
|
|
11947
|
+
)) })
|
|
11948
|
+
}
|
|
11949
|
+
),
|
|
11833
11950
|
/* @__PURE__ */ jsx("div", { "data-cimplify-bookings-list": true, className: classNames?.list, children: /* @__PURE__ */ jsx(
|
|
11834
11951
|
BookingList,
|
|
11835
11952
|
{
|