@anker-in/ui 0.1.5 → 0.1.9
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/README.md +162 -37
- package/dist/DemoRoom-YZ2To7p9.d.mts +86 -0
- package/dist/DemoRoom-YZ2To7p9.d.ts +86 -0
- package/dist/demo-room.d.mts +18 -1
- package/dist/demo-room.d.ts +18 -1
- package/dist/demo-room.js +134 -122
- package/dist/demo-room.js.map +1 -1
- package/dist/demo-room.mjs +134 -122
- package/dist/demo-room.mjs.map +1 -1
- package/dist/index.d.mts +117 -3
- package/dist/index.d.ts +117 -3
- package/dist/index.js +404 -219
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +404 -219
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +0 -1
- package/package.json +1 -1
- package/dist/DemoRoom-CZyrsxWe.d.mts +0 -30
- package/dist/DemoRoom-CZyrsxWe.d.ts +0 -30
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ var Title = ({
|
|
|
39
39
|
title = "",
|
|
40
40
|
...props
|
|
41
41
|
}) => {
|
|
42
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full"), ...props, children: /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-[48px] font-
|
|
42
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full"), ...props, children: /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-[32px] min-l:text-[48px] font-bold mb-12 text-[#080A0F]", children: title }) });
|
|
43
43
|
};
|
|
44
44
|
Title.displayName = "Title";
|
|
45
45
|
var StudioCard = ({
|
|
@@ -47,18 +47,18 @@ var StudioCard = ({
|
|
|
47
47
|
name,
|
|
48
48
|
availableTime,
|
|
49
49
|
address,
|
|
50
|
-
city,
|
|
51
|
-
state,
|
|
52
|
-
zipCode,
|
|
53
|
-
country = "United States",
|
|
54
50
|
euifyMakeModel,
|
|
55
51
|
distance,
|
|
56
52
|
onSchedule,
|
|
53
|
+
pageData = {
|
|
54
|
+
scheduleNow: "Schedule Now",
|
|
55
|
+
available: "Available",
|
|
56
|
+
away: "away"
|
|
57
|
+
},
|
|
57
58
|
className,
|
|
58
59
|
style,
|
|
59
60
|
...props
|
|
60
61
|
}) => {
|
|
61
|
-
const fullAddress = `${address}, ${city}, ${state} ${country} ${zipCode}`;
|
|
62
62
|
const [isHovered, setIsHovered] = React2__default.default.useState(false);
|
|
63
63
|
const handleScheduleClick = () => {
|
|
64
64
|
onSchedule?.(code);
|
|
@@ -91,7 +91,8 @@ var StudioCard = ({
|
|
|
91
91
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-semibold text-gray-900", children: name }),
|
|
92
92
|
distance !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-medium text-[#2E8B57] bg-[#E8F5E9] px-3 py-1 rounded-full whitespace-nowrap ml-2", children: [
|
|
93
93
|
formatDistance(distance),
|
|
94
|
-
"
|
|
94
|
+
" ",
|
|
95
|
+
pageData.away
|
|
95
96
|
] })
|
|
96
97
|
] }),
|
|
97
98
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 mb-3", children: [
|
|
@@ -148,7 +149,8 @@ var StudioCard = ({
|
|
|
148
149
|
}
|
|
149
150
|
),
|
|
150
151
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-gray-600", children: [
|
|
151
|
-
|
|
152
|
+
pageData.available,
|
|
153
|
+
" ",
|
|
152
154
|
availableTime
|
|
153
155
|
] }) })
|
|
154
156
|
] }),
|
|
@@ -182,7 +184,7 @@ var StudioCard = ({
|
|
|
182
184
|
]
|
|
183
185
|
}
|
|
184
186
|
),
|
|
185
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-600", children:
|
|
187
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-600 break-words", children: address }) })
|
|
186
188
|
] }),
|
|
187
189
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 mb-6", children: [
|
|
188
190
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -239,10 +241,10 @@ var StudioCard = ({
|
|
|
239
241
|
"w-full px-6 py-3 rounded-full",
|
|
240
242
|
"bg-white text-gray-900 border border-gray-900",
|
|
241
243
|
"font-medium text-sm",
|
|
242
|
-
"hover:bg-gray-900",
|
|
244
|
+
"hover:bg-gray-900 hover:text-white",
|
|
243
245
|
"transition-all duration-200"
|
|
244
246
|
),
|
|
245
|
-
children:
|
|
247
|
+
children: pageData.scheduleNow
|
|
246
248
|
}
|
|
247
249
|
)
|
|
248
250
|
]
|
|
@@ -274,6 +276,12 @@ var StudioMap = ({
|
|
|
274
276
|
defaultZoom = 4,
|
|
275
277
|
mapHeight = "600px",
|
|
276
278
|
onSchedule,
|
|
279
|
+
pageData = {
|
|
280
|
+
apiKeyRequired: "Google Maps API Key is required",
|
|
281
|
+
loadingMap: "Loading map...",
|
|
282
|
+
scheduleNow: "Schedule Now",
|
|
283
|
+
available: "Available"
|
|
284
|
+
},
|
|
277
285
|
className,
|
|
278
286
|
...props
|
|
279
287
|
}) => {
|
|
@@ -350,18 +358,22 @@ var StudioMap = ({
|
|
|
350
358
|
validLocations.forEach((location) => {
|
|
351
359
|
const lat = Number(location.lat);
|
|
352
360
|
const lng = Number(location.lng);
|
|
361
|
+
const svgIcon = {
|
|
362
|
+
url: `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`
|
|
363
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
364
|
+
<circle cx="24" cy="24" r="22" fill="#00000010"/>
|
|
365
|
+
<circle cx="24" cy="24" r="10" fill="#000000"/>
|
|
366
|
+
<circle cx="24" cy="24" r="5" fill="#3ADB67"/>
|
|
367
|
+
</svg>
|
|
368
|
+
`)}`,
|
|
369
|
+
scaledSize: { width: 48, height: 48 },
|
|
370
|
+
anchor: { x: 24, y: 24 }
|
|
371
|
+
};
|
|
353
372
|
const marker = new google.maps.Marker({
|
|
354
373
|
position: { lat, lng },
|
|
355
374
|
map: googleMapRef.current,
|
|
356
375
|
title: location.name,
|
|
357
|
-
icon:
|
|
358
|
-
path: google.maps.SymbolPath.CIRCLE,
|
|
359
|
-
scale: 10,
|
|
360
|
-
fillColor: "#000000",
|
|
361
|
-
fillOpacity: 1,
|
|
362
|
-
strokeColor: "#ffffff",
|
|
363
|
-
strokeWeight: 2
|
|
364
|
-
}
|
|
376
|
+
icon: svgIcon
|
|
365
377
|
});
|
|
366
378
|
marker.addListener("click", () => {
|
|
367
379
|
setSelectedLocation(location);
|
|
@@ -372,13 +384,13 @@ var StudioMap = ({
|
|
|
372
384
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
373
385
|
<path d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z"/>
|
|
374
386
|
</svg>
|
|
375
|
-
<span style="vertical-align: middle;"
|
|
387
|
+
<span style="vertical-align: middle;">${pageData.available} ${location.availableTime}</span>
|
|
376
388
|
</div>` : ""}
|
|
377
389
|
<div style="margin-bottom: 8px; color: #666;">
|
|
378
390
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
379
391
|
<path fill-rule="evenodd" d="M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z" clip-rule="evenodd"/>
|
|
380
392
|
</svg>
|
|
381
|
-
<span style="vertical-align: middle;">${location.address}
|
|
393
|
+
<span style="vertical-align: middle;">${location.address}</span>
|
|
382
394
|
</div>
|
|
383
395
|
${location.euifyMakeModel ? `<div style="margin-bottom: 12px; color: #666;">
|
|
384
396
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
@@ -402,7 +414,7 @@ var StudioMap = ({
|
|
|
402
414
|
onmouseover="this.style.background='#333'"
|
|
403
415
|
onmouseout="this.style.background='#000'"
|
|
404
416
|
>
|
|
405
|
-
|
|
417
|
+
${pageData.scheduleNow}
|
|
406
418
|
</button>
|
|
407
419
|
</div>
|
|
408
420
|
`;
|
|
@@ -458,13 +470,13 @@ var StudioMap = ({
|
|
|
458
470
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
459
471
|
<path d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z"/>
|
|
460
472
|
</svg>
|
|
461
|
-
<span style="vertical-align: middle;"
|
|
473
|
+
<span style="vertical-align: middle;">${pageData.available} ${location.availableTime}</span>
|
|
462
474
|
</div>` : ""}
|
|
463
475
|
<div style="margin-bottom: 8px; color: #666;">
|
|
464
476
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
465
477
|
<path fill-rule="evenodd" d="M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z" clip-rule="evenodd"/>
|
|
466
478
|
</svg>
|
|
467
|
-
<span style="vertical-align: middle;">${location.address}
|
|
479
|
+
<span style="vertical-align: middle;">${location.address}</span>
|
|
468
480
|
</div>
|
|
469
481
|
${location.euifyMakeModel ? `<div style="margin-bottom: 12px; color: #666;">
|
|
470
482
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
@@ -488,7 +500,7 @@ var StudioMap = ({
|
|
|
488
500
|
onmouseover="this.style.background='#333'"
|
|
489
501
|
onmouseout="this.style.background='#000'"
|
|
490
502
|
>
|
|
491
|
-
|
|
503
|
+
${pageData.scheduleNow}
|
|
492
504
|
</button>
|
|
493
505
|
</div>
|
|
494
506
|
`;
|
|
@@ -524,7 +536,7 @@ var StudioMap = ({
|
|
|
524
536
|
),
|
|
525
537
|
style: { height: mapHeight },
|
|
526
538
|
...props,
|
|
527
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-gray-600", children:
|
|
539
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-gray-600", children: pageData.apiKeyRequired })
|
|
528
540
|
}
|
|
529
541
|
);
|
|
530
542
|
}
|
|
@@ -537,7 +549,7 @@ var StudioMap = ({
|
|
|
537
549
|
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: mapRef, style: { height: mapHeight } }),
|
|
538
550
|
!isLoaded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-gray-100", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
|
|
539
551
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-gray-900 mb-2" }),
|
|
540
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-gray-600", children:
|
|
552
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-gray-600", children: pageData.loadingMap })
|
|
541
553
|
] }) })
|
|
542
554
|
]
|
|
543
555
|
}
|
|
@@ -666,7 +678,14 @@ function useQuestionnaire(client, code, questionnaire_id, locale, options) {
|
|
|
666
678
|
});
|
|
667
679
|
const enabled = options?.enabled !== false;
|
|
668
680
|
React2.useEffect(() => {
|
|
669
|
-
if (!enabled || !code || !questionnaire_id)
|
|
681
|
+
if (!enabled || !code || !questionnaire_id) {
|
|
682
|
+
setState({
|
|
683
|
+
data: null,
|
|
684
|
+
loading: false,
|
|
685
|
+
error: null
|
|
686
|
+
});
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
670
689
|
let cancelled = false;
|
|
671
690
|
const fetchData = async () => {
|
|
672
691
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
@@ -822,65 +841,6 @@ var AntdMobileIsolated = ({
|
|
|
822
841
|
AntdMobileIsolated.displayName = "AntdMobileIsolated";
|
|
823
842
|
|
|
824
843
|
// src/components/DemoRoom/utils/addressParser.ts
|
|
825
|
-
var KNOWN_COUNTRIES = [
|
|
826
|
-
"United States",
|
|
827
|
-
"United Kingdom",
|
|
828
|
-
"American Samoa",
|
|
829
|
-
"United Arab Emirates",
|
|
830
|
-
"Bosnia and Herzegovina",
|
|
831
|
-
"Trinidad and Tobago",
|
|
832
|
-
"Saint Kitts and Nevis",
|
|
833
|
-
"Antigua and Barbuda",
|
|
834
|
-
"Saint Vincent and the Grenadines",
|
|
835
|
-
"S\xE3o Tom\xE9 and Pr\xEDncipe",
|
|
836
|
-
"United States Minor Outlying Islands",
|
|
837
|
-
"British Virgin Islands",
|
|
838
|
-
"United States Virgin Islands",
|
|
839
|
-
"Cayman Islands",
|
|
840
|
-
"Cook Islands",
|
|
841
|
-
"Falkland Islands",
|
|
842
|
-
"Faroe Islands",
|
|
843
|
-
"Marshall Islands",
|
|
844
|
-
"Northern Mariana Islands",
|
|
845
|
-
"Pitcairn Islands",
|
|
846
|
-
"Solomon Islands",
|
|
847
|
-
"Turks and Caicos Islands",
|
|
848
|
-
"Wallis and Futuna"
|
|
849
|
-
];
|
|
850
|
-
function parseAddress(address) {
|
|
851
|
-
const parts = address.split(",").map((part) => part.trim()).filter(Boolean);
|
|
852
|
-
let country = "United States";
|
|
853
|
-
let state = "";
|
|
854
|
-
let city = "";
|
|
855
|
-
if (parts.length === 0) {
|
|
856
|
-
return { country, state, city };
|
|
857
|
-
}
|
|
858
|
-
const lastPart = parts[parts.length - 1];
|
|
859
|
-
const matchedCountry = KNOWN_COUNTRIES.find(
|
|
860
|
-
(knownCountry) => lastPart.toLowerCase() === knownCountry.toLowerCase()
|
|
861
|
-
);
|
|
862
|
-
if (matchedCountry) {
|
|
863
|
-
country = matchedCountry;
|
|
864
|
-
if (parts.length >= 2) {
|
|
865
|
-
state = parts[parts.length - 2].split(" ")[0];
|
|
866
|
-
}
|
|
867
|
-
if (parts.length >= 3) {
|
|
868
|
-
city = parts[parts.length - 3];
|
|
869
|
-
}
|
|
870
|
-
} else {
|
|
871
|
-
if (parts.length >= 2) {
|
|
872
|
-
state = parts[parts.length - 1].split(" ")[0];
|
|
873
|
-
city = parts[parts.length - 2];
|
|
874
|
-
} else if (parts.length === 1) {
|
|
875
|
-
city = parts[0];
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
return {
|
|
879
|
-
country: country.trim(),
|
|
880
|
-
state: state.trim(),
|
|
881
|
-
city: city.trim()
|
|
882
|
-
};
|
|
883
|
-
}
|
|
884
844
|
function groupByAlphabet(items) {
|
|
885
845
|
const groups = /* @__PURE__ */ new Map();
|
|
886
846
|
items.forEach((item) => {
|
|
@@ -907,7 +867,15 @@ var LocationFilter = ({
|
|
|
907
867
|
locations,
|
|
908
868
|
onSelect,
|
|
909
869
|
visible = false,
|
|
910
|
-
onClose
|
|
870
|
+
onClose,
|
|
871
|
+
pageData = {
|
|
872
|
+
allLocations: "All Locations",
|
|
873
|
+
clear: "Clear",
|
|
874
|
+
country: "Country",
|
|
875
|
+
state: "State",
|
|
876
|
+
city: "City",
|
|
877
|
+
noStudiosFound: "No studios found in this location"
|
|
878
|
+
}
|
|
911
879
|
}) => {
|
|
912
880
|
const [currentLevel, setCurrentLevel] = React2.useState("country");
|
|
913
881
|
const [selectedCountry, setSelectedCountry] = React2.useState();
|
|
@@ -918,7 +886,7 @@ var LocationFilter = ({
|
|
|
918
886
|
const states = /* @__PURE__ */ new Map();
|
|
919
887
|
const cities = /* @__PURE__ */ new Map();
|
|
920
888
|
locations.forEach((location) => {
|
|
921
|
-
const { country, state, city } =
|
|
889
|
+
const { country, state, city } = location;
|
|
922
890
|
if (country) {
|
|
923
891
|
const existing = countries.get(country);
|
|
924
892
|
countries.set(country, {
|
|
@@ -1055,7 +1023,7 @@ var LocationFilter = ({
|
|
|
1055
1023
|
"pb-[4px] transition-colors",
|
|
1056
1024
|
currentLevel === "country" ? "text-[#1D1D1F] border-b-2 border-[#2E8B57]" : "text-[#767880]"
|
|
1057
1025
|
),
|
|
1058
|
-
children:
|
|
1026
|
+
children: pageData.country
|
|
1059
1027
|
}
|
|
1060
1028
|
),
|
|
1061
1029
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1068,7 +1036,7 @@ var LocationFilter = ({
|
|
|
1068
1036
|
currentLevel === "state" ? "text-[#1D1D1F] border-b-2 border-[#2E8B57]" : "text-[#767880]",
|
|
1069
1037
|
!selectedCountry && "opacity-50 cursor-not-allowed"
|
|
1070
1038
|
),
|
|
1071
|
-
children:
|
|
1039
|
+
children: pageData.state
|
|
1072
1040
|
}
|
|
1073
1041
|
),
|
|
1074
1042
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1081,7 +1049,7 @@ var LocationFilter = ({
|
|
|
1081
1049
|
currentLevel === "city" ? "text-[#1D1D1F] border-b-2 border-[#2E8B57]" : "text-[#767880]",
|
|
1082
1050
|
!selectedState && "opacity-50 cursor-not-allowed"
|
|
1083
1051
|
),
|
|
1084
|
-
children:
|
|
1052
|
+
children: pageData.city
|
|
1085
1053
|
}
|
|
1086
1054
|
)
|
|
1087
1055
|
] })
|
|
@@ -1113,11 +1081,38 @@ var LocationFilter = ({
|
|
|
1113
1081
|
);
|
|
1114
1082
|
};
|
|
1115
1083
|
LocationFilter.displayName = "LocationFilter";
|
|
1084
|
+
var defaultPageData = {
|
|
1085
|
+
title: "Find a Studio Near You",
|
|
1086
|
+
loadingText: "Loading demo rooms...",
|
|
1087
|
+
errorTitle: "Failed to load demo rooms",
|
|
1088
|
+
machine: "eufymake E1",
|
|
1089
|
+
locationFilter: {
|
|
1090
|
+
allLocations: "All Locations",
|
|
1091
|
+
clear: "Clear",
|
|
1092
|
+
country: "Country",
|
|
1093
|
+
state: "State",
|
|
1094
|
+
city: "City",
|
|
1095
|
+
noStudiosFound: "No studios found in this location"
|
|
1096
|
+
},
|
|
1097
|
+
studioCard: {
|
|
1098
|
+
scheduleNow: "Schedule Now",
|
|
1099
|
+
available: "Available",
|
|
1100
|
+
away: "away"
|
|
1101
|
+
},
|
|
1102
|
+
map: {
|
|
1103
|
+
apiKeyRequired: "Google Maps API Key is required",
|
|
1104
|
+
loadingMap: "Loading map...",
|
|
1105
|
+
scheduleNow: "Schedule Now",
|
|
1106
|
+
available: "Available"
|
|
1107
|
+
},
|
|
1108
|
+
defaultCountry: "United States",
|
|
1109
|
+
noAvailableTime: "No available time"
|
|
1110
|
+
};
|
|
1116
1111
|
var defaultStudioLocations = [
|
|
1117
1112
|
{
|
|
1118
1113
|
id: "1",
|
|
1119
1114
|
name: "Design District Demo Room",
|
|
1120
|
-
address: "111 8th St",
|
|
1115
|
+
address: "111 8th St, San Francisco, CA, United States",
|
|
1121
1116
|
city: "San Francisco",
|
|
1122
1117
|
state: "CA",
|
|
1123
1118
|
zipCode: "94108",
|
|
@@ -1130,7 +1125,7 @@ var defaultStudioLocations = [
|
|
|
1130
1125
|
{
|
|
1131
1126
|
id: "2",
|
|
1132
1127
|
name: "Brooklyn Creative Studio",
|
|
1133
|
-
address: "456 Broadway",
|
|
1128
|
+
address: "456 Broadway, Brooklyn, NY, United States",
|
|
1134
1129
|
city: "Brooklyn",
|
|
1135
1130
|
state: "NY",
|
|
1136
1131
|
zipCode: "11211",
|
|
@@ -1143,7 +1138,7 @@ var defaultStudioLocations = [
|
|
|
1143
1138
|
{
|
|
1144
1139
|
id: "3",
|
|
1145
1140
|
name: "Austin Innovation Hub",
|
|
1146
|
-
address: "789 Tech Blvd",
|
|
1141
|
+
address: "789 Tech Blvd, Austin, TX, United States",
|
|
1147
1142
|
city: "Austin",
|
|
1148
1143
|
state: "TX",
|
|
1149
1144
|
zipCode: "78701",
|
|
@@ -1156,7 +1151,7 @@ var defaultStudioLocations = [
|
|
|
1156
1151
|
{
|
|
1157
1152
|
id: "4",
|
|
1158
1153
|
name: "Seattle Maker Space",
|
|
1159
|
-
address: "321 Pine St",
|
|
1154
|
+
address: "321 Pine St, Seattle, WA, United States",
|
|
1160
1155
|
city: "Seattle",
|
|
1161
1156
|
state: "WA",
|
|
1162
1157
|
zipCode: "98101",
|
|
@@ -1169,7 +1164,7 @@ var defaultStudioLocations = [
|
|
|
1169
1164
|
{
|
|
1170
1165
|
id: "5",
|
|
1171
1166
|
name: "Chicago Design Center",
|
|
1172
|
-
address: "654 Michigan Ave",
|
|
1167
|
+
address: "654 Michigan Ave, Chicago, IL, United States",
|
|
1173
1168
|
city: "Chicago",
|
|
1174
1169
|
state: "IL",
|
|
1175
1170
|
zipCode: "60611",
|
|
@@ -1182,7 +1177,7 @@ var defaultStudioLocations = [
|
|
|
1182
1177
|
{
|
|
1183
1178
|
id: "6",
|
|
1184
1179
|
name: "Miami Beach Studio",
|
|
1185
|
-
address: "987 Ocean Drive",
|
|
1180
|
+
address: "987 Ocean Drive, Miami Beach, FL, United States",
|
|
1186
1181
|
city: "Miami Beach",
|
|
1187
1182
|
state: "FL",
|
|
1188
1183
|
zipCode: "33139",
|
|
@@ -1195,7 +1190,7 @@ var defaultStudioLocations = [
|
|
|
1195
1190
|
{
|
|
1196
1191
|
id: "7",
|
|
1197
1192
|
name: "Denver Mountain Studio",
|
|
1198
|
-
address: "147 16th St",
|
|
1193
|
+
address: "147 16th St, Denver, CO, United States",
|
|
1199
1194
|
city: "Denver",
|
|
1200
1195
|
state: "CO",
|
|
1201
1196
|
zipCode: "80202",
|
|
@@ -1208,7 +1203,7 @@ var defaultStudioLocations = [
|
|
|
1208
1203
|
{
|
|
1209
1204
|
id: "8",
|
|
1210
1205
|
name: "Los Angeles Creative Lab",
|
|
1211
|
-
address: "258 Main St",
|
|
1206
|
+
address: "258 Main St, Los Angeles, CA, United States",
|
|
1212
1207
|
city: "Los Angeles",
|
|
1213
1208
|
state: "CA",
|
|
1214
1209
|
zipCode: "90012",
|
|
@@ -1226,8 +1221,22 @@ var RoomsList = ({
|
|
|
1226
1221
|
teamCode,
|
|
1227
1222
|
brandWebsite,
|
|
1228
1223
|
onSchedule,
|
|
1224
|
+
pageData,
|
|
1229
1225
|
...props
|
|
1230
1226
|
}) => {
|
|
1227
|
+
const mergedPageData = React2.useMemo(
|
|
1228
|
+
() => ({
|
|
1229
|
+
...defaultPageData,
|
|
1230
|
+
...pageData,
|
|
1231
|
+
locationFilter: {
|
|
1232
|
+
...defaultPageData.locationFilter,
|
|
1233
|
+
...pageData?.locationFilter
|
|
1234
|
+
},
|
|
1235
|
+
studioCard: { ...defaultPageData.studioCard, ...pageData?.studioCard },
|
|
1236
|
+
map: { ...defaultPageData.map, ...pageData?.map }
|
|
1237
|
+
}),
|
|
1238
|
+
[pageData]
|
|
1239
|
+
);
|
|
1231
1240
|
const [showLocationFilter, setShowLocationFilter] = React2.useState(false);
|
|
1232
1241
|
const [selectedLocation, setSelectedLocation] = React2.useState();
|
|
1233
1242
|
const [hoveredRoomId, setHoveredRoomId] = React2.useState(null);
|
|
@@ -1246,18 +1255,22 @@ var RoomsList = ({
|
|
|
1246
1255
|
const nextAvailableTimeslot = room?.timeslots?.find(
|
|
1247
1256
|
(slot) => slot.status === "available"
|
|
1248
1257
|
);
|
|
1249
|
-
const
|
|
1258
|
+
const country = room.location?.country || mergedPageData.defaultCountry;
|
|
1259
|
+
const state = room.location?.state || "";
|
|
1260
|
+
const city = room.location?.city || "";
|
|
1261
|
+
const addressParts = [room.address, city, state, country].filter(Boolean);
|
|
1262
|
+
const fullAddress = addressParts.join(", ");
|
|
1250
1263
|
return {
|
|
1251
1264
|
id: room.code,
|
|
1252
1265
|
name: room.name,
|
|
1253
|
-
address:
|
|
1266
|
+
address: fullAddress,
|
|
1254
1267
|
city,
|
|
1255
1268
|
state,
|
|
1256
1269
|
zipCode: "",
|
|
1257
1270
|
country,
|
|
1258
1271
|
lat: Number(room.latitude) || 34.0522,
|
|
1259
1272
|
lng: Number(room.longitude) || -118.2437,
|
|
1260
|
-
availableTime: nextAvailableTimeslot ? `${nextAvailableTimeslot.start_time}` :
|
|
1273
|
+
availableTime: nextAvailableTimeslot ? `${nextAvailableTimeslot.start_time}` : mergedPageData.noAvailableTime,
|
|
1261
1274
|
euifyMakeModel: room?.description
|
|
1262
1275
|
};
|
|
1263
1276
|
});
|
|
@@ -1265,25 +1278,24 @@ var RoomsList = ({
|
|
|
1265
1278
|
const filteredStudioLocations = React2.useMemo(() => {
|
|
1266
1279
|
if (!selectedLocation) return studioLocations;
|
|
1267
1280
|
return studioLocations.filter((location) => {
|
|
1268
|
-
const { country, state, city } = parseAddress(location.address);
|
|
1269
1281
|
if (selectedLocation.city) {
|
|
1270
|
-
return country === selectedLocation.country && state === selectedLocation.state && city === selectedLocation.city;
|
|
1282
|
+
return location.country === selectedLocation.country && location.state === selectedLocation.state && location.city === selectedLocation.city;
|
|
1271
1283
|
}
|
|
1272
1284
|
if (selectedLocation.state) {
|
|
1273
|
-
return country === selectedLocation.country && state === selectedLocation.state;
|
|
1285
|
+
return location.country === selectedLocation.country && location.state === selectedLocation.state;
|
|
1274
1286
|
}
|
|
1275
1287
|
if (selectedLocation.country) {
|
|
1276
|
-
return country === selectedLocation.country;
|
|
1288
|
+
return location.country === selectedLocation.country;
|
|
1277
1289
|
}
|
|
1278
1290
|
return true;
|
|
1279
1291
|
});
|
|
1280
1292
|
}, [studioLocations, selectedLocation]);
|
|
1281
1293
|
const getSelectedLocationName = () => {
|
|
1282
|
-
if (!selectedLocation) return
|
|
1294
|
+
if (!selectedLocation) return mergedPageData.locationFilter.allLocations;
|
|
1283
1295
|
if (selectedLocation.city) return selectedLocation.city;
|
|
1284
1296
|
if (selectedLocation.state) return selectedLocation.state;
|
|
1285
1297
|
if (selectedLocation.country) return selectedLocation.country;
|
|
1286
|
-
return
|
|
1298
|
+
return mergedPageData.locationFilter.allLocations;
|
|
1287
1299
|
};
|
|
1288
1300
|
const handleLocationSelect = (selection) => {
|
|
1289
1301
|
setSelectedLocation(selection);
|
|
@@ -1294,17 +1306,17 @@ var RoomsList = ({
|
|
|
1294
1306
|
};
|
|
1295
1307
|
console.log(filteredStudioLocations);
|
|
1296
1308
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, ...props, children: [
|
|
1297
|
-
/* @__PURE__ */ jsxRuntime.jsx(Title, { title:
|
|
1298
|
-
loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[794px]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-lg font-medium", children:
|
|
1309
|
+
/* @__PURE__ */ jsxRuntime.jsx(Title, { title: mergedPageData.title }),
|
|
1310
|
+
loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[794px]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-lg font-medium", children: mergedPageData.loadingText }) }) }),
|
|
1299
1311
|
error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[794px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", style: { color: "#FF4D4D" }, children: [
|
|
1300
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-lg font-medium", children:
|
|
1312
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-lg font-medium", children: mergedPageData.errorTitle }),
|
|
1301
1313
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm mt-2", children: error.message })
|
|
1302
1314
|
] }) }),
|
|
1303
1315
|
!loading && !error && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[794px] gap-4", children: [
|
|
1304
1316
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1305
1317
|
"div",
|
|
1306
1318
|
{
|
|
1307
|
-
className: "flex-none relative w-[420px]",
|
|
1319
|
+
className: "flex-none relative w-[420px] l:!w-full",
|
|
1308
1320
|
style: { height: "794px" },
|
|
1309
1321
|
children: [
|
|
1310
1322
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-[12px] mb-4 bg-white border border-[#E4E5E6] px-[20px] py-[16px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-[40px] font-bold text-[16px] gap-10 flex items-center", children: [
|
|
@@ -1340,11 +1352,11 @@ var RoomsList = ({
|
|
|
1340
1352
|
{
|
|
1341
1353
|
onClick: handleClearFilter,
|
|
1342
1354
|
className: "ml-auto text-[14px] text-[#2E8B57] hover:underline",
|
|
1343
|
-
children:
|
|
1355
|
+
children: mergedPageData.locationFilter.clear
|
|
1344
1356
|
}
|
|
1345
1357
|
),
|
|
1346
1358
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex text-[#767880] cursor-not-allowed", children: [
|
|
1347
|
-
|
|
1359
|
+
mergedPageData.machine,
|
|
1348
1360
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1349
1361
|
"svg",
|
|
1350
1362
|
{
|
|
@@ -1369,7 +1381,7 @@ var RoomsList = ({
|
|
|
1369
1381
|
{
|
|
1370
1382
|
style: { maxHeight: "706px", overflow: "auto" },
|
|
1371
1383
|
className: "rounded-[12px] bg-white border border-[#E4E5E6]",
|
|
1372
|
-
children: filteredStudioLocations.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[200px] text-[#767880]", children:
|
|
1384
|
+
children: filteredStudioLocations.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[200px] text-[#767880]", children: mergedPageData.locationFilter.noStudiosFound }) : filteredStudioLocations.map((item) => {
|
|
1373
1385
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1374
1386
|
StudioCard,
|
|
1375
1387
|
{
|
|
@@ -1383,7 +1395,8 @@ var RoomsList = ({
|
|
|
1383
1395
|
euifyMakeModel: item?.euifyMakeModel || "",
|
|
1384
1396
|
onSchedule,
|
|
1385
1397
|
onMouseEnter: () => setHoveredRoomId(item.id),
|
|
1386
|
-
onMouseLeave: () => setHoveredRoomId(null)
|
|
1398
|
+
onMouseLeave: () => setHoveredRoomId(null),
|
|
1399
|
+
pageData: mergedPageData.studioCard
|
|
1387
1400
|
},
|
|
1388
1401
|
item.id
|
|
1389
1402
|
);
|
|
@@ -1394,25 +1407,29 @@ var RoomsList = ({
|
|
|
1394
1407
|
LocationFilter,
|
|
1395
1408
|
{
|
|
1396
1409
|
locations: studioLocations.map((loc) => ({
|
|
1397
|
-
|
|
1398
|
-
|
|
1410
|
+
id: loc.id,
|
|
1411
|
+
country: loc.country,
|
|
1412
|
+
state: loc.state,
|
|
1413
|
+
city: loc.city
|
|
1399
1414
|
})),
|
|
1400
1415
|
visible: showLocationFilter,
|
|
1401
1416
|
onSelect: handleLocationSelect,
|
|
1402
|
-
onClose: () => setShowLocationFilter(false)
|
|
1417
|
+
onClose: () => setShowLocationFilter(false),
|
|
1418
|
+
pageData: mergedPageData.locationFilter
|
|
1403
1419
|
}
|
|
1404
1420
|
)
|
|
1405
1421
|
]
|
|
1406
1422
|
}
|
|
1407
1423
|
),
|
|
1408
|
-
googleMapsApiKey && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex-1"), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1424
|
+
googleMapsApiKey && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex-1 l:!hidden"), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1409
1425
|
StudioMap,
|
|
1410
1426
|
{
|
|
1411
1427
|
googleMapsApiKey,
|
|
1412
1428
|
locations: filteredStudioLocations,
|
|
1413
1429
|
hoveredLocationId: hoveredRoomId,
|
|
1414
1430
|
onSchedule,
|
|
1415
|
-
mapHeight: "794px"
|
|
1431
|
+
mapHeight: "794px",
|
|
1432
|
+
pageData: mergedPageData.map
|
|
1416
1433
|
}
|
|
1417
1434
|
) })
|
|
1418
1435
|
] })
|
|
@@ -1594,6 +1611,7 @@ var DemoRoom = ({
|
|
|
1594
1611
|
teamCode,
|
|
1595
1612
|
brandWebsite,
|
|
1596
1613
|
onSchedule,
|
|
1614
|
+
pageData,
|
|
1597
1615
|
...props
|
|
1598
1616
|
}) => {
|
|
1599
1617
|
const apiClient = React2.useMemo(
|
|
@@ -1608,7 +1626,8 @@ var DemoRoom = ({
|
|
|
1608
1626
|
apiClient,
|
|
1609
1627
|
teamCode,
|
|
1610
1628
|
brandWebsite,
|
|
1611
|
-
onSchedule
|
|
1629
|
+
onSchedule,
|
|
1630
|
+
pageData
|
|
1612
1631
|
}
|
|
1613
1632
|
) });
|
|
1614
1633
|
};
|
|
@@ -1617,10 +1636,10 @@ var QuestionnaireForm = ({
|
|
|
1617
1636
|
questions,
|
|
1618
1637
|
onSubmit,
|
|
1619
1638
|
pageData,
|
|
1639
|
+
selectedTimeslotId,
|
|
1620
1640
|
loading = false,
|
|
1621
1641
|
className
|
|
1622
1642
|
}) => {
|
|
1623
|
-
console.log(pageData);
|
|
1624
1643
|
const [responses, setResponses] = React2.useState({});
|
|
1625
1644
|
const [errors, setErrors] = React2.useState({});
|
|
1626
1645
|
const [agreements, setAgreements] = React2.useState({});
|
|
@@ -1696,6 +1715,7 @@ var QuestionnaireForm = ({
|
|
|
1696
1715
|
case "text":
|
|
1697
1716
|
case "email":
|
|
1698
1717
|
case "tel":
|
|
1718
|
+
case "phone":
|
|
1699
1719
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1700
1720
|
"input",
|
|
1701
1721
|
{
|
|
@@ -1807,7 +1827,7 @@ var QuestionnaireForm = ({
|
|
|
1807
1827
|
}
|
|
1808
1828
|
};
|
|
1809
1829
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pb-[80px]", children: [
|
|
1810
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white rounded-[12px] border border-[#E4E5E6] p-8", children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: handleSubmit, className: cn("space-y-6", className), children: questions
|
|
1830
|
+
questions && questions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white rounded-[12px] border border-[#E4E5E6] p-8", children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: handleSubmit, className: cn("space-y-6", className), children: questions.map((question) => {
|
|
1811
1831
|
const questionId = getQuestionId(question);
|
|
1812
1832
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1813
1833
|
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block", children: [
|
|
@@ -1822,7 +1842,7 @@ var QuestionnaireForm = ({
|
|
|
1822
1842
|
errors[questionId] && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", style: { color: "#FF4D4D" }, children: errors[questionId] })
|
|
1823
1843
|
] }, questionId);
|
|
1824
1844
|
}) }) }),
|
|
1825
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
1845
|
+
!!selectedTimeslotId && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
1826
1846
|
pageData?.agrees && pageData.agrees.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 mt-8", children: [
|
|
1827
1847
|
pageData.agrees.map((agreeContent, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
1828
1848
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1860,7 +1880,7 @@ var QuestionnaireForm = ({
|
|
|
1860
1880
|
"focus:outline-none focus:ring-2 focus:ring-[#3ADB67] focus:ring-offset-2",
|
|
1861
1881
|
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
1862
1882
|
),
|
|
1863
|
-
children: loading ? "Submitting..." : "Submit Booking"
|
|
1883
|
+
children: loading ? pageData?.submitting || "Submitting..." : pageData?.submit || "Submit Booking"
|
|
1864
1884
|
}
|
|
1865
1885
|
)
|
|
1866
1886
|
] })
|
|
@@ -1873,17 +1893,29 @@ var DateTimePicker = ({
|
|
|
1873
1893
|
apiClient,
|
|
1874
1894
|
demoRoomCode,
|
|
1875
1895
|
timezone,
|
|
1876
|
-
pageData
|
|
1896
|
+
pageData = {
|
|
1897
|
+
scheduleYourVisit: "Schedule Your Visit",
|
|
1898
|
+
timeSlot: "Time Slot",
|
|
1899
|
+
loadingTimeSlots: "Loading time slots...",
|
|
1900
|
+
failedToLoadTimeSlots: "Failed to load time slots",
|
|
1901
|
+
noAvailableTimeSlots: "No available time slots for this date",
|
|
1902
|
+
full: "Full",
|
|
1903
|
+
spotsLeft: "spots left",
|
|
1904
|
+
fillOutForm: "Fill out Form",
|
|
1905
|
+
loadingQuestionnaire: "Loading questionnaire...",
|
|
1906
|
+
bookingFailed: "Booking failed"
|
|
1907
|
+
},
|
|
1877
1908
|
locale,
|
|
1878
1909
|
onBookingSuccess
|
|
1879
1910
|
}) => {
|
|
1880
1911
|
const { token } = antd.theme.useToken();
|
|
1881
1912
|
const [selectMonth, setSelectMonth] = React2.useState("");
|
|
1882
|
-
const [selectedDate, setSelectedDate] = React2.useState(
|
|
1913
|
+
const [selectedDate, setSelectedDate] = React2.useState(null);
|
|
1914
|
+
const [calendarValue, setCalendarValue] = React2.useState(dayjs__default.default());
|
|
1883
1915
|
const [selectedTimeslotId, setSelectedTimeslotId] = React2.useState(
|
|
1884
1916
|
null
|
|
1885
1917
|
);
|
|
1886
|
-
const [
|
|
1918
|
+
const [isInitialized, setIsInitialized] = React2.useState(false);
|
|
1887
1919
|
const {
|
|
1888
1920
|
createBooking,
|
|
1889
1921
|
loading: bookingLoading,
|
|
@@ -1902,13 +1934,9 @@ var DateTimePicker = ({
|
|
|
1902
1934
|
locale,
|
|
1903
1935
|
{ enabled: !!demoRoomCode && !!demoRoom?.questionnaire_id }
|
|
1904
1936
|
);
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
}
|
|
1909
|
-
}, [questionnaire]);
|
|
1910
|
-
const startDate = selectedDate.startOf("month").format("YYYY-MM-DD");
|
|
1911
|
-
const endDate = selectedDate.endOf("month").format("YYYY-MM-DD");
|
|
1937
|
+
const currentDate = selectedDate || dayjs__default.default();
|
|
1938
|
+
const startDate = currentDate.startOf("month").format("YYYY-MM-DD");
|
|
1939
|
+
const endDate = currentDate.endOf("month").format("YYYY-MM-DD");
|
|
1912
1940
|
const {
|
|
1913
1941
|
data: timeslotsData,
|
|
1914
1942
|
loading: timeslotsLoading,
|
|
@@ -1924,30 +1952,59 @@ var DateTimePicker = ({
|
|
|
1924
1952
|
{ enabled: !!demoRoomCode }
|
|
1925
1953
|
);
|
|
1926
1954
|
const dayTimeslots = React2.useMemo(() => {
|
|
1927
|
-
if (!timeslotsData?.timeslots) return [];
|
|
1955
|
+
if (!timeslotsData?.timeslots || !selectedDate) return [];
|
|
1928
1956
|
const selectedDateStr = selectedDate.format("YYYY-MM-DD");
|
|
1929
1957
|
return timeslotsData.timeslots.filter((slot) => {
|
|
1930
1958
|
const slotDate = dayjs__default.default(slot.start_time).format("YYYY-MM-DD");
|
|
1931
1959
|
return slotDate === selectedDateStr;
|
|
1932
1960
|
});
|
|
1933
1961
|
}, [timeslotsData, selectedDate]);
|
|
1962
|
+
const availableDates = React2.useMemo(() => {
|
|
1963
|
+
if (!timeslotsData?.timeslots) return /* @__PURE__ */ new Set();
|
|
1964
|
+
const dates = /* @__PURE__ */ new Set();
|
|
1965
|
+
timeslotsData.timeslots.forEach((slot) => {
|
|
1966
|
+
if (slot.status === "available") {
|
|
1967
|
+
const dateStr = dayjs__default.default(slot.start_time).format("YYYY-MM-DD");
|
|
1968
|
+
dates.add(dateStr);
|
|
1969
|
+
}
|
|
1970
|
+
});
|
|
1971
|
+
return dates;
|
|
1972
|
+
}, [timeslotsData]);
|
|
1973
|
+
React2.useEffect(() => {
|
|
1974
|
+
if (!timeslotsData?.timeslots || isInitialized) return;
|
|
1975
|
+
const now = dayjs__default.default();
|
|
1976
|
+
const availableTimeslots = timeslotsData.timeslots.filter(
|
|
1977
|
+
(slot) => slot.status === "available" && dayjs__default.default(slot.start_time).isAfter(now)
|
|
1978
|
+
);
|
|
1979
|
+
if (availableTimeslots.length > 0) {
|
|
1980
|
+
const sortedSlots = [...availableTimeslots].sort(
|
|
1981
|
+
(a, b) => dayjs__default.default(a.start_time).unix() - dayjs__default.default(b.start_time).unix()
|
|
1982
|
+
);
|
|
1983
|
+
const nearestSlot = sortedSlots[0];
|
|
1984
|
+
const nearestDate = dayjs__default.default(nearestSlot.start_time);
|
|
1985
|
+
setSelectedDate(nearestDate);
|
|
1986
|
+
setCalendarValue(nearestDate);
|
|
1987
|
+
setSelectedTimeslotId(nearestSlot.id);
|
|
1988
|
+
setIsInitialized(true);
|
|
1989
|
+
} else if (!selectedDate) {
|
|
1990
|
+
setSelectedDate(now);
|
|
1991
|
+
setCalendarValue(now);
|
|
1992
|
+
setIsInitialized(true);
|
|
1993
|
+
}
|
|
1994
|
+
}, [timeslotsData, isInitialized, selectedDate]);
|
|
1934
1995
|
const formatTimeslot = (slot) => {
|
|
1935
1996
|
const start = dayjs__default.default(slot.start_time).format("h:mm A");
|
|
1936
1997
|
const end = dayjs__default.default(slot.end_time).format("h:mm A");
|
|
1937
1998
|
return `${start} - ${end}`;
|
|
1938
1999
|
};
|
|
1939
|
-
const onPanelChange = (value, mode) => {
|
|
1940
|
-
console.log(value.format("YYYY-MM-DD"), mode);
|
|
1941
|
-
};
|
|
1942
2000
|
const wrapperStyle = {
|
|
1943
|
-
width: 824,
|
|
1944
2001
|
background: "#fff",
|
|
1945
2002
|
border: `1px solid ${token.colorBorderSecondary}`,
|
|
1946
2003
|
borderRadius: token.borderRadiusLG
|
|
1947
2004
|
};
|
|
1948
2005
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1949
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[48px] py-[64px] font-bold text-center", children:
|
|
1950
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4", children: [
|
|
2006
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[48px] l:text-[32px] py-[64px] l:py-[24px] font-bold text-center", children: pageData.scheduleYourVisit }),
|
|
2007
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4 l:flex-col", children: [
|
|
1951
2008
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1952
2009
|
antd.ConfigProvider,
|
|
1953
2010
|
{
|
|
@@ -1963,34 +2020,74 @@ var DateTimePicker = ({
|
|
|
1963
2020
|
}
|
|
1964
2021
|
}
|
|
1965
2022
|
},
|
|
1966
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: wrapperStyle, className: "calendar-custom-cell", children: [
|
|
2023
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: wrapperStyle, className: "calendar-custom-cell w-[calc(824/1920*100vw)] min-l:max-w-[824px] l:w-full", children: [
|
|
1967
2024
|
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `
|
|
1968
2025
|
.calendar-custom-cell .ant-picker-cell {
|
|
1969
2026
|
padding: 6px !important;
|
|
2027
|
+
text-align: center !important;
|
|
2028
|
+
}
|
|
2029
|
+
.calendar-custom-cell .ant-picker-cell .ant-picker-cell-inner {
|
|
2030
|
+
margin: 0 auto !important;
|
|
1970
2031
|
}
|
|
1971
2032
|
.calendar-custom-cell .ant-picker-cell-inner {
|
|
1972
|
-
width:
|
|
1973
|
-
height:
|
|
2033
|
+
width: 38px !important;
|
|
2034
|
+
height: 38px !important;
|
|
1974
2035
|
display: flex !important;
|
|
1975
2036
|
align-items: center !important;
|
|
1976
2037
|
justify-content: center !important;
|
|
1977
|
-
border-radius:
|
|
2038
|
+
border-radius: 8px !important;
|
|
1978
2039
|
border: 1px solid #E4E5E6 !important;
|
|
2040
|
+
aspect-ratio: 1 / 1 !important;
|
|
2041
|
+
}
|
|
2042
|
+
@media (min-width: 1024px) and (max-width: 1919px) {
|
|
2043
|
+
.calendar-custom-cell .ant-picker-cell-inner {
|
|
2044
|
+
width: 54px !important;
|
|
2045
|
+
height: 54px !important;
|
|
2046
|
+
border-radius: 12px !important;
|
|
2047
|
+
}
|
|
2048
|
+
.calendar-custom-cell .ant-picker-calendar-date-value {
|
|
2049
|
+
line-height: 54px !important;
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
@media (min-width: 1920px) {
|
|
2053
|
+
.calendar-custom-cell .ant-picker-cell-inner {
|
|
2054
|
+
width: 100px !important;
|
|
2055
|
+
height: 100px !important;
|
|
2056
|
+
border-radius: 20px !important;
|
|
2057
|
+
}
|
|
2058
|
+
.calendar-custom-cell .ant-picker-calendar-date-value {
|
|
2059
|
+
line-height: 100px !important;
|
|
2060
|
+
}
|
|
1979
2061
|
}
|
|
1980
|
-
.calendar-custom-cell .ant-picker-cell-selected .ant-picker-cell-inner
|
|
2062
|
+
.calendar-custom-cell .ant-picker-cell-selected .ant-picker-cell-inner,
|
|
2063
|
+
.calendar-custom-cell .ant-picker-cell-selected:not(.ant-picker-cell-disabled) .ant-picker-cell-inner {
|
|
1981
2064
|
background-color: #3ADB67 !important;
|
|
1982
2065
|
color: white !important;
|
|
1983
2066
|
border-color: #3ADB67 !important;
|
|
1984
2067
|
}
|
|
2068
|
+
.calendar-custom-cell .ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner {
|
|
2069
|
+
background-color: #3ADB67 !important;
|
|
2070
|
+
color: white !important;
|
|
2071
|
+
}
|
|
1985
2072
|
.calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner {
|
|
1986
2073
|
border-color: #3ADB67 !important;
|
|
1987
|
-
border-radius:
|
|
2074
|
+
border-radius: 8px !important;
|
|
2075
|
+
}
|
|
2076
|
+
@media (min-width: 1024px) and (max-width: 1919px) {
|
|
2077
|
+
.calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner {
|
|
2078
|
+
border-radius: 12px !important;
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
@media (min-width: 1920px) {
|
|
2082
|
+
.calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner {
|
|
2083
|
+
border-radius: 20px !important;
|
|
2084
|
+
}
|
|
1988
2085
|
}
|
|
1989
2086
|
.calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner::before {
|
|
1990
2087
|
display: none !important;
|
|
1991
2088
|
}
|
|
1992
2089
|
.calendar-custom-cell .ant-picker-calendar-date-value {
|
|
1993
|
-
line-height:
|
|
2090
|
+
line-height: 38px !important;
|
|
1994
2091
|
}
|
|
1995
2092
|
.calendar-custom-cell .ant-picker-content {
|
|
1996
2093
|
width: 100% !important;
|
|
@@ -1998,13 +2095,62 @@ var DateTimePicker = ({
|
|
|
1998
2095
|
.calendar-custom-cell .ant-picker-content thead tr th {
|
|
1999
2096
|
line-height: 48px !important;
|
|
2000
2097
|
}
|
|
2098
|
+
.calendar-custom-cell .ant-picker-cell-disabled .ant-picker-cell-inner {
|
|
2099
|
+
background-color: #F5F5F5 !important;
|
|
2100
|
+
color: #BDBDBD !important;
|
|
2101
|
+
border-color: #E4E5E6 !important;
|
|
2102
|
+
cursor: not-allowed !important;
|
|
2103
|
+
box-shadow: none !important;
|
|
2104
|
+
}
|
|
2105
|
+
.calendar-custom-cell .ant-picker-cell-disabled:hover .ant-picker-cell-inner {
|
|
2106
|
+
background-color: #F5F5F5 !important;
|
|
2107
|
+
border-color: #E4E5E6 !important;
|
|
2108
|
+
box-shadow: none !important;
|
|
2109
|
+
}
|
|
2110
|
+
.calendar-custom-cell .ant-picker-cell-disabled::before {
|
|
2111
|
+
display: none !important;
|
|
2112
|
+
}
|
|
2113
|
+
.calendar-custom-cell .ant-picker-cell-disabled::after {
|
|
2114
|
+
display: none !important;
|
|
2115
|
+
}
|
|
2001
2116
|
` }),
|
|
2002
2117
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2003
2118
|
antd.Calendar,
|
|
2004
2119
|
{
|
|
2005
2120
|
fullscreen: false,
|
|
2006
|
-
value:
|
|
2007
|
-
|
|
2121
|
+
value: calendarValue,
|
|
2122
|
+
onSelect: (date) => {
|
|
2123
|
+
setSelectedDate(date);
|
|
2124
|
+
setCalendarValue(date);
|
|
2125
|
+
},
|
|
2126
|
+
onPanelChange: (date) => {
|
|
2127
|
+
setCalendarValue(date);
|
|
2128
|
+
},
|
|
2129
|
+
disabledDate: (current) => {
|
|
2130
|
+
if (!current) return false;
|
|
2131
|
+
if (current.isSame(dayjs__default.default(), "day")) return false;
|
|
2132
|
+
if (current.isBefore(dayjs__default.default(), "day")) return true;
|
|
2133
|
+
const dateStr = current.format("YYYY-MM-DD");
|
|
2134
|
+
return !availableDates.has(dateStr);
|
|
2135
|
+
},
|
|
2136
|
+
fullCellRender: (date) => {
|
|
2137
|
+
const isSelected = selectedDate && date.isSame(selectedDate, "day");
|
|
2138
|
+
const isToday = date.isSame(dayjs__default.default(), "day");
|
|
2139
|
+
const dateStr = date.format("YYYY-MM-DD");
|
|
2140
|
+
const isDisabled = !isToday && (date.isBefore(dayjs__default.default(), "day") || !availableDates.has(dateStr));
|
|
2141
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2142
|
+
"div",
|
|
2143
|
+
{
|
|
2144
|
+
className: `ant-picker-cell-inner ${isSelected ? "ant-picker-cell-inner-selected" : ""} ${isToday ? "ant-picker-cell-inner-today" : ""}`,
|
|
2145
|
+
style: {
|
|
2146
|
+
backgroundColor: isSelected ? "#3ADB67" : void 0,
|
|
2147
|
+
color: isSelected ? "white" : isDisabled ? "#BDBDBD" : void 0,
|
|
2148
|
+
borderColor: isSelected ? "#3ADB67" : isToday ? "#3ADB67" : void 0
|
|
2149
|
+
},
|
|
2150
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ant-picker-calendar-date-value", children: date.date() })
|
|
2151
|
+
}
|
|
2152
|
+
);
|
|
2153
|
+
},
|
|
2008
2154
|
headerRender: ({ value, onChange }) => {
|
|
2009
2155
|
const year = value.year();
|
|
2010
2156
|
const month = value.month();
|
|
@@ -2122,8 +2268,7 @@ var DateTimePicker = ({
|
|
|
2122
2268
|
)
|
|
2123
2269
|
] })
|
|
2124
2270
|
] });
|
|
2125
|
-
}
|
|
2126
|
-
onPanelChange
|
|
2271
|
+
}
|
|
2127
2272
|
}
|
|
2128
2273
|
)
|
|
2129
2274
|
] })
|
|
@@ -2131,16 +2276,22 @@ var DateTimePicker = ({
|
|
|
2131
2276
|
),
|
|
2132
2277
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white p-[24px] rounded-[12px] flex-1", children: [
|
|
2133
2278
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
|
|
2134
|
-
|
|
2279
|
+
pageData.timeSlot,
|
|
2135
2280
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
2136
2281
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2137
2282
|
"button",
|
|
2138
2283
|
{
|
|
2139
2284
|
onClick: () => {
|
|
2140
|
-
|
|
2141
|
-
|
|
2285
|
+
if (selectedDate) {
|
|
2286
|
+
const newDate = selectedDate.subtract(1, "day");
|
|
2287
|
+
if (!newDate.isBefore(dayjs__default.default(), "day")) {
|
|
2288
|
+
setSelectedDate(newDate);
|
|
2289
|
+
setCalendarValue(newDate);
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2142
2292
|
},
|
|
2143
|
-
|
|
2293
|
+
disabled: !selectedDate || selectedDate.isSame(dayjs__default.default(), "day") || selectedDate.isBefore(dayjs__default.default(), "day"),
|
|
2294
|
+
className: "w-10 h-10 flex items-center justify-center hover:bg-gray-100 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2144
2295
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2145
2296
|
"svg",
|
|
2146
2297
|
{
|
|
@@ -2165,10 +2316,14 @@ var DateTimePicker = ({
|
|
|
2165
2316
|
"button",
|
|
2166
2317
|
{
|
|
2167
2318
|
onClick: () => {
|
|
2168
|
-
|
|
2169
|
-
|
|
2319
|
+
if (selectedDate) {
|
|
2320
|
+
const newDate = selectedDate.add(1, "day");
|
|
2321
|
+
setSelectedDate(newDate);
|
|
2322
|
+
setCalendarValue(newDate);
|
|
2323
|
+
}
|
|
2170
2324
|
},
|
|
2171
|
-
|
|
2325
|
+
disabled: !selectedDate,
|
|
2326
|
+
className: "w-10 h-10 flex items-center justify-center hover:bg-gray-100 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2172
2327
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2173
2328
|
"svg",
|
|
2174
2329
|
{
|
|
@@ -2190,7 +2345,7 @@ var DateTimePicker = ({
|
|
|
2190
2345
|
)
|
|
2191
2346
|
] })
|
|
2192
2347
|
] }),
|
|
2193
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 mt-[40px] gap-4", children: timeslotsLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2 text-center text-[#767880] py-8", children:
|
|
2348
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 mt-[40px] gap-4", children: timeslotsLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2 text-center text-[#767880] py-8", children: pageData.loadingTimeSlots }) : timeslotsError ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2 text-center text-red-600 py-8", children: pageData.failedToLoadTimeSlots }) : dayTimeslots.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2 text-center text-[#767880] py-8", children: pageData.noAvailableTimeSlots }) : dayTimeslots.map((slot) => {
|
|
2194
2349
|
const isAvailable = slot.status === "available";
|
|
2195
2350
|
const isFull = slot.status === "full";
|
|
2196
2351
|
const isSelected = selectedTimeslotId === slot.id;
|
|
@@ -2210,14 +2365,16 @@ var DateTimePicker = ({
|
|
|
2210
2365
|
`,
|
|
2211
2366
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
2212
2367
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: formatTimeslot(slot) }),
|
|
2213
|
-
isFull && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-[#BDBDBD] mt-1", children:
|
|
2368
|
+
isFull && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-[#BDBDBD] mt-1", children: pageData.full }),
|
|
2214
2369
|
isAvailable && !isSelected && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-[#767880] mt-1", children: [
|
|
2215
2370
|
slot.capacity - slot.booked_count,
|
|
2216
|
-
"
|
|
2371
|
+
" ",
|
|
2372
|
+
pageData.spotsLeft
|
|
2217
2373
|
] }),
|
|
2218
2374
|
isAvailable && isSelected && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-white mt-1", children: [
|
|
2219
2375
|
slot.capacity - slot.booked_count,
|
|
2220
|
-
"
|
|
2376
|
+
" ",
|
|
2377
|
+
pageData.spotsLeft
|
|
2221
2378
|
] })
|
|
2222
2379
|
] })
|
|
2223
2380
|
},
|
|
@@ -2226,32 +2383,35 @@ var DateTimePicker = ({
|
|
|
2226
2383
|
}) })
|
|
2227
2384
|
] })
|
|
2228
2385
|
] }),
|
|
2229
|
-
|
|
2230
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[48px] font-bold text-center mb-8", children:
|
|
2231
|
-
questionnaireLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-[#767880] py-8", children:
|
|
2386
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-12", children: [
|
|
2387
|
+
!!questionnaire?.questions?.length && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[48px] font-bold text-center mb-8", children: pageData.fillOutForm }),
|
|
2388
|
+
questionnaireLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-[#767880] py-8", children: pageData.loadingQuestionnaire }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2232
2389
|
QuestionnaireForm,
|
|
2233
2390
|
{
|
|
2234
|
-
questions: questionnaire
|
|
2391
|
+
questions: questionnaire?.questions || [],
|
|
2235
2392
|
loading: bookingLoading,
|
|
2236
2393
|
pageData,
|
|
2394
|
+
selectedTimeslotId,
|
|
2237
2395
|
onSubmit: async (responses) => {
|
|
2238
2396
|
try {
|
|
2239
2397
|
const customerName = responses.name || responses.customer_name || "";
|
|
2240
2398
|
const customerEmail = responses.email || responses.customer_email || "";
|
|
2241
2399
|
const customerPhone = responses.phone || responses.customer_phone_number || "";
|
|
2242
2400
|
const customerPhoneCode = responses.phone_code || responses.customer_phone_code || "+1";
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2401
|
+
if (selectedTimeslotId) {
|
|
2402
|
+
const result = await createBooking({
|
|
2403
|
+
demoroom_code: demoRoomCode,
|
|
2404
|
+
timeslot_id: selectedTimeslotId,
|
|
2405
|
+
questionnaire_id: questionnaire?.id,
|
|
2406
|
+
questionnaire_response: responses,
|
|
2407
|
+
customer_name: customerName,
|
|
2408
|
+
customer_email: customerEmail,
|
|
2409
|
+
customer_phone_code: customerPhoneCode,
|
|
2410
|
+
customer_phone_number: customerPhone
|
|
2411
|
+
});
|
|
2412
|
+
if (result && onBookingSuccess) {
|
|
2413
|
+
onBookingSuccess(result?.cancel_token);
|
|
2414
|
+
}
|
|
2255
2415
|
}
|
|
2256
2416
|
} catch (error) {
|
|
2257
2417
|
console.error("Booking creation failed:", error);
|
|
@@ -2259,10 +2419,6 @@ var DateTimePicker = ({
|
|
|
2259
2419
|
}
|
|
2260
2420
|
}
|
|
2261
2421
|
)
|
|
2262
|
-
] }),
|
|
2263
|
-
bookingError && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-8 p-4 bg-red-50 border border-red-200 rounded-lg text-red-600 max-w-2xl mx-auto", children: [
|
|
2264
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium", children: "Booking failed" }),
|
|
2265
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm mt-1", children: bookingError.message })
|
|
2266
2422
|
] })
|
|
2267
2423
|
] });
|
|
2268
2424
|
};
|
|
@@ -2332,6 +2488,12 @@ var DemoRoomDetail = ({
|
|
|
2332
2488
|
address: addressProp,
|
|
2333
2489
|
mapsLink,
|
|
2334
2490
|
images: imagesProp,
|
|
2491
|
+
pageData = {
|
|
2492
|
+
loadingText: "Loading...",
|
|
2493
|
+
errorTitle: "Failed to load demo room details",
|
|
2494
|
+
openInGoogleMaps: "Open in Google Maps",
|
|
2495
|
+
demoRoomImages: "Demo Room Images"
|
|
2496
|
+
},
|
|
2335
2497
|
className,
|
|
2336
2498
|
...props
|
|
2337
2499
|
}) => {
|
|
@@ -2339,12 +2501,9 @@ var DemoRoomDetail = ({
|
|
|
2339
2501
|
data: demoRoom,
|
|
2340
2502
|
loading,
|
|
2341
2503
|
error
|
|
2342
|
-
} = useDemoRoom(
|
|
2343
|
-
apiClient
|
|
2344
|
-
|
|
2345
|
-
locale,
|
|
2346
|
-
{ enabled: !!apiClient && !!demoRoomCode }
|
|
2347
|
-
);
|
|
2504
|
+
} = useDemoRoom(apiClient, demoRoomCode || "", locale, {
|
|
2505
|
+
enabled: !!apiClient && !!demoRoomCode
|
|
2506
|
+
});
|
|
2348
2507
|
const title = demoRoom?.name || titleProp || "Design District Demo Room";
|
|
2349
2508
|
const descriptions = demoRoom?.description ? [demoRoom.description] : descriptionsProp || defaultDescriptions;
|
|
2350
2509
|
const devices = demoRoom?.description || devicesProp || "eufyMake E1, eufyMake M5";
|
|
@@ -2369,12 +2528,12 @@ var DemoRoomDetail = ({
|
|
|
2369
2528
|
}
|
|
2370
2529
|
if (error && apiClient && demoRoomCode) {
|
|
2371
2530
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center text-red-600 py-8", children: [
|
|
2372
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-medium", children:
|
|
2531
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-medium", children: pageData.errorTitle }),
|
|
2373
2532
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm mt-2", children: error.message })
|
|
2374
2533
|
] }) });
|
|
2375
2534
|
}
|
|
2376
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-8 items-start", children: [
|
|
2377
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
|
|
2535
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-8 l:flex l:flex-col items-start", children: [
|
|
2536
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6 py-[24px]", children: [
|
|
2378
2537
|
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-[40px] font-bold text-gray-900 leading-tight", children: title }),
|
|
2379
2538
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: descriptions.map((desc, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2380
2539
|
"p",
|
|
@@ -2474,7 +2633,7 @@ var DemoRoomDetail = ({
|
|
|
2474
2633
|
rel: "noopener noreferrer",
|
|
2475
2634
|
className: "inline-flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700 mt-1 underline",
|
|
2476
2635
|
children: [
|
|
2477
|
-
|
|
2636
|
+
pageData.openInGoogleMaps,
|
|
2478
2637
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2479
2638
|
"svg",
|
|
2480
2639
|
{
|
|
@@ -2501,7 +2660,7 @@ var DemoRoomDetail = ({
|
|
|
2501
2660
|
] })
|
|
2502
2661
|
] })
|
|
2503
2662
|
] }),
|
|
2504
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative h-[400px] rounded-2xl overflow-hidden", children: images.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2663
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative l:w-full h-[400px] rounded-2xl overflow-hidden", children: images.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2505
2664
|
react.Swiper,
|
|
2506
2665
|
{
|
|
2507
2666
|
...swiperVersion === "11+" && Navigation && Pagination && Autoplay ? { modules: [Navigation, Pagination, Autoplay] } : {},
|
|
@@ -2560,7 +2719,7 @@ var DemoRoomDetail = ({
|
|
|
2560
2719
|
]
|
|
2561
2720
|
}
|
|
2562
2721
|
) }),
|
|
2563
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-gray-500 text-sm", children:
|
|
2722
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-gray-500 text-sm", children: pageData.demoRoomImages })
|
|
2564
2723
|
] }) }) })
|
|
2565
2724
|
] }) });
|
|
2566
2725
|
};
|
|
@@ -2579,6 +2738,10 @@ var BookingForm = ({
|
|
|
2579
2738
|
() => createDemoRoomApi(apiConfig),
|
|
2580
2739
|
[apiConfig]
|
|
2581
2740
|
);
|
|
2741
|
+
const dateTimePickerPageData = React2.useMemo(() => ({
|
|
2742
|
+
...pageData?.dateTimePicker,
|
|
2743
|
+
...pageData?.questionnaireForm
|
|
2744
|
+
}), [pageData?.dateTimePicker, pageData?.questionnaireForm]);
|
|
2582
2745
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2583
2746
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2584
2747
|
DemoRoomDetail,
|
|
@@ -2586,7 +2749,8 @@ var BookingForm = ({
|
|
|
2586
2749
|
className: cn("mt-8", layoutClassName),
|
|
2587
2750
|
apiClient,
|
|
2588
2751
|
demoRoomCode,
|
|
2589
|
-
locale: apiConfig.locale
|
|
2752
|
+
locale: apiConfig.locale,
|
|
2753
|
+
pageData: pageData?.demoRoomDetail
|
|
2590
2754
|
}
|
|
2591
2755
|
) }),
|
|
2592
2756
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-[#f5f5f5]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2597,7 +2761,7 @@ var BookingForm = ({
|
|
|
2597
2761
|
timezone,
|
|
2598
2762
|
locale: apiConfig.locale,
|
|
2599
2763
|
onBookingSuccess: handleBookingSuccess,
|
|
2600
|
-
pageData
|
|
2764
|
+
pageData: dateTimePickerPageData
|
|
2601
2765
|
}
|
|
2602
2766
|
) }) })
|
|
2603
2767
|
] });
|
|
@@ -2609,7 +2773,28 @@ var BookingSuccess = ({
|
|
|
2609
2773
|
apiConfig,
|
|
2610
2774
|
onScheduleAgain,
|
|
2611
2775
|
onCancelSuccess,
|
|
2612
|
-
className
|
|
2776
|
+
className,
|
|
2777
|
+
pageData = {
|
|
2778
|
+
yourAppointment: "Your Appointment",
|
|
2779
|
+
appointmentCanceled: "This appointment has been canceled.",
|
|
2780
|
+
scheduleAgain: "Schedule again",
|
|
2781
|
+
location: "Location",
|
|
2782
|
+
openInGoogleMaps: "Open in Google Maps \u2197",
|
|
2783
|
+
dateAndTime: "Date and Time",
|
|
2784
|
+
event: "Event",
|
|
2785
|
+
demoRoom: "Demo Room",
|
|
2786
|
+
visitorInfo: "Visitor Info",
|
|
2787
|
+
noPhoneProvided: "No phone provided",
|
|
2788
|
+
cancelAppointment: "Cancel Appointment",
|
|
2789
|
+
cancelDialog: {
|
|
2790
|
+
title: "Are you sure you want to cancel?",
|
|
2791
|
+
description: "You won't be able to restore the schedule.",
|
|
2792
|
+
backButton: "Back",
|
|
2793
|
+
confirmButton: "Cancel Appointment",
|
|
2794
|
+
canceling: "Canceling..."
|
|
2795
|
+
},
|
|
2796
|
+
cancelError: "Failed to cancel appointment. Please try again."
|
|
2797
|
+
}
|
|
2613
2798
|
}) => {
|
|
2614
2799
|
const [bookingData, setBookingData] = React2.useState(
|
|
2615
2800
|
initialBookingData || null
|
|
@@ -2639,7 +2824,7 @@ var BookingSuccess = ({
|
|
|
2639
2824
|
}, [token, apiConfig, initialBookingData]);
|
|
2640
2825
|
const handleCancelAppointment = async () => {
|
|
2641
2826
|
if (!token || !apiConfig) {
|
|
2642
|
-
setCancelError("Unable to cancel: Missing token or API configuration");
|
|
2827
|
+
setCancelError(pageData.cancelError || "Unable to cancel: Missing token or API configuration");
|
|
2643
2828
|
return;
|
|
2644
2829
|
}
|
|
2645
2830
|
setCancelLoading(true);
|
|
@@ -2660,7 +2845,7 @@ var BookingSuccess = ({
|
|
|
2660
2845
|
}
|
|
2661
2846
|
} catch (err) {
|
|
2662
2847
|
console.error("Failed to cancel booking:", err);
|
|
2663
|
-
setCancelError("Failed to cancel appointment. Please try again.");
|
|
2848
|
+
setCancelError(pageData.cancelError || "Failed to cancel appointment. Please try again.");
|
|
2664
2849
|
} finally {
|
|
2665
2850
|
setCancelLoading(false);
|
|
2666
2851
|
}
|
|
@@ -2680,21 +2865,21 @@ var BookingSuccess = ({
|
|
|
2680
2865
|
return null;
|
|
2681
2866
|
}
|
|
2682
2867
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `min-h-screen py-12 px-6 ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-3xl mx-auto", children: [
|
|
2683
|
-
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-[40px] font-bold text-gray-900 mb-8", children:
|
|
2868
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-[40px] font-bold text-gray-900 mb-8", children: pageData.yourAppointment }),
|
|
2684
2869
|
isCancelled && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white rounded-lg p-6 mb-8 flex items-center justify-between", children: [
|
|
2685
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-700", children:
|
|
2870
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-700", children: pageData.appointmentCanceled }),
|
|
2686
2871
|
onScheduleAgain && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2687
2872
|
"button",
|
|
2688
2873
|
{
|
|
2689
2874
|
onClick: onScheduleAgain,
|
|
2690
2875
|
className: "px-6 py-3 bg-black text-white rounded-full font-medium hover:bg-gray-800 transition-colors whitespace-nowrap",
|
|
2691
|
-
children:
|
|
2876
|
+
children: pageData.scheduleAgain
|
|
2692
2877
|
}
|
|
2693
2878
|
)
|
|
2694
2879
|
] }),
|
|
2695
2880
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-8 bg-white px-[48px] py-[32px] rounded-lg", children: [
|
|
2696
2881
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2697
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2882
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.location }),
|
|
2698
2883
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
2699
2884
|
bookingData.demoroom_name && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base font-medium text-gray-900", children: bookingData.demoroom_name }),
|
|
2700
2885
|
bookingData.address && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-600", children: bookingData.address }),
|
|
@@ -2705,13 +2890,13 @@ var BookingSuccess = ({
|
|
|
2705
2890
|
target: "_blank",
|
|
2706
2891
|
rel: "noopener noreferrer",
|
|
2707
2892
|
className: "inline-flex items-center gap-1 text-base text-blue-600 hover:text-blue-700 hover:underline",
|
|
2708
|
-
children:
|
|
2893
|
+
children: pageData.openInGoogleMaps
|
|
2709
2894
|
}
|
|
2710
2895
|
)
|
|
2711
2896
|
] })
|
|
2712
2897
|
] }),
|
|
2713
2898
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2714
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2899
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.dateAndTime }),
|
|
2715
2900
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-base text-gray-900", children: [
|
|
2716
2901
|
bookingData.booking_date,
|
|
2717
2902
|
bookingData.time_slot && `, ${bookingData.time_slot}`,
|
|
@@ -2719,15 +2904,15 @@ var BookingSuccess = ({
|
|
|
2719
2904
|
] })
|
|
2720
2905
|
] }),
|
|
2721
2906
|
bookingData.equipment && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2722
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2907
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.event }),
|
|
2723
2908
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-900", children: bookingData.equipment })
|
|
2724
2909
|
] }),
|
|
2725
2910
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2726
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2911
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.demoRoom }),
|
|
2727
2912
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-900", children: bookingData.demoroom_code })
|
|
2728
2913
|
] }),
|
|
2729
2914
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2730
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2915
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.visitorInfo }),
|
|
2731
2916
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
2732
2917
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-900", children: bookingData.customer_name }),
|
|
2733
2918
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-base text-gray-600", children: [
|
|
@@ -2753,7 +2938,7 @@ var BookingSuccess = ({
|
|
|
2753
2938
|
bookingData.phone_code,
|
|
2754
2939
|
" ",
|
|
2755
2940
|
bookingData.phone_number
|
|
2756
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children:
|
|
2941
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: pageData.noPhoneProvided })
|
|
2757
2942
|
] }),
|
|
2758
2943
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-base text-gray-600", children: [
|
|
2759
2944
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2786,7 +2971,7 @@ var BookingSuccess = ({
|
|
|
2786
2971
|
onClick: () => setShowCancelDialog(true),
|
|
2787
2972
|
disabled: cancelLoading,
|
|
2788
2973
|
className: "text-[14px] cursor-pointer w-fit rounded-full text-[#080A0F] border border-[#080A0F] px-[20px] py-[10px] leading-[1] hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2789
|
-
children:
|
|
2974
|
+
children: pageData.cancelAppointment
|
|
2790
2975
|
}
|
|
2791
2976
|
),
|
|
2792
2977
|
cancelError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm mt-2", style: { color: "#FF4D4D" }, children: cancelError })
|
|
@@ -2842,8 +3027,8 @@ var BookingSuccess = ({
|
|
|
2842
3027
|
}
|
|
2843
3028
|
) }) }),
|
|
2844
3029
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center mb-8", children: [
|
|
2845
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-[18px] font-semibold text-gray-900 mb-2", children:
|
|
2846
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[14px] text-gray-600", children:
|
|
3030
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-[18px] font-semibold text-gray-900 mb-2", children: pageData.cancelDialog?.title }),
|
|
3031
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[14px] text-gray-600", children: pageData.cancelDialog?.description })
|
|
2847
3032
|
] }),
|
|
2848
3033
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 justify-center", children: [
|
|
2849
3034
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2852,7 +3037,7 @@ var BookingSuccess = ({
|
|
|
2852
3037
|
onClick: () => setShowCancelDialog(false),
|
|
2853
3038
|
disabled: cancelLoading,
|
|
2854
3039
|
className: "px-8 py-3 border-2 border-black rounded-full text-black font-medium hover:bg-gray-50 transition-colors disabled:opacity-50 min-w-[120px]",
|
|
2855
|
-
children:
|
|
3040
|
+
children: pageData.cancelDialog?.backButton
|
|
2856
3041
|
}
|
|
2857
3042
|
),
|
|
2858
3043
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2892,8 +3077,8 @@ var BookingSuccess = ({
|
|
|
2892
3077
|
]
|
|
2893
3078
|
}
|
|
2894
3079
|
),
|
|
2895
|
-
|
|
2896
|
-
] }) :
|
|
3080
|
+
pageData.cancelDialog?.canceling
|
|
3081
|
+
] }) : pageData.cancelDialog?.confirmButton
|
|
2897
3082
|
}
|
|
2898
3083
|
)
|
|
2899
3084
|
] })
|