@anker-in/ui 0.1.5 → 0.1.8
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-Dx3PluHP.d.mts +85 -0
- package/dist/DemoRoom-Dx3PluHP.d.ts +85 -0
- package/dist/demo-room.d.mts +18 -1
- package/dist/demo-room.d.ts +18 -1
- package/dist/demo-room.js +120 -113
- package/dist/demo-room.js.map +1 -1
- package/dist/demo-room.mjs +120 -113
- package/dist/demo-room.mjs.map +1 -1
- package/dist/index.d.mts +116 -2
- package/dist/index.d.ts +116 -2
- package/dist/index.js +227 -175
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +227 -175
- 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
|
}) => {
|
|
@@ -360,13 +368,13 @@ var StudioMap = ({
|
|
|
360
368
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
361
369
|
<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
370
|
</svg>
|
|
363
|
-
<span style="vertical-align: middle;"
|
|
371
|
+
<span style="vertical-align: middle;">${pageData.available} ${location.availableTime}</span>
|
|
364
372
|
</div>` : ""}
|
|
365
373
|
<div style="margin-bottom: 8px; color: #666;">
|
|
366
374
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
367
375
|
<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
376
|
</svg>
|
|
369
|
-
<span style="vertical-align: middle;">${location.address}
|
|
377
|
+
<span style="vertical-align: middle;">${location.address}</span>
|
|
370
378
|
</div>
|
|
371
379
|
${location.euifyMakeModel ? `<div style="margin-bottom: 12px; color: #666;">
|
|
372
380
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
@@ -390,7 +398,7 @@ var StudioMap = ({
|
|
|
390
398
|
onmouseover="this.style.background='#333'"
|
|
391
399
|
onmouseout="this.style.background='#000'"
|
|
392
400
|
>
|
|
393
|
-
|
|
401
|
+
${pageData.scheduleNow}
|
|
394
402
|
</button>
|
|
395
403
|
</div>
|
|
396
404
|
`;
|
|
@@ -446,13 +454,13 @@ var StudioMap = ({
|
|
|
446
454
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
447
455
|
<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
456
|
</svg>
|
|
449
|
-
<span style="vertical-align: middle;"
|
|
457
|
+
<span style="vertical-align: middle;">${pageData.available} ${location.availableTime}</span>
|
|
450
458
|
</div>` : ""}
|
|
451
459
|
<div style="margin-bottom: 8px; color: #666;">
|
|
452
460
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
453
461
|
<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
462
|
</svg>
|
|
455
|
-
<span style="vertical-align: middle;">${location.address}
|
|
463
|
+
<span style="vertical-align: middle;">${location.address}</span>
|
|
456
464
|
</div>
|
|
457
465
|
${location.euifyMakeModel ? `<div style="margin-bottom: 12px; color: #666;">
|
|
458
466
|
<svg style="display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: middle;" fill="currentColor" viewBox="0 0 20 20">
|
|
@@ -476,7 +484,7 @@ var StudioMap = ({
|
|
|
476
484
|
onmouseover="this.style.background='#333'"
|
|
477
485
|
onmouseout="this.style.background='#000'"
|
|
478
486
|
>
|
|
479
|
-
|
|
487
|
+
${pageData.scheduleNow}
|
|
480
488
|
</button>
|
|
481
489
|
</div>
|
|
482
490
|
`;
|
|
@@ -512,7 +520,7 @@ var StudioMap = ({
|
|
|
512
520
|
),
|
|
513
521
|
style: { height: mapHeight },
|
|
514
522
|
...props,
|
|
515
|
-
children: /* @__PURE__ */ jsx("p", { className: "text-gray-600", children:
|
|
523
|
+
children: /* @__PURE__ */ jsx("p", { className: "text-gray-600", children: pageData.apiKeyRequired })
|
|
516
524
|
}
|
|
517
525
|
);
|
|
518
526
|
}
|
|
@@ -525,7 +533,7 @@ var StudioMap = ({
|
|
|
525
533
|
/* @__PURE__ */ jsx("div", { ref: mapRef, style: { height: mapHeight } }),
|
|
526
534
|
!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
535
|
/* @__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:
|
|
536
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-600", children: pageData.loadingMap })
|
|
529
537
|
] }) })
|
|
530
538
|
]
|
|
531
539
|
}
|
|
@@ -654,7 +662,14 @@ function useQuestionnaire(client, code, questionnaire_id, locale, options) {
|
|
|
654
662
|
});
|
|
655
663
|
const enabled = options?.enabled !== false;
|
|
656
664
|
useEffect(() => {
|
|
657
|
-
if (!enabled || !code || !questionnaire_id)
|
|
665
|
+
if (!enabled || !code || !questionnaire_id) {
|
|
666
|
+
setState({
|
|
667
|
+
data: null,
|
|
668
|
+
loading: false,
|
|
669
|
+
error: null
|
|
670
|
+
});
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
658
673
|
let cancelled = false;
|
|
659
674
|
const fetchData = async () => {
|
|
660
675
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
@@ -810,65 +825,6 @@ var AntdMobileIsolated = ({
|
|
|
810
825
|
AntdMobileIsolated.displayName = "AntdMobileIsolated";
|
|
811
826
|
|
|
812
827
|
// 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
828
|
function groupByAlphabet(items) {
|
|
873
829
|
const groups = /* @__PURE__ */ new Map();
|
|
874
830
|
items.forEach((item) => {
|
|
@@ -895,7 +851,15 @@ var LocationFilter = ({
|
|
|
895
851
|
locations,
|
|
896
852
|
onSelect,
|
|
897
853
|
visible = false,
|
|
898
|
-
onClose
|
|
854
|
+
onClose,
|
|
855
|
+
pageData = {
|
|
856
|
+
allLocations: "All Locations",
|
|
857
|
+
clear: "Clear",
|
|
858
|
+
country: "Country",
|
|
859
|
+
state: "State",
|
|
860
|
+
city: "City",
|
|
861
|
+
noStudiosFound: "No studios found in this location"
|
|
862
|
+
}
|
|
899
863
|
}) => {
|
|
900
864
|
const [currentLevel, setCurrentLevel] = useState("country");
|
|
901
865
|
const [selectedCountry, setSelectedCountry] = useState();
|
|
@@ -906,7 +870,7 @@ var LocationFilter = ({
|
|
|
906
870
|
const states = /* @__PURE__ */ new Map();
|
|
907
871
|
const cities = /* @__PURE__ */ new Map();
|
|
908
872
|
locations.forEach((location) => {
|
|
909
|
-
const { country, state, city } =
|
|
873
|
+
const { country, state, city } = location;
|
|
910
874
|
if (country) {
|
|
911
875
|
const existing = countries.get(country);
|
|
912
876
|
countries.set(country, {
|
|
@@ -1043,7 +1007,7 @@ var LocationFilter = ({
|
|
|
1043
1007
|
"pb-[4px] transition-colors",
|
|
1044
1008
|
currentLevel === "country" ? "text-[#1D1D1F] border-b-2 border-[#2E8B57]" : "text-[#767880]"
|
|
1045
1009
|
),
|
|
1046
|
-
children:
|
|
1010
|
+
children: pageData.country
|
|
1047
1011
|
}
|
|
1048
1012
|
),
|
|
1049
1013
|
/* @__PURE__ */ jsx(
|
|
@@ -1056,7 +1020,7 @@ var LocationFilter = ({
|
|
|
1056
1020
|
currentLevel === "state" ? "text-[#1D1D1F] border-b-2 border-[#2E8B57]" : "text-[#767880]",
|
|
1057
1021
|
!selectedCountry && "opacity-50 cursor-not-allowed"
|
|
1058
1022
|
),
|
|
1059
|
-
children:
|
|
1023
|
+
children: pageData.state
|
|
1060
1024
|
}
|
|
1061
1025
|
),
|
|
1062
1026
|
/* @__PURE__ */ jsx(
|
|
@@ -1069,7 +1033,7 @@ var LocationFilter = ({
|
|
|
1069
1033
|
currentLevel === "city" ? "text-[#1D1D1F] border-b-2 border-[#2E8B57]" : "text-[#767880]",
|
|
1070
1034
|
!selectedState && "opacity-50 cursor-not-allowed"
|
|
1071
1035
|
),
|
|
1072
|
-
children:
|
|
1036
|
+
children: pageData.city
|
|
1073
1037
|
}
|
|
1074
1038
|
)
|
|
1075
1039
|
] })
|
|
@@ -1101,11 +1065,37 @@ var LocationFilter = ({
|
|
|
1101
1065
|
);
|
|
1102
1066
|
};
|
|
1103
1067
|
LocationFilter.displayName = "LocationFilter";
|
|
1068
|
+
var defaultPageData = {
|
|
1069
|
+
title: "Find a Studio Near You",
|
|
1070
|
+
loadingText: "Loading demo rooms...",
|
|
1071
|
+
errorTitle: "Failed to load demo rooms",
|
|
1072
|
+
locationFilter: {
|
|
1073
|
+
allLocations: "All Locations",
|
|
1074
|
+
clear: "Clear",
|
|
1075
|
+
country: "Country",
|
|
1076
|
+
state: "State",
|
|
1077
|
+
city: "City",
|
|
1078
|
+
noStudiosFound: "No studios found in this location"
|
|
1079
|
+
},
|
|
1080
|
+
studioCard: {
|
|
1081
|
+
scheduleNow: "Schedule Now",
|
|
1082
|
+
available: "Available",
|
|
1083
|
+
away: "away"
|
|
1084
|
+
},
|
|
1085
|
+
map: {
|
|
1086
|
+
apiKeyRequired: "Google Maps API Key is required",
|
|
1087
|
+
loadingMap: "Loading map...",
|
|
1088
|
+
scheduleNow: "Schedule Now",
|
|
1089
|
+
available: "Available"
|
|
1090
|
+
},
|
|
1091
|
+
defaultCountry: "United States",
|
|
1092
|
+
noAvailableTime: "No available time"
|
|
1093
|
+
};
|
|
1104
1094
|
var defaultStudioLocations = [
|
|
1105
1095
|
{
|
|
1106
1096
|
id: "1",
|
|
1107
1097
|
name: "Design District Demo Room",
|
|
1108
|
-
address: "111 8th St",
|
|
1098
|
+
address: "111 8th St, San Francisco, CA, United States",
|
|
1109
1099
|
city: "San Francisco",
|
|
1110
1100
|
state: "CA",
|
|
1111
1101
|
zipCode: "94108",
|
|
@@ -1118,7 +1108,7 @@ var defaultStudioLocations = [
|
|
|
1118
1108
|
{
|
|
1119
1109
|
id: "2",
|
|
1120
1110
|
name: "Brooklyn Creative Studio",
|
|
1121
|
-
address: "456 Broadway",
|
|
1111
|
+
address: "456 Broadway, Brooklyn, NY, United States",
|
|
1122
1112
|
city: "Brooklyn",
|
|
1123
1113
|
state: "NY",
|
|
1124
1114
|
zipCode: "11211",
|
|
@@ -1131,7 +1121,7 @@ var defaultStudioLocations = [
|
|
|
1131
1121
|
{
|
|
1132
1122
|
id: "3",
|
|
1133
1123
|
name: "Austin Innovation Hub",
|
|
1134
|
-
address: "789 Tech Blvd",
|
|
1124
|
+
address: "789 Tech Blvd, Austin, TX, United States",
|
|
1135
1125
|
city: "Austin",
|
|
1136
1126
|
state: "TX",
|
|
1137
1127
|
zipCode: "78701",
|
|
@@ -1144,7 +1134,7 @@ var defaultStudioLocations = [
|
|
|
1144
1134
|
{
|
|
1145
1135
|
id: "4",
|
|
1146
1136
|
name: "Seattle Maker Space",
|
|
1147
|
-
address: "321 Pine St",
|
|
1137
|
+
address: "321 Pine St, Seattle, WA, United States",
|
|
1148
1138
|
city: "Seattle",
|
|
1149
1139
|
state: "WA",
|
|
1150
1140
|
zipCode: "98101",
|
|
@@ -1157,7 +1147,7 @@ var defaultStudioLocations = [
|
|
|
1157
1147
|
{
|
|
1158
1148
|
id: "5",
|
|
1159
1149
|
name: "Chicago Design Center",
|
|
1160
|
-
address: "654 Michigan Ave",
|
|
1150
|
+
address: "654 Michigan Ave, Chicago, IL, United States",
|
|
1161
1151
|
city: "Chicago",
|
|
1162
1152
|
state: "IL",
|
|
1163
1153
|
zipCode: "60611",
|
|
@@ -1170,7 +1160,7 @@ var defaultStudioLocations = [
|
|
|
1170
1160
|
{
|
|
1171
1161
|
id: "6",
|
|
1172
1162
|
name: "Miami Beach Studio",
|
|
1173
|
-
address: "987 Ocean Drive",
|
|
1163
|
+
address: "987 Ocean Drive, Miami Beach, FL, United States",
|
|
1174
1164
|
city: "Miami Beach",
|
|
1175
1165
|
state: "FL",
|
|
1176
1166
|
zipCode: "33139",
|
|
@@ -1183,7 +1173,7 @@ var defaultStudioLocations = [
|
|
|
1183
1173
|
{
|
|
1184
1174
|
id: "7",
|
|
1185
1175
|
name: "Denver Mountain Studio",
|
|
1186
|
-
address: "147 16th St",
|
|
1176
|
+
address: "147 16th St, Denver, CO, United States",
|
|
1187
1177
|
city: "Denver",
|
|
1188
1178
|
state: "CO",
|
|
1189
1179
|
zipCode: "80202",
|
|
@@ -1196,7 +1186,7 @@ var defaultStudioLocations = [
|
|
|
1196
1186
|
{
|
|
1197
1187
|
id: "8",
|
|
1198
1188
|
name: "Los Angeles Creative Lab",
|
|
1199
|
-
address: "258 Main St",
|
|
1189
|
+
address: "258 Main St, Los Angeles, CA, United States",
|
|
1200
1190
|
city: "Los Angeles",
|
|
1201
1191
|
state: "CA",
|
|
1202
1192
|
zipCode: "90012",
|
|
@@ -1214,8 +1204,22 @@ var RoomsList = ({
|
|
|
1214
1204
|
teamCode,
|
|
1215
1205
|
brandWebsite,
|
|
1216
1206
|
onSchedule,
|
|
1207
|
+
pageData,
|
|
1217
1208
|
...props
|
|
1218
1209
|
}) => {
|
|
1210
|
+
const mergedPageData = useMemo(
|
|
1211
|
+
() => ({
|
|
1212
|
+
...defaultPageData,
|
|
1213
|
+
...pageData,
|
|
1214
|
+
locationFilter: {
|
|
1215
|
+
...defaultPageData.locationFilter,
|
|
1216
|
+
...pageData?.locationFilter
|
|
1217
|
+
},
|
|
1218
|
+
studioCard: { ...defaultPageData.studioCard, ...pageData?.studioCard },
|
|
1219
|
+
map: { ...defaultPageData.map, ...pageData?.map }
|
|
1220
|
+
}),
|
|
1221
|
+
[pageData]
|
|
1222
|
+
);
|
|
1219
1223
|
const [showLocationFilter, setShowLocationFilter] = useState(false);
|
|
1220
1224
|
const [selectedLocation, setSelectedLocation] = useState();
|
|
1221
1225
|
const [hoveredRoomId, setHoveredRoomId] = useState(null);
|
|
@@ -1234,18 +1238,22 @@ var RoomsList = ({
|
|
|
1234
1238
|
const nextAvailableTimeslot = room?.timeslots?.find(
|
|
1235
1239
|
(slot) => slot.status === "available"
|
|
1236
1240
|
);
|
|
1237
|
-
const
|
|
1241
|
+
const country = room.location?.country || mergedPageData.defaultCountry;
|
|
1242
|
+
const state = room.location?.state || "";
|
|
1243
|
+
const city = room.location?.city || "";
|
|
1244
|
+
const addressParts = [room.address, city, state, country].filter(Boolean);
|
|
1245
|
+
const fullAddress = addressParts.join(", ");
|
|
1238
1246
|
return {
|
|
1239
1247
|
id: room.code,
|
|
1240
1248
|
name: room.name,
|
|
1241
|
-
address:
|
|
1249
|
+
address: fullAddress,
|
|
1242
1250
|
city,
|
|
1243
1251
|
state,
|
|
1244
1252
|
zipCode: "",
|
|
1245
1253
|
country,
|
|
1246
1254
|
lat: Number(room.latitude) || 34.0522,
|
|
1247
1255
|
lng: Number(room.longitude) || -118.2437,
|
|
1248
|
-
availableTime: nextAvailableTimeslot ? `${nextAvailableTimeslot.start_time}` :
|
|
1256
|
+
availableTime: nextAvailableTimeslot ? `${nextAvailableTimeslot.start_time}` : mergedPageData.noAvailableTime,
|
|
1249
1257
|
euifyMakeModel: room?.description
|
|
1250
1258
|
};
|
|
1251
1259
|
});
|
|
@@ -1253,25 +1261,24 @@ var RoomsList = ({
|
|
|
1253
1261
|
const filteredStudioLocations = useMemo(() => {
|
|
1254
1262
|
if (!selectedLocation) return studioLocations;
|
|
1255
1263
|
return studioLocations.filter((location) => {
|
|
1256
|
-
const { country, state, city } = parseAddress(location.address);
|
|
1257
1264
|
if (selectedLocation.city) {
|
|
1258
|
-
return country === selectedLocation.country && state === selectedLocation.state && city === selectedLocation.city;
|
|
1265
|
+
return location.country === selectedLocation.country && location.state === selectedLocation.state && location.city === selectedLocation.city;
|
|
1259
1266
|
}
|
|
1260
1267
|
if (selectedLocation.state) {
|
|
1261
|
-
return country === selectedLocation.country && state === selectedLocation.state;
|
|
1268
|
+
return location.country === selectedLocation.country && location.state === selectedLocation.state;
|
|
1262
1269
|
}
|
|
1263
1270
|
if (selectedLocation.country) {
|
|
1264
|
-
return country === selectedLocation.country;
|
|
1271
|
+
return location.country === selectedLocation.country;
|
|
1265
1272
|
}
|
|
1266
1273
|
return true;
|
|
1267
1274
|
});
|
|
1268
1275
|
}, [studioLocations, selectedLocation]);
|
|
1269
1276
|
const getSelectedLocationName = () => {
|
|
1270
|
-
if (!selectedLocation) return
|
|
1277
|
+
if (!selectedLocation) return mergedPageData.locationFilter.allLocations;
|
|
1271
1278
|
if (selectedLocation.city) return selectedLocation.city;
|
|
1272
1279
|
if (selectedLocation.state) return selectedLocation.state;
|
|
1273
1280
|
if (selectedLocation.country) return selectedLocation.country;
|
|
1274
|
-
return
|
|
1281
|
+
return mergedPageData.locationFilter.allLocations;
|
|
1275
1282
|
};
|
|
1276
1283
|
const handleLocationSelect = (selection) => {
|
|
1277
1284
|
setSelectedLocation(selection);
|
|
@@ -1282,17 +1289,17 @@ var RoomsList = ({
|
|
|
1282
1289
|
};
|
|
1283
1290
|
console.log(filteredStudioLocations);
|
|
1284
1291
|
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:
|
|
1292
|
+
/* @__PURE__ */ jsx(Title, { title: mergedPageData.title }),
|
|
1293
|
+
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
1294
|
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:
|
|
1295
|
+
/* @__PURE__ */ jsx("div", { className: "text-lg font-medium", children: mergedPageData.errorTitle }),
|
|
1289
1296
|
/* @__PURE__ */ jsx("div", { className: "text-sm mt-2", children: error.message })
|
|
1290
1297
|
] }) }),
|
|
1291
1298
|
!loading && !error && /* @__PURE__ */ jsxs("div", { className: "flex h-[794px] gap-4", children: [
|
|
1292
1299
|
/* @__PURE__ */ jsxs(
|
|
1293
1300
|
"div",
|
|
1294
1301
|
{
|
|
1295
|
-
className: "flex-none relative w-[420px]",
|
|
1302
|
+
className: "flex-none relative w-[420px] l:!w-full",
|
|
1296
1303
|
style: { height: "794px" },
|
|
1297
1304
|
children: [
|
|
1298
1305
|
/* @__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,7 +1335,7 @@ var RoomsList = ({
|
|
|
1328
1335
|
{
|
|
1329
1336
|
onClick: handleClearFilter,
|
|
1330
1337
|
className: "ml-auto text-[14px] text-[#2E8B57] hover:underline",
|
|
1331
|
-
children:
|
|
1338
|
+
children: mergedPageData.locationFilter.clear
|
|
1332
1339
|
}
|
|
1333
1340
|
),
|
|
1334
1341
|
/* @__PURE__ */ jsxs("div", { className: "flex text-[#767880] cursor-not-allowed", children: [
|
|
@@ -1357,7 +1364,7 @@ var RoomsList = ({
|
|
|
1357
1364
|
{
|
|
1358
1365
|
style: { maxHeight: "706px", overflow: "auto" },
|
|
1359
1366
|
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:
|
|
1367
|
+
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
1368
|
return /* @__PURE__ */ jsx(
|
|
1362
1369
|
StudioCard,
|
|
1363
1370
|
{
|
|
@@ -1371,7 +1378,8 @@ var RoomsList = ({
|
|
|
1371
1378
|
euifyMakeModel: item?.euifyMakeModel || "",
|
|
1372
1379
|
onSchedule,
|
|
1373
1380
|
onMouseEnter: () => setHoveredRoomId(item.id),
|
|
1374
|
-
onMouseLeave: () => setHoveredRoomId(null)
|
|
1381
|
+
onMouseLeave: () => setHoveredRoomId(null),
|
|
1382
|
+
pageData: mergedPageData.studioCard
|
|
1375
1383
|
},
|
|
1376
1384
|
item.id
|
|
1377
1385
|
);
|
|
@@ -1382,25 +1390,29 @@ var RoomsList = ({
|
|
|
1382
1390
|
LocationFilter,
|
|
1383
1391
|
{
|
|
1384
1392
|
locations: studioLocations.map((loc) => ({
|
|
1385
|
-
|
|
1386
|
-
|
|
1393
|
+
id: loc.id,
|
|
1394
|
+
country: loc.country,
|
|
1395
|
+
state: loc.state,
|
|
1396
|
+
city: loc.city
|
|
1387
1397
|
})),
|
|
1388
1398
|
visible: showLocationFilter,
|
|
1389
1399
|
onSelect: handleLocationSelect,
|
|
1390
|
-
onClose: () => setShowLocationFilter(false)
|
|
1400
|
+
onClose: () => setShowLocationFilter(false),
|
|
1401
|
+
pageData: mergedPageData.locationFilter
|
|
1391
1402
|
}
|
|
1392
1403
|
)
|
|
1393
1404
|
]
|
|
1394
1405
|
}
|
|
1395
1406
|
),
|
|
1396
|
-
googleMapsApiKey && /* @__PURE__ */ jsx("div", { className: cn("flex-1"), children: /* @__PURE__ */ jsx(
|
|
1407
|
+
googleMapsApiKey && /* @__PURE__ */ jsx("div", { className: cn("flex-1 l:!hidden"), children: /* @__PURE__ */ jsx(
|
|
1397
1408
|
StudioMap,
|
|
1398
1409
|
{
|
|
1399
1410
|
googleMapsApiKey,
|
|
1400
1411
|
locations: filteredStudioLocations,
|
|
1401
1412
|
hoveredLocationId: hoveredRoomId,
|
|
1402
1413
|
onSchedule,
|
|
1403
|
-
mapHeight: "794px"
|
|
1414
|
+
mapHeight: "794px",
|
|
1415
|
+
pageData: mergedPageData.map
|
|
1404
1416
|
}
|
|
1405
1417
|
) })
|
|
1406
1418
|
] })
|
|
@@ -1582,6 +1594,7 @@ var DemoRoom = ({
|
|
|
1582
1594
|
teamCode,
|
|
1583
1595
|
brandWebsite,
|
|
1584
1596
|
onSchedule,
|
|
1597
|
+
pageData,
|
|
1585
1598
|
...props
|
|
1586
1599
|
}) => {
|
|
1587
1600
|
const apiClient = useMemo(
|
|
@@ -1596,7 +1609,8 @@ var DemoRoom = ({
|
|
|
1596
1609
|
apiClient,
|
|
1597
1610
|
teamCode,
|
|
1598
1611
|
brandWebsite,
|
|
1599
|
-
onSchedule
|
|
1612
|
+
onSchedule,
|
|
1613
|
+
pageData
|
|
1600
1614
|
}
|
|
1601
1615
|
) });
|
|
1602
1616
|
};
|
|
@@ -1605,10 +1619,10 @@ var QuestionnaireForm = ({
|
|
|
1605
1619
|
questions,
|
|
1606
1620
|
onSubmit,
|
|
1607
1621
|
pageData,
|
|
1622
|
+
selectedTimeslotId,
|
|
1608
1623
|
loading = false,
|
|
1609
1624
|
className
|
|
1610
1625
|
}) => {
|
|
1611
|
-
console.log(pageData);
|
|
1612
1626
|
const [responses, setResponses] = useState({});
|
|
1613
1627
|
const [errors, setErrors] = useState({});
|
|
1614
1628
|
const [agreements, setAgreements] = useState({});
|
|
@@ -1795,7 +1809,7 @@ var QuestionnaireForm = ({
|
|
|
1795
1809
|
}
|
|
1796
1810
|
};
|
|
1797
1811
|
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
|
|
1812
|
+
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
1813
|
const questionId = getQuestionId(question);
|
|
1800
1814
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1801
1815
|
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
@@ -1810,7 +1824,7 @@ var QuestionnaireForm = ({
|
|
|
1810
1824
|
errors[questionId] && /* @__PURE__ */ jsx("p", { className: "text-sm", style: { color: "#FF4D4D" }, children: errors[questionId] })
|
|
1811
1825
|
] }, questionId);
|
|
1812
1826
|
}) }) }),
|
|
1813
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
1827
|
+
!!selectedTimeslotId && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
1814
1828
|
pageData?.agrees && pageData.agrees.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-4 mt-8", children: [
|
|
1815
1829
|
pageData.agrees.map((agreeContent, index) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
1816
1830
|
/* @__PURE__ */ jsx(
|
|
@@ -1848,7 +1862,7 @@ var QuestionnaireForm = ({
|
|
|
1848
1862
|
"focus:outline-none focus:ring-2 focus:ring-[#3ADB67] focus:ring-offset-2",
|
|
1849
1863
|
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
1850
1864
|
),
|
|
1851
|
-
children: loading ? "Submitting..." : "Submit Booking"
|
|
1865
|
+
children: loading ? pageData?.submitting || "Submitting..." : pageData?.submit || "Submit Booking"
|
|
1852
1866
|
}
|
|
1853
1867
|
)
|
|
1854
1868
|
] })
|
|
@@ -1861,7 +1875,18 @@ var DateTimePicker = ({
|
|
|
1861
1875
|
apiClient,
|
|
1862
1876
|
demoRoomCode,
|
|
1863
1877
|
timezone,
|
|
1864
|
-
pageData
|
|
1878
|
+
pageData = {
|
|
1879
|
+
scheduleYourVisit: "Schedule Your Visit",
|
|
1880
|
+
timeSlot: "Time Slot",
|
|
1881
|
+
loadingTimeSlots: "Loading time slots...",
|
|
1882
|
+
failedToLoadTimeSlots: "Failed to load time slots",
|
|
1883
|
+
noAvailableTimeSlots: "No available time slots for this date",
|
|
1884
|
+
full: "Full",
|
|
1885
|
+
spotsLeft: "spots left",
|
|
1886
|
+
fillOutForm: "Fill out Form",
|
|
1887
|
+
loadingQuestionnaire: "Loading questionnaire...",
|
|
1888
|
+
bookingFailed: "Booking failed"
|
|
1889
|
+
},
|
|
1865
1890
|
locale,
|
|
1866
1891
|
onBookingSuccess
|
|
1867
1892
|
}) => {
|
|
@@ -1871,7 +1896,6 @@ var DateTimePicker = ({
|
|
|
1871
1896
|
const [selectedTimeslotId, setSelectedTimeslotId] = useState(
|
|
1872
1897
|
null
|
|
1873
1898
|
);
|
|
1874
|
-
const [showQuestionnaire, setShowQuestionnaire] = useState(false);
|
|
1875
1899
|
const {
|
|
1876
1900
|
createBooking,
|
|
1877
1901
|
loading: bookingLoading,
|
|
@@ -1890,11 +1914,6 @@ var DateTimePicker = ({
|
|
|
1890
1914
|
locale,
|
|
1891
1915
|
{ enabled: !!demoRoomCode && !!demoRoom?.questionnaire_id }
|
|
1892
1916
|
);
|
|
1893
|
-
useEffect(() => {
|
|
1894
|
-
if (questionnaire) {
|
|
1895
|
-
setShowQuestionnaire(true);
|
|
1896
|
-
}
|
|
1897
|
-
}, [questionnaire]);
|
|
1898
1917
|
const startDate = selectedDate.startOf("month").format("YYYY-MM-DD");
|
|
1899
1918
|
const endDate = selectedDate.endOf("month").format("YYYY-MM-DD");
|
|
1900
1919
|
const {
|
|
@@ -1934,7 +1953,7 @@ var DateTimePicker = ({
|
|
|
1934
1953
|
borderRadius: token.borderRadiusLG
|
|
1935
1954
|
};
|
|
1936
1955
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
1937
|
-
/* @__PURE__ */ jsx("div", { className: "text-[48px] py-[64px] font-bold text-center", children:
|
|
1956
|
+
/* @__PURE__ */ jsx("div", { className: "text-[48px] py-[64px] font-bold text-center", children: pageData.scheduleYourVisit }),
|
|
1938
1957
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
|
|
1939
1958
|
/* @__PURE__ */ jsx(
|
|
1940
1959
|
ConfigProvider,
|
|
@@ -2119,7 +2138,7 @@ var DateTimePicker = ({
|
|
|
2119
2138
|
),
|
|
2120
2139
|
/* @__PURE__ */ jsxs("div", { className: "bg-white p-[24px] rounded-[12px] flex-1", children: [
|
|
2121
2140
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
2122
|
-
|
|
2141
|
+
pageData.timeSlot,
|
|
2123
2142
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
2124
2143
|
/* @__PURE__ */ jsx(
|
|
2125
2144
|
"button",
|
|
@@ -2178,7 +2197,7 @@ var DateTimePicker = ({
|
|
|
2178
2197
|
)
|
|
2179
2198
|
] })
|
|
2180
2199
|
] }),
|
|
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:
|
|
2200
|
+
/* @__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
2201
|
const isAvailable = slot.status === "available";
|
|
2183
2202
|
const isFull = slot.status === "full";
|
|
2184
2203
|
const isSelected = selectedTimeslotId === slot.id;
|
|
@@ -2198,14 +2217,16 @@ var DateTimePicker = ({
|
|
|
2198
2217
|
`,
|
|
2199
2218
|
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
|
|
2200
2219
|
/* @__PURE__ */ jsx("div", { children: formatTimeslot(slot) }),
|
|
2201
|
-
isFull && /* @__PURE__ */ jsx("div", { className: "text-xs text-[#BDBDBD] mt-1", children:
|
|
2220
|
+
isFull && /* @__PURE__ */ jsx("div", { className: "text-xs text-[#BDBDBD] mt-1", children: pageData.full }),
|
|
2202
2221
|
isAvailable && !isSelected && /* @__PURE__ */ jsxs("div", { className: "text-xs text-[#767880] mt-1", children: [
|
|
2203
2222
|
slot.capacity - slot.booked_count,
|
|
2204
|
-
"
|
|
2223
|
+
" ",
|
|
2224
|
+
pageData.spotsLeft
|
|
2205
2225
|
] }),
|
|
2206
2226
|
isAvailable && isSelected && /* @__PURE__ */ jsxs("div", { className: "text-xs text-white mt-1", children: [
|
|
2207
2227
|
slot.capacity - slot.booked_count,
|
|
2208
|
-
"
|
|
2228
|
+
" ",
|
|
2229
|
+
pageData.spotsLeft
|
|
2209
2230
|
] })
|
|
2210
2231
|
] })
|
|
2211
2232
|
},
|
|
@@ -2214,32 +2235,35 @@ var DateTimePicker = ({
|
|
|
2214
2235
|
}) })
|
|
2215
2236
|
] })
|
|
2216
2237
|
] }),
|
|
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:
|
|
2238
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-12", children: [
|
|
2239
|
+
!!questionnaire?.questions?.length && /* @__PURE__ */ jsx("div", { className: "text-[48px] font-bold text-center mb-8", children: pageData.fillOutForm }),
|
|
2240
|
+
questionnaireLoading ? /* @__PURE__ */ jsx("div", { className: "text-center text-[#767880] py-8", children: pageData.loadingQuestionnaire }) : /* @__PURE__ */ jsx(
|
|
2220
2241
|
QuestionnaireForm,
|
|
2221
2242
|
{
|
|
2222
|
-
questions: questionnaire
|
|
2243
|
+
questions: questionnaire?.questions || [],
|
|
2223
2244
|
loading: bookingLoading,
|
|
2224
2245
|
pageData,
|
|
2246
|
+
selectedTimeslotId,
|
|
2225
2247
|
onSubmit: async (responses) => {
|
|
2226
2248
|
try {
|
|
2227
2249
|
const customerName = responses.name || responses.customer_name || "";
|
|
2228
2250
|
const customerEmail = responses.email || responses.customer_email || "";
|
|
2229
2251
|
const customerPhone = responses.phone || responses.customer_phone_number || "";
|
|
2230
2252
|
const customerPhoneCode = responses.phone_code || responses.customer_phone_code || "+1";
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2253
|
+
if (selectedTimeslotId) {
|
|
2254
|
+
const result = await createBooking({
|
|
2255
|
+
demoroom_code: demoRoomCode,
|
|
2256
|
+
timeslot_id: selectedTimeslotId,
|
|
2257
|
+
questionnaire_id: questionnaire?.id,
|
|
2258
|
+
questionnaire_response: responses,
|
|
2259
|
+
customer_name: customerName,
|
|
2260
|
+
customer_email: customerEmail,
|
|
2261
|
+
customer_phone_code: customerPhoneCode,
|
|
2262
|
+
customer_phone_number: customerPhone
|
|
2263
|
+
});
|
|
2264
|
+
if (result && onBookingSuccess) {
|
|
2265
|
+
onBookingSuccess(result?.cancel_token);
|
|
2266
|
+
}
|
|
2243
2267
|
}
|
|
2244
2268
|
} catch (error) {
|
|
2245
2269
|
console.error("Booking creation failed:", error);
|
|
@@ -2247,10 +2271,6 @@ var DateTimePicker = ({
|
|
|
2247
2271
|
}
|
|
2248
2272
|
}
|
|
2249
2273
|
)
|
|
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
2274
|
] })
|
|
2255
2275
|
] });
|
|
2256
2276
|
};
|
|
@@ -2320,6 +2340,12 @@ var DemoRoomDetail = ({
|
|
|
2320
2340
|
address: addressProp,
|
|
2321
2341
|
mapsLink,
|
|
2322
2342
|
images: imagesProp,
|
|
2343
|
+
pageData = {
|
|
2344
|
+
loadingText: "Loading...",
|
|
2345
|
+
errorTitle: "Failed to load demo room details",
|
|
2346
|
+
openInGoogleMaps: "Open in Google Maps",
|
|
2347
|
+
demoRoomImages: "Demo Room Images"
|
|
2348
|
+
},
|
|
2323
2349
|
className,
|
|
2324
2350
|
...props
|
|
2325
2351
|
}) => {
|
|
@@ -2357,7 +2383,7 @@ var DemoRoomDetail = ({
|
|
|
2357
2383
|
}
|
|
2358
2384
|
if (error && apiClient && demoRoomCode) {
|
|
2359
2385
|
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:
|
|
2386
|
+
/* @__PURE__ */ jsx("p", { className: "text-lg font-medium", children: pageData.errorTitle }),
|
|
2361
2387
|
/* @__PURE__ */ jsx("p", { className: "text-sm mt-2", children: error.message })
|
|
2362
2388
|
] }) });
|
|
2363
2389
|
}
|
|
@@ -2462,7 +2488,7 @@ var DemoRoomDetail = ({
|
|
|
2462
2488
|
rel: "noopener noreferrer",
|
|
2463
2489
|
className: "inline-flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700 mt-1 underline",
|
|
2464
2490
|
children: [
|
|
2465
|
-
|
|
2491
|
+
pageData.openInGoogleMaps,
|
|
2466
2492
|
/* @__PURE__ */ jsx(
|
|
2467
2493
|
"svg",
|
|
2468
2494
|
{
|
|
@@ -2548,7 +2574,7 @@ var DemoRoomDetail = ({
|
|
|
2548
2574
|
]
|
|
2549
2575
|
}
|
|
2550
2576
|
) }),
|
|
2551
|
-
/* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm", children:
|
|
2577
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm", children: pageData.demoRoomImages })
|
|
2552
2578
|
] }) }) })
|
|
2553
2579
|
] }) });
|
|
2554
2580
|
};
|
|
@@ -2567,6 +2593,10 @@ var BookingForm = ({
|
|
|
2567
2593
|
() => createDemoRoomApi(apiConfig),
|
|
2568
2594
|
[apiConfig]
|
|
2569
2595
|
);
|
|
2596
|
+
const dateTimePickerPageData = useMemo(() => ({
|
|
2597
|
+
...pageData?.dateTimePicker,
|
|
2598
|
+
...pageData?.questionnaireForm
|
|
2599
|
+
}), [pageData?.dateTimePicker, pageData?.questionnaireForm]);
|
|
2570
2600
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2571
2601
|
/* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsx(
|
|
2572
2602
|
DemoRoomDetail,
|
|
@@ -2574,7 +2604,8 @@ var BookingForm = ({
|
|
|
2574
2604
|
className: cn("mt-8", layoutClassName),
|
|
2575
2605
|
apiClient,
|
|
2576
2606
|
demoRoomCode,
|
|
2577
|
-
locale: apiConfig.locale
|
|
2607
|
+
locale: apiConfig.locale,
|
|
2608
|
+
pageData: pageData?.demoRoomDetail
|
|
2578
2609
|
}
|
|
2579
2610
|
) }),
|
|
2580
2611
|
/* @__PURE__ */ jsx("div", { className: "bg-[#f5f5f5]", children: /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
|
|
@@ -2585,7 +2616,7 @@ var BookingForm = ({
|
|
|
2585
2616
|
timezone,
|
|
2586
2617
|
locale: apiConfig.locale,
|
|
2587
2618
|
onBookingSuccess: handleBookingSuccess,
|
|
2588
|
-
pageData
|
|
2619
|
+
pageData: dateTimePickerPageData
|
|
2589
2620
|
}
|
|
2590
2621
|
) }) })
|
|
2591
2622
|
] });
|
|
@@ -2597,7 +2628,28 @@ var BookingSuccess = ({
|
|
|
2597
2628
|
apiConfig,
|
|
2598
2629
|
onScheduleAgain,
|
|
2599
2630
|
onCancelSuccess,
|
|
2600
|
-
className
|
|
2631
|
+
className,
|
|
2632
|
+
pageData = {
|
|
2633
|
+
yourAppointment: "Your Appointment",
|
|
2634
|
+
appointmentCanceled: "This appointment has been canceled.",
|
|
2635
|
+
scheduleAgain: "Schedule again",
|
|
2636
|
+
location: "Location",
|
|
2637
|
+
openInGoogleMaps: "Open in Google Maps \u2197",
|
|
2638
|
+
dateAndTime: "Date and Time",
|
|
2639
|
+
event: "Event",
|
|
2640
|
+
demoRoom: "Demo Room",
|
|
2641
|
+
visitorInfo: "Visitor Info",
|
|
2642
|
+
noPhoneProvided: "No phone provided",
|
|
2643
|
+
cancelAppointment: "Cancel Appointment",
|
|
2644
|
+
cancelDialog: {
|
|
2645
|
+
title: "Are you sure you want to cancel?",
|
|
2646
|
+
description: "You won't be able to restore the schedule.",
|
|
2647
|
+
backButton: "Back",
|
|
2648
|
+
confirmButton: "Cancel Appointment",
|
|
2649
|
+
canceling: "Canceling..."
|
|
2650
|
+
},
|
|
2651
|
+
cancelError: "Failed to cancel appointment. Please try again."
|
|
2652
|
+
}
|
|
2601
2653
|
}) => {
|
|
2602
2654
|
const [bookingData, setBookingData] = useState(
|
|
2603
2655
|
initialBookingData || null
|
|
@@ -2627,7 +2679,7 @@ var BookingSuccess = ({
|
|
|
2627
2679
|
}, [token, apiConfig, initialBookingData]);
|
|
2628
2680
|
const handleCancelAppointment = async () => {
|
|
2629
2681
|
if (!token || !apiConfig) {
|
|
2630
|
-
setCancelError("Unable to cancel: Missing token or API configuration");
|
|
2682
|
+
setCancelError(pageData.cancelError || "Unable to cancel: Missing token or API configuration");
|
|
2631
2683
|
return;
|
|
2632
2684
|
}
|
|
2633
2685
|
setCancelLoading(true);
|
|
@@ -2648,7 +2700,7 @@ var BookingSuccess = ({
|
|
|
2648
2700
|
}
|
|
2649
2701
|
} catch (err) {
|
|
2650
2702
|
console.error("Failed to cancel booking:", err);
|
|
2651
|
-
setCancelError("Failed to cancel appointment. Please try again.");
|
|
2703
|
+
setCancelError(pageData.cancelError || "Failed to cancel appointment. Please try again.");
|
|
2652
2704
|
} finally {
|
|
2653
2705
|
setCancelLoading(false);
|
|
2654
2706
|
}
|
|
@@ -2668,21 +2720,21 @@ var BookingSuccess = ({
|
|
|
2668
2720
|
return null;
|
|
2669
2721
|
}
|
|
2670
2722
|
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:
|
|
2723
|
+
/* @__PURE__ */ jsx("h1", { className: "text-[40px] font-bold text-gray-900 mb-8", children: pageData.yourAppointment }),
|
|
2672
2724
|
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:
|
|
2725
|
+
/* @__PURE__ */ jsx("p", { className: "text-base text-gray-700", children: pageData.appointmentCanceled }),
|
|
2674
2726
|
onScheduleAgain && /* @__PURE__ */ jsx(
|
|
2675
2727
|
"button",
|
|
2676
2728
|
{
|
|
2677
2729
|
onClick: onScheduleAgain,
|
|
2678
2730
|
className: "px-6 py-3 bg-black text-white rounded-full font-medium hover:bg-gray-800 transition-colors whitespace-nowrap",
|
|
2679
|
-
children:
|
|
2731
|
+
children: pageData.scheduleAgain
|
|
2680
2732
|
}
|
|
2681
2733
|
)
|
|
2682
2734
|
] }),
|
|
2683
2735
|
/* @__PURE__ */ jsxs("div", { className: "space-y-8 bg-white px-[48px] py-[32px] rounded-lg", children: [
|
|
2684
2736
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2685
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2737
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.location }),
|
|
2686
2738
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2687
2739
|
bookingData.demoroom_name && /* @__PURE__ */ jsx("p", { className: "text-base font-medium text-gray-900", children: bookingData.demoroom_name }),
|
|
2688
2740
|
bookingData.address && /* @__PURE__ */ jsx("p", { className: "text-base text-gray-600", children: bookingData.address }),
|
|
@@ -2693,13 +2745,13 @@ var BookingSuccess = ({
|
|
|
2693
2745
|
target: "_blank",
|
|
2694
2746
|
rel: "noopener noreferrer",
|
|
2695
2747
|
className: "inline-flex items-center gap-1 text-base text-blue-600 hover:text-blue-700 hover:underline",
|
|
2696
|
-
children:
|
|
2748
|
+
children: pageData.openInGoogleMaps
|
|
2697
2749
|
}
|
|
2698
2750
|
)
|
|
2699
2751
|
] })
|
|
2700
2752
|
] }),
|
|
2701
2753
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2702
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2754
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.dateAndTime }),
|
|
2703
2755
|
/* @__PURE__ */ jsxs("p", { className: "text-base text-gray-900", children: [
|
|
2704
2756
|
bookingData.booking_date,
|
|
2705
2757
|
bookingData.time_slot && `, ${bookingData.time_slot}`,
|
|
@@ -2707,15 +2759,15 @@ var BookingSuccess = ({
|
|
|
2707
2759
|
] })
|
|
2708
2760
|
] }),
|
|
2709
2761
|
bookingData.equipment && /* @__PURE__ */ jsxs("div", { children: [
|
|
2710
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2762
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.event }),
|
|
2711
2763
|
/* @__PURE__ */ jsx("p", { className: "text-base text-gray-900", children: bookingData.equipment })
|
|
2712
2764
|
] }),
|
|
2713
2765
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2714
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2766
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.demoRoom }),
|
|
2715
2767
|
/* @__PURE__ */ jsx("p", { className: "text-base text-gray-900", children: bookingData.demoroom_code })
|
|
2716
2768
|
] }),
|
|
2717
2769
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2718
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children:
|
|
2770
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: pageData.visitorInfo }),
|
|
2719
2771
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2720
2772
|
/* @__PURE__ */ jsx("p", { className: "text-base text-gray-900", children: bookingData.customer_name }),
|
|
2721
2773
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-base text-gray-600", children: [
|
|
@@ -2741,7 +2793,7 @@ var BookingSuccess = ({
|
|
|
2741
2793
|
bookingData.phone_code,
|
|
2742
2794
|
" ",
|
|
2743
2795
|
bookingData.phone_number
|
|
2744
|
-
] }) : /* @__PURE__ */ jsx("span", { children:
|
|
2796
|
+
] }) : /* @__PURE__ */ jsx("span", { children: pageData.noPhoneProvided })
|
|
2745
2797
|
] }),
|
|
2746
2798
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-base text-gray-600", children: [
|
|
2747
2799
|
/* @__PURE__ */ jsx(
|
|
@@ -2774,7 +2826,7 @@ var BookingSuccess = ({
|
|
|
2774
2826
|
onClick: () => setShowCancelDialog(true),
|
|
2775
2827
|
disabled: cancelLoading,
|
|
2776
2828
|
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:
|
|
2829
|
+
children: pageData.cancelAppointment
|
|
2778
2830
|
}
|
|
2779
2831
|
),
|
|
2780
2832
|
cancelError && /* @__PURE__ */ jsx("p", { className: "text-sm mt-2", style: { color: "#FF4D4D" }, children: cancelError })
|
|
@@ -2830,8 +2882,8 @@ var BookingSuccess = ({
|
|
|
2830
2882
|
}
|
|
2831
2883
|
) }) }),
|
|
2832
2884
|
/* @__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:
|
|
2885
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[18px] font-semibold text-gray-900 mb-2", children: pageData.cancelDialog?.title }),
|
|
2886
|
+
/* @__PURE__ */ jsx("p", { className: "text-[14px] text-gray-600", children: pageData.cancelDialog?.description })
|
|
2835
2887
|
] }),
|
|
2836
2888
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-3 justify-center", children: [
|
|
2837
2889
|
/* @__PURE__ */ jsx(
|
|
@@ -2840,7 +2892,7 @@ var BookingSuccess = ({
|
|
|
2840
2892
|
onClick: () => setShowCancelDialog(false),
|
|
2841
2893
|
disabled: cancelLoading,
|
|
2842
2894
|
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:
|
|
2895
|
+
children: pageData.cancelDialog?.backButton
|
|
2844
2896
|
}
|
|
2845
2897
|
),
|
|
2846
2898
|
/* @__PURE__ */ jsx(
|
|
@@ -2880,8 +2932,8 @@ var BookingSuccess = ({
|
|
|
2880
2932
|
]
|
|
2881
2933
|
}
|
|
2882
2934
|
),
|
|
2883
|
-
|
|
2884
|
-
] }) :
|
|
2935
|
+
pageData.cancelDialog?.canceling
|
|
2936
|
+
] }) : pageData.cancelDialog?.confirmButton
|
|
2885
2937
|
}
|
|
2886
2938
|
)
|
|
2887
2939
|
] })
|