@anker-in/ui 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/demo-room.js +23 -1
- package/dist/demo-room.js.map +1 -1
- package/dist/demo-room.mjs +20 -1
- package/dist/demo-room.mjs.map +1 -1
- package/dist/index.js +64 -48
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,26 +8,26 @@ var IndexBar = require('antd-mobile/es/components/index-bar');
|
|
|
8
8
|
var List = require('antd-mobile/es/components/list');
|
|
9
9
|
require('antd-mobile/es/components/index-bar/index-bar.css');
|
|
10
10
|
require('antd-mobile/es/components/list/list.css');
|
|
11
|
-
var
|
|
11
|
+
var dayjs2 = require('dayjs');
|
|
12
|
+
var utc = require('dayjs/plugin/utc');
|
|
13
|
+
var timezone = require('dayjs/plugin/timezone');
|
|
12
14
|
require('dayjs/locale/zh-cn');
|
|
13
15
|
var antd = require('antd');
|
|
14
16
|
var dayLocaleData = require('dayjs/plugin/localeData');
|
|
15
17
|
var weekday = require('dayjs/plugin/weekday');
|
|
16
18
|
var weekOfYear = require('dayjs/plugin/weekOfYear');
|
|
17
|
-
var timezone = require('dayjs/plugin/timezone');
|
|
18
|
-
var utc = require('dayjs/plugin/utc');
|
|
19
19
|
|
|
20
20
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
21
|
|
|
22
22
|
var React9__default = /*#__PURE__*/_interopDefault(React9);
|
|
23
23
|
var IndexBar__default = /*#__PURE__*/_interopDefault(IndexBar);
|
|
24
24
|
var List__default = /*#__PURE__*/_interopDefault(List);
|
|
25
|
-
var
|
|
25
|
+
var dayjs2__default = /*#__PURE__*/_interopDefault(dayjs2);
|
|
26
|
+
var utc__default = /*#__PURE__*/_interopDefault(utc);
|
|
27
|
+
var timezone__default = /*#__PURE__*/_interopDefault(timezone);
|
|
26
28
|
var dayLocaleData__default = /*#__PURE__*/_interopDefault(dayLocaleData);
|
|
27
29
|
var weekday__default = /*#__PURE__*/_interopDefault(weekday);
|
|
28
30
|
var weekOfYear__default = /*#__PURE__*/_interopDefault(weekOfYear);
|
|
29
|
-
var timezone__default = /*#__PURE__*/_interopDefault(timezone);
|
|
30
|
-
var utc__default = /*#__PURE__*/_interopDefault(utc);
|
|
31
31
|
|
|
32
32
|
function cn(...inputs) {
|
|
33
33
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
@@ -1117,6 +1117,8 @@ var LocationFilter = ({
|
|
|
1117
1117
|
);
|
|
1118
1118
|
};
|
|
1119
1119
|
LocationFilter.displayName = "LocationFilter";
|
|
1120
|
+
dayjs2__default.default.extend(utc__default.default);
|
|
1121
|
+
dayjs2__default.default.extend(timezone__default.default);
|
|
1120
1122
|
var defaultPageData = {
|
|
1121
1123
|
title: "Find a Studio Near You",
|
|
1122
1124
|
loadingText: "Loading demo rooms...",
|
|
@@ -1296,6 +1298,20 @@ var RoomsList = ({
|
|
|
1296
1298
|
const city = room.location?.city || "";
|
|
1297
1299
|
const addressParts = [room.address, city, state, country].filter(Boolean);
|
|
1298
1300
|
const fullAddress = addressParts.join(", ");
|
|
1301
|
+
let formattedTime = mergedPageData.noAvailableTime;
|
|
1302
|
+
if (nextAvailableTimeslot) {
|
|
1303
|
+
try {
|
|
1304
|
+
const timeInZone = dayjs2__default.default(nextAvailableTimeslot.start_time).tz(
|
|
1305
|
+
room.timezone || "America/Los_Angeles"
|
|
1306
|
+
);
|
|
1307
|
+
const month = timeInZone.format("MMM");
|
|
1308
|
+
const day = timeInZone.format("D");
|
|
1309
|
+
const time = timeInZone.format("h:mm A");
|
|
1310
|
+
formattedTime = `${month}.${day}, ${time}`;
|
|
1311
|
+
} catch (error2) {
|
|
1312
|
+
formattedTime = nextAvailableTimeslot.start_time;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1299
1315
|
return {
|
|
1300
1316
|
id: room.code,
|
|
1301
1317
|
name: room.name,
|
|
@@ -1306,7 +1322,7 @@ var RoomsList = ({
|
|
|
1306
1322
|
country,
|
|
1307
1323
|
lat: Number(room.latitude) || 0,
|
|
1308
1324
|
lng: Number(room.longitude) || 0,
|
|
1309
|
-
availableTime:
|
|
1325
|
+
availableTime: formattedTime,
|
|
1310
1326
|
euifyMakeModel: room?.equipment?.join(", ") || ""
|
|
1311
1327
|
};
|
|
1312
1328
|
});
|
|
@@ -2089,7 +2105,7 @@ var QuestionnaireForm = ({
|
|
|
2089
2105
|
}) });
|
|
2090
2106
|
case "select": {
|
|
2091
2107
|
const currentValue = responses[questionId];
|
|
2092
|
-
const hasOnlyOneOption = question
|
|
2108
|
+
const hasOnlyOneOption = !!question?.options?.length;
|
|
2093
2109
|
const defaultValue = hasOnlyOneOption && !currentValue && question.options?.[0] ? question.options[0].value || question.options[0].label : currentValue || "";
|
|
2094
2110
|
if (hasOnlyOneOption && !currentValue && question.options?.[0]) {
|
|
2095
2111
|
handleChange(questionId, defaultValue);
|
|
@@ -2215,15 +2231,15 @@ var QuestionnaireForm = ({
|
|
|
2215
2231
|
] })
|
|
2216
2232
|
] });
|
|
2217
2233
|
};
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2234
|
+
dayjs2__default.default.extend(dayLocaleData__default.default);
|
|
2235
|
+
dayjs2__default.default.extend(weekday__default.default);
|
|
2236
|
+
dayjs2__default.default.extend(weekOfYear__default.default);
|
|
2237
|
+
dayjs2__default.default.extend(utc__default.default);
|
|
2238
|
+
dayjs2__default.default.extend(timezone__default.default);
|
|
2223
2239
|
var DateTimePicker = ({
|
|
2224
2240
|
apiClient,
|
|
2225
2241
|
demoRoomCode,
|
|
2226
|
-
timezone:
|
|
2242
|
+
timezone: timezone3,
|
|
2227
2243
|
pageData = {
|
|
2228
2244
|
scheduleYourVisit: "Schedule Your Visit",
|
|
2229
2245
|
timeSlot: "Time Slot",
|
|
@@ -2242,7 +2258,7 @@ var DateTimePicker = ({
|
|
|
2242
2258
|
}) => {
|
|
2243
2259
|
const { token } = antd.theme.useToken();
|
|
2244
2260
|
const [selectedDate, setSelectedDate] = React9.useState(null);
|
|
2245
|
-
const [calendarValue, setCalendarValue] = React9.useState(
|
|
2261
|
+
const [calendarValue, setCalendarValue] = React9.useState(dayjs2__default.default());
|
|
2246
2262
|
const [selectedTimeslotId, setSelectedTimeslotId] = React9.useState(
|
|
2247
2263
|
null
|
|
2248
2264
|
);
|
|
@@ -2277,47 +2293,47 @@ var DateTimePicker = ({
|
|
|
2277
2293
|
{
|
|
2278
2294
|
start_date: startDate,
|
|
2279
2295
|
end_date: endDate,
|
|
2280
|
-
timezone:
|
|
2296
|
+
timezone: timezone3
|
|
2281
2297
|
},
|
|
2282
2298
|
{ enabled: !!demoRoomCode }
|
|
2283
2299
|
);
|
|
2284
2300
|
const dayTimeslots = React9.useMemo(() => {
|
|
2285
2301
|
if (!timeslotsData?.timeslots || !selectedDate) return [];
|
|
2286
|
-
const tz = demoRoom?.timezone ||
|
|
2302
|
+
const tz = demoRoom?.timezone || timezone3;
|
|
2287
2303
|
const selectedDateStr = selectedDate.format("YYYY-MM-DD");
|
|
2288
2304
|
return timeslotsData.timeslots.filter((slot) => {
|
|
2289
|
-
const slotDate = tz ?
|
|
2305
|
+
const slotDate = tz ? dayjs2__default.default(slot.start_time).tz(tz).format("YYYY-MM-DD") : dayjs2__default.default(slot.start_time).format("YYYY-MM-DD");
|
|
2290
2306
|
return slotDate === selectedDateStr;
|
|
2291
2307
|
});
|
|
2292
|
-
}, [timeslotsData, selectedDate, demoRoom?.timezone,
|
|
2308
|
+
}, [timeslotsData, selectedDate, demoRoom?.timezone, timezone3]);
|
|
2293
2309
|
const availableDates = React9.useMemo(() => {
|
|
2294
2310
|
if (!timeslotsData?.timeslots) return /* @__PURE__ */ new Set();
|
|
2295
|
-
const tz = demoRoom?.timezone ||
|
|
2311
|
+
const tz = demoRoom?.timezone || timezone3;
|
|
2296
2312
|
const dates = /* @__PURE__ */ new Set();
|
|
2297
2313
|
timeslotsData.timeslots.forEach((slot) => {
|
|
2298
2314
|
if (slot.status === "available") {
|
|
2299
|
-
const dateStr = tz ?
|
|
2315
|
+
const dateStr = tz ? dayjs2__default.default(slot.start_time).tz(tz).format("YYYY-MM-DD") : dayjs2__default.default(slot.start_time).format("YYYY-MM-DD");
|
|
2300
2316
|
dates.add(dateStr);
|
|
2301
2317
|
}
|
|
2302
2318
|
});
|
|
2303
2319
|
return dates;
|
|
2304
|
-
}, [timeslotsData, demoRoom?.timezone,
|
|
2320
|
+
}, [timeslotsData, demoRoom?.timezone, timezone3]);
|
|
2305
2321
|
React9.useEffect(() => {
|
|
2306
2322
|
if (!timeslotsData?.timeslots || isInitialized) return;
|
|
2307
|
-
const tz = demoRoom?.timezone ||
|
|
2308
|
-
const now2 = tz ?
|
|
2323
|
+
const tz = demoRoom?.timezone || timezone3;
|
|
2324
|
+
const now2 = tz ? dayjs2__default.default().tz(tz) : dayjs2__default.default();
|
|
2309
2325
|
const availableTimeslots = timeslotsData.timeslots.filter((slot) => {
|
|
2310
|
-
const slotTime = tz ?
|
|
2326
|
+
const slotTime = tz ? dayjs2__default.default(slot.start_time).tz(tz) : dayjs2__default.default(slot.start_time);
|
|
2311
2327
|
return slot.status === "available" && slotTime.isAfter(now2);
|
|
2312
2328
|
});
|
|
2313
2329
|
if (availableTimeslots.length > 0) {
|
|
2314
2330
|
const sortedSlots = [...availableTimeslots].sort((a, b) => {
|
|
2315
|
-
const timeA = tz ?
|
|
2316
|
-
const timeB = tz ?
|
|
2331
|
+
const timeA = tz ? dayjs2__default.default(a.start_time).tz(tz) : dayjs2__default.default(a.start_time);
|
|
2332
|
+
const timeB = tz ? dayjs2__default.default(b.start_time).tz(tz) : dayjs2__default.default(b.start_time);
|
|
2317
2333
|
return timeA.unix() - timeB.unix();
|
|
2318
2334
|
});
|
|
2319
2335
|
const nearestSlot = sortedSlots[0];
|
|
2320
|
-
const nearestDate = tz ?
|
|
2336
|
+
const nearestDate = tz ? dayjs2__default.default(nearestSlot.start_time).tz(tz) : dayjs2__default.default(nearestSlot.start_time);
|
|
2321
2337
|
setSelectedDate(nearestDate);
|
|
2322
2338
|
setCalendarValue(nearestDate);
|
|
2323
2339
|
setSelectedTimeslotId(nearestSlot.id);
|
|
@@ -2327,28 +2343,28 @@ var DateTimePicker = ({
|
|
|
2327
2343
|
setCalendarValue(now2);
|
|
2328
2344
|
setIsInitialized(true);
|
|
2329
2345
|
}
|
|
2330
|
-
}, [timeslotsData, isInitialized, selectedDate, demoRoom?.timezone,
|
|
2346
|
+
}, [timeslotsData, isInitialized, selectedDate, demoRoom?.timezone, timezone3]);
|
|
2331
2347
|
React9.useEffect(() => {
|
|
2332
2348
|
if (!timeslotsData?.timeslots || !isInitialized) return;
|
|
2333
2349
|
if (selectedDate && selectedDate.isSame(calendarValue, "month")) {
|
|
2334
2350
|
return;
|
|
2335
2351
|
}
|
|
2336
|
-
const tz = demoRoom?.timezone ||
|
|
2352
|
+
const tz = demoRoom?.timezone || timezone3;
|
|
2337
2353
|
const currentMonthStart = calendarValue.startOf("month");
|
|
2338
2354
|
const currentMonthEnd = calendarValue.endOf("month");
|
|
2339
|
-
const now2 = tz ?
|
|
2355
|
+
const now2 = tz ? dayjs2__default.default().tz(tz) : dayjs2__default.default();
|
|
2340
2356
|
const availableTimeslots = timeslotsData.timeslots.filter((slot) => {
|
|
2341
|
-
const slotDate = tz ?
|
|
2357
|
+
const slotDate = tz ? dayjs2__default.default(slot.start_time).tz(tz) : dayjs2__default.default(slot.start_time);
|
|
2342
2358
|
return slot.status === "available" && slotDate.isAfter(now2) && (slotDate.isAfter(currentMonthStart) || slotDate.isSame(currentMonthStart, "day")) && (slotDate.isBefore(currentMonthEnd) || slotDate.isSame(currentMonthEnd, "day"));
|
|
2343
2359
|
});
|
|
2344
2360
|
if (availableTimeslots.length > 0) {
|
|
2345
2361
|
const sortedSlots = [...availableTimeslots].sort((a, b) => {
|
|
2346
|
-
const timeA = tz ?
|
|
2347
|
-
const timeB = tz ?
|
|
2362
|
+
const timeA = tz ? dayjs2__default.default(a.start_time).tz(tz) : dayjs2__default.default(a.start_time);
|
|
2363
|
+
const timeB = tz ? dayjs2__default.default(b.start_time).tz(tz) : dayjs2__default.default(b.start_time);
|
|
2348
2364
|
return timeA.unix() - timeB.unix();
|
|
2349
2365
|
});
|
|
2350
2366
|
const firstSlot = sortedSlots[0];
|
|
2351
|
-
const firstDate = tz ?
|
|
2367
|
+
const firstDate = tz ? dayjs2__default.default(firstSlot.start_time).tz(tz) : dayjs2__default.default(firstSlot.start_time);
|
|
2352
2368
|
setSelectedDate(firstDate);
|
|
2353
2369
|
setSelectedTimeslotId(firstSlot.id);
|
|
2354
2370
|
}
|
|
@@ -2358,12 +2374,12 @@ var DateTimePicker = ({
|
|
|
2358
2374
|
isInitialized,
|
|
2359
2375
|
selectedDate,
|
|
2360
2376
|
demoRoom?.timezone,
|
|
2361
|
-
|
|
2377
|
+
timezone3
|
|
2362
2378
|
]);
|
|
2363
2379
|
const formatTimeslot = (slot) => {
|
|
2364
|
-
const tz = demoRoom?.timezone ||
|
|
2365
|
-
const start = tz ?
|
|
2366
|
-
const end = tz ?
|
|
2380
|
+
const tz = demoRoom?.timezone || timezone3;
|
|
2381
|
+
const start = tz ? dayjs2__default.default(slot.start_time).tz(tz).format("h:mm A") : dayjs2__default.default(slot.start_time).format("h:mm A");
|
|
2382
|
+
const end = tz ? dayjs2__default.default(slot.end_time).tz(tz).format("h:mm A") : dayjs2__default.default(slot.end_time).format("h:mm A");
|
|
2367
2383
|
return `${start} - ${end}`;
|
|
2368
2384
|
};
|
|
2369
2385
|
const wrapperStyle = {
|
|
@@ -2524,16 +2540,16 @@ var DateTimePicker = ({
|
|
|
2524
2540
|
},
|
|
2525
2541
|
disabledDate: (current) => {
|
|
2526
2542
|
if (!current) return false;
|
|
2527
|
-
if (current.isSame(
|
|
2528
|
-
if (current.isBefore(
|
|
2543
|
+
if (current.isSame(dayjs2__default.default(), "day")) return false;
|
|
2544
|
+
if (current.isBefore(dayjs2__default.default(), "day")) return true;
|
|
2529
2545
|
const dateStr = current.format("YYYY-MM-DD");
|
|
2530
2546
|
return !availableDates.has(dateStr);
|
|
2531
2547
|
},
|
|
2532
2548
|
fullCellRender: (date) => {
|
|
2533
2549
|
const isSelected = selectedDate && date.isSame(selectedDate, "day");
|
|
2534
|
-
const isToday = date.isSame(
|
|
2550
|
+
const isToday = date.isSame(dayjs2__default.default(), "day");
|
|
2535
2551
|
const dateStr = date.format("YYYY-MM-DD");
|
|
2536
|
-
const isDisabled = !isToday && (date.isBefore(
|
|
2552
|
+
const isDisabled = !isToday && (date.isBefore(dayjs2__default.default(), "day") || !availableDates.has(dateStr));
|
|
2537
2553
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2538
2554
|
"div",
|
|
2539
2555
|
{
|
|
@@ -2679,13 +2695,13 @@ var DateTimePicker = ({
|
|
|
2679
2695
|
onClick: () => {
|
|
2680
2696
|
if (selectedDate) {
|
|
2681
2697
|
const newDate = selectedDate.subtract(1, "day");
|
|
2682
|
-
if (!newDate.isBefore(
|
|
2698
|
+
if (!newDate.isBefore(dayjs2__default.default(), "day")) {
|
|
2683
2699
|
setSelectedDate(newDate);
|
|
2684
2700
|
setCalendarValue(newDate);
|
|
2685
2701
|
}
|
|
2686
2702
|
}
|
|
2687
2703
|
},
|
|
2688
|
-
disabled: !selectedDate || selectedDate.isSame(
|
|
2704
|
+
disabled: !selectedDate || selectedDate.isSame(dayjs2__default.default(), "day") || selectedDate.isBefore(dayjs2__default.default(), "day"),
|
|
2689
2705
|
className: "w-8 h-8 flex items-center justify-center hover:bg-gray-100 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
2690
2706
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2691
2707
|
"svg",
|
|
@@ -2778,7 +2794,7 @@ var DateTimePicker = ({
|
|
|
2778
2794
|
}) }),
|
|
2779
2795
|
!timeslotsLoading && dayTimeslots?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-[24px] text-[#6d6d6F] text-center", children: pageData?.timezone?.replace(
|
|
2780
2796
|
"{{timezone}}",
|
|
2781
|
-
demoRoom?.timezone ||
|
|
2797
|
+
demoRoom?.timezone || timezone3 || ""
|
|
2782
2798
|
) })
|
|
2783
2799
|
] })
|
|
2784
2800
|
] }),
|
|
@@ -8882,7 +8898,7 @@ var BookingForm = ({
|
|
|
8882
8898
|
apiConfig,
|
|
8883
8899
|
demoRoomCode,
|
|
8884
8900
|
pageData,
|
|
8885
|
-
timezone:
|
|
8901
|
+
timezone: timezone3,
|
|
8886
8902
|
handleBookingSuccess,
|
|
8887
8903
|
onQuestionnaireSubmit,
|
|
8888
8904
|
...props
|
|
@@ -8914,7 +8930,7 @@ var BookingForm = ({
|
|
|
8914
8930
|
{
|
|
8915
8931
|
apiClient,
|
|
8916
8932
|
demoRoomCode,
|
|
8917
|
-
timezone:
|
|
8933
|
+
timezone: timezone3,
|
|
8918
8934
|
locale: apiConfig.locale,
|
|
8919
8935
|
onBookingSuccess: handleBookingSuccess,
|
|
8920
8936
|
onQuestionnaireSubmit,
|