@anker-in/ui 0.3.1 → 0.3.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/index.mjs CHANGED
@@ -10,7 +10,7 @@ import dayjs4 from 'dayjs';
10
10
  import utc from 'dayjs/plugin/utc';
11
11
  import timezone from 'dayjs/plugin/timezone';
12
12
  import 'dayjs/locale/zh-cn';
13
- import { QRCode, theme, ConfigProvider, Calendar, Select } from 'antd';
13
+ import { Image, QRCode, theme, ConfigProvider, Calendar, Select } from 'antd';
14
14
  import dayLocaleData from 'dayjs/plugin/localeData';
15
15
  import weekday from 'dayjs/plugin/weekday';
16
16
  import weekOfYear from 'dayjs/plugin/weekOfYear';
@@ -10853,7 +10853,9 @@ var QuestionnaireForm2 = ({
10853
10853
  error,
10854
10854
  initialResponses
10855
10855
  }) => {
10856
- const [responses, setResponses] = useState(() => initialResponses || {});
10856
+ const [responses, setResponses] = useState(
10857
+ () => initialResponses || {}
10858
+ );
10857
10859
  const [errors, setErrors] = useState({});
10858
10860
  const [agreements, setAgreements] = useState({});
10859
10861
  const [agreementError, setAgreementError] = useState("");
@@ -10875,8 +10877,12 @@ var QuestionnaireForm2 = ({
10875
10877
  });
10876
10878
  return seeded;
10877
10879
  });
10878
- const prevHasBookedBeforeRef = useRef(initialResponses?.["has_booked_before"] === "option2");
10879
- const hasBookedBeforeInitialized = useRef(!!initialResponses?.["has_booked_before"]);
10880
+ const prevHasBookedBeforeRef = useRef(
10881
+ initialResponses?.["has_booked_before"] === "option2"
10882
+ );
10883
+ const hasBookedBeforeInitialized = useRef(
10884
+ !!initialResponses?.["has_booked_before"]
10885
+ );
10880
10886
  const hasBookedBeforeQuestion = questions.find(
10881
10887
  (q) => (q.key || q.id) === "has_booked_before"
10882
10888
  );
@@ -10894,6 +10900,7 @@ var QuestionnaireForm2 = ({
10894
10900
  return true;
10895
10901
  });
10896
10902
  }, [questions, hasBookedBefore]);
10903
+ console.log(error, pageData);
10897
10904
  useEffect(() => {
10898
10905
  if (hasBookedBeforeInitialized.current) return;
10899
10906
  if (hasBookedBeforeQuestion && hasBookedBeforeQuestionId) {
@@ -11046,7 +11053,9 @@ var QuestionnaireForm2 = ({
11046
11053
  onSubmit?.(finalResponses);
11047
11054
  } else {
11048
11055
  setTimeout(() => {
11049
- const firstErrorElement = document.querySelector('[data-has-error="true"]');
11056
+ const firstErrorElement = document.querySelector(
11057
+ '[data-has-error="true"]'
11058
+ );
11050
11059
  if (firstErrorElement) {
11051
11060
  firstErrorElement.scrollIntoView({
11052
11061
  behavior: "smooth",
@@ -11402,7 +11411,7 @@ var QuestionnaireForm2 = ({
11402
11411
  children: loading ? pageData?.submitting || "Submitting..." : pageData?.submit || "Submit Booking"
11403
11412
  }
11404
11413
  ),
11405
- error && /* @__PURE__ */ jsx("div", { className: "text-center w-full p-4", children: /* @__PURE__ */ jsx("p", { className: "text-[#FF4D4D] font-bold", children: error.message }) })
11414
+ error && /* @__PURE__ */ jsx("div", { className: "text-center w-full p-4", children: /* @__PURE__ */ jsx("p", { className: "text-[#FF4D4D] font-bold", children: pageData?.errorMsg?.[String(error.code)] || pageData?.errorMsg?.[error.code || ""] || error.message }) })
11406
11415
  ] })
11407
11416
  ] });
11408
11417
  };
@@ -11564,22 +11573,34 @@ var DateTimePicker2 = ({
11564
11573
  return `${start} - ${end}`;
11565
11574
  };
11566
11575
  useEffect(() => {
11567
- if (!booking || hasResolvedBookingSlot || !timeslotsData?.timeslots?.length) return;
11576
+ if (!booking?.booking_date) return;
11577
+ setSelectedDate(dayjs4(booking.booking_date));
11578
+ setCalendarValue(dayjs4(booking.booking_date));
11579
+ setIsInitialized(true);
11580
+ if (booking.timeslot_id) {
11581
+ setSelectedTimeslotId(booking.timeslot_id);
11582
+ setHasResolvedBookingSlot(true);
11583
+ }
11584
+ }, [booking?.booking_date, booking?.timeslot_id]);
11585
+ useEffect(() => {
11586
+ if (!booking || hasResolvedBookingSlot || !dayTimeslots.length) return;
11568
11587
  if (booking.timeslot_id) {
11569
11588
  setSelectedTimeslotId(booking.timeslot_id);
11570
11589
  setHasResolvedBookingSlot(true);
11571
11590
  return;
11572
11591
  }
11573
- if (booking.time_slot) {
11574
- const match = timeslotsData.timeslots.find(
11575
- (slot) => formatTimeslot(slot) === booking.time_slot
11576
- );
11577
- if (match) {
11578
- setSelectedTimeslotId(match.id);
11579
- setHasResolvedBookingSlot(true);
11580
- }
11592
+ if (!booking.time_slot) return;
11593
+ const tz = demoRoom?.timezone || timezone5;
11594
+ const target = booking.time_slot.replace(/\s+/g, "");
11595
+ const match = dayTimeslots.find((slot) => {
11596
+ const toHm = (iso) => (tz ? dayjs4(iso).tz(tz) : dayjs4(iso)).format("HH:mm");
11597
+ return `${toHm(slot.start_time)}-${toHm(slot.end_time)}` === target;
11598
+ });
11599
+ if (match) {
11600
+ setSelectedTimeslotId(match.id);
11601
+ setHasResolvedBookingSlot(true);
11581
11602
  }
11582
- }, [booking, timeslotsData, hasResolvedBookingSlot]);
11603
+ }, [booking, dayTimeslots, hasResolvedBookingSlot, demoRoom?.timezone, timezone5]);
11583
11604
  const initialResponses = useMemo(() => {
11584
11605
  if (!booking) return void 0;
11585
11606
  return {
@@ -12122,7 +12143,9 @@ var DemoRoomDetail2 = ({
12122
12143
  if (demoRoom?.latitude && demoRoom?.longitude) {
12123
12144
  return `https://www.google.com/maps/search/?api=1&query=${demoRoom.latitude},${demoRoom.longitude}`;
12124
12145
  } else if (address) {
12125
- return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(address)}`;
12146
+ return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(
12147
+ address
12148
+ )}`;
12126
12149
  }
12127
12150
  return "#";
12128
12151
  })();
@@ -12143,129 +12166,133 @@ var DemoRoomDetail2 = ({
12143
12166
  /* @__PURE__ */ jsx("p", { className: "text-sm mt-2", children: error.message })
12144
12167
  ] }) });
12145
12168
  }
12146
- return /* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxs("div", { className: cn(
12147
- "gap-[80px] l:gap-[40px] l:flex l:flex-col-reverse items-start py-[24px] l:pb-[64px]",
12148
- images.length > 0 ? "grid grid-cols-2" : "flex"
12149
- ), children: [
12150
- /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
12151
- /* @__PURE__ */ jsx("h1", { className: "text-[48px] l:text-[32px] font-bold text-gray-900 leading-tight", children: title }),
12152
- /* @__PURE__ */ jsx("div", { className: "mt-[20px]", children: descriptions?.map((desc, index) => /* @__PURE__ */ jsx(
12153
- "p",
12154
- {
12155
- className: "text-base text-gray-600 leading-relaxed",
12156
- children: desc
12157
- },
12158
- index
12159
- )) }),
12160
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
12161
- /* @__PURE__ */ jsxs(
12162
- "svg",
12163
- {
12164
- width: "24",
12165
- height: "24",
12166
- viewBox: "0 0 24 24",
12167
- fill: "none",
12168
- xmlns: "http://www.w3.org/2000/svg",
12169
- className: "flex-shrink-0 mt-0.5",
12170
- children: [
12171
- /* @__PURE__ */ jsx(
12172
- "path",
12173
- {
12174
- d: "M14.4643 7.4929H9.65565M3.16391 18.7132H20.8171C22.0122 18.7132 22.981 17.7563 22.981 16.576L23 13.8348L22.981 6.42431C22.981 5.24396 22.0122 4.28711 20.8171 4.28711H3.16391C1.96882 4.28711 1 5.24396 1 6.42431V16.576C1 17.7563 1.96882 18.7132 3.16391 18.7132Z",
12175
- stroke: "currentColor",
12176
- strokeWidth: "2",
12177
- strokeLinecap: "round",
12178
- strokeLinejoin: "round"
12179
- }
12180
- ),
12181
- /* @__PURE__ */ jsx(
12182
- "path",
12183
- {
12184
- d: "M5.32812 18.2325V14.4238C5.32812 13.8715 5.77584 13.4238 6.32813 13.4238H17.7925C18.3447 13.4238 18.7925 13.8715 18.7925 14.4238V18.2325",
12185
- stroke: "currentColor",
12186
- strokeWidth: "2",
12187
- strokeLinecap: "round",
12188
- strokeLinejoin: "round"
12189
- }
12190
- )
12191
- ]
12192
- }
12193
- ),
12194
- /* @__PURE__ */ jsx("span", { className: "text-base text-gray-900", children: devices })
12195
- ] }),
12196
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
12197
- /* @__PURE__ */ jsxs(
12198
- "svg",
12199
- {
12200
- width: "24",
12201
- height: "24",
12202
- viewBox: "0 0 24 24",
12203
- fill: "none",
12204
- xmlns: "http://www.w3.org/2000/svg",
12205
- className: "flex-shrink-0 mt-0.5",
12206
- children: [
12207
- /* @__PURE__ */ jsx(
12208
- "path",
12209
- {
12210
- d: "M12 2C8.13 2 5 5.13 5 9C5 14.25 12 22 12 22C12 22 19 14.25 19 9C19 5.13 15.87 2 12 2Z",
12211
- stroke: "currentColor",
12212
- strokeWidth: "2",
12213
- strokeLinecap: "round",
12214
- strokeLinejoin: "round"
12215
- }
12216
- ),
12217
- /* @__PURE__ */ jsx(
12218
- "circle",
12219
- {
12220
- cx: "12",
12221
- cy: "9",
12222
- r: "2.5",
12223
- stroke: "currentColor",
12224
- strokeWidth: "2"
12225
- }
12226
- )
12227
- ]
12228
- }
12229
- ),
12230
- /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
12231
- /* @__PURE__ */ jsx("p", { className: "text-base text-gray-900", children: address }),
12232
- /* @__PURE__ */ jsxs(
12233
- "a",
12169
+ return /* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxs(
12170
+ "div",
12171
+ {
12172
+ className: cn(
12173
+ "gap-[80px] l:gap-[40px] l:flex l:flex-col-reverse items-start py-[24px] l:pb-[64px]",
12174
+ images.length > 0 ? "grid grid-cols-2" : "flex"
12175
+ ),
12176
+ children: [
12177
+ /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
12178
+ /* @__PURE__ */ jsx("h1", { className: "text-[48px] l:text-[32px] font-bold text-gray-900 leading-tight", children: title }),
12179
+ /* @__PURE__ */ jsx("div", { className: "mt-[20px]", children: descriptions?.map((desc, index) => /* @__PURE__ */ jsx(
12180
+ "p",
12234
12181
  {
12235
- href: googleMapsLink,
12236
- target: "_blank",
12237
- rel: "noopener noreferrer",
12238
- className: "inline-flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700 mt-1 underline",
12239
- children: [
12240
- pageData.openInGoogleMaps,
12241
- /* @__PURE__ */ jsx(
12242
- "svg",
12243
- {
12244
- width: "12",
12245
- height: "12",
12246
- viewBox: "0 0 12 12",
12247
- fill: "none",
12248
- xmlns: "http://www.w3.org/2000/svg",
12249
- children: /* @__PURE__ */ jsx(
12250
- "path",
12182
+ className: "text-base text-gray-600 leading-relaxed",
12183
+ children: desc
12184
+ },
12185
+ index
12186
+ )) }),
12187
+ !!devices && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
12188
+ /* @__PURE__ */ jsxs(
12189
+ "svg",
12190
+ {
12191
+ width: "24",
12192
+ height: "24",
12193
+ viewBox: "0 0 24 24",
12194
+ fill: "none",
12195
+ xmlns: "http://www.w3.org/2000/svg",
12196
+ className: "flex-shrink-0 mt-0.5",
12197
+ children: [
12198
+ /* @__PURE__ */ jsx(
12199
+ "path",
12200
+ {
12201
+ d: "M14.4643 7.4929H9.65565M3.16391 18.7132H20.8171C22.0122 18.7132 22.981 17.7563 22.981 16.576L23 13.8348L22.981 6.42431C22.981 5.24396 22.0122 4.28711 20.8171 4.28711H3.16391C1.96882 4.28711 1 5.24396 1 6.42431V16.576C1 17.7563 1.96882 18.7132 3.16391 18.7132Z",
12202
+ stroke: "currentColor",
12203
+ strokeWidth: "2",
12204
+ strokeLinecap: "round",
12205
+ strokeLinejoin: "round"
12206
+ }
12207
+ ),
12208
+ /* @__PURE__ */ jsx(
12209
+ "path",
12210
+ {
12211
+ d: "M5.32812 18.2325V14.4238C5.32812 13.8715 5.77584 13.4238 6.32813 13.4238H17.7925C18.3447 13.4238 18.7925 13.8715 18.7925 14.4238V18.2325",
12212
+ stroke: "currentColor",
12213
+ strokeWidth: "2",
12214
+ strokeLinecap: "round",
12215
+ strokeLinejoin: "round"
12216
+ }
12217
+ )
12218
+ ]
12219
+ }
12220
+ ),
12221
+ /* @__PURE__ */ jsx("span", { className: "text-base text-gray-900", children: devices })
12222
+ ] }),
12223
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
12224
+ /* @__PURE__ */ jsxs(
12225
+ "svg",
12226
+ {
12227
+ width: "24",
12228
+ height: "24",
12229
+ viewBox: "0 0 24 24",
12230
+ fill: "none",
12231
+ xmlns: "http://www.w3.org/2000/svg",
12232
+ className: "flex-shrink-0 mt-0.5",
12233
+ children: [
12234
+ /* @__PURE__ */ jsx(
12235
+ "path",
12236
+ {
12237
+ d: "M12 2C8.13 2 5 5.13 5 9C5 14.25 12 22 12 22C12 22 19 14.25 19 9C19 5.13 15.87 2 12 2Z",
12238
+ stroke: "currentColor",
12239
+ strokeWidth: "2",
12240
+ strokeLinecap: "round",
12241
+ strokeLinejoin: "round"
12242
+ }
12243
+ ),
12244
+ /* @__PURE__ */ jsx(
12245
+ "circle",
12246
+ {
12247
+ cx: "12",
12248
+ cy: "9",
12249
+ r: "2.5",
12250
+ stroke: "currentColor",
12251
+ strokeWidth: "2"
12252
+ }
12253
+ )
12254
+ ]
12255
+ }
12256
+ ),
12257
+ /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
12258
+ /* @__PURE__ */ jsx("p", { className: "text-base text-gray-900", children: address }),
12259
+ /* @__PURE__ */ jsxs(
12260
+ "a",
12261
+ {
12262
+ href: googleMapsLink,
12263
+ target: "_blank",
12264
+ rel: "noopener noreferrer",
12265
+ className: "inline-flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700 mt-1 underline",
12266
+ children: [
12267
+ pageData.openInGoogleMaps,
12268
+ /* @__PURE__ */ jsx(
12269
+ "svg",
12251
12270
  {
12252
- d: "M3 9L9 3M9 3H3M9 3V9",
12253
- stroke: "currentColor",
12254
- strokeWidth: "1.5",
12255
- strokeLinecap: "round",
12256
- strokeLinejoin: "round"
12271
+ width: "12",
12272
+ height: "12",
12273
+ viewBox: "0 0 12 12",
12274
+ fill: "none",
12275
+ xmlns: "http://www.w3.org/2000/svg",
12276
+ children: /* @__PURE__ */ jsx(
12277
+ "path",
12278
+ {
12279
+ d: "M3 9L9 3M9 3H3M9 3V9",
12280
+ stroke: "currentColor",
12281
+ strokeWidth: "1.5",
12282
+ strokeLinecap: "round",
12283
+ strokeLinejoin: "round"
12284
+ }
12285
+ )
12257
12286
  }
12258
12287
  )
12259
- }
12260
- )
12261
- ]
12262
- }
12263
- )
12264
- ] })
12265
- ] })
12266
- ] }),
12267
- images.length > 0 && /* @__PURE__ */ jsxs("div", { className: "relative l:w-full min-l:h-[400px] rounded-2xl overflow-hidden demo-room-swiper", children: [
12268
- /* @__PURE__ */ jsx("style", { children: `
12288
+ ]
12289
+ }
12290
+ )
12291
+ ] })
12292
+ ] })
12293
+ ] }),
12294
+ images.length > 0 && /* @__PURE__ */ jsxs("div", { className: "relative l:w-full min-l:h-[400px] rounded-2xl overflow-hidden demo-room-swiper", children: [
12295
+ /* @__PURE__ */ jsx("style", { children: `
12269
12296
  .demo-room-swiper .swiper-pagination-bullet {
12270
12297
  background-color: rgba(255, 255, 255, 0.5);
12271
12298
  }
@@ -12295,32 +12322,34 @@ var DemoRoomDetail2 = ({
12295
12322
  right: 16px !important;
12296
12323
  }
12297
12324
  ` }),
12298
- /* @__PURE__ */ jsx(
12299
- Swiper2,
12300
- {
12301
- modules: [Navigation, Pagination, Autoplay],
12302
- spaceBetween: 0,
12303
- slidesPerView: 1,
12304
- navigation: images.length > 1,
12305
- pagination: images.length > 1 ? { clickable: true } : false,
12306
- autoplay: images.length > 1 ? {
12307
- delay: 3e3,
12308
- disableOnInteraction: false
12309
- } : false,
12310
- loop: images.length > 1,
12311
- className: "h-full rounded-2xl",
12312
- children: images.map((img, index) => /* @__PURE__ */ jsx(SwiperSlide, { children: /* @__PURE__ */ jsx("div", { className: "relative w-full h-full bg-gray-100", children: /* @__PURE__ */ jsx(
12313
- "img",
12325
+ /* @__PURE__ */ jsx(
12326
+ Swiper2,
12314
12327
  {
12315
- src: img,
12316
- alt: `Demo room view ${index + 1}`,
12317
- className: "w-full h-full object-cover"
12328
+ modules: [Navigation, Pagination, Autoplay],
12329
+ spaceBetween: 0,
12330
+ slidesPerView: 1,
12331
+ navigation: images.length > 1,
12332
+ pagination: images.length > 1 ? { clickable: true } : false,
12333
+ autoplay: images.length > 1 ? {
12334
+ delay: 3e3,
12335
+ disableOnInteraction: false
12336
+ } : false,
12337
+ loop: images.length > 1,
12338
+ className: "h-full rounded-2xl",
12339
+ children: images.map((img, index) => /* @__PURE__ */ jsx(SwiperSlide, { children: /* @__PURE__ */ jsx("div", { className: "relative w-full h-full bg-gray-100", children: /* @__PURE__ */ jsx(
12340
+ "img",
12341
+ {
12342
+ src: img,
12343
+ alt: `Demo room view ${index + 1}`,
12344
+ className: "w-full h-full object-cover"
12345
+ }
12346
+ ) }) }, index))
12318
12347
  }
12319
- ) }) }, index))
12320
- }
12321
- )
12322
- ] })
12323
- ] }) });
12348
+ )
12349
+ ] })
12350
+ ]
12351
+ }
12352
+ ) });
12324
12353
  };
12325
12354
  DemoRoomDetail2.displayName = "DemoRoomDetail";
12326
12355
 
@@ -12524,9 +12553,7 @@ var BookingFormO2O = ({
12524
12553
  const selectedPodButtonLink = useMemo(() => {
12525
12554
  if (isPodButtonDisabled) return void 0;
12526
12555
  if (isPodDesignEditMode) {
12527
- const editBaseUrl = getSafePageDataUrl(
12528
- selectedPodContent?.buttonEditLink
12529
- );
12556
+ const editBaseUrl = getSafePageDataUrl(selectedPodContent?.buttonEditLink);
12530
12557
  if (!editBaseUrl || !effectiveStoreManagerId || !effectiveMirSessionId) {
12531
12558
  return void 0;
12532
12559
  }
@@ -12598,7 +12625,11 @@ var BookingFormO2O = ({
12598
12625
  onChange: (event2) => {
12599
12626
  setSelectedPurposeType(event2.target.value);
12600
12627
  },
12601
- className: "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]",
12628
+ disabled: !!token,
12629
+ className: cn(
12630
+ "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]",
12631
+ token && "pointer-events-none cursor-not-allowed opacity-50"
12632
+ ),
12602
12633
  children: purposeOptions.map((item, index) => /* @__PURE__ */ jsx(
12603
12634
  "option",
12604
12635
  {
@@ -12624,7 +12655,7 @@ var BookingFormO2O = ({
12624
12655
  className: "mt-[12px] h-[220px] rounded-[8px] object-cover l:h-auto"
12625
12656
  }
12626
12657
  ),
12627
- !!selectedPodButtonText && /* @__PURE__ */ jsxs(
12658
+ !!selectedPodButtonText && (booking?.print_status === "unprinted" && booking?.design_project_id || !token) && /* @__PURE__ */ jsxs(
12628
12659
  "a",
12629
12660
  {
12630
12661
  href: selectedPodButtonLink || "#",
@@ -12669,7 +12700,7 @@ var BookingFormO2O = ({
12669
12700
  onQuestionnaireSubmit,
12670
12701
  pageData: dateTimePickerPageData,
12671
12702
  selectedPurposeType: selectedPurpose?.type,
12672
- podDesignId
12703
+ podDesignId: mirSessionId
12673
12704
  }
12674
12705
  ) })
12675
12706
  ] })
@@ -12679,6 +12710,7 @@ BookingFormO2O.displayName = "BookingFormO2O";
12679
12710
  var BookingSuccessO2O = ({
12680
12711
  bookingData: initialBookingData,
12681
12712
  token,
12713
+ isStoreUser,
12682
12714
  apiConfig,
12683
12715
  onScheduleAgain,
12684
12716
  onCancelSuccess,
@@ -12722,10 +12754,14 @@ var BookingSuccessO2O = ({
12722
12754
  const [loading, setLoading] = useState(false);
12723
12755
  const [bookingDesign, setBookingDesign] = useState(null);
12724
12756
  const [isCancelled, setIsCancelled] = useState(false);
12757
+ const [isPending, setIsPending] = useState(false);
12725
12758
  const [showCancelDialog, setShowCancelDialog] = useState(false);
12726
12759
  const [cancelLoading, setCancelLoading] = useState(false);
12727
12760
  const [cancelError, setCancelError] = useState(null);
12761
+ const [checkinLoading, setCheckinLoading] = useState(false);
12762
+ const [checkinError, setCheckinError] = useState(null);
12728
12763
  const qrCodeContainerRef = useRef(null);
12764
+ const isStore = Boolean(isStoreUser);
12729
12765
  const handlePrintQRCode = () => {
12730
12766
  const canvas = qrCodeContainerRef.current?.querySelector("canvas");
12731
12767
  const qrImageSrc = canvas?.toDataURL("image/png");
@@ -12763,16 +12799,30 @@ var BookingSuccessO2O = ({
12763
12799
  const subtitle = iframeDoc.createElement("p");
12764
12800
  subtitle.textContent = pageData.podData?.QRCodeSubTitle || "";
12765
12801
  const image = iframeDoc.createElement("img");
12766
- image.src = qrImageSrc;
12767
12802
  image.alt = "QR Code";
12768
12803
  iframeDoc.body.appendChild(title);
12769
12804
  iframeDoc.body.appendChild(subtitle);
12770
12805
  iframeDoc.body.appendChild(image);
12771
- iframe.contentWindow?.focus();
12772
- iframe.contentWindow?.print();
12773
- setTimeout(() => {
12774
- document.body.removeChild(iframe);
12775
- }, 1e3);
12806
+ const doPrint = () => {
12807
+ iframe.contentWindow?.focus();
12808
+ iframe.contentWindow?.print();
12809
+ setTimeout(() => {
12810
+ document.body.removeChild(iframe);
12811
+ }, 1e3);
12812
+ };
12813
+ let printed = false;
12814
+ const triggerPrintOnce = () => {
12815
+ if (printed) return;
12816
+ printed = true;
12817
+ doPrint();
12818
+ };
12819
+ image.onload = triggerPrintOnce;
12820
+ image.onerror = triggerPrintOnce;
12821
+ setTimeout(triggerPrintOnce, 1500);
12822
+ image.src = qrImageSrc;
12823
+ if (image.complete) {
12824
+ triggerPrintOnce();
12825
+ }
12776
12826
  };
12777
12827
  useEffect(() => {
12778
12828
  if (token && apiConfig && !initialBookingData) {
@@ -12783,6 +12833,7 @@ var BookingSuccessO2O = ({
12783
12833
  const booking = await apiClient.getBooking(token, apiConfig.locale);
12784
12834
  setBookingData(booking);
12785
12835
  setIsCancelled(booking.status === "cancelled");
12836
+ setIsPending(booking.status === "pending");
12786
12837
  } catch (err) {
12787
12838
  console.error("Failed to fetch booking data:", err);
12788
12839
  } finally {
@@ -12798,7 +12849,9 @@ var BookingSuccessO2O = ({
12798
12849
  const fetchBookingDesign = async () => {
12799
12850
  try {
12800
12851
  const apiClient = createDemoRoomApi(apiConfig);
12801
- const design = await apiClient.getBookingDesign({ booking_token: token });
12852
+ const design = await apiClient.getBookingDesign({
12853
+ booking_token: token
12854
+ });
12802
12855
  setBookingDesign(design);
12803
12856
  } catch (err) {
12804
12857
  console.error("Failed to fetch booking design:", err);
@@ -12844,6 +12897,33 @@ var BookingSuccessO2O = ({
12844
12897
  setCancelLoading(false);
12845
12898
  }
12846
12899
  };
12900
+ const handleCheckin = async () => {
12901
+ if (!token || !apiConfig) {
12902
+ setCheckinError(
12903
+ pageData.cancelError || "Unable to check in: Missing token or API configuration"
12904
+ );
12905
+ return;
12906
+ }
12907
+ setCheckinLoading(true);
12908
+ setCheckinError(null);
12909
+ try {
12910
+ const apiClient = createDemoRoomApi(apiConfig);
12911
+ const checkedInBooking = await apiClient.checkinBooking({
12912
+ booking_token: token
12913
+ });
12914
+ if (checkedInBooking) {
12915
+ setBookingData(checkedInBooking);
12916
+ window.location.reload();
12917
+ }
12918
+ } catch (err) {
12919
+ console.error("Failed to check in booking:", err);
12920
+ setCheckinError(
12921
+ pageData.cancelError || "Failed to check in. Please try again."
12922
+ );
12923
+ } finally {
12924
+ setCheckinLoading(false);
12925
+ }
12926
+ };
12847
12927
  if (loading) {
12848
12928
  return /* @__PURE__ */ jsx("div", { className: `min-h-screen py-12 px-6 ${className || ""}`, children: /* @__PURE__ */ jsx("div", { className: "mx-auto", children: /* @__PURE__ */ jsxs("div", { className: "animate-pulse space-y-6", children: [
12849
12929
  /* @__PURE__ */ jsx("div", { className: "h-8 bg-gray-200 rounded w-1/3" }),
@@ -12860,26 +12940,36 @@ var BookingSuccessO2O = ({
12860
12940
  }
12861
12941
  const podDesignName = bookingDesign?.material;
12862
12942
  const podDesignImage = bookingDesign?.thumb_url;
12863
- const podOrderCode = bookingDesign?.order_code;
12864
- console.log(bookingDesign);
12865
- console.log(bookingData);
12943
+ bookingDesign?.order_code;
12866
12944
  return /* @__PURE__ */ jsx("div", { className: `min-h-screen l:py-0 l:px-0 py-12 px-6 ${className || ""}`, children: /* @__PURE__ */ jsxs("div", { className: "mx-auto", children: [
12867
12945
  /* @__PURE__ */ jsx("h1", { className: "text-[48px] xxl:text-[32px] font-bold text-[#080A0F] mb-8 print:hidden", children: pageData.yourAppointment }),
12868
- isCancelled && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-[16px] l:items-start p-6 mb-4 l:gap-2 flex l:flex-col items-center justify-between print:hidden", children: [
12946
+ isCancelled && !isStore && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-[16px] l:items-start l:p-3 p-6 mb-4 l:gap-2 flex l:flex-col items-center justify-between print:hidden", children: [
12869
12947
  /* @__PURE__ */ jsx("p", { className: "text-base text-[#080A0F]", children: pageData.appointmentCanceled }),
12870
- onScheduleAgain && bookingData && /* @__PURE__ */ jsx(
12871
- "button",
12872
- {
12873
- onClick: () => onScheduleAgain(bookingData.demoroom_code),
12874
- className: "px-6 py-3 text-[16px] bg-black text-white rounded-full hover:bg-gray-800 transition-colors whitespace-nowrap",
12875
- children: pageData.scheduleAgain
12876
- }
12877
- )
12948
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center l:gap-2 gap-4", children: [
12949
+ !!pageData.contactUs && /* @__PURE__ */ jsx(
12950
+ "a",
12951
+ {
12952
+ href: pageData?.contactUsLink,
12953
+ target: "_blank",
12954
+ className: "text-[14px] cursor-pointer w-fit rounded-full text-[#080A0F] border-2 border-[#080A0F] px-[20px] l:px-[12px] py-[10px] leading-[1] hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
12955
+ rel: "noreferrer",
12956
+ children: pageData.contactUs
12957
+ }
12958
+ ),
12959
+ onScheduleAgain && bookingData && /* @__PURE__ */ jsx(
12960
+ "button",
12961
+ {
12962
+ onClick: () => onScheduleAgain(bookingData.demoroom_code),
12963
+ className: "text-[14px] cursor-pointer w-fit bg-black text-white rounded-full hover:bg-gray-800 border-2 border-[#080A0F] px-[20px] l:px-[12px] py-[10px] leading-[1] transition-colors",
12964
+ children: pageData.scheduleAgain
12965
+ }
12966
+ )
12967
+ ] })
12878
12968
  ] }),
12879
12969
  /* @__PURE__ */ jsxs(
12880
12970
  "div",
12881
12971
  {
12882
- className: bookingData.business_type === "pod" ? "grid grid-cols-2 gap-[16px] l:grid-cols-1 print:grid-cols-1" : "",
12972
+ className: bookingData.business_type === "pod" && !isCancelled && !isStore ? "grid grid-cols-2 gap-[16px] l:grid-cols-1 print:grid-cols-1" : "",
12883
12973
  children: [
12884
12974
  /* @__PURE__ */ jsxs("div", { className: "space-y-8 bg-white px-[48px] l:px-[16px] l:py-[16px] py-[32px] rounded-[16px] print:hidden", children: [
12885
12975
  /* @__PURE__ */ jsxs("div", { children: [
@@ -12978,21 +13068,20 @@ var BookingSuccessO2O = ({
12978
13068
  " ",
12979
13069
  podDesignName
12980
13070
  ] }),
12981
- bookingData?.status && pageData.podData?.status?.[bookingData.status] && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-[#4A4C56]", children: pageData.podData.status[bookingData.status] }),
12982
- podOrderCode && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-[#4A4C56]", children: podOrderCode })
13071
+ bookingData?.status && pageData.podData?.status?.[bookingData.status] && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-[#4A4C56]", children: pageData.podData.status[bookingData.status] })
12983
13072
  ] }),
12984
13073
  podDesignImage && /* @__PURE__ */ jsx(
12985
- "img",
13074
+ Image,
12986
13075
  {
12987
13076
  src: podDesignImage,
12988
13077
  alt: podDesignName,
12989
- className: "w-[88px] h-[88px] rounded-[8px] object-cover shrink-0"
13078
+ className: "!w-[88px] !h-[88px] rounded-[8px] !object-cover"
12990
13079
  }
12991
13080
  )
12992
13081
  ] })
12993
13082
  ] })
12994
13083
  ] }),
12995
- bookingData.business_type === "pod" && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-[16px] px-[48px] l:px-[16px] l:py-[16px] py-[32px] flex flex-col items-center justify-center text-center print:w-full", children: [
13084
+ bookingData.business_type === "pod" && !isStore && !isCancelled && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-[16px] px-[48px] l:px-[16px] l:py-[16px] py-[32px] flex flex-col items-center justify-center text-center print:w-full", children: [
12996
13085
  /* @__PURE__ */ jsx("h2", { className: "text-[24px] l:text-[20px] text-[#4A4C56] text-center", children: pageData.podData?.QRCodeTitle }),
12997
13086
  /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 text-center mt-2", children: pageData.podData?.QRCodeSubTitle }),
12998
13087
  /* @__PURE__ */ jsx(
@@ -13003,26 +13092,26 @@ var BookingSuccessO2O = ({
13003
13092
  children: /* @__PURE__ */ jsx(
13004
13093
  QRCode,
13005
13094
  {
13006
- value: "https://www.eufymake.com/?type=qrcode",
13095
+ value: `${pageData.podData?.QRCodeUrl}${token}&isStoreUser=true` || "",
13007
13096
  size: 200
13008
13097
  }
13009
13098
  )
13010
13099
  }
13011
13100
  ),
13012
13101
  /* @__PURE__ */ jsxs("div", { className: "flex justify-center gap-3 mt-6 print:hidden", children: [
13013
- /* @__PURE__ */ jsx(
13102
+ !!pageData.podData?.btnToWallet && /* @__PURE__ */ jsx(
13014
13103
  "button",
13015
13104
  {
13016
13105
  onClick: () => onAddToWallet?.(bookingData),
13017
- className: "rounded-full border-2 border-[#080A0F] px-[20px] py-[10px] text-[14px] hover:bg-gray-50 transition-colors",
13106
+ className: "text-[14px] cursor-pointer w-fit rounded-full text-[#080A0F] border-2 border-[#080A0F] px-[20px] py-[10px] leading-[1] hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
13018
13107
  children: pageData.podData?.btnToWallet
13019
13108
  }
13020
13109
  ),
13021
- /* @__PURE__ */ jsx(
13110
+ !!pageData.podData?.btnToPrint && /* @__PURE__ */ jsx(
13022
13111
  "button",
13023
13112
  {
13024
13113
  onClick: handlePrintQRCode,
13025
- className: "rounded-full border-2 border-[#080A0F] px-[20px] py-[10px] text-[14px] hover:bg-gray-50 transition-colors",
13114
+ className: "text-[14px] cursor-pointer w-fit rounded-full text-[#080A0F] border-2 border-[#080A0F] px-[20px] py-[10px] leading-[1] hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
13026
13115
  children: pageData.podData?.btnToPrint
13027
13116
  }
13028
13117
  )
@@ -13031,8 +13120,8 @@ var BookingSuccessO2O = ({
13031
13120
  ]
13032
13121
  }
13033
13122
  ),
13034
- !isCancelled && /* @__PURE__ */ jsxs("div", { className: "mt-[64px] print:hidden", children: [
13035
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
13123
+ isPending && /* @__PURE__ */ jsxs("div", { className: "mt-[64px] pb-4 print:hidden", children: [
13124
+ /* @__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: [
13036
13125
  onEditBooking && token && /* @__PURE__ */ jsx(
13037
13126
  "button",
13038
13127
  {
@@ -13041,7 +13130,7 @@ var BookingSuccessO2O = ({
13041
13130
  bookingData.demoroom_code,
13042
13131
  bookingData.business_type
13043
13132
  ),
13044
- className: "text-[14px] cursor-pointer w-fit rounded-full text-[#080A0F] border-2 border-[#080A0F] px-[20px] py-[10px] leading-[1] hover:bg-gray-50 transition-colors",
13133
+ className: "text-[14px] cursor-pointer w-fit bg-black text-white rounded-full hover:bg-gray-800 border-2 border-[#080A0F] l:px-[12px] px-[20px] py-[10px] leading-[1] transition-colors",
13045
13134
  children: pageData.editAppointment
13046
13135
  }
13047
13136
  ),
@@ -13050,13 +13139,25 @@ var BookingSuccessO2O = ({
13050
13139
  {
13051
13140
  onClick: () => setShowCancelDialog(true),
13052
13141
  disabled: cancelLoading,
13053
- className: "text-[14px] cursor-pointer w-fit rounded-full text-[#080A0F] border-2 border-[#080A0F] px-[20px] py-[10px] leading-[1] hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
13142
+ className: "text-[14px] cursor-pointer w-fit rounded-full text-[#080A0F] border-2 border-[#080A0F] px-[20px] l:px-[12px] py-[10px] leading-[1] hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
13054
13143
  children: pageData.cancelAppointment
13055
13144
  }
13056
13145
  )
13057
- ] }),
13146
+ ] }) }),
13058
13147
  cancelError && /* @__PURE__ */ jsx("p", { className: "text-sm mt-2", style: { color: "#FF4D4D" }, children: cancelError })
13059
13148
  ] }),
13149
+ isStore && bookingData?.print_status === "completed" && /* @__PURE__ */ jsxs("div", { className: "mt-[64px] pb-4 print:hidden", children: [
13150
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx(
13151
+ "button",
13152
+ {
13153
+ onClick: handleCheckin,
13154
+ disabled: checkinLoading,
13155
+ className: "text-[14px] cursor-pointer w-fit rounded-full text-[#080A0F] border-2 border-[#080A0F] px-[20px] l:px-[12px] py-[10px] leading-[1] hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
13156
+ children: pageData.changeStatusButton || "Change Pickup Status"
13157
+ }
13158
+ ) }),
13159
+ checkinError && /* @__PURE__ */ jsx("p", { className: "text-sm mt-2", style: { color: "#FF4D4D" }, children: checkinError })
13160
+ ] }),
13060
13161
  showCancelDialog && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 px-4 print:hidden", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-[24px] max-w-[600px] p-8 shadow-xl relative", children: [
13061
13162
  /* @__PURE__ */ jsx(
13062
13163
  "button",