@anker-in/ui 0.3.3 → 0.3.4
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/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +116 -80
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +116 -80
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -10914,7 +10914,6 @@ var QuestionnaireForm2 = ({
|
|
|
10914
10914
|
return true;
|
|
10915
10915
|
});
|
|
10916
10916
|
}, [questions, hasBookedBefore]);
|
|
10917
|
-
console.log(error, pageData);
|
|
10918
10917
|
React15.useEffect(() => {
|
|
10919
10918
|
if (hasBookedBeforeInitialized.current) return;
|
|
10920
10919
|
if (hasBookedBeforeQuestion && hasBookedBeforeQuestionId) {
|
|
@@ -10987,7 +10986,7 @@ var QuestionnaireForm2 = ({
|
|
|
10987
10986
|
if (!emailRegex.test(value)) {
|
|
10988
10987
|
setErrors((prev) => ({
|
|
10989
10988
|
...prev,
|
|
10990
|
-
[questionId]: "Please enter a valid email address"
|
|
10989
|
+
[questionId]: pageData?.emailValidError || "Please enter a valid email address"
|
|
10991
10990
|
}));
|
|
10992
10991
|
}
|
|
10993
10992
|
};
|
|
@@ -11025,7 +11024,7 @@ var QuestionnaireForm2 = ({
|
|
|
11025
11024
|
const questionId = getQuestionId(question);
|
|
11026
11025
|
const value = responses[questionId];
|
|
11027
11026
|
if (!value || Array.isArray(value) && value.length === 0) {
|
|
11028
|
-
newErrors[questionId] = "This field is required";
|
|
11027
|
+
newErrors[questionId] = pageData?.fieldRuquired || "This field is required";
|
|
11029
11028
|
}
|
|
11030
11029
|
}
|
|
11031
11030
|
});
|
|
@@ -11036,7 +11035,7 @@ var QuestionnaireForm2 = ({
|
|
|
11036
11035
|
);
|
|
11037
11036
|
if (!allAgreed) {
|
|
11038
11037
|
setAgreementError(
|
|
11039
|
-
"Please agree to all terms and conditions to continue"
|
|
11038
|
+
pageData?.agreeRuquired || "Please agree to all terms and conditions to continue"
|
|
11040
11039
|
);
|
|
11041
11040
|
setErrors(newErrors);
|
|
11042
11041
|
return false;
|
|
@@ -11522,6 +11521,25 @@ var DateTimePicker2 = ({
|
|
|
11522
11521
|
});
|
|
11523
11522
|
return dates;
|
|
11524
11523
|
}, [timeslotsData, demoRoom?.timezone, timezone5]);
|
|
11524
|
+
React15.useEffect(() => {
|
|
11525
|
+
if (booking || isInitialized || !demoRoom?.timeslots?.length) return;
|
|
11526
|
+
const tz = demoRoom?.timezone || timezone5;
|
|
11527
|
+
const now2 = tz ? dayjs4__default.default().tz(tz) : dayjs4__default.default();
|
|
11528
|
+
const nearestSlot = demoRoom.timeslots.filter((slot) => {
|
|
11529
|
+
const slotTime = tz ? dayjs4__default.default(slot.start_time).tz(tz) : dayjs4__default.default(slot.start_time);
|
|
11530
|
+
return slot.status === "available" && slotTime.isAfter(now2);
|
|
11531
|
+
}).sort((a, b) => {
|
|
11532
|
+
const timeA = tz ? dayjs4__default.default(a.start_time).tz(tz) : dayjs4__default.default(a.start_time);
|
|
11533
|
+
const timeB = tz ? dayjs4__default.default(b.start_time).tz(tz) : dayjs4__default.default(b.start_time);
|
|
11534
|
+
return timeA.unix() - timeB.unix();
|
|
11535
|
+
})[0];
|
|
11536
|
+
if (!nearestSlot) return;
|
|
11537
|
+
const nearestDate = tz ? dayjs4__default.default(nearestSlot.start_time).tz(tz) : dayjs4__default.default(nearestSlot.start_time);
|
|
11538
|
+
setSelectedDate(nearestDate);
|
|
11539
|
+
setCalendarValue(nearestDate);
|
|
11540
|
+
setSelectedTimeslotId(nearestSlot.id);
|
|
11541
|
+
setIsInitialized(true);
|
|
11542
|
+
}, [booking, isInitialized, demoRoom?.timeslots, demoRoom?.timezone, timezone5]);
|
|
11525
11543
|
React15.useEffect(() => {
|
|
11526
11544
|
if (!timeslotsData?.timeslots || isInitialized) return;
|
|
11527
11545
|
const tz = demoRoom?.timezone || timezone5;
|
|
@@ -12521,6 +12539,9 @@ var BookingFormO2O = ({
|
|
|
12521
12539
|
const [selectedPurposeType, setSelectedPurposeType] = React15.useState(
|
|
12522
12540
|
() => initialBusinessType || purposeOptions[0]?.type || ""
|
|
12523
12541
|
);
|
|
12542
|
+
const [isPurposeConfirmed, setIsPurposeConfirmed] = React15.useState(
|
|
12543
|
+
() => !!initialBusinessType && purposeOptions.some((item) => item.type === initialBusinessType)
|
|
12544
|
+
);
|
|
12524
12545
|
React15.useEffect(() => {
|
|
12525
12546
|
setSelectedPurposeType((currentType) => {
|
|
12526
12547
|
if (purposeOptions.some((item) => item.type === currentType)) {
|
|
@@ -12534,11 +12555,16 @@ var BookingFormO2O = ({
|
|
|
12534
12555
|
}
|
|
12535
12556
|
return purposeOptions[0]?.type || "";
|
|
12536
12557
|
});
|
|
12558
|
+
const resolvedFromExplicitSource = !!initialBusinessType && purposeOptions.some((item) => item.type === initialBusinessType) || !!booking?.business_type && purposeOptions.some((item) => item.type === booking.business_type);
|
|
12559
|
+
if (resolvedFromExplicitSource) {
|
|
12560
|
+
setIsPurposeConfirmed(true);
|
|
12561
|
+
}
|
|
12537
12562
|
}, [purposeOptions, initialBusinessType, booking?.business_type]);
|
|
12538
12563
|
const selectedPurpose = React15.useMemo(() => {
|
|
12539
|
-
return purposeOptions.find((item) => item.type === selectedPurposeType) ||
|
|
12564
|
+
return purposeOptions.find((item) => item.type === selectedPurposeType) || {};
|
|
12540
12565
|
}, [purposeOptions, selectedPurposeType]);
|
|
12541
|
-
const
|
|
12566
|
+
const isPodSelected = isPurposeConfirmed && selectedPurpose?.type === "pod";
|
|
12567
|
+
const selectedPodContent = isPodSelected ? selectedPurpose?.podContent : void 0;
|
|
12542
12568
|
const selectedPodDescription = getPodContentDescription(selectedPodContent);
|
|
12543
12569
|
const podDesignId = React15.useMemo(() => getQueryParam("design_id"), []);
|
|
12544
12570
|
const isPodDesignEditMode = !!podDesignId || !!booking?.design_project_id;
|
|
@@ -12620,85 +12646,95 @@ var BookingFormO2O = ({
|
|
|
12620
12646
|
}
|
|
12621
12647
|
) }),
|
|
12622
12648
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-[#f5f5f5]", children: [
|
|
12623
|
-
!!purposeOptions.length && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("py-[40px] l:py-[24px]", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12624
|
-
|
|
12625
|
-
|
|
12626
|
-
|
|
12627
|
-
|
|
12628
|
-
|
|
12629
|
-
className: "block text-[16px] font-bold text-[#080A0F] l:text-[14px]",
|
|
12630
|
-
children: getPurposeLabel(pageData)
|
|
12631
|
-
}
|
|
12632
|
-
),
|
|
12633
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative mt-[14px]", children: [
|
|
12634
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12635
|
-
"select",
|
|
12636
|
-
{
|
|
12637
|
-
id: "booking-purpose-select",
|
|
12638
|
-
value: selectedPurpose?.type || "",
|
|
12639
|
-
onChange: (event2) => {
|
|
12640
|
-
setSelectedPurposeType(event2.target.value);
|
|
12641
|
-
},
|
|
12642
|
-
disabled: !!token,
|
|
12643
|
-
className: cn(
|
|
12644
|
-
"h-[48px] w-full appearance-none rounded-[8px] border border-[#D9DCE1] bg-white px-[16px] pr-[48px] text-[16px] font-medium text-[#2A2C32] outline-none transition-colors focus:border-[#080A0F] focus:ring-2 focus:ring-[#3ADB67]/30 l:text-[14px]",
|
|
12645
|
-
token && "pointer-events-none cursor-not-allowed opacity-50"
|
|
12646
|
-
),
|
|
12647
|
-
children: purposeOptions.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
12648
|
-
"option",
|
|
12649
|
-
{
|
|
12650
|
-
value: item.type || "",
|
|
12651
|
-
children: item.label || item.type
|
|
12652
|
-
},
|
|
12653
|
-
`${item.type || item.label || "purpose"}-${index}`
|
|
12654
|
-
))
|
|
12655
|
-
}
|
|
12656
|
-
),
|
|
12657
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute right-[14px] top-1/2 flex -translate-y-1/2 text-[#080A0F]", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon2, {}) })
|
|
12658
|
-
] }),
|
|
12659
|
-
!!selectedPurpose?.purposeNote && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-[16px] max-w-[720px] text-[14px] font-medium leading-[1.35] text-[#080A0F] l:text-[13px]", children: selectedPurpose.purposeNote })
|
|
12660
|
-
] }),
|
|
12661
|
-
selectedPurpose?.type === "pod" && !!selectedPodContent && /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "rounded-[16px] bg-white px-[28px] py-[20px] l:px-[16px] l:py-[20px]", children: [
|
|
12662
|
-
!!selectedPodContent.title && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-[16px] font-bold text-[#080A0F] l:text-[14px]", children: selectedPodContent.title }),
|
|
12663
|
-
!!selectedPodDescription && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-[6px] text-[13px] font-medium leading-[1.35] text-[#080A0F] l:text-[12px]", children: selectedPodDescription }),
|
|
12664
|
-
!!selectedPodImage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12665
|
-
"img",
|
|
12666
|
-
{
|
|
12667
|
-
src: selectedPodImage,
|
|
12668
|
-
alt: selectedPodContent.imageAlt || selectedPodContent.title || "",
|
|
12669
|
-
className: "mt-[12px] h-[220px] rounded-[8px] object-cover l:h-auto"
|
|
12670
|
-
}
|
|
12649
|
+
!!purposeOptions.length && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("py-[40px] l:py-[24px]", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12650
|
+
"div",
|
|
12651
|
+
{
|
|
12652
|
+
className: cn(
|
|
12653
|
+
"grid gap-[16px] l:grid-cols-1",
|
|
12654
|
+
isPodSelected && "grid-cols-2"
|
|
12671
12655
|
),
|
|
12672
|
-
|
|
12673
|
-
"
|
|
12674
|
-
|
|
12675
|
-
|
|
12676
|
-
|
|
12677
|
-
|
|
12678
|
-
|
|
12679
|
-
|
|
12680
|
-
|
|
12681
|
-
rel: "noopener noreferrer",
|
|
12682
|
-
className: cn(
|
|
12683
|
-
"mt-[12px] inline-flex h-[42px] items-center justify-center gap-[6px] rounded-full bg-[#080A0F] px-[24px] text-[14px] font-bold text-white transition-colors hover:bg-[#2A2C32]",
|
|
12684
|
-
isPodButtonDisabled && "pointer-events-none cursor-not-allowed opacity-50"
|
|
12656
|
+
children: [
|
|
12657
|
+
/* @__PURE__ */ jsxRuntime.jsxs("section", { className: "rounded-[16px] bg-white px-[28px] py-[24px] l:px-[16px] l:py-[20px]", children: [
|
|
12658
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12659
|
+
"label",
|
|
12660
|
+
{
|
|
12661
|
+
htmlFor: "booking-purpose-select",
|
|
12662
|
+
className: "block text-[16px] font-bold text-[#080A0F] l:text-[14px]",
|
|
12663
|
+
children: getPurposeLabel(pageData)
|
|
12664
|
+
}
|
|
12685
12665
|
),
|
|
12686
|
-
children: [
|
|
12687
|
-
|
|
12688
|
-
"
|
|
12666
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative mt-[14px]", children: [
|
|
12667
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12668
|
+
"select",
|
|
12689
12669
|
{
|
|
12690
|
-
|
|
12691
|
-
|
|
12692
|
-
|
|
12693
|
-
|
|
12670
|
+
id: "booking-purpose-select",
|
|
12671
|
+
value: selectedPurpose?.type || "",
|
|
12672
|
+
onChange: (event2) => {
|
|
12673
|
+
setSelectedPurposeType(event2.target.value);
|
|
12674
|
+
setIsPurposeConfirmed(true);
|
|
12675
|
+
},
|
|
12676
|
+
disabled: !!token,
|
|
12677
|
+
className: cn(
|
|
12678
|
+
"h-[48px] w-full appearance-none rounded-[8px] border border-[#D9DCE1] bg-white px-[16px] pr-[48px] text-[16px] font-medium text-[#2A2C32] outline-none transition-colors focus:border-[#080A0F] focus:ring-2 focus:ring-[#3ADB67]/30 l:text-[14px]",
|
|
12679
|
+
token && "pointer-events-none cursor-not-allowed opacity-50"
|
|
12680
|
+
),
|
|
12681
|
+
children: purposeOptions.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
12682
|
+
"option",
|
|
12683
|
+
{
|
|
12684
|
+
value: item.type || "",
|
|
12685
|
+
children: item.label || item.type
|
|
12686
|
+
},
|
|
12687
|
+
`${item.type || item.label || "purpose"}-${index}`
|
|
12688
|
+
))
|
|
12694
12689
|
}
|
|
12695
12690
|
),
|
|
12696
|
-
|
|
12697
|
-
]
|
|
12698
|
-
|
|
12699
|
-
|
|
12700
|
-
|
|
12701
|
-
|
|
12691
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute right-[14px] top-1/2 flex -translate-y-1/2 text-[#080A0F]", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon2, {}) })
|
|
12692
|
+
] }),
|
|
12693
|
+
!!selectedPurpose?.purposeNote && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-[16px] max-w-[720px] text-[14px] font-medium leading-[1.35] text-[#080A0F] l:text-[13px]", children: selectedPurpose.purposeNote })
|
|
12694
|
+
] }),
|
|
12695
|
+
isPodSelected && !!selectedPodContent && /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "rounded-[16px] bg-white px-[28px] py-[20px] l:px-[16px] l:py-[20px]", children: [
|
|
12696
|
+
!!selectedPodContent.title && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-[16px] font-bold text-[#080A0F] l:text-[14px]", children: selectedPodContent.title }),
|
|
12697
|
+
!!selectedPodDescription && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-[6px] text-[13px] font-medium leading-[1.35] text-[#080A0F] l:text-[12px]", children: selectedPodDescription }),
|
|
12698
|
+
!!selectedPodImage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12699
|
+
"img",
|
|
12700
|
+
{
|
|
12701
|
+
src: selectedPodImage,
|
|
12702
|
+
alt: selectedPodContent.imageAlt || selectedPodContent.title || "",
|
|
12703
|
+
className: "mt-[12px] h-[220px] rounded-[8px] object-cover l:h-auto"
|
|
12704
|
+
}
|
|
12705
|
+
),
|
|
12706
|
+
!!selectedPodButtonText && (booking?.print_status === "unprinted" && booking?.design_project_id || !token) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12707
|
+
"a",
|
|
12708
|
+
{
|
|
12709
|
+
href: selectedPodButtonLink || "#",
|
|
12710
|
+
"aria-disabled": isPodButtonDisabled,
|
|
12711
|
+
tabIndex: isPodButtonDisabled ? -1 : void 0,
|
|
12712
|
+
onClick: (event2) => {
|
|
12713
|
+
if (isPodButtonDisabled) event2.preventDefault();
|
|
12714
|
+
},
|
|
12715
|
+
rel: "noopener noreferrer",
|
|
12716
|
+
className: cn(
|
|
12717
|
+
"mt-[12px] inline-flex h-[42px] items-center justify-center gap-[6px] rounded-full bg-[#080A0F] px-[24px] text-[14px] font-bold text-white transition-colors hover:bg-[#2A2C32]",
|
|
12718
|
+
isPodButtonDisabled && "pointer-events-none cursor-not-allowed opacity-50"
|
|
12719
|
+
),
|
|
12720
|
+
children: [
|
|
12721
|
+
selectedPodButtonIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12722
|
+
"img",
|
|
12723
|
+
{
|
|
12724
|
+
src: selectedPodButtonIcon,
|
|
12725
|
+
alt: "",
|
|
12726
|
+
className: "h-[16px] w-[16px]",
|
|
12727
|
+
"aria-hidden": "true"
|
|
12728
|
+
}
|
|
12729
|
+
),
|
|
12730
|
+
selectedPodButtonText
|
|
12731
|
+
]
|
|
12732
|
+
}
|
|
12733
|
+
)
|
|
12734
|
+
] })
|
|
12735
|
+
]
|
|
12736
|
+
}
|
|
12737
|
+
) }),
|
|
12702
12738
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12703
12739
|
DateTimePicker_default2,
|
|
12704
12740
|
{
|