@anker-in/ui 0.3.5 → 0.3.6
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 +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +67 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -730,6 +730,10 @@ interface BookingFormO2OProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
730
730
|
baseUrl: string;
|
|
731
731
|
apiKey: string;
|
|
732
732
|
locale?: string;
|
|
733
|
+
/** MIR 欢迎页语言代码(POD 场景,透传给 buildMirWelcomeUrl 的 language) */
|
|
734
|
+
podLanguage?: string;
|
|
735
|
+
/** MIR 欢迎页国家代码(POD 场景,透传给 buildMirWelcomeUrl 的 countrycode) */
|
|
736
|
+
podCountry?: string;
|
|
733
737
|
};
|
|
734
738
|
/**
|
|
735
739
|
* 门店代码(可选,可以从 URL 参数或 props 传入)
|
package/dist/index.d.ts
CHANGED
|
@@ -730,6 +730,10 @@ interface BookingFormO2OProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
730
730
|
baseUrl: string;
|
|
731
731
|
apiKey: string;
|
|
732
732
|
locale?: string;
|
|
733
|
+
/** MIR 欢迎页语言代码(POD 场景,透传给 buildMirWelcomeUrl 的 language) */
|
|
734
|
+
podLanguage?: string;
|
|
735
|
+
/** MIR 欢迎页国家代码(POD 场景,透传给 buildMirWelcomeUrl 的 countrycode) */
|
|
736
|
+
podCountry?: string;
|
|
733
737
|
};
|
|
734
738
|
/**
|
|
735
739
|
* 门店代码(可选,可以从 URL 参数或 props 传入)
|
package/dist/index.js
CHANGED
|
@@ -3247,7 +3247,7 @@ var RoomsList2 = ({
|
|
|
3247
3247
|
}
|
|
3248
3248
|
) })
|
|
3249
3249
|
] }),
|
|
3250
|
-
!!mergedPageData?.note && /* @__PURE__ */ jsxRuntime.jsx("div", { children: mergedPageData?.note })
|
|
3250
|
+
!!mergedPageData?.note && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-[32px] xl:mt-[16px]", children: mergedPageData?.note })
|
|
3251
3251
|
] });
|
|
3252
3252
|
};
|
|
3253
3253
|
RoomsList2.displayName = "RoomsList";
|
|
@@ -11449,8 +11449,12 @@ var DateTimePicker2 = ({
|
|
|
11449
11449
|
podDesignId
|
|
11450
11450
|
}) => {
|
|
11451
11451
|
const { token: themeToken } = antd.theme.useToken();
|
|
11452
|
-
const [selectedDate, setSelectedDate] = React15.useState(
|
|
11453
|
-
|
|
11452
|
+
const [selectedDate, setSelectedDate] = React15.useState(
|
|
11453
|
+
() => booking ? dayjs4__default.default(booking.booking_date) : null
|
|
11454
|
+
);
|
|
11455
|
+
const [calendarValue, setCalendarValue] = React15.useState(
|
|
11456
|
+
() => booking ? dayjs4__default.default(booking.booking_date) : dayjs4__default.default()
|
|
11457
|
+
);
|
|
11454
11458
|
const [selectedTimeslotId, setSelectedTimeslotId] = React15.useState(
|
|
11455
11459
|
null
|
|
11456
11460
|
);
|
|
@@ -11471,15 +11475,9 @@ var DateTimePicker2 = ({
|
|
|
11471
11475
|
error: editError
|
|
11472
11476
|
} = useEditBooking(apiClient);
|
|
11473
11477
|
const isManagedByParent = demoRoomLoading !== void 0;
|
|
11474
|
-
const {
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
} = useDemoRoom(
|
|
11478
|
-
apiClient,
|
|
11479
|
-
demoRoomCode || "",
|
|
11480
|
-
locale,
|
|
11481
|
-
{ enabled: !isManagedByParent && !demoRoomProp && !!demoRoomCode }
|
|
11482
|
-
);
|
|
11478
|
+
const { data: fetchedDemoRoom, loading: fetchedDemoRoomLoading } = useDemoRoom(apiClient, demoRoomCode || "", locale, {
|
|
11479
|
+
enabled: !isManagedByParent && !demoRoomProp && !!demoRoomCode
|
|
11480
|
+
});
|
|
11483
11481
|
const demoRoom = demoRoomProp ?? fetchedDemoRoom;
|
|
11484
11482
|
const effectiveDemoRoomLoading = !demoRoom && !!(isManagedByParent ? demoRoomLoading : fetchedDemoRoomLoading);
|
|
11485
11483
|
const isPodPurpose = selectedPurposeType === "pod";
|
|
@@ -11549,9 +11547,16 @@ var DateTimePicker2 = ({
|
|
|
11549
11547
|
setCalendarValue(nearestDate);
|
|
11550
11548
|
setSelectedTimeslotId(nearestSlot.id);
|
|
11551
11549
|
setIsInitialized(true);
|
|
11552
|
-
}, [
|
|
11550
|
+
}, [
|
|
11551
|
+
booking,
|
|
11552
|
+
isInitialized,
|
|
11553
|
+
demoRoom?.timeslots,
|
|
11554
|
+
demoRoom?.timezone,
|
|
11555
|
+
timezone5
|
|
11556
|
+
]);
|
|
11553
11557
|
React15.useEffect(() => {
|
|
11554
|
-
if (!timeslotsData?.timeslots || isInitialized || autoSelectLockRef.current)
|
|
11558
|
+
if (!timeslotsData?.timeslots || isInitialized || autoSelectLockRef.current)
|
|
11559
|
+
return;
|
|
11555
11560
|
const tz = demoRoom?.timezone || timezone5;
|
|
11556
11561
|
const now2 = tz ? dayjs4__default.default().tz(tz) : dayjs4__default.default();
|
|
11557
11562
|
const availableTimeslots = timeslotsData.timeslots.filter((slot) => {
|
|
@@ -11651,7 +11656,13 @@ var DateTimePicker2 = ({
|
|
|
11651
11656
|
setSelectedTimeslotId(match.id);
|
|
11652
11657
|
setHasResolvedBookingSlot(true);
|
|
11653
11658
|
}
|
|
11654
|
-
}, [
|
|
11659
|
+
}, [
|
|
11660
|
+
booking,
|
|
11661
|
+
dayTimeslots,
|
|
11662
|
+
hasResolvedBookingSlot,
|
|
11663
|
+
demoRoom?.timezone,
|
|
11664
|
+
timezone5
|
|
11665
|
+
]);
|
|
11655
11666
|
const initialResponses = React15.useMemo(() => {
|
|
11656
11667
|
if (!booking) return void 0;
|
|
11657
11668
|
return {
|
|
@@ -11672,7 +11683,6 @@ var DateTimePicker2 = ({
|
|
|
11672
11683
|
borderRadius: 16
|
|
11673
11684
|
};
|
|
11674
11685
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11675
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[48px] l:text-[32px] py-[64px] l:py-[24px] l:pt-[64px] font-bold text-center", children: pageData?.scheduleYourVisit }),
|
|
11676
11686
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4 l:flex-col", children: [
|
|
11677
11687
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11678
11688
|
antd.ConfigProvider,
|
|
@@ -12042,7 +12052,7 @@ var DateTimePicker2 = ({
|
|
|
12042
12052
|
] }),
|
|
12043
12053
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 mt-[40px] gap-4 l:mt-[16px] l:flex l:flex-col l:gap-2", children: timeslotsLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2 text-center text-[#767880] py-8", children: pageData?.loadingTimeSlots }) : timeslotsError ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2 text-center text-red-600 py-8", children: pageData?.failedToLoadTimeSlots }) : dayTimeslots.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-2 text-center text-[#767880] py-8", children: pageData?.noAvailableTimeSlots }) : dayTimeslots.map((slot) => {
|
|
12044
12054
|
const isAvailable = slot.status === "available";
|
|
12045
|
-
|
|
12055
|
+
slot.status === "full";
|
|
12046
12056
|
const isSelected = selectedTimeslotId === slot.id;
|
|
12047
12057
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12048
12058
|
"button",
|
|
@@ -12058,20 +12068,7 @@ var DateTimePicker2 = ({
|
|
|
12058
12068
|
border text-center transition-colors
|
|
12059
12069
|
${isSelected ? "border-[#3ADB67] bg-[#3ADB67] cursor-pointer" : isAvailable ? "border-[#E4E5E6] hover:border-[#3ADB67] hover:bg-[#3ADB67] cursor-pointer" : "border-[#E4E5E6] bg-[#F5F5F5] text-[#767880] cursor-not-allowed"}
|
|
12060
12070
|
`,
|
|
12061
|
-
children: /* @__PURE__ */ jsxRuntime.
|
|
12062
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children: formatTimeslot(slot) }),
|
|
12063
|
-
isFull && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[16px] l:text-[14px] text-[#767880] mt-[2px]", children: pageData?.full }),
|
|
12064
|
-
isAvailable && !isSelected && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-[16px] l:text-[14px] text-[#767880] mt-1", children: [
|
|
12065
|
-
slot.capacity - slot.booked_count,
|
|
12066
|
-
" ",
|
|
12067
|
-
pageData?.spotsLeft
|
|
12068
|
-
] }),
|
|
12069
|
-
isAvailable && isSelected && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-[16px] l:text-[14px] mt-1", children: [
|
|
12070
|
-
slot.capacity - slot.booked_count,
|
|
12071
|
-
" ",
|
|
12072
|
-
pageData?.spotsLeft
|
|
12073
|
-
] })
|
|
12074
|
-
] })
|
|
12071
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: formatTimeslot(slot) }) })
|
|
12075
12072
|
},
|
|
12076
12073
|
slot.id
|
|
12077
12074
|
);
|
|
@@ -12082,8 +12079,16 @@ var DateTimePicker2 = ({
|
|
|
12082
12079
|
) })
|
|
12083
12080
|
] })
|
|
12084
12081
|
] }),
|
|
12085
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
12086
|
-
!!questionnaire?.questions?.length && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12082
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
12083
|
+
!!questionnaire?.questions?.length && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12084
|
+
"div",
|
|
12085
|
+
{
|
|
12086
|
+
className: cn(
|
|
12087
|
+
"text-[48px] l:text-[32px] pb-[24px] pt-[64px] l:pt-[32px] font-bold"
|
|
12088
|
+
),
|
|
12089
|
+
children: pageData?.fillOutForm
|
|
12090
|
+
}
|
|
12091
|
+
),
|
|
12087
12092
|
questionnaireLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-[#767880] py-8", children: pageData?.loadingQuestionnaire }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
12088
12093
|
QuestionnaireForm2,
|
|
12089
12094
|
{
|
|
@@ -12424,6 +12429,7 @@ function sanitizeRedirectSource(source) {
|
|
|
12424
12429
|
function buildMirWelcomeUrl({
|
|
12425
12430
|
baseUrl,
|
|
12426
12431
|
language,
|
|
12432
|
+
countrycode = "US",
|
|
12427
12433
|
managerId,
|
|
12428
12434
|
credential,
|
|
12429
12435
|
currentUrl,
|
|
@@ -12434,7 +12440,7 @@ function buildMirWelcomeUrl({
|
|
|
12434
12440
|
if (language) {
|
|
12435
12441
|
url.searchParams.set("language", language);
|
|
12436
12442
|
}
|
|
12437
|
-
url.searchParams.set("countrycode",
|
|
12443
|
+
url.searchParams.set("countrycode", countrycode);
|
|
12438
12444
|
url.searchParams.set(managerIdParam, managerId);
|
|
12439
12445
|
url.searchParams.set(credentialParam, credential);
|
|
12440
12446
|
const redirectSource = sanitizeRedirectSource(
|
|
@@ -12500,12 +12506,12 @@ var normalizePurposeData = (purposeData) => {
|
|
|
12500
12506
|
return normalizePurposeSource(purposeData);
|
|
12501
12507
|
};
|
|
12502
12508
|
var filterPurposeOptionsByBusinessTypes = (purposeOptions, businessTypes) => {
|
|
12503
|
-
if (!businessTypes?.length) return
|
|
12509
|
+
if (!businessTypes?.length) return [];
|
|
12504
12510
|
const allowedTypes = new Set(businessTypes);
|
|
12505
12511
|
const filtered = purposeOptions.filter(
|
|
12506
12512
|
(item) => !!item.type && allowedTypes.has(item.type)
|
|
12507
12513
|
);
|
|
12508
|
-
return filtered.length ? filtered :
|
|
12514
|
+
return filtered.length ? filtered : [];
|
|
12509
12515
|
};
|
|
12510
12516
|
var getPurposeLabel = (pageData) => {
|
|
12511
12517
|
const purposeData = pageData?.purposeData;
|
|
@@ -12575,7 +12581,7 @@ var BookingFormO2O = ({
|
|
|
12575
12581
|
return purposeOptions[0]?.type || "";
|
|
12576
12582
|
});
|
|
12577
12583
|
const resolvedFromExplicitSource = !!initialBusinessType && purposeOptions.some((item) => item.type === initialBusinessType) || !!booking?.business_type && purposeOptions.some((item) => item.type === booking.business_type);
|
|
12578
|
-
if (resolvedFromExplicitSource) {
|
|
12584
|
+
if (resolvedFromExplicitSource || purposeOptions.length > 0) {
|
|
12579
12585
|
setIsPurposeConfirmed(true);
|
|
12580
12586
|
}
|
|
12581
12587
|
}, [purposeOptions, initialBusinessType, booking?.business_type]);
|
|
@@ -12618,7 +12624,8 @@ var BookingFormO2O = ({
|
|
|
12618
12624
|
}
|
|
12619
12625
|
return buildMirWelcomeUrl({
|
|
12620
12626
|
baseUrl: editBaseUrl,
|
|
12621
|
-
language: apiConfig
|
|
12627
|
+
language: apiConfig?.podLanguage,
|
|
12628
|
+
countrycode: apiConfig?.podCountry,
|
|
12622
12629
|
managerId: effectiveStoreManagerId,
|
|
12623
12630
|
credential: effectiveMirSessionId,
|
|
12624
12631
|
managerIdParam: "store_manager_id",
|
|
@@ -12630,17 +12637,20 @@ var BookingFormO2O = ({
|
|
|
12630
12637
|
if (!baseUrl) return void 0;
|
|
12631
12638
|
return buildMirWelcomeUrl({
|
|
12632
12639
|
baseUrl,
|
|
12633
|
-
language: apiConfig
|
|
12640
|
+
language: apiConfig?.podLanguage,
|
|
12641
|
+
countrycode: apiConfig?.podCountry,
|
|
12634
12642
|
managerId,
|
|
12635
12643
|
credential: mirCredential
|
|
12636
12644
|
});
|
|
12637
12645
|
}, [
|
|
12638
|
-
selectedPodContent,
|
|
12639
|
-
apiConfig.locale,
|
|
12640
|
-
managerId,
|
|
12641
12646
|
isPodButtonDisabled,
|
|
12642
|
-
mirCredential,
|
|
12643
12647
|
isPodDesignEditMode,
|
|
12648
|
+
managerId,
|
|
12649
|
+
selectedPodContent?.buttonLink,
|
|
12650
|
+
selectedPodContent?.buttonEditLink,
|
|
12651
|
+
apiConfig?.podLanguage,
|
|
12652
|
+
apiConfig?.podCountry,
|
|
12653
|
+
mirCredential,
|
|
12644
12654
|
effectiveStoreManagerId,
|
|
12645
12655
|
effectiveMirSessionId
|
|
12646
12656
|
]);
|
|
@@ -12652,7 +12662,7 @@ var BookingFormO2O = ({
|
|
|
12652
12662
|
[pageData?.dateTimePicker, pageData?.questionnaireForm]
|
|
12653
12663
|
);
|
|
12654
12664
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
12655
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12665
|
+
!token && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12656
12666
|
DemoRoomDetail2,
|
|
12657
12667
|
{
|
|
12658
12668
|
className: cn("min-l:mt-8", layoutClassName),
|
|
@@ -12665,7 +12675,17 @@ var BookingFormO2O = ({
|
|
|
12665
12675
|
}
|
|
12666
12676
|
) }),
|
|
12667
12677
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-[#f5f5f5]", children: [
|
|
12668
|
-
|
|
12678
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12679
|
+
"div",
|
|
12680
|
+
{
|
|
12681
|
+
className: cn(
|
|
12682
|
+
"text-[48px] l:text-[32px] pb-[24px] pt-[128px] l:pt-[64px] font-bold",
|
|
12683
|
+
className
|
|
12684
|
+
),
|
|
12685
|
+
children: dateTimePickerPageData?.scheduleYourVisit
|
|
12686
|
+
}
|
|
12687
|
+
),
|
|
12688
|
+
!!purposeOptions.length && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("pb-[40px] l:pb-[24px]", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12669
12689
|
"div",
|
|
12670
12690
|
{
|
|
12671
12691
|
className: cn(
|
|
@@ -12719,7 +12739,7 @@ var BookingFormO2O = ({
|
|
|
12719
12739
|
{
|
|
12720
12740
|
src: selectedPodImage,
|
|
12721
12741
|
alt: selectedPodContent.imageAlt || selectedPodContent.title || "",
|
|
12722
|
-
className: "mt-[12px] h-[220px] rounded-[8px] object-cover
|
|
12742
|
+
className: "mt-[12px] h-[220px] rounded-[8px] object-cover max-h-[360px]"
|
|
12723
12743
|
}
|
|
12724
12744
|
),
|
|
12725
12745
|
!!selectedPodButtonText && (booking?.print_status === "unprinted" && booking?.design_project_id || !token) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -13189,7 +13209,7 @@ var BookingSuccessO2O = ({
|
|
|
13189
13209
|
]
|
|
13190
13210
|
}
|
|
13191
13211
|
),
|
|
13192
|
-
isPending && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-[64px] pb-4 print:hidden", children: [
|
|
13212
|
+
isPending && !isCancelled && !isStore && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-[64px] pb-4 print:hidden", children: [
|
|
13193
13213
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex md:w-full gap-4 md:flex-col md:items-center md:justify-center", children: [
|
|
13194
13214
|
onEditBooking && token && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13195
13215
|
"button",
|