@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.mjs CHANGED
@@ -3233,7 +3233,7 @@ var RoomsList2 = ({
3233
3233
  }
3234
3234
  ) })
3235
3235
  ] }),
3236
- !!mergedPageData?.note && /* @__PURE__ */ jsx("div", { children: mergedPageData?.note })
3236
+ !!mergedPageData?.note && /* @__PURE__ */ jsx("div", { className: "mt-[32px] xl:mt-[16px]", children: mergedPageData?.note })
3237
3237
  ] });
3238
3238
  };
3239
3239
  RoomsList2.displayName = "RoomsList";
@@ -11435,8 +11435,12 @@ var DateTimePicker2 = ({
11435
11435
  podDesignId
11436
11436
  }) => {
11437
11437
  const { token: themeToken } = theme.useToken();
11438
- const [selectedDate, setSelectedDate] = useState(() => booking ? dayjs4(booking.booking_date) : null);
11439
- const [calendarValue, setCalendarValue] = useState(() => booking ? dayjs4(booking.booking_date) : dayjs4());
11438
+ const [selectedDate, setSelectedDate] = useState(
11439
+ () => booking ? dayjs4(booking.booking_date) : null
11440
+ );
11441
+ const [calendarValue, setCalendarValue] = useState(
11442
+ () => booking ? dayjs4(booking.booking_date) : dayjs4()
11443
+ );
11440
11444
  const [selectedTimeslotId, setSelectedTimeslotId] = useState(
11441
11445
  null
11442
11446
  );
@@ -11457,15 +11461,9 @@ var DateTimePicker2 = ({
11457
11461
  error: editError
11458
11462
  } = useEditBooking(apiClient);
11459
11463
  const isManagedByParent = demoRoomLoading !== void 0;
11460
- const {
11461
- data: fetchedDemoRoom,
11462
- loading: fetchedDemoRoomLoading
11463
- } = useDemoRoom(
11464
- apiClient,
11465
- demoRoomCode || "",
11466
- locale,
11467
- { enabled: !isManagedByParent && !demoRoomProp && !!demoRoomCode }
11468
- );
11464
+ const { data: fetchedDemoRoom, loading: fetchedDemoRoomLoading } = useDemoRoom(apiClient, demoRoomCode || "", locale, {
11465
+ enabled: !isManagedByParent && !demoRoomProp && !!demoRoomCode
11466
+ });
11469
11467
  const demoRoom = demoRoomProp ?? fetchedDemoRoom;
11470
11468
  const effectiveDemoRoomLoading = !demoRoom && !!(isManagedByParent ? demoRoomLoading : fetchedDemoRoomLoading);
11471
11469
  const isPodPurpose = selectedPurposeType === "pod";
@@ -11535,9 +11533,16 @@ var DateTimePicker2 = ({
11535
11533
  setCalendarValue(nearestDate);
11536
11534
  setSelectedTimeslotId(nearestSlot.id);
11537
11535
  setIsInitialized(true);
11538
- }, [booking, isInitialized, demoRoom?.timeslots, demoRoom?.timezone, timezone5]);
11536
+ }, [
11537
+ booking,
11538
+ isInitialized,
11539
+ demoRoom?.timeslots,
11540
+ demoRoom?.timezone,
11541
+ timezone5
11542
+ ]);
11539
11543
  useEffect(() => {
11540
- if (!timeslotsData?.timeslots || isInitialized || autoSelectLockRef.current) return;
11544
+ if (!timeslotsData?.timeslots || isInitialized || autoSelectLockRef.current)
11545
+ return;
11541
11546
  const tz = demoRoom?.timezone || timezone5;
11542
11547
  const now2 = tz ? dayjs4().tz(tz) : dayjs4();
11543
11548
  const availableTimeslots = timeslotsData.timeslots.filter((slot) => {
@@ -11637,7 +11642,13 @@ var DateTimePicker2 = ({
11637
11642
  setSelectedTimeslotId(match.id);
11638
11643
  setHasResolvedBookingSlot(true);
11639
11644
  }
11640
- }, [booking, dayTimeslots, hasResolvedBookingSlot, demoRoom?.timezone, timezone5]);
11645
+ }, [
11646
+ booking,
11647
+ dayTimeslots,
11648
+ hasResolvedBookingSlot,
11649
+ demoRoom?.timezone,
11650
+ timezone5
11651
+ ]);
11641
11652
  const initialResponses = useMemo(() => {
11642
11653
  if (!booking) return void 0;
11643
11654
  return {
@@ -11658,7 +11669,6 @@ var DateTimePicker2 = ({
11658
11669
  borderRadius: 16
11659
11670
  };
11660
11671
  return /* @__PURE__ */ jsxs("div", { children: [
11661
- /* @__PURE__ */ jsx("div", { className: "text-[48px] l:text-[32px] py-[64px] l:py-[24px] l:pt-[64px] font-bold text-center", children: pageData?.scheduleYourVisit }),
11662
11672
  /* @__PURE__ */ jsxs("div", { className: "flex gap-4 l:flex-col", children: [
11663
11673
  /* @__PURE__ */ jsx(
11664
11674
  ConfigProvider,
@@ -12028,7 +12038,7 @@ var DateTimePicker2 = ({
12028
12038
  ] }),
12029
12039
  /* @__PURE__ */ 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__ */ 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) => {
12030
12040
  const isAvailable = slot.status === "available";
12031
- const isFull = slot.status === "full";
12041
+ slot.status === "full";
12032
12042
  const isSelected = selectedTimeslotId === slot.id;
12033
12043
  return /* @__PURE__ */ jsx(
12034
12044
  "button",
@@ -12044,20 +12054,7 @@ var DateTimePicker2 = ({
12044
12054
  border text-center transition-colors
12045
12055
  ${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"}
12046
12056
  `,
12047
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
12048
- /* @__PURE__ */ jsx("div", { children: formatTimeslot(slot) }),
12049
- isFull && /* @__PURE__ */ jsx("div", { className: "text-[16px] l:text-[14px] text-[#767880] mt-[2px]", children: pageData?.full }),
12050
- isAvailable && !isSelected && /* @__PURE__ */ jsxs("div", { className: "text-[16px] l:text-[14px] text-[#767880] mt-1", children: [
12051
- slot.capacity - slot.booked_count,
12052
- " ",
12053
- pageData?.spotsLeft
12054
- ] }),
12055
- isAvailable && isSelected && /* @__PURE__ */ jsxs("div", { className: "text-[16px] l:text-[14px] mt-1", children: [
12056
- slot.capacity - slot.booked_count,
12057
- " ",
12058
- pageData?.spotsLeft
12059
- ] })
12060
- ] })
12057
+ children: /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center", children: /* @__PURE__ */ jsx("div", { children: formatTimeslot(slot) }) })
12061
12058
  },
12062
12059
  slot.id
12063
12060
  );
@@ -12068,8 +12065,16 @@ var DateTimePicker2 = ({
12068
12065
  ) })
12069
12066
  ] })
12070
12067
  ] }),
12071
- /* @__PURE__ */ jsxs("div", { className: "mt-12", children: [
12072
- !!questionnaire?.questions?.length && /* @__PURE__ */ jsx("div", { className: "text-[48px] font-bold text-center mb-8 l:mb-[24px] l:text-[32px] l:text-left", children: pageData?.fillOutForm }),
12068
+ /* @__PURE__ */ jsxs("div", { children: [
12069
+ !!questionnaire?.questions?.length && /* @__PURE__ */ jsx(
12070
+ "div",
12071
+ {
12072
+ className: cn(
12073
+ "text-[48px] l:text-[32px] pb-[24px] pt-[64px] l:pt-[32px] font-bold"
12074
+ ),
12075
+ children: pageData?.fillOutForm
12076
+ }
12077
+ ),
12073
12078
  questionnaireLoading ? /* @__PURE__ */ jsx("div", { className: "text-center text-[#767880] py-8", children: pageData?.loadingQuestionnaire }) : /* @__PURE__ */ jsx(
12074
12079
  QuestionnaireForm2,
12075
12080
  {
@@ -12410,6 +12415,7 @@ function sanitizeRedirectSource(source) {
12410
12415
  function buildMirWelcomeUrl({
12411
12416
  baseUrl,
12412
12417
  language,
12418
+ countrycode = "US",
12413
12419
  managerId,
12414
12420
  credential,
12415
12421
  currentUrl,
@@ -12420,7 +12426,7 @@ function buildMirWelcomeUrl({
12420
12426
  if (language) {
12421
12427
  url.searchParams.set("language", language);
12422
12428
  }
12423
- url.searchParams.set("countrycode", "US");
12429
+ url.searchParams.set("countrycode", countrycode);
12424
12430
  url.searchParams.set(managerIdParam, managerId);
12425
12431
  url.searchParams.set(credentialParam, credential);
12426
12432
  const redirectSource = sanitizeRedirectSource(
@@ -12486,12 +12492,12 @@ var normalizePurposeData = (purposeData) => {
12486
12492
  return normalizePurposeSource(purposeData);
12487
12493
  };
12488
12494
  var filterPurposeOptionsByBusinessTypes = (purposeOptions, businessTypes) => {
12489
- if (!businessTypes?.length) return purposeOptions;
12495
+ if (!businessTypes?.length) return [];
12490
12496
  const allowedTypes = new Set(businessTypes);
12491
12497
  const filtered = purposeOptions.filter(
12492
12498
  (item) => !!item.type && allowedTypes.has(item.type)
12493
12499
  );
12494
- return filtered.length ? filtered : purposeOptions;
12500
+ return filtered.length ? filtered : [];
12495
12501
  };
12496
12502
  var getPurposeLabel = (pageData) => {
12497
12503
  const purposeData = pageData?.purposeData;
@@ -12561,7 +12567,7 @@ var BookingFormO2O = ({
12561
12567
  return purposeOptions[0]?.type || "";
12562
12568
  });
12563
12569
  const resolvedFromExplicitSource = !!initialBusinessType && purposeOptions.some((item) => item.type === initialBusinessType) || !!booking?.business_type && purposeOptions.some((item) => item.type === booking.business_type);
12564
- if (resolvedFromExplicitSource) {
12570
+ if (resolvedFromExplicitSource || purposeOptions.length > 0) {
12565
12571
  setIsPurposeConfirmed(true);
12566
12572
  }
12567
12573
  }, [purposeOptions, initialBusinessType, booking?.business_type]);
@@ -12604,7 +12610,8 @@ var BookingFormO2O = ({
12604
12610
  }
12605
12611
  return buildMirWelcomeUrl({
12606
12612
  baseUrl: editBaseUrl,
12607
- language: apiConfig.locale,
12613
+ language: apiConfig?.podLanguage,
12614
+ countrycode: apiConfig?.podCountry,
12608
12615
  managerId: effectiveStoreManagerId,
12609
12616
  credential: effectiveMirSessionId,
12610
12617
  managerIdParam: "store_manager_id",
@@ -12616,17 +12623,20 @@ var BookingFormO2O = ({
12616
12623
  if (!baseUrl) return void 0;
12617
12624
  return buildMirWelcomeUrl({
12618
12625
  baseUrl,
12619
- language: apiConfig.locale,
12626
+ language: apiConfig?.podLanguage,
12627
+ countrycode: apiConfig?.podCountry,
12620
12628
  managerId,
12621
12629
  credential: mirCredential
12622
12630
  });
12623
12631
  }, [
12624
- selectedPodContent,
12625
- apiConfig.locale,
12626
- managerId,
12627
12632
  isPodButtonDisabled,
12628
- mirCredential,
12629
12633
  isPodDesignEditMode,
12634
+ managerId,
12635
+ selectedPodContent?.buttonLink,
12636
+ selectedPodContent?.buttonEditLink,
12637
+ apiConfig?.podLanguage,
12638
+ apiConfig?.podCountry,
12639
+ mirCredential,
12630
12640
  effectiveStoreManagerId,
12631
12641
  effectiveMirSessionId
12632
12642
  ]);
@@ -12638,7 +12648,7 @@ var BookingFormO2O = ({
12638
12648
  [pageData?.dateTimePicker, pageData?.questionnaireForm]
12639
12649
  );
12640
12650
  return /* @__PURE__ */ jsxs("div", { children: [
12641
- /* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsx(
12651
+ !token && /* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsx(
12642
12652
  DemoRoomDetail2,
12643
12653
  {
12644
12654
  className: cn("min-l:mt-8", layoutClassName),
@@ -12651,7 +12661,17 @@ var BookingFormO2O = ({
12651
12661
  }
12652
12662
  ) }),
12653
12663
  /* @__PURE__ */ jsxs("div", { className: "bg-[#f5f5f5]", children: [
12654
- !!purposeOptions.length && /* @__PURE__ */ jsx("div", { className: cn("py-[40px] l:py-[24px]", className), children: /* @__PURE__ */ jsxs(
12664
+ /* @__PURE__ */ jsx(
12665
+ "div",
12666
+ {
12667
+ className: cn(
12668
+ "text-[48px] l:text-[32px] pb-[24px] pt-[128px] l:pt-[64px] font-bold",
12669
+ className
12670
+ ),
12671
+ children: dateTimePickerPageData?.scheduleYourVisit
12672
+ }
12673
+ ),
12674
+ !!purposeOptions.length && /* @__PURE__ */ jsx("div", { className: cn("pb-[40px] l:pb-[24px]", className), children: /* @__PURE__ */ jsxs(
12655
12675
  "div",
12656
12676
  {
12657
12677
  className: cn(
@@ -12705,7 +12725,7 @@ var BookingFormO2O = ({
12705
12725
  {
12706
12726
  src: selectedPodImage,
12707
12727
  alt: selectedPodContent.imageAlt || selectedPodContent.title || "",
12708
- className: "mt-[12px] h-[220px] rounded-[8px] object-cover l:h-auto"
12728
+ className: "mt-[12px] h-[220px] rounded-[8px] object-cover max-h-[360px]"
12709
12729
  }
12710
12730
  ),
12711
12731
  !!selectedPodButtonText && (booking?.print_status === "unprinted" && booking?.design_project_id || !token) && /* @__PURE__ */ jsxs(
@@ -13175,7 +13195,7 @@ var BookingSuccessO2O = ({
13175
13195
  ]
13176
13196
  }
13177
13197
  ),
13178
- isPending && /* @__PURE__ */ jsxs("div", { className: "mt-[64px] pb-4 print:hidden", children: [
13198
+ isPending && !isCancelled && !isStore && /* @__PURE__ */ jsxs("div", { className: "mt-[64px] pb-4 print:hidden", children: [
13179
13199
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs("div", { className: "flex md:w-full gap-4 md:flex-col md:items-center md:justify-center", children: [
13180
13200
  onEditBooking && token && /* @__PURE__ */ jsx(
13181
13201
  "button",