@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.mjs
CHANGED
|
@@ -27,7 +27,7 @@ var Title = ({
|
|
|
27
27
|
title = "",
|
|
28
28
|
...props
|
|
29
29
|
}) => {
|
|
30
|
-
return /* @__PURE__ */ jsx("div", { className: cn("w-full"), ...props, children: /* @__PURE__ */ jsx("h2", { className: "text-[48px] font-
|
|
30
|
+
return /* @__PURE__ */ jsx("div", { className: cn("w-full"), ...props, children: /* @__PURE__ */ jsx("h2", { className: "text-[32px] min-l:text-[48px] font-bold mb-12 text-[#080A0F]", children: title }) });
|
|
31
31
|
};
|
|
32
32
|
Title.displayName = "Title";
|
|
33
33
|
var StudioCard = ({
|
|
@@ -35,18 +35,18 @@ var StudioCard = ({
|
|
|
35
35
|
name,
|
|
36
36
|
availableTime,
|
|
37
37
|
address,
|
|
38
|
-
city,
|
|
39
|
-
state,
|
|
40
|
-
zipCode,
|
|
41
|
-
country = "United States",
|
|
42
38
|
euifyMakeModel,
|
|
43
39
|
distance,
|
|
44
40
|
onSchedule,
|
|
41
|
+
pageData = {
|
|
42
|
+
scheduleNow: "Schedule Now",
|
|
43
|
+
available: "Available",
|
|
44
|
+
away: "away"
|
|
45
|
+
},
|
|
45
46
|
className,
|
|
46
47
|
style,
|
|
47
48
|
...props
|
|
48
49
|
}) => {
|
|
49
|
-
const fullAddress = `${address}, ${city}, ${state} ${country} ${zipCode}`;
|
|
50
50
|
const [isHovered, setIsHovered] = React2.useState(false);
|
|
51
51
|
const handleScheduleClick = () => {
|
|
52
52
|
onSchedule?.(code);
|
|
@@ -79,7 +79,8 @@ var StudioCard = ({
|
|
|
79
79
|
/* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold text-gray-900", children: name }),
|
|
80
80
|
distance !== void 0 && /* @__PURE__ */ jsxs("span", { className: "text-sm font-medium text-[#2E8B57] bg-[#E8F5E9] px-3 py-1 rounded-full whitespace-nowrap ml-2", children: [
|
|
81
81
|
formatDistance(distance),
|
|
82
|
-
"
|
|
82
|
+
" ",
|
|
83
|
+
pageData.away
|
|
83
84
|
] })
|
|
84
85
|
] }),
|
|
85
86
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 mb-3", children: [
|
|
@@ -136,7 +137,8 @@ var StudioCard = ({
|
|
|
136
137
|
}
|
|
137
138
|
),
|
|
138
139
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600", children: [
|
|
139
|
-
|
|
140
|
+
pageData.available,
|
|
141
|
+
" ",
|
|
140
142
|
availableTime
|
|
141
143
|
] }) })
|
|
142
144
|
] }),
|
|
@@ -170,7 +172,7 @@ var StudioCard = ({
|
|
|
170
172
|
]
|
|
171
173
|
}
|
|
172
174
|
),
|
|
173
|
-
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children:
|
|
175
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 break-words", children: address }) })
|
|
174
176
|
] }),
|
|
175
177
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 mb-6", children: [
|
|
176
178
|
/* @__PURE__ */ jsxs(
|
|
@@ -227,10 +229,10 @@ var StudioCard = ({
|
|
|
227
229
|
"w-full px-6 py-3 rounded-full",
|
|
228
230
|
"bg-white text-gray-900 border border-gray-900",
|
|
229
231
|
"font-medium text-sm",
|
|
230
|
-
"hover:bg-gray-900",
|
|
232
|
+
"hover:bg-gray-900 hover:text-white",
|
|
231
233
|
"transition-all duration-200"
|
|
232
234
|
),
|
|
233
|
-
children:
|
|
235
|
+
children: pageData.scheduleNow
|
|
234
236
|
}
|
|
235
237
|
)
|
|
236
238
|
]
|
|
@@ -262,6 +264,12 @@ var StudioMap = ({
|
|
|
262
264
|
defaultZoom = 4,
|
|
263
265
|
mapHeight = "600px",
|
|
264
266
|
onSchedule,
|
|
267
|
+
pageData = {
|
|
268
|
+
apiKeyRequired: "Google Maps API Key is required",
|
|
269
|
+
loadingMap: "Loading map...",
|
|
270
|
+
scheduleNow: "Schedule Now",
|
|
271
|
+
available: "Available"
|
|
272
|
+
},
|
|
265
273
|
className,
|
|
266
274
|
...props
|
|
267
275
|
}) => {
|
|
@@ -338,18 +346,22 @@ var StudioMap = ({
|
|
|
338
346
|
validLocations.forEach((location) => {
|
|
339
347
|
const lat = Number(location.lat);
|
|
340
348
|
const lng = Number(location.lng);
|
|
349
|
+
const svgIcon = {
|
|
350
|
+
url: `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`
|
|
351
|
+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
352
|
+
<circle cx="24" cy="24" r="22" fill="#00000010"/>
|
|
353
|
+
<circle cx="24" cy="24" r="10" fill="#000000"/>
|
|
354
|
+
<circle cx="24" cy="24" r="5" fill="#3ADB67"/>
|
|
355
|
+
</svg>
|
|
356
|
+
`)}`,
|
|
357
|
+
scaledSize: { width: 48, height: 48 },
|
|
358
|
+
anchor: { x: 24, y: 24 }
|
|
359
|
+
};
|
|
341
360
|
const marker = new google.maps.Marker({
|
|
342
361
|
position: { lat, lng },
|
|
343
362
|
map: googleMapRef.current,
|
|
344
363
|
title: location.name,
|
|
345
|
-
icon:
|
|
346
|
-
path: google.maps.SymbolPath.CIRCLE,
|
|
347
|
-
scale: 10,
|
|
348
|
-
fillColor: "#000000",
|
|
349
|
-
fillOpacity: 1,
|
|
350
|
-
strokeColor: "#ffffff",
|
|
351
|
-
strokeWeight: 2
|
|
352
|
-
}
|
|
364
|
+
icon: svgIcon
|
|
353
365
|
});
|
|
354
366
|
marker.addListener("click", () => {
|
|
355
367
|
setSelectedLocation(location);
|
|
@@ -360,13 +372,13 @@ var StudioMap = ({
|
|
|
360
372
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
361
373
|
<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"/>
|
|
362
374
|
</svg>
|
|
363
|
-
<span style="vertical-align: middle;"
|
|
375
|
+
<span style="vertical-align: middle;">${pageData.available} ${location.availableTime}</span>
|
|
364
376
|
</div>` : ""}
|
|
365
377
|
<div style="margin-bottom: 8px; color: #666;">
|
|
366
378
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
367
379
|
<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"/>
|
|
368
380
|
</svg>
|
|
369
|
-
<span style="vertical-align: middle;">${location.address}
|
|
381
|
+
<span style="vertical-align: middle;">${location.address}</span>
|
|
370
382
|
</div>
|
|
371
383
|
${location.euifyMakeModel ? `<div style="margin-bottom: 12px; color: #666;">
|
|
372
384
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
@@ -390,7 +402,7 @@ var StudioMap = ({
|
|
|
390
402
|
onmouseover="this.style.background='#333'"
|
|
391
403
|
onmouseout="this.style.background='#000'"
|
|
392
404
|
>
|
|
393
|
-
|
|
405
|
+
${pageData.scheduleNow}
|
|
394
406
|
</button>
|
|
395
407
|
</div>
|
|
396
408
|
`;
|
|
@@ -446,13 +458,13 @@ var StudioMap = ({
|
|
|
446
458
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
447
459
|
<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"/>
|
|
448
460
|
</svg>
|
|
449
|
-
<span style="vertical-align: middle;"
|
|
461
|
+
<span style="vertical-align: middle;">${pageData.available} ${location.availableTime}</span>
|
|
450
462
|
</div>` : ""}
|
|
451
463
|
<div style="margin-bottom: 8px; color: #666;">
|
|
452
464
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
453
465
|
<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"/>
|
|
454
466
|
</svg>
|
|
455
|
-
<span style="vertical-align: middle;">${location.address}
|
|
467
|
+
<span style="vertical-align: middle;">${location.address}</span>
|
|
456
468
|
</div>
|
|
457
469
|
${location.euifyMakeModel ? `<div style="margin-bottom: 12px; color: #666;">
|
|
458
470
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
@@ -476,7 +488,7 @@ var StudioMap = ({
|
|
|
476
488
|
onmouseover="this.style.background='#333'"
|
|
477
489
|
onmouseout="this.style.background='#000'"
|
|
478
490
|
>
|
|
479
|
-
|
|
491
|
+
${pageData.scheduleNow}
|
|
480
492
|
</button>
|
|
481
493
|
</div>
|
|
482
494
|
`;
|
|
@@ -512,7 +524,7 @@ var StudioMap = ({
|
|
|
512
524
|
),
|
|
513
525
|
style: { height: mapHeight },
|
|
514
526
|
...props,
|
|
515
|
-
children: /* @__PURE__ */ jsx("p", { className: "text-gray-600", children:
|
|
527
|
+
children: /* @__PURE__ */ jsx("p", { className: "text-gray-600", children: pageData.apiKeyRequired })
|
|
516
528
|
}
|
|
517
529
|
);
|
|
518
530
|
}
|
|
@@ -525,7 +537,7 @@ var StudioMap = ({
|
|
|
525
537
|
/* @__PURE__ */ jsx("div", { ref: mapRef, style: { height: mapHeight } }),
|
|
526
538
|
!isLoaded && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-gray-100", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
527
539
|
/* @__PURE__ */ jsx("div", { className: "inline-block animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-gray-900 mb-2" }),
|
|
528
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-600", children:
|
|
540
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-600", children: pageData.loadingMap })
|
|
529
541
|
] }) })
|
|
530
542
|
]
|
|
531
543
|
}
|
|
@@ -654,7 +666,14 @@ function useQuestionnaire(client, code, questionnaire_id, locale, options) {
|
|
|
654
666
|
});
|
|
655
667
|
const enabled = options?.enabled !== false;
|
|
656
668
|
useEffect(() => {
|
|
657
|
-
if (!enabled || !code || !questionnaire_id)
|
|
669
|
+
if (!enabled || !code || !questionnaire_id) {
|
|
670
|
+
setState({
|
|
671
|
+
data: null,
|
|
672
|
+
loading: false,
|
|
673
|
+
error: null
|
|
674
|
+
});
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
658
677
|
let cancelled = false;
|
|
659
678
|
const fetchData = async () => {
|
|
660
679
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
@@ -810,65 +829,6 @@ var AntdMobileIsolated = ({
|
|
|
810
829
|
AntdMobileIsolated.displayName = "AntdMobileIsolated";
|
|
811
830
|
|
|
812
831
|
// src/components/DemoRoom/utils/addressParser.ts
|
|
813
|
-
var KNOWN_COUNTRIES = [
|
|
814
|
-
"United States",
|
|
815
|
-
"United Kingdom",
|
|
816
|
-
"American Samoa",
|
|
817
|
-
"United Arab Emirates",
|
|
818
|
-
"Bosnia and Herzegovina",
|
|
819
|
-
"Trinidad and Tobago",
|
|
820
|
-
"Saint Kitts and Nevis",
|
|
821
|
-
"Antigua and Barbuda",
|
|
822
|
-
"Saint Vincent and the Grenadines",
|
|
823
|
-
"S\xE3o Tom\xE9 and Pr\xEDncipe",
|
|
824
|
-
"United States Minor Outlying Islands",
|
|
825
|
-
"British Virgin Islands",
|
|
826
|
-
"United States Virgin Islands",
|
|
827
|
-
"Cayman Islands",
|
|
828
|
-
"Cook Islands",
|
|
829
|
-
"Falkland Islands",
|
|
830
|
-
"Faroe Islands",
|
|
831
|
-
"Marshall Islands",
|
|
832
|
-
"Northern Mariana Islands",
|
|
833
|
-
"Pitcairn Islands",
|
|
834
|
-
"Solomon Islands",
|
|
835
|
-
"Turks and Caicos Islands",
|
|
836
|
-
"Wallis and Futuna"
|
|
837
|
-
];
|
|
838
|
-
function parseAddress(address) {
|
|
839
|
-
const parts = address.split(",").map((part) => part.trim()).filter(Boolean);
|
|
840
|
-
let country = "United States";
|
|
841
|
-
let state = "";
|
|
842
|
-
let city = "";
|
|
843
|
-
if (parts.length === 0) {
|
|
844
|
-
return { country, state, city };
|
|
845
|
-
}
|
|
846
|
-
const lastPart = parts[parts.length - 1];
|
|
847
|
-
const matchedCountry = KNOWN_COUNTRIES.find(
|
|
848
|
-
(knownCountry) => lastPart.toLowerCase() === knownCountry.toLowerCase()
|
|
849
|
-
);
|
|
850
|
-
if (matchedCountry) {
|
|
851
|
-
country = matchedCountry;
|
|
852
|
-
if (parts.length >= 2) {
|
|
853
|
-
state = parts[parts.length - 2].split(" ")[0];
|
|
854
|
-
}
|
|
855
|
-
if (parts.length >= 3) {
|
|
856
|
-
city = parts[parts.length - 3];
|
|
857
|
-
}
|
|
858
|
-
} else {
|
|
859
|
-
if (parts.length >= 2) {
|
|
860
|
-
state = parts[parts.length - 1].split(" ")[0];
|
|
861
|
-
city = parts[parts.length - 2];
|
|
862
|
-
} else if (parts.length === 1) {
|
|
863
|
-
city = parts[0];
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
return {
|
|
867
|
-
country: country.trim(),
|
|
868
|
-
state: state.trim(),
|
|
869
|
-
city: city.trim()
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
832
|
function groupByAlphabet(items) {
|
|
873
833
|
const groups = /* @__PURE__ */ new Map();
|
|
874
834
|
items.forEach((item) => {
|
|
@@ -895,7 +855,15 @@ var LocationFilter = ({
|
|
|
895
855
|
locations,
|
|
896
856
|
onSelect,
|
|
897
857
|
visible = false,
|
|
898
|
-
onClose
|
|
858
|
+
onClose,
|
|
859
|
+
pageData = {
|
|
860
|
+
allLocations: "All Locations",
|
|
861
|
+
clear: "Clear",
|
|
862
|
+
country: "Country",
|
|
863
|
+
state: "State",
|
|
864
|
+
city: "City",
|
|
865
|
+
noStudiosFound: "No studios found in this location"
|
|
866
|
+
}
|
|
899
867
|
}) => {
|
|
900
868
|
const [currentLevel, setCurrentLevel] = useState("country");
|
|
901
869
|
const [selectedCountry, setSelectedCountry] = useState();
|
|
@@ -906,7 +874,7 @@ var LocationFilter = ({
|
|
|
906
874
|
const states = /* @__PURE__ */ new Map();
|
|
907
875
|
const cities = /* @__PURE__ */ new Map();
|
|
908
876
|
locations.forEach((location) => {
|
|
909
|
-
const { country, state, city } =
|
|
877
|
+
const { country, state, city } = location;
|
|
910
878
|
if (country) {
|
|
911
879
|
const existing = countries.get(country);
|
|
912
880
|
countries.set(country, {
|
|
@@ -1043,7 +1011,7 @@ var LocationFilter = ({
|
|
|
1043
1011
|
"pb-[4px] transition-colors",
|
|
1044
1012
|
currentLevel === "country" ? "text-[#1D1D1F] border-b-2 border-[#2E8B57]" : "text-[#767880]"
|
|
1045
1013
|
),
|
|
1046
|
-
children:
|
|
1014
|
+
children: pageData.country
|
|
1047
1015
|
}
|
|
1048
1016
|
),
|
|
1049
1017
|
/* @__PURE__ */ jsx(
|
|
@@ -1056,7 +1024,7 @@ var LocationFilter = ({
|
|
|
1056
1024
|
currentLevel === "state" ? "text-[#1D1D1F] border-b-2 border-[#2E8B57]" : "text-[#767880]",
|
|
1057
1025
|
!selectedCountry && "opacity-50 cursor-not-allowed"
|
|
1058
1026
|
),
|
|
1059
|
-
children:
|
|
1027
|
+
children: pageData.state
|
|
1060
1028
|
}
|
|
1061
1029
|
),
|
|
1062
1030
|
/* @__PURE__ */ jsx(
|
|
@@ -1069,7 +1037,7 @@ var LocationFilter = ({
|
|
|
1069
1037
|
currentLevel === "city" ? "text-[#1D1D1F] border-b-2 border-[#2E8B57]" : "text-[#767880]",
|
|
1070
1038
|
!selectedState && "opacity-50 cursor-not-allowed"
|
|
1071
1039
|
),
|
|
1072
|
-
children:
|
|
1040
|
+
children: pageData.city
|
|
1073
1041
|
}
|
|
1074
1042
|
)
|
|
1075
1043
|
] })
|
|
@@ -1101,11 +1069,38 @@ var LocationFilter = ({
|
|
|
1101
1069
|
);
|
|
1102
1070
|
};
|
|
1103
1071
|
LocationFilter.displayName = "LocationFilter";
|
|
1072
|
+
var defaultPageData = {
|
|
1073
|
+
title: "Find a Studio Near You",
|
|
1074
|
+
loadingText: "Loading demo rooms...",
|
|
1075
|
+
errorTitle: "Failed to load demo rooms",
|
|
1076
|
+
machine: "eufymake E1",
|
|
1077
|
+
locationFilter: {
|
|
1078
|
+
allLocations: "All Locations",
|
|
1079
|
+
clear: "Clear",
|
|
1080
|
+
country: "Country",
|
|
1081
|
+
state: "State",
|
|
1082
|
+
city: "City",
|
|
1083
|
+
noStudiosFound: "No studios found in this location"
|
|
1084
|
+
},
|
|
1085
|
+
studioCard: {
|
|
1086
|
+
scheduleNow: "Schedule Now",
|
|
1087
|
+
available: "Available",
|
|
1088
|
+
away: "away"
|
|
1089
|
+
},
|
|
1090
|
+
map: {
|
|
1091
|
+
apiKeyRequired: "Google Maps API Key is required",
|
|
1092
|
+
loadingMap: "Loading map...",
|
|
1093
|
+
scheduleNow: "Schedule Now",
|
|
1094
|
+
available: "Available"
|
|
1095
|
+
},
|
|
1096
|
+
defaultCountry: "United States",
|
|
1097
|
+
noAvailableTime: "No available time"
|
|
1098
|
+
};
|
|
1104
1099
|
var defaultStudioLocations = [
|
|
1105
1100
|
{
|
|
1106
1101
|
id: "1",
|
|
1107
1102
|
name: "Design District Demo Room",
|
|
1108
|
-
address: "111 8th St",
|
|
1103
|
+
address: "111 8th St, San Francisco, CA, United States",
|
|
1109
1104
|
city: "San Francisco",
|
|
1110
1105
|
state: "CA",
|
|
1111
1106
|
zipCode: "94108",
|
|
@@ -1118,7 +1113,7 @@ var defaultStudioLocations = [
|
|
|
1118
1113
|
{
|
|
1119
1114
|
id: "2",
|
|
1120
1115
|
name: "Brooklyn Creative Studio",
|
|
1121
|
-
address: "456 Broadway",
|
|
1116
|
+
address: "456 Broadway, Brooklyn, NY, United States",
|
|
1122
1117
|
city: "Brooklyn",
|
|
1123
1118
|
state: "NY",
|
|
1124
1119
|
zipCode: "11211",
|
|
@@ -1131,7 +1126,7 @@ var defaultStudioLocations = [
|
|
|
1131
1126
|
{
|
|
1132
1127
|
id: "3",
|
|
1133
1128
|
name: "Austin Innovation Hub",
|
|
1134
|
-
address: "789 Tech Blvd",
|
|
1129
|
+
address: "789 Tech Blvd, Austin, TX, United States",
|
|
1135
1130
|
city: "Austin",
|
|
1136
1131
|
state: "TX",
|
|
1137
1132
|
zipCode: "78701",
|
|
@@ -1144,7 +1139,7 @@ var defaultStudioLocations = [
|
|
|
1144
1139
|
{
|
|
1145
1140
|
id: "4",
|
|
1146
1141
|
name: "Seattle Maker Space",
|
|
1147
|
-
address: "321 Pine St",
|
|
1142
|
+
address: "321 Pine St, Seattle, WA, United States",
|
|
1148
1143
|
city: "Seattle",
|
|
1149
1144
|
state: "WA",
|
|
1150
1145
|
zipCode: "98101",
|
|
@@ -1157,7 +1152,7 @@ var defaultStudioLocations = [
|
|
|
1157
1152
|
{
|
|
1158
1153
|
id: "5",
|
|
1159
1154
|
name: "Chicago Design Center",
|
|
1160
|
-
address: "654 Michigan Ave",
|
|
1155
|
+
address: "654 Michigan Ave, Chicago, IL, United States",
|
|
1161
1156
|
city: "Chicago",
|
|
1162
1157
|
state: "IL",
|
|
1163
1158
|
zipCode: "60611",
|
|
@@ -1170,7 +1165,7 @@ var defaultStudioLocations = [
|
|
|
1170
1165
|
{
|
|
1171
1166
|
id: "6",
|
|
1172
1167
|
name: "Miami Beach Studio",
|
|
1173
|
-
address: "987 Ocean Drive",
|
|
1168
|
+
address: "987 Ocean Drive, Miami Beach, FL, United States",
|
|
1174
1169
|
city: "Miami Beach",
|
|
1175
1170
|
state: "FL",
|
|
1176
1171
|
zipCode: "33139",
|
|
@@ -1183,7 +1178,7 @@ var defaultStudioLocations = [
|
|
|
1183
1178
|
{
|
|
1184
1179
|
id: "7",
|
|
1185
1180
|
name: "Denver Mountain Studio",
|
|
1186
|
-
address: "147 16th St",
|
|
1181
|
+
address: "147 16th St, Denver, CO, United States",
|
|
1187
1182
|
city: "Denver",
|
|
1188
1183
|
state: "CO",
|
|
1189
1184
|
zipCode: "80202",
|
|
@@ -1196,7 +1191,7 @@ var defaultStudioLocations = [
|
|
|
1196
1191
|
{
|
|
1197
1192
|
id: "8",
|
|
1198
1193
|
name: "Los Angeles Creative Lab",
|
|
1199
|
-
address: "258 Main St",
|
|
1194
|
+
address: "258 Main St, Los Angeles, CA, United States",
|
|
1200
1195
|
city: "Los Angeles",
|
|
1201
1196
|
state: "CA",
|
|
1202
1197
|
zipCode: "90012",
|
|
@@ -1214,8 +1209,22 @@ var RoomsList = ({
|
|
|
1214
1209
|
teamCode,
|
|
1215
1210
|
brandWebsite,
|
|
1216
1211
|
onSchedule,
|
|
1212
|
+
pageData,
|
|
1217
1213
|
...props
|
|
1218
1214
|
}) => {
|
|
1215
|
+
const mergedPageData = useMemo(
|
|
1216
|
+
() => ({
|
|
1217
|
+
...defaultPageData,
|
|
1218
|
+
...pageData,
|
|
1219
|
+
locationFilter: {
|
|
1220
|
+
...defaultPageData.locationFilter,
|
|
1221
|
+
...pageData?.locationFilter
|
|
1222
|
+
},
|
|
1223
|
+
studioCard: { ...defaultPageData.studioCard, ...pageData?.studioCard },
|
|
1224
|
+
map: { ...defaultPageData.map, ...pageData?.map }
|
|
1225
|
+
}),
|
|
1226
|
+
[pageData]
|
|
1227
|
+
);
|
|
1219
1228
|
const [showLocationFilter, setShowLocationFilter] = useState(false);
|
|
1220
1229
|
const [selectedLocation, setSelectedLocation] = useState();
|
|
1221
1230
|
const [hoveredRoomId, setHoveredRoomId] = useState(null);
|
|
@@ -1234,18 +1243,22 @@ var RoomsList = ({
|
|
|
1234
1243
|
const nextAvailableTimeslot = room?.timeslots?.find(
|
|
1235
1244
|
(slot) => slot.status === "available"
|
|
1236
1245
|
);
|
|
1237
|
-
const
|
|
1246
|
+
const country = room.location?.country || mergedPageData.defaultCountry;
|
|
1247
|
+
const state = room.location?.state || "";
|
|
1248
|
+
const city = room.location?.city || "";
|
|
1249
|
+
const addressParts = [room.address, city, state, country].filter(Boolean);
|
|
1250
|
+
const fullAddress = addressParts.join(", ");
|
|
1238
1251
|
return {
|
|
1239
1252
|
id: room.code,
|
|
1240
1253
|
name: room.name,
|
|
1241
|
-
address:
|
|
1254
|
+
address: fullAddress,
|
|
1242
1255
|
city,
|
|
1243
1256
|
state,
|
|
1244
1257
|
zipCode: "",
|
|
1245
1258
|
country,
|
|
1246
1259
|
lat: Number(room.latitude) || 34.0522,
|
|
1247
1260
|
lng: Number(room.longitude) || -118.2437,
|
|
1248
|
-
availableTime: nextAvailableTimeslot ? `${nextAvailableTimeslot.start_time}` :
|
|
1261
|
+
availableTime: nextAvailableTimeslot ? `${nextAvailableTimeslot.start_time}` : mergedPageData.noAvailableTime,
|
|
1249
1262
|
euifyMakeModel: room?.description
|
|
1250
1263
|
};
|
|
1251
1264
|
});
|
|
@@ -1253,25 +1266,24 @@ var RoomsList = ({
|
|
|
1253
1266
|
const filteredStudioLocations = useMemo(() => {
|
|
1254
1267
|
if (!selectedLocation) return studioLocations;
|
|
1255
1268
|
return studioLocations.filter((location) => {
|
|
1256
|
-
const { country, state, city } = parseAddress(location.address);
|
|
1257
1269
|
if (selectedLocation.city) {
|
|
1258
|
-
return country === selectedLocation.country && state === selectedLocation.state && city === selectedLocation.city;
|
|
1270
|
+
return location.country === selectedLocation.country && location.state === selectedLocation.state && location.city === selectedLocation.city;
|
|
1259
1271
|
}
|
|
1260
1272
|
if (selectedLocation.state) {
|
|
1261
|
-
return country === selectedLocation.country && state === selectedLocation.state;
|
|
1273
|
+
return location.country === selectedLocation.country && location.state === selectedLocation.state;
|
|
1262
1274
|
}
|
|
1263
1275
|
if (selectedLocation.country) {
|
|
1264
|
-
return country === selectedLocation.country;
|
|
1276
|
+
return location.country === selectedLocation.country;
|
|
1265
1277
|
}
|
|
1266
1278
|
return true;
|
|
1267
1279
|
});
|
|
1268
1280
|
}, [studioLocations, selectedLocation]);
|
|
1269
1281
|
const getSelectedLocationName = () => {
|
|
1270
|
-
if (!selectedLocation) return
|
|
1282
|
+
if (!selectedLocation) return mergedPageData.locationFilter.allLocations;
|
|
1271
1283
|
if (selectedLocation.city) return selectedLocation.city;
|
|
1272
1284
|
if (selectedLocation.state) return selectedLocation.state;
|
|
1273
1285
|
if (selectedLocation.country) return selectedLocation.country;
|
|
1274
|
-
return
|
|
1286
|
+
return mergedPageData.locationFilter.allLocations;
|
|
1275
1287
|
};
|
|
1276
1288
|
const handleLocationSelect = (selection) => {
|
|
1277
1289
|
setSelectedLocation(selection);
|
|
@@ -1282,17 +1294,17 @@ var RoomsList = ({
|
|
|
1282
1294
|
};
|
|
1283
1295
|
console.log(filteredStudioLocations);
|
|
1284
1296
|
return /* @__PURE__ */ jsxs("div", { className, ...props, children: [
|
|
1285
|
-
/* @__PURE__ */ jsx(Title, { title:
|
|
1286
|
-
loading && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-[794px]", children: /* @__PURE__ */ jsx("div", { className: "text-center", children: /* @__PURE__ */ jsx("div", { className: "text-lg font-medium", children:
|
|
1297
|
+
/* @__PURE__ */ jsx(Title, { title: mergedPageData.title }),
|
|
1298
|
+
loading && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-[794px]", children: /* @__PURE__ */ jsx("div", { className: "text-center", children: /* @__PURE__ */ jsx("div", { className: "text-lg font-medium", children: mergedPageData.loadingText }) }) }),
|
|
1287
1299
|
error && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-[794px]", children: /* @__PURE__ */ jsxs("div", { className: "text-center", style: { color: "#FF4D4D" }, children: [
|
|
1288
|
-
/* @__PURE__ */ jsx("div", { className: "text-lg font-medium", children:
|
|
1300
|
+
/* @__PURE__ */ jsx("div", { className: "text-lg font-medium", children: mergedPageData.errorTitle }),
|
|
1289
1301
|
/* @__PURE__ */ jsx("div", { className: "text-sm mt-2", children: error.message })
|
|
1290
1302
|
] }) }),
|
|
1291
1303
|
!loading && !error && /* @__PURE__ */ jsxs("div", { className: "flex h-[794px] gap-4", children: [
|
|
1292
1304
|
/* @__PURE__ */ jsxs(
|
|
1293
1305
|
"div",
|
|
1294
1306
|
{
|
|
1295
|
-
className: "flex-none relative w-[420px]",
|
|
1307
|
+
className: "flex-none relative w-[420px] l:!w-full",
|
|
1296
1308
|
style: { height: "794px" },
|
|
1297
1309
|
children: [
|
|
1298
1310
|
/* @__PURE__ */ jsx("div", { className: "rounded-[12px] mb-4 bg-white border border-[#E4E5E6] px-[20px] py-[16px]", children: /* @__PURE__ */ jsxs("div", { className: "h-[40px] font-bold text-[16px] gap-10 flex items-center", children: [
|
|
@@ -1328,11 +1340,11 @@ var RoomsList = ({
|
|
|
1328
1340
|
{
|
|
1329
1341
|
onClick: handleClearFilter,
|
|
1330
1342
|
className: "ml-auto text-[14px] text-[#2E8B57] hover:underline",
|
|
1331
|
-
children:
|
|
1343
|
+
children: mergedPageData.locationFilter.clear
|
|
1332
1344
|
}
|
|
1333
1345
|
),
|
|
1334
1346
|
/* @__PURE__ */ jsxs("div", { className: "flex text-[#767880] cursor-not-allowed", children: [
|
|
1335
|
-
|
|
1347
|
+
mergedPageData.machine,
|
|
1336
1348
|
/* @__PURE__ */ jsx(
|
|
1337
1349
|
"svg",
|
|
1338
1350
|
{
|
|
@@ -1357,7 +1369,7 @@ var RoomsList = ({
|
|
|
1357
1369
|
{
|
|
1358
1370
|
style: { maxHeight: "706px", overflow: "auto" },
|
|
1359
1371
|
className: "rounded-[12px] bg-white border border-[#E4E5E6]",
|
|
1360
|
-
children: filteredStudioLocations.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-[200px] text-[#767880]", children:
|
|
1372
|
+
children: filteredStudioLocations.length === 0 ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center h-[200px] text-[#767880]", children: mergedPageData.locationFilter.noStudiosFound }) : filteredStudioLocations.map((item) => {
|
|
1361
1373
|
return /* @__PURE__ */ jsx(
|
|
1362
1374
|
StudioCard,
|
|
1363
1375
|
{
|
|
@@ -1371,7 +1383,8 @@ var RoomsList = ({
|
|
|
1371
1383
|
euifyMakeModel: item?.euifyMakeModel || "",
|
|
1372
1384
|
onSchedule,
|
|
1373
1385
|
onMouseEnter: () => setHoveredRoomId(item.id),
|
|
1374
|
-
onMouseLeave: () => setHoveredRoomId(null)
|
|
1386
|
+
onMouseLeave: () => setHoveredRoomId(null),
|
|
1387
|
+
pageData: mergedPageData.studioCard
|
|
1375
1388
|
},
|
|
1376
1389
|
item.id
|
|
1377
1390
|
);
|
|
@@ -1382,25 +1395,29 @@ var RoomsList = ({
|
|
|
1382
1395
|
LocationFilter,
|
|
1383
1396
|
{
|
|
1384
1397
|
locations: studioLocations.map((loc) => ({
|
|
1385
|
-
|
|
1386
|
-
|
|
1398
|
+
id: loc.id,
|
|
1399
|
+
country: loc.country,
|
|
1400
|
+
state: loc.state,
|
|
1401
|
+
city: loc.city
|
|
1387
1402
|
})),
|
|
1388
1403
|
visible: showLocationFilter,
|
|
1389
1404
|
onSelect: handleLocationSelect,
|
|
1390
|
-
onClose: () => setShowLocationFilter(false)
|
|
1405
|
+
onClose: () => setShowLocationFilter(false),
|
|
1406
|
+
pageData: mergedPageData.locationFilter
|
|
1391
1407
|
}
|
|
1392
1408
|
)
|
|
1393
1409
|
]
|
|
1394
1410
|
}
|
|
1395
1411
|
),
|
|
1396
|
-
googleMapsApiKey && /* @__PURE__ */ jsx("div", { className: cn("flex-1"), children: /* @__PURE__ */ jsx(
|
|
1412
|
+
googleMapsApiKey && /* @__PURE__ */ jsx("div", { className: cn("flex-1 l:!hidden"), children: /* @__PURE__ */ jsx(
|
|
1397
1413
|
StudioMap,
|
|
1398
1414
|
{
|
|
1399
1415
|
googleMapsApiKey,
|
|
1400
1416
|
locations: filteredStudioLocations,
|
|
1401
1417
|
hoveredLocationId: hoveredRoomId,
|
|
1402
1418
|
onSchedule,
|
|
1403
|
-
mapHeight: "794px"
|
|
1419
|
+
mapHeight: "794px",
|
|
1420
|
+
pageData: mergedPageData.map
|
|
1404
1421
|
}
|
|
1405
1422
|
) })
|
|
1406
1423
|
] })
|
|
@@ -1582,6 +1599,7 @@ var DemoRoom = ({
|
|
|
1582
1599
|
teamCode,
|
|
1583
1600
|
brandWebsite,
|
|
1584
1601
|
onSchedule,
|
|
1602
|
+
pageData,
|
|
1585
1603
|
...props
|
|
1586
1604
|
}) => {
|
|
1587
1605
|
const apiClient = useMemo(
|
|
@@ -1596,7 +1614,8 @@ var DemoRoom = ({
|
|
|
1596
1614
|
apiClient,
|
|
1597
1615
|
teamCode,
|
|
1598
1616
|
brandWebsite,
|
|
1599
|
-
onSchedule
|
|
1617
|
+
onSchedule,
|
|
1618
|
+
pageData
|
|
1600
1619
|
}
|
|
1601
1620
|
) });
|
|
1602
1621
|
};
|
|
@@ -1605,10 +1624,10 @@ var QuestionnaireForm = ({
|
|
|
1605
1624
|
questions,
|
|
1606
1625
|
onSubmit,
|
|
1607
1626
|
pageData,
|
|
1627
|
+
selectedTimeslotId,
|
|
1608
1628
|
loading = false,
|
|
1609
1629
|
className
|
|
1610
1630
|
}) => {
|
|
1611
|
-
console.log(pageData);
|
|
1612
1631
|
const [responses, setResponses] = useState({});
|
|
1613
1632
|
const [errors, setErrors] = useState({});
|
|
1614
1633
|
const [agreements, setAgreements] = useState({});
|
|
@@ -1684,6 +1703,7 @@ var QuestionnaireForm = ({
|
|
|
1684
1703
|
case "text":
|
|
1685
1704
|
case "email":
|
|
1686
1705
|
case "tel":
|
|
1706
|
+
case "phone":
|
|
1687
1707
|
return /* @__PURE__ */ jsx(
|
|
1688
1708
|
"input",
|
|
1689
1709
|
{
|
|
@@ -1795,7 +1815,7 @@ var QuestionnaireForm = ({
|
|
|
1795
1815
|
}
|
|
1796
1816
|
};
|
|
1797
1817
|
return /* @__PURE__ */ jsxs("div", { className: "pb-[80px]", children: [
|
|
1798
|
-
/* @__PURE__ */ jsx("div", { className: "bg-white rounded-[12px] border border-[#E4E5E6] p-8", children: /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, className: cn("space-y-6", className), children: questions
|
|
1818
|
+
questions && questions.length > 0 && /* @__PURE__ */ jsx("div", { className: "bg-white rounded-[12px] border border-[#E4E5E6] p-8", children: /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, className: cn("space-y-6", className), children: questions.map((question) => {
|
|
1799
1819
|
const questionId = getQuestionId(question);
|
|
1800
1820
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1801
1821
|
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
@@ -1810,7 +1830,7 @@ var QuestionnaireForm = ({
|
|
|
1810
1830
|
errors[questionId] && /* @__PURE__ */ jsx("p", { className: "text-sm", style: { color: "#FF4D4D" }, children: errors[questionId] })
|
|
1811
1831
|
] }, questionId);
|
|
1812
1832
|
}) }) }),
|
|
1813
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
1833
|
+
!!selectedTimeslotId && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
1814
1834
|
pageData?.agrees && pageData.agrees.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-4 mt-8", children: [
|
|
1815
1835
|
pageData.agrees.map((agreeContent, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
1816
1836
|
/* @__PURE__ */ jsx(
|
|
@@ -1848,7 +1868,7 @@ var QuestionnaireForm = ({
|
|
|
1848
1868
|
"focus:outline-none focus:ring-2 focus:ring-[#3ADB67] focus:ring-offset-2",
|
|
1849
1869
|
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
1850
1870
|
),
|
|
1851
|
-
children: loading ? "Submitting..." : "Submit Booking"
|
|
1871
|
+
children: loading ? pageData?.submitting || "Submitting..." : pageData?.submit || "Submit Booking"
|
|
1852
1872
|
}
|
|
1853
1873
|
)
|
|
1854
1874
|
] })
|
|
@@ -1861,17 +1881,29 @@ var DateTimePicker = ({
|
|
|
1861
1881
|
apiClient,
|
|
1862
1882
|
demoRoomCode,
|
|
1863
1883
|
timezone,
|
|
1864
|
-
pageData
|
|
1884
|
+
pageData = {
|
|
1885
|
+
scheduleYourVisit: "Schedule Your Visit",
|
|
1886
|
+
timeSlot: "Time Slot",
|
|
1887
|
+
loadingTimeSlots: "Loading time slots...",
|
|
1888
|
+
failedToLoadTimeSlots: "Failed to load time slots",
|
|
1889
|
+
noAvailableTimeSlots: "No available time slots for this date",
|
|
1890
|
+
full: "Full",
|
|
1891
|
+
spotsLeft: "spots left",
|
|
1892
|
+
fillOutForm: "Fill out Form",
|
|
1893
|
+
loadingQuestionnaire: "Loading questionnaire...",
|
|
1894
|
+
bookingFailed: "Booking failed"
|
|
1895
|
+
},
|
|
1865
1896
|
locale,
|
|
1866
1897
|
onBookingSuccess
|
|
1867
1898
|
}) => {
|
|
1868
1899
|
const { token } = theme.useToken();
|
|
1869
1900
|
const [selectMonth, setSelectMonth] = useState("");
|
|
1870
|
-
const [selectedDate, setSelectedDate] = useState(
|
|
1901
|
+
const [selectedDate, setSelectedDate] = useState(null);
|
|
1902
|
+
const [calendarValue, setCalendarValue] = useState(dayjs());
|
|
1871
1903
|
const [selectedTimeslotId, setSelectedTimeslotId] = useState(
|
|
1872
1904
|
null
|
|
1873
1905
|
);
|
|
1874
|
-
const [
|
|
1906
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
1875
1907
|
const {
|
|
1876
1908
|
createBooking,
|
|
1877
1909
|
loading: bookingLoading,
|
|
@@ -1890,13 +1922,9 @@ var DateTimePicker = ({
|
|
|
1890
1922
|
locale,
|
|
1891
1923
|
{ enabled: !!demoRoomCode && !!demoRoom?.questionnaire_id }
|
|
1892
1924
|
);
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
}
|
|
1897
|
-
}, [questionnaire]);
|
|
1898
|
-
const startDate = selectedDate.startOf("month").format("YYYY-MM-DD");
|
|
1899
|
-
const endDate = selectedDate.endOf("month").format("YYYY-MM-DD");
|
|
1925
|
+
const currentDate = selectedDate || dayjs();
|
|
1926
|
+
const startDate = currentDate.startOf("month").format("YYYY-MM-DD");
|
|
1927
|
+
const endDate = currentDate.endOf("month").format("YYYY-MM-DD");
|
|
1900
1928
|
const {
|
|
1901
1929
|
data: timeslotsData,
|
|
1902
1930
|
loading: timeslotsLoading,
|
|
@@ -1912,30 +1940,59 @@ var DateTimePicker = ({
|
|
|
1912
1940
|
{ enabled: !!demoRoomCode }
|
|
1913
1941
|
);
|
|
1914
1942
|
const dayTimeslots = useMemo(() => {
|
|
1915
|
-
if (!timeslotsData?.timeslots) return [];
|
|
1943
|
+
if (!timeslotsData?.timeslots || !selectedDate) return [];
|
|
1916
1944
|
const selectedDateStr = selectedDate.format("YYYY-MM-DD");
|
|
1917
1945
|
return timeslotsData.timeslots.filter((slot) => {
|
|
1918
1946
|
const slotDate = dayjs(slot.start_time).format("YYYY-MM-DD");
|
|
1919
1947
|
return slotDate === selectedDateStr;
|
|
1920
1948
|
});
|
|
1921
1949
|
}, [timeslotsData, selectedDate]);
|
|
1950
|
+
const availableDates = useMemo(() => {
|
|
1951
|
+
if (!timeslotsData?.timeslots) return /* @__PURE__ */ new Set();
|
|
1952
|
+
const dates = /* @__PURE__ */ new Set();
|
|
1953
|
+
timeslotsData.timeslots.forEach((slot) => {
|
|
1954
|
+
if (slot.status === "available") {
|
|
1955
|
+
const dateStr = dayjs(slot.start_time).format("YYYY-MM-DD");
|
|
1956
|
+
dates.add(dateStr);
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
return dates;
|
|
1960
|
+
}, [timeslotsData]);
|
|
1961
|
+
useEffect(() => {
|
|
1962
|
+
if (!timeslotsData?.timeslots || isInitialized) return;
|
|
1963
|
+
const now = dayjs();
|
|
1964
|
+
const availableTimeslots = timeslotsData.timeslots.filter(
|
|
1965
|
+
(slot) => slot.status === "available" && dayjs(slot.start_time).isAfter(now)
|
|
1966
|
+
);
|
|
1967
|
+
if (availableTimeslots.length > 0) {
|
|
1968
|
+
const sortedSlots = [...availableTimeslots].sort(
|
|
1969
|
+
(a, b) => dayjs(a.start_time).unix() - dayjs(b.start_time).unix()
|
|
1970
|
+
);
|
|
1971
|
+
const nearestSlot = sortedSlots[0];
|
|
1972
|
+
const nearestDate = dayjs(nearestSlot.start_time);
|
|
1973
|
+
setSelectedDate(nearestDate);
|
|
1974
|
+
setCalendarValue(nearestDate);
|
|
1975
|
+
setSelectedTimeslotId(nearestSlot.id);
|
|
1976
|
+
setIsInitialized(true);
|
|
1977
|
+
} else if (!selectedDate) {
|
|
1978
|
+
setSelectedDate(now);
|
|
1979
|
+
setCalendarValue(now);
|
|
1980
|
+
setIsInitialized(true);
|
|
1981
|
+
}
|
|
1982
|
+
}, [timeslotsData, isInitialized, selectedDate]);
|
|
1922
1983
|
const formatTimeslot = (slot) => {
|
|
1923
1984
|
const start = dayjs(slot.start_time).format("h:mm A");
|
|
1924
1985
|
const end = dayjs(slot.end_time).format("h:mm A");
|
|
1925
1986
|
return `${start} - ${end}`;
|
|
1926
1987
|
};
|
|
1927
|
-
const onPanelChange = (value, mode) => {
|
|
1928
|
-
console.log(value.format("YYYY-MM-DD"), mode);
|
|
1929
|
-
};
|
|
1930
1988
|
const wrapperStyle = {
|
|
1931
|
-
width: 824,
|
|
1932
1989
|
background: "#fff",
|
|
1933
1990
|
border: `1px solid ${token.colorBorderSecondary}`,
|
|
1934
1991
|
borderRadius: token.borderRadiusLG
|
|
1935
1992
|
};
|
|
1936
1993
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
1937
|
-
/* @__PURE__ */ jsx("div", { className: "text-[48px] py-[64px] font-bold text-center", children:
|
|
1938
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
|
|
1994
|
+
/* @__PURE__ */ jsx("div", { className: "text-[48px] l:text-[32px] py-[64px] l:py-[24px] font-bold text-center", children: pageData.scheduleYourVisit }),
|
|
1995
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-4 l:flex-col", children: [
|
|
1939
1996
|
/* @__PURE__ */ jsx(
|
|
1940
1997
|
ConfigProvider,
|
|
1941
1998
|
{
|
|
@@ -1951,34 +2008,74 @@ var DateTimePicker = ({
|
|
|
1951
2008
|
}
|
|
1952
2009
|
}
|
|
1953
2010
|
},
|
|
1954
|
-
children: /* @__PURE__ */ jsxs("div", { style: wrapperStyle, className: "calendar-custom-cell", children: [
|
|
2011
|
+
children: /* @__PURE__ */ jsxs("div", { style: wrapperStyle, className: "calendar-custom-cell w-[calc(824/1920*100vw)] min-l:max-w-[824px] l:w-full", children: [
|
|
1955
2012
|
/* @__PURE__ */ jsx("style", { children: `
|
|
1956
2013
|
.calendar-custom-cell .ant-picker-cell {
|
|
1957
2014
|
padding: 6px !important;
|
|
2015
|
+
text-align: center !important;
|
|
2016
|
+
}
|
|
2017
|
+
.calendar-custom-cell .ant-picker-cell .ant-picker-cell-inner {
|
|
2018
|
+
margin: 0 auto !important;
|
|
1958
2019
|
}
|
|
1959
2020
|
.calendar-custom-cell .ant-picker-cell-inner {
|
|
1960
|
-
width:
|
|
1961
|
-
height:
|
|
2021
|
+
width: 38px !important;
|
|
2022
|
+
height: 38px !important;
|
|
1962
2023
|
display: flex !important;
|
|
1963
2024
|
align-items: center !important;
|
|
1964
2025
|
justify-content: center !important;
|
|
1965
|
-
border-radius:
|
|
2026
|
+
border-radius: 8px !important;
|
|
1966
2027
|
border: 1px solid #E4E5E6 !important;
|
|
2028
|
+
aspect-ratio: 1 / 1 !important;
|
|
2029
|
+
}
|
|
2030
|
+
@media (min-width: 1024px) and (max-width: 1919px) {
|
|
2031
|
+
.calendar-custom-cell .ant-picker-cell-inner {
|
|
2032
|
+
width: 54px !important;
|
|
2033
|
+
height: 54px !important;
|
|
2034
|
+
border-radius: 12px !important;
|
|
2035
|
+
}
|
|
2036
|
+
.calendar-custom-cell .ant-picker-calendar-date-value {
|
|
2037
|
+
line-height: 54px !important;
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
@media (min-width: 1920px) {
|
|
2041
|
+
.calendar-custom-cell .ant-picker-cell-inner {
|
|
2042
|
+
width: 100px !important;
|
|
2043
|
+
height: 100px !important;
|
|
2044
|
+
border-radius: 20px !important;
|
|
2045
|
+
}
|
|
2046
|
+
.calendar-custom-cell .ant-picker-calendar-date-value {
|
|
2047
|
+
line-height: 100px !important;
|
|
2048
|
+
}
|
|
1967
2049
|
}
|
|
1968
|
-
.calendar-custom-cell .ant-picker-cell-selected .ant-picker-cell-inner
|
|
2050
|
+
.calendar-custom-cell .ant-picker-cell-selected .ant-picker-cell-inner,
|
|
2051
|
+
.calendar-custom-cell .ant-picker-cell-selected:not(.ant-picker-cell-disabled) .ant-picker-cell-inner {
|
|
1969
2052
|
background-color: #3ADB67 !important;
|
|
1970
2053
|
color: white !important;
|
|
1971
2054
|
border-color: #3ADB67 !important;
|
|
1972
2055
|
}
|
|
2056
|
+
.calendar-custom-cell .ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner {
|
|
2057
|
+
background-color: #3ADB67 !important;
|
|
2058
|
+
color: white !important;
|
|
2059
|
+
}
|
|
1973
2060
|
.calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner {
|
|
1974
2061
|
border-color: #3ADB67 !important;
|
|
1975
|
-
border-radius:
|
|
2062
|
+
border-radius: 8px !important;
|
|
2063
|
+
}
|
|
2064
|
+
@media (min-width: 1024px) and (max-width: 1919px) {
|
|
2065
|
+
.calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner {
|
|
2066
|
+
border-radius: 12px !important;
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
@media (min-width: 1920px) {
|
|
2070
|
+
.calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner {
|
|
2071
|
+
border-radius: 20px !important;
|
|
2072
|
+
}
|
|
1976
2073
|
}
|
|
1977
2074
|
.calendar-custom-cell .ant-picker-cell-today .ant-picker-cell-inner::before {
|
|
1978
2075
|
display: none !important;
|
|
1979
2076
|
}
|
|
1980
2077
|
.calendar-custom-cell .ant-picker-calendar-date-value {
|
|
1981
|
-
line-height:
|
|
2078
|
+
line-height: 38px !important;
|
|
1982
2079
|
}
|
|
1983
2080
|
.calendar-custom-cell .ant-picker-content {
|
|
1984
2081
|
width: 100% !important;
|
|
@@ -1986,13 +2083,62 @@ var DateTimePicker = ({
|
|
|
1986
2083
|
.calendar-custom-cell .ant-picker-content thead tr th {
|
|
1987
2084
|
line-height: 48px !important;
|
|
1988
2085
|
}
|
|
2086
|
+
.calendar-custom-cell .ant-picker-cell-disabled .ant-picker-cell-inner {
|
|
2087
|
+
background-color: #F5F5F5 !important;
|
|
2088
|
+
color: #BDBDBD !important;
|
|
2089
|
+
border-color: #E4E5E6 !important;
|
|
2090
|
+
cursor: not-allowed !important;
|
|
2091
|
+
box-shadow: none !important;
|
|
2092
|
+
}
|
|
2093
|
+
.calendar-custom-cell .ant-picker-cell-disabled:hover .ant-picker-cell-inner {
|
|
2094
|
+
background-color: #F5F5F5 !important;
|
|
2095
|
+
border-color: #E4E5E6 !important;
|
|
2096
|
+
box-shadow: none !important;
|
|
2097
|
+
}
|
|
2098
|
+
.calendar-custom-cell .ant-picker-cell-disabled::before {
|
|
2099
|
+
display: none !important;
|
|
2100
|
+
}
|
|
2101
|
+
.calendar-custom-cell .ant-picker-cell-disabled::after {
|
|
2102
|
+
display: none !important;
|
|
2103
|
+
}
|
|
1989
2104
|
` }),
|
|
1990
2105
|
/* @__PURE__ */ jsx(
|
|
1991
2106
|
Calendar,
|
|
1992
2107
|
{
|
|
1993
2108
|
fullscreen: false,
|
|
1994
|
-
value:
|
|
1995
|
-
|
|
2109
|
+
value: calendarValue,
|
|
2110
|
+
onSelect: (date) => {
|
|
2111
|
+
setSelectedDate(date);
|
|
2112
|
+
setCalendarValue(date);
|
|
2113
|
+
},
|
|
2114
|
+
onPanelChange: (date) => {
|
|
2115
|
+
setCalendarValue(date);
|
|
2116
|
+
},
|
|
2117
|
+
disabledDate: (current) => {
|
|
2118
|
+
if (!current) return false;
|
|
2119
|
+
if (current.isSame(dayjs(), "day")) return false;
|
|
2120
|
+
if (current.isBefore(dayjs(), "day")) return true;
|
|
2121
|
+
const dateStr = current.format("YYYY-MM-DD");
|
|
2122
|
+
return !availableDates.has(dateStr);
|
|
2123
|
+
},
|
|
2124
|
+
fullCellRender: (date) => {
|
|
2125
|
+
const isSelected = selectedDate && date.isSame(selectedDate, "day");
|
|
2126
|
+
const isToday = date.isSame(dayjs(), "day");
|
|
2127
|
+
const dateStr = date.format("YYYY-MM-DD");
|
|
2128
|
+
const isDisabled = !isToday && (date.isBefore(dayjs(), "day") || !availableDates.has(dateStr));
|
|
2129
|
+
return /* @__PURE__ */ jsx(
|
|
2130
|
+
"div",
|
|
2131
|
+
{
|
|
2132
|
+
className: `ant-picker-cell-inner ${isSelected ? "ant-picker-cell-inner-selected" : ""} ${isToday ? "ant-picker-cell-inner-today" : ""}`,
|
|
2133
|
+
style: {
|
|
2134
|
+
backgroundColor: isSelected ? "#3ADB67" : void 0,
|
|
2135
|
+
color: isSelected ? "white" : isDisabled ? "#BDBDBD" : void 0,
|
|
2136
|
+
borderColor: isSelected ? "#3ADB67" : isToday ? "#3ADB67" : void 0
|
|
2137
|
+
},
|
|
2138
|
+
children: /* @__PURE__ */ jsx("div", { className: "ant-picker-calendar-date-value", children: date.date() })
|
|
2139
|
+
}
|
|
2140
|
+
);
|
|
2141
|
+
},
|
|
1996
2142
|
headerRender: ({ value, onChange }) => {
|
|
1997
2143
|
const year = value.year();
|
|
1998
2144
|
const month = value.month();
|
|
@@ -2110,8 +2256,7 @@ var DateTimePicker = ({
|
|
|
2110
2256
|
)
|
|
2111
2257
|
] })
|
|
2112
2258
|
] });
|
|
2113
|
-
}
|
|
2114
|
-
onPanelChange
|
|
2259
|
+
}
|
|
2115
2260
|
}
|
|
2116
2261
|
)
|
|
2117
2262
|
] })
|
|
@@ -2119,16 +2264,22 @@ var DateTimePicker = ({
|
|
|
2119
2264
|
),
|
|
2120
2265
|
/* @__PURE__ */ jsxs("div", { className: "bg-white p-[24px] rounded-[12px] flex-1", children: [
|
|
2121
2266
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
2122
|
-
|
|
2267
|
+
pageData.timeSlot,
|
|
2123
2268
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
2124
2269
|
/* @__PURE__ */ jsx(
|
|
2125
2270
|
"button",
|
|
2126
2271
|
{
|
|
2127
2272
|
onClick: () => {
|
|
2128
|
-
|
|
2129
|
-
|
|
2273
|
+
if (selectedDate) {
|
|
2274
|
+
const newDate = selectedDate.subtract(1, "day");
|
|
2275
|
+
if (!newDate.isBefore(dayjs(), "day")) {
|
|
2276
|
+
setSelectedDate(newDate);
|
|
2277
|
+
setCalendarValue(newDate);
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2130
2280
|
},
|
|
2131
|
-
|
|
2281
|
+
disabled: !selectedDate || selectedDate.isSame(dayjs(), "day") || selectedDate.isBefore(dayjs(), "day"),
|
|
2282
|
+
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",
|
|
2132
2283
|
children: /* @__PURE__ */ jsx(
|
|
2133
2284
|
"svg",
|
|
2134
2285
|
{
|
|
@@ -2153,10 +2304,14 @@ var DateTimePicker = ({
|
|
|
2153
2304
|
"button",
|
|
2154
2305
|
{
|
|
2155
2306
|
onClick: () => {
|
|
2156
|
-
|
|
2157
|
-
|
|
2307
|
+
if (selectedDate) {
|
|
2308
|
+
const newDate = selectedDate.add(1, "day");
|
|
2309
|
+
setSelectedDate(newDate);
|
|
2310
|
+
setCalendarValue(newDate);
|
|
2311
|
+
}
|
|
2158
2312
|
},
|
|
2159
|
-
|
|
2313
|
+
disabled: !selectedDate,
|
|
2314
|
+
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",
|
|
2160
2315
|
children: /* @__PURE__ */ jsx(
|
|
2161
2316
|
"svg",
|
|
2162
2317
|
{
|
|
@@ -2178,7 +2333,7 @@ var DateTimePicker = ({
|
|
|
2178
2333
|
)
|
|
2179
2334
|
] })
|
|
2180
2335
|
] }),
|
|
2181
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 mt-[40px] gap-4", children: timeslotsLoading ? /* @__PURE__ */ jsx("div", { className: "col-span-2 text-center text-[#767880] py-8", children:
|
|
2336
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 mt-[40px] gap-4", children: timeslotsLoading ? /* @__PURE__ */ jsx("div", { className: "col-span-2 text-center text-[#767880] py-8", children: pageData.loadingTimeSlots }) : timeslotsError ? /* @__PURE__ */ jsx("div", { className: "col-span-2 text-center text-red-600 py-8", children: pageData.failedToLoadTimeSlots }) : dayTimeslots.length === 0 ? /* @__PURE__ */ jsx("div", { className: "col-span-2 text-center text-[#767880] py-8", children: pageData.noAvailableTimeSlots }) : dayTimeslots.map((slot) => {
|
|
2182
2337
|
const isAvailable = slot.status === "available";
|
|
2183
2338
|
const isFull = slot.status === "full";
|
|
2184
2339
|
const isSelected = selectedTimeslotId === slot.id;
|
|
@@ -2198,14 +2353,16 @@ var DateTimePicker = ({
|
|
|
2198
2353
|
`,
|
|
2199
2354
|
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
2200
2355
|
/* @__PURE__ */ jsx("div", { children: formatTimeslot(slot) }),
|
|
2201
|
-
isFull && /* @__PURE__ */ jsx("div", { className: "text-xs text-[#BDBDBD] mt-1", children:
|
|
2356
|
+
isFull && /* @__PURE__ */ jsx("div", { className: "text-xs text-[#BDBDBD] mt-1", children: pageData.full }),
|
|
2202
2357
|
isAvailable && !isSelected && /* @__PURE__ */ jsxs("div", { className: "text-xs text-[#767880] mt-1", children: [
|
|
2203
2358
|
slot.capacity - slot.booked_count,
|
|
2204
|
-
"
|
|
2359
|
+
" ",
|
|
2360
|
+
pageData.spotsLeft
|
|
2205
2361
|
] }),
|
|
2206
2362
|
isAvailable && isSelected && /* @__PURE__ */ jsxs("div", { className: "text-xs text-white mt-1", children: [
|
|
2207
2363
|
slot.capacity - slot.booked_count,
|
|
2208
|
-
"
|
|
2364
|
+
" ",
|
|
2365
|
+
pageData.spotsLeft
|
|
2209
2366
|
] })
|
|
2210
2367
|
] })
|
|
2211
2368
|
},
|
|
@@ -2214,32 +2371,35 @@ var DateTimePicker = ({
|
|
|
2214
2371
|
}) })
|
|
2215
2372
|
] })
|
|
2216
2373
|
] }),
|
|
2217
|
-
|
|
2218
|
-
/* @__PURE__ */ jsx("div", { className: "text-[48px] font-bold text-center mb-8", children:
|
|
2219
|
-
questionnaireLoading ? /* @__PURE__ */ jsx("div", { className: "text-center text-[#767880] py-8", children:
|
|
2374
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-12", children: [
|
|
2375
|
+
!!questionnaire?.questions?.length && /* @__PURE__ */ jsx("div", { className: "text-[48px] font-bold text-center mb-8", children: pageData.fillOutForm }),
|
|
2376
|
+
questionnaireLoading ? /* @__PURE__ */ jsx("div", { className: "text-center text-[#767880] py-8", children: pageData.loadingQuestionnaire }) : /* @__PURE__ */ jsx(
|
|
2220
2377
|
QuestionnaireForm,
|
|
2221
2378
|
{
|
|
2222
|
-
questions: questionnaire
|
|
2379
|
+
questions: questionnaire?.questions || [],
|
|
2223
2380
|
loading: bookingLoading,
|
|
2224
2381
|
pageData,
|
|
2382
|
+
selectedTimeslotId,
|
|
2225
2383
|
onSubmit: async (responses) => {
|
|
2226
2384
|
try {
|
|
2227
2385
|
const customerName = responses.name || responses.customer_name || "";
|
|
2228
2386
|
const customerEmail = responses.email || responses.customer_email || "";
|
|
2229
2387
|
const customerPhone = responses.phone || responses.customer_phone_number || "";
|
|
2230
2388
|
const customerPhoneCode = responses.phone_code || responses.customer_phone_code || "+1";
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2389
|
+
if (selectedTimeslotId) {
|
|
2390
|
+
const result = await createBooking({
|
|
2391
|
+
demoroom_code: demoRoomCode,
|
|
2392
|
+
timeslot_id: selectedTimeslotId,
|
|
2393
|
+
questionnaire_id: questionnaire?.id,
|
|
2394
|
+
questionnaire_response: responses,
|
|
2395
|
+
customer_name: customerName,
|
|
2396
|
+
customer_email: customerEmail,
|
|
2397
|
+
customer_phone_code: customerPhoneCode,
|
|
2398
|
+
customer_phone_number: customerPhone
|
|
2399
|
+
});
|
|
2400
|
+
if (result && onBookingSuccess) {
|
|
2401
|
+
onBookingSuccess(result?.cancel_token);
|
|
2402
|
+
}
|
|
2243
2403
|
}
|
|
2244
2404
|
} catch (error) {
|
|
2245
2405
|
console.error("Booking creation failed:", error);
|
|
@@ -2247,10 +2407,6 @@ var DateTimePicker = ({
|
|
|
2247
2407
|
}
|
|
2248
2408
|
}
|
|
2249
2409
|
)
|
|
2250
|
-
] }),
|
|
2251
|
-
bookingError && /* @__PURE__ */ 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: [
|
|
2252
|
-
/* @__PURE__ */ jsx("p", { className: "font-medium", children: "Booking failed" }),
|
|
2253
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm mt-1", children: bookingError.message })
|
|
2254
2410
|
] })
|
|
2255
2411
|
] });
|
|
2256
2412
|
};
|
|
@@ -2320,6 +2476,12 @@ var DemoRoomDetail = ({
|
|
|
2320
2476
|
address: addressProp,
|
|
2321
2477
|
mapsLink,
|
|
2322
2478
|
images: imagesProp,
|
|
2479
|
+
pageData = {
|
|
2480
|
+
loadingText: "Loading...",
|
|
2481
|
+
errorTitle: "Failed to load demo room details",
|
|
2482
|
+
openInGoogleMaps: "Open in Google Maps",
|
|
2483
|
+
demoRoomImages: "Demo Room Images"
|
|
2484
|
+
},
|
|
2323
2485
|
className,
|
|
2324
2486
|
...props
|
|
2325
2487
|
}) => {
|
|
@@ -2327,12 +2489,9 @@ var DemoRoomDetail = ({
|
|
|
2327
2489
|
data: demoRoom,
|
|
2328
2490
|
loading,
|
|
2329
2491
|
error
|
|
2330
|
-
} = useDemoRoom(
|
|
2331
|
-
apiClient
|
|
2332
|
-
|
|
2333
|
-
locale,
|
|
2334
|
-
{ enabled: !!apiClient && !!demoRoomCode }
|
|
2335
|
-
);
|
|
2492
|
+
} = useDemoRoom(apiClient, demoRoomCode || "", locale, {
|
|
2493
|
+
enabled: !!apiClient && !!demoRoomCode
|
|
2494
|
+
});
|
|
2336
2495
|
const title = demoRoom?.name || titleProp || "Design District Demo Room";
|
|
2337
2496
|
const descriptions = demoRoom?.description ? [demoRoom.description] : descriptionsProp || defaultDescriptions;
|
|
2338
2497
|
const devices = demoRoom?.description || devicesProp || "eufyMake E1, eufyMake M5";
|
|
@@ -2357,12 +2516,12 @@ var DemoRoomDetail = ({
|
|
|
2357
2516
|
}
|
|
2358
2517
|
if (error && apiClient && demoRoomCode) {
|
|
2359
2518
|
return /* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxs("div", { className: "text-center text-red-600 py-8", children: [
|
|
2360
|
-
/* @__PURE__ */ jsx("p", { className: "text-lg font-medium", children:
|
|
2519
|
+
/* @__PURE__ */ jsx("p", { className: "text-lg font-medium", children: pageData.errorTitle }),
|
|
2361
2520
|
/* @__PURE__ */ jsx("p", { className: "text-sm mt-2", children: error.message })
|
|
2362
2521
|
] }) });
|
|
2363
2522
|
}
|
|
2364
|
-
return /* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-8 items-start", children: [
|
|
2365
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
2523
|
+
return /* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-8 l:flex l:flex-col items-start", children: [
|
|
2524
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-6 py-[24px]", children: [
|
|
2366
2525
|
/* @__PURE__ */ jsx("h1", { className: "text-[40px] font-bold text-gray-900 leading-tight", children: title }),
|
|
2367
2526
|
/* @__PURE__ */ jsx("div", { className: "space-y-4", children: descriptions.map((desc, index) => /* @__PURE__ */ jsx(
|
|
2368
2527
|
"p",
|
|
@@ -2462,7 +2621,7 @@ var DemoRoomDetail = ({
|
|
|
2462
2621
|
rel: "noopener noreferrer",
|
|
2463
2622
|
className: "inline-flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700 mt-1 underline",
|
|
2464
2623
|
children: [
|
|
2465
|
-
|
|
2624
|
+
pageData.openInGoogleMaps,
|
|
2466
2625
|
/* @__PURE__ */ jsx(
|
|
2467
2626
|
"svg",
|
|
2468
2627
|
{
|
|
@@ -2489,7 +2648,7 @@ var DemoRoomDetail = ({
|
|
|
2489
2648
|
] })
|
|
2490
2649
|
] })
|
|
2491
2650
|
] }),
|
|
2492
|
-
/* @__PURE__ */ jsx("div", { className: "relative h-[400px] rounded-2xl overflow-hidden", children: images.length > 0 ? /* @__PURE__ */ jsx(
|
|
2651
|
+
/* @__PURE__ */ jsx("div", { className: "relative l:w-full h-[400px] rounded-2xl overflow-hidden", children: images.length > 0 ? /* @__PURE__ */ jsx(
|
|
2493
2652
|
Swiper,
|
|
2494
2653
|
{
|
|
2495
2654
|
...swiperVersion === "11+" && Navigation && Pagination && Autoplay ? { modules: [Navigation, Pagination, Autoplay] } : {},
|
|
@@ -2548,7 +2707,7 @@ var DemoRoomDetail = ({
|
|
|
2548
2707
|
]
|
|
2549
2708
|
}
|
|
2550
2709
|
) }),
|
|
2551
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm", children:
|
|
2710
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm", children: pageData.demoRoomImages })
|
|
2552
2711
|
] }) }) })
|
|
2553
2712
|
] }) });
|
|
2554
2713
|
};
|
|
@@ -2567,6 +2726,10 @@ var BookingForm = ({
|
|
|
2567
2726
|
() => createDemoRoomApi(apiConfig),
|
|
2568
2727
|
[apiConfig]
|
|
2569
2728
|
);
|
|
2729
|
+
const dateTimePickerPageData = useMemo(() => ({
|
|
2730
|
+
...pageData?.dateTimePicker,
|
|
2731
|
+
...pageData?.questionnaireForm
|
|
2732
|
+
}), [pageData?.dateTimePicker, pageData?.questionnaireForm]);
|
|
2570
2733
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2571
2734
|
/* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsx(
|
|
2572
2735
|
DemoRoomDetail,
|
|
@@ -2574,7 +2737,8 @@ var BookingForm = ({
|
|
|
2574
2737
|
className: cn("mt-8", layoutClassName),
|
|
2575
2738
|
apiClient,
|
|
2576
2739
|
demoRoomCode,
|
|
2577
|
-
locale: apiConfig.locale
|
|
2740
|
+
locale: apiConfig.locale,
|
|
2741
|
+
pageData: pageData?.demoRoomDetail
|
|
2578
2742
|
}
|
|
2579
2743
|
) }),
|
|
2580
2744
|
/* @__PURE__ */ jsx("div", { className: "bg-[#f5f5f5]", children: /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
|
|
@@ -2585,7 +2749,7 @@ var BookingForm = ({
|
|
|
2585
2749
|
timezone,
|
|
2586
2750
|
locale: apiConfig.locale,
|
|
2587
2751
|
onBookingSuccess: handleBookingSuccess,
|
|
2588
|
-
pageData
|
|
2752
|
+
pageData: dateTimePickerPageData
|
|
2589
2753
|
}
|
|
2590
2754
|
) }) })
|
|
2591
2755
|
] });
|
|
@@ -2597,7 +2761,28 @@ var BookingSuccess = ({
|
|
|
2597
2761
|
apiConfig,
|
|
2598
2762
|
onScheduleAgain,
|
|
2599
2763
|
onCancelSuccess,
|
|
2600
|
-
className
|
|
2764
|
+
className,
|
|
2765
|
+
pageData = {
|
|
2766
|
+
yourAppointment: "Your Appointment",
|
|
2767
|
+
appointmentCanceled: "This appointment has been canceled.",
|
|
2768
|
+
scheduleAgain: "Schedule again",
|
|
2769
|
+
location: "Location",
|
|
2770
|
+
openInGoogleMaps: "Open in Google Maps \u2197",
|
|
2771
|
+
dateAndTime: "Date and Time",
|
|
2772
|
+
event: "Event",
|
|
2773
|
+
demoRoom: "Demo Room",
|
|
2774
|
+
visitorInfo: "Visitor Info",
|
|
2775
|
+
noPhoneProvided: "No phone provided",
|
|
2776
|
+
cancelAppointment: "Cancel Appointment",
|
|
2777
|
+
cancelDialog: {
|
|
2778
|
+
title: "Are you sure you want to cancel?",
|
|
2779
|
+
description: "You won't be able to restore the schedule.",
|
|
2780
|
+
backButton: "Back",
|
|
2781
|
+
confirmButton: "Cancel Appointment",
|
|
2782
|
+
canceling: "Canceling..."
|
|
2783
|
+
},
|
|
2784
|
+
cancelError: "Failed to cancel appointment. Please try again."
|
|
2785
|
+
}
|
|
2601
2786
|
}) => {
|
|
2602
2787
|
const [bookingData, setBookingData] = useState(
|
|
2603
2788
|
initialBookingData || null
|
|
@@ -2627,7 +2812,7 @@ var BookingSuccess = ({
|
|
|
2627
2812
|
}, [token, apiConfig, initialBookingData]);
|
|
2628
2813
|
const handleCancelAppointment = async () => {
|
|
2629
2814
|
if (!token || !apiConfig) {
|
|
2630
|
-
setCancelError("Unable to cancel: Missing token or API configuration");
|
|
2815
|
+
setCancelError(pageData.cancelError || "Unable to cancel: Missing token or API configuration");
|
|
2631
2816
|
return;
|
|
2632
2817
|
}
|
|
2633
2818
|
setCancelLoading(true);
|
|
@@ -2648,7 +2833,7 @@ var BookingSuccess = ({
|
|
|
2648
2833
|
}
|
|
2649
2834
|
} catch (err) {
|
|
2650
2835
|
console.error("Failed to cancel booking:", err);
|
|
2651
|
-
setCancelError("Failed to cancel appointment. Please try again.");
|
|
2836
|
+
setCancelError(pageData.cancelError || "Failed to cancel appointment. Please try again.");
|
|
2652
2837
|
} finally {
|
|
2653
2838
|
setCancelLoading(false);
|
|
2654
2839
|
}
|
|
@@ -2668,21 +2853,21 @@ var BookingSuccess = ({
|
|
|
2668
2853
|
return null;
|
|
2669
2854
|
}
|
|
2670
2855
|
return /* @__PURE__ */ jsx("div", { className: `min-h-screen py-12 px-6 ${className || ""}`, children: /* @__PURE__ */ jsxs("div", { className: "max-w-3xl mx-auto", children: [
|
|
2671
|
-
/* @__PURE__ */ jsx("h1", { className: "text-[40px] font-bold text-gray-900 mb-8", children:
|
|
2856
|
+
/* @__PURE__ */ jsx("h1", { className: "text-[40px] font-bold text-gray-900 mb-8", children: pageData.yourAppointment }),
|
|
2672
2857
|
isCancelled && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg p-6 mb-8 flex items-center justify-between", children: [
|
|
2673
|
-
/* @__PURE__ */ jsx("p", { className: "text-base text-gray-700", children:
|
|
2858
|
+
/* @__PURE__ */ jsx("p", { className: "text-base text-gray-700", children: pageData.appointmentCanceled }),
|
|
2674
2859
|
onScheduleAgain && /* @__PURE__ */ jsx(
|
|
2675
2860
|
"button",
|
|
2676
2861
|
{
|
|
2677
2862
|
onClick: onScheduleAgain,
|
|
2678
2863
|
className: "px-6 py-3 bg-black text-white rounded-full font-medium hover:bg-gray-800 transition-colors whitespace-nowrap",
|
|
2679
|
-
children:
|
|
2864
|
+
children: pageData.scheduleAgain
|
|
2680
2865
|
}
|
|
2681
2866
|
)
|
|
2682
2867
|
] }),
|
|
2683
2868
|
/* @__PURE__ */ jsxs("div", { className: "space-y-8 bg-white px-[48px] py-[32px] rounded-lg", children: [
|
|
2684
2869
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2685
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2870
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.location }),
|
|
2686
2871
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2687
2872
|
bookingData.demoroom_name && /* @__PURE__ */ jsx("p", { className: "text-base font-medium text-gray-900", children: bookingData.demoroom_name }),
|
|
2688
2873
|
bookingData.address && /* @__PURE__ */ jsx("p", { className: "text-base text-gray-600", children: bookingData.address }),
|
|
@@ -2693,13 +2878,13 @@ var BookingSuccess = ({
|
|
|
2693
2878
|
target: "_blank",
|
|
2694
2879
|
rel: "noopener noreferrer",
|
|
2695
2880
|
className: "inline-flex items-center gap-1 text-base text-blue-600 hover:text-blue-700 hover:underline",
|
|
2696
|
-
children:
|
|
2881
|
+
children: pageData.openInGoogleMaps
|
|
2697
2882
|
}
|
|
2698
2883
|
)
|
|
2699
2884
|
] })
|
|
2700
2885
|
] }),
|
|
2701
2886
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2702
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2887
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.dateAndTime }),
|
|
2703
2888
|
/* @__PURE__ */ jsxs("p", { className: "text-base text-gray-900", children: [
|
|
2704
2889
|
bookingData.booking_date,
|
|
2705
2890
|
bookingData.time_slot && `, ${bookingData.time_slot}`,
|
|
@@ -2707,15 +2892,15 @@ var BookingSuccess = ({
|
|
|
2707
2892
|
] })
|
|
2708
2893
|
] }),
|
|
2709
2894
|
bookingData.equipment && /* @__PURE__ */ jsxs("div", { children: [
|
|
2710
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2895
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.event }),
|
|
2711
2896
|
/* @__PURE__ */ jsx("p", { className: "text-base text-gray-900", children: bookingData.equipment })
|
|
2712
2897
|
] }),
|
|
2713
2898
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2714
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2899
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.demoRoom }),
|
|
2715
2900
|
/* @__PURE__ */ jsx("p", { className: "text-base text-gray-900", children: bookingData.demoroom_code })
|
|
2716
2901
|
] }),
|
|
2717
2902
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2718
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2903
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.visitorInfo }),
|
|
2719
2904
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2720
2905
|
/* @__PURE__ */ jsx("p", { className: "text-base text-gray-900", children: bookingData.customer_name }),
|
|
2721
2906
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-base text-gray-600", children: [
|
|
@@ -2741,7 +2926,7 @@ var BookingSuccess = ({
|
|
|
2741
2926
|
bookingData.phone_code,
|
|
2742
2927
|
" ",
|
|
2743
2928
|
bookingData.phone_number
|
|
2744
|
-
] }) : /* @__PURE__ */ jsx("span", { children:
|
|
2929
|
+
] }) : /* @__PURE__ */ jsx("span", { children: pageData.noPhoneProvided })
|
|
2745
2930
|
] }),
|
|
2746
2931
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-base text-gray-600", children: [
|
|
2747
2932
|
/* @__PURE__ */ jsx(
|
|
@@ -2774,7 +2959,7 @@ var BookingSuccess = ({
|
|
|
2774
2959
|
onClick: () => setShowCancelDialog(true),
|
|
2775
2960
|
disabled: cancelLoading,
|
|
2776
2961
|
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",
|
|
2777
|
-
children:
|
|
2962
|
+
children: pageData.cancelAppointment
|
|
2778
2963
|
}
|
|
2779
2964
|
),
|
|
2780
2965
|
cancelError && /* @__PURE__ */ jsx("p", { className: "text-sm mt-2", style: { color: "#FF4D4D" }, children: cancelError })
|
|
@@ -2830,8 +3015,8 @@ var BookingSuccess = ({
|
|
|
2830
3015
|
}
|
|
2831
3016
|
) }) }),
|
|
2832
3017
|
/* @__PURE__ */ jsxs("div", { className: "text-center mb-8", children: [
|
|
2833
|
-
/* @__PURE__ */ jsx("h3", { className: "text-[18px] font-semibold text-gray-900 mb-2", children:
|
|
2834
|
-
/* @__PURE__ */ jsx("p", { className: "text-[14px] text-gray-600", children:
|
|
3018
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[18px] font-semibold text-gray-900 mb-2", children: pageData.cancelDialog?.title }),
|
|
3019
|
+
/* @__PURE__ */ jsx("p", { className: "text-[14px] text-gray-600", children: pageData.cancelDialog?.description })
|
|
2835
3020
|
] }),
|
|
2836
3021
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-3 justify-center", children: [
|
|
2837
3022
|
/* @__PURE__ */ jsx(
|
|
@@ -2840,7 +3025,7 @@ var BookingSuccess = ({
|
|
|
2840
3025
|
onClick: () => setShowCancelDialog(false),
|
|
2841
3026
|
disabled: cancelLoading,
|
|
2842
3027
|
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]",
|
|
2843
|
-
children:
|
|
3028
|
+
children: pageData.cancelDialog?.backButton
|
|
2844
3029
|
}
|
|
2845
3030
|
),
|
|
2846
3031
|
/* @__PURE__ */ jsx(
|
|
@@ -2880,8 +3065,8 @@ var BookingSuccess = ({
|
|
|
2880
3065
|
]
|
|
2881
3066
|
}
|
|
2882
3067
|
),
|
|
2883
|
-
|
|
2884
|
-
] }) :
|
|
3068
|
+
pageData.cancelDialog?.canceling
|
|
3069
|
+
] }) : pageData.cancelDialog?.confirmButton
|
|
2885
3070
|
}
|
|
2886
3071
|
)
|
|
2887
3072
|
] })
|