@anker-in/ui 0.3.0 → 0.3.2

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';
@@ -864,12 +864,12 @@ function useBookingDesign(client, params, options) {
864
864
  });
865
865
  const enabled = options?.enabled !== false;
866
866
  useEffect(() => {
867
- if (!enabled || !params.booking_token) return;
867
+ if (!enabled || !params.booking_token && !(params.demoroom_code && params.session_id)) return;
868
868
  let cancelled = false;
869
869
  const fetchData = async () => {
870
870
  setState((prev) => ({ ...prev, loading: true, error: null }));
871
871
  try {
872
- const data = await client.getBookingDesign(params.booking_token);
872
+ const data = await client.getBookingDesign(params);
873
873
  if (!cancelled) {
874
874
  setState({ data, loading: false, error: null });
875
875
  }
@@ -887,7 +887,7 @@ function useBookingDesign(client, params, options) {
887
887
  return () => {
888
888
  cancelled = true;
889
889
  };
890
- }, [client, params.booking_token, enabled]);
890
+ }, [client, params.booking_token, params.demoroom_code, params.session_id, enabled]);
891
891
  return state;
892
892
  }
893
893
  var AntdMobileIsolated = ({
@@ -1766,12 +1766,23 @@ var DemoRoomApiClient = class {
1766
1766
  return response.booking;
1767
1767
  }
1768
1768
  /**
1769
- * 查询 POD 作品信息(模式1:精确查询)
1770
- * @param bookingToken 预约凭证
1769
+ * 查询 POD 作品信息
1770
+ * 模式1(优先):通过 booking_token 精确查询
1771
+ * 模式2:通过 demoroom_code + session_id 查询(MIR 跳回时预约尚未创建的场景)
1772
+ * @param params 查询参数
1771
1773
  */
1772
- async getBookingDesign(bookingToken) {
1774
+ async getBookingDesign(params) {
1773
1775
  const searchParams = new URLSearchParams();
1774
- searchParams.append("booking_token", bookingToken);
1776
+ if (params.booking_token) {
1777
+ searchParams.append("booking_token", params.booking_token);
1778
+ } else {
1779
+ if (params.demoroom_code) {
1780
+ searchParams.append("demoroom_code", params.demoroom_code);
1781
+ }
1782
+ if (params.session_id) {
1783
+ searchParams.append("session_id", params.session_id);
1784
+ }
1785
+ }
1775
1786
  return this.request(
1776
1787
  `/api/v1/store/bookings/design?${searchParams.toString()}`
1777
1788
  );
@@ -11404,6 +11415,7 @@ var DateTimePicker2 = ({
11404
11415
  apiClient,
11405
11416
  demoRoomCode,
11406
11417
  demoRoom: demoRoomProp,
11418
+ demoRoomLoading,
11407
11419
  token,
11408
11420
  booking,
11409
11421
  timezone: timezone5,
@@ -11432,11 +11444,12 @@ var DateTimePicker2 = ({
11432
11444
  loading: editLoading,
11433
11445
  error: editError
11434
11446
  } = useEditBooking(apiClient);
11447
+ const isManagedByParent = demoRoomLoading !== void 0;
11435
11448
  const { data: fetchedDemoRoom } = useDemoRoom(
11436
11449
  apiClient,
11437
11450
  demoRoomCode || "",
11438
11451
  locale,
11439
- { enabled: !demoRoomProp && !!demoRoomCode }
11452
+ { enabled: !isManagedByParent && !demoRoomProp && !!demoRoomCode }
11440
11453
  );
11441
11454
  const demoRoom = demoRoomProp ?? fetchedDemoRoom;
11442
11455
  const isPodPurpose = selectedPurposeType === "pod";
@@ -12074,6 +12087,7 @@ var DemoRoomDetail2 = ({
12074
12087
  demoRoomCode,
12075
12088
  locale,
12076
12089
  demoRoom: demoRoomProp,
12090
+ demoRoomLoading,
12077
12091
  title: titleProp,
12078
12092
  descriptions: descriptionsProp,
12079
12093
  devices: devicesProp,
@@ -12089,7 +12103,8 @@ var DemoRoomDetail2 = ({
12089
12103
  className,
12090
12104
  ...props
12091
12105
  }) => {
12092
- const shouldFetch = !demoRoomProp && !!apiClient && !!demoRoomCode;
12106
+ const isManagedByParent = demoRoomLoading !== void 0;
12107
+ const shouldFetch = !isManagedByParent && !demoRoomProp && !!apiClient && !!demoRoomCode;
12093
12108
  const {
12094
12109
  data: fetchedDemoRoom,
12095
12110
  loading,
@@ -12107,11 +12122,14 @@ var DemoRoomDetail2 = ({
12107
12122
  if (demoRoom?.latitude && demoRoom?.longitude) {
12108
12123
  return `https://www.google.com/maps/search/?api=1&query=${demoRoom.latitude},${demoRoom.longitude}`;
12109
12124
  } else if (address) {
12110
- return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(address)}`;
12125
+ return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(
12126
+ address
12127
+ )}`;
12111
12128
  }
12112
12129
  return "#";
12113
12130
  })();
12114
- if (loading && shouldFetch) {
12131
+ const isLoading = isManagedByParent ? !!demoRoomLoading : loading && shouldFetch;
12132
+ if (isLoading) {
12115
12133
  return /* @__PURE__ */ jsx("div", { className: cn("w-full pb-4", className), ...props, children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-8 items-start", children: [
12116
12134
  /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
12117
12135
  /* @__PURE__ */ jsx("div", { className: "h-12 bg-gray-200 rounded animate-pulse" }),
@@ -12127,129 +12145,133 @@ var DemoRoomDetail2 = ({
12127
12145
  /* @__PURE__ */ jsx("p", { className: "text-sm mt-2", children: error.message })
12128
12146
  ] }) });
12129
12147
  }
12130
- return /* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxs("div", { className: cn(
12131
- "gap-[80px] l:gap-[40px] l:flex l:flex-col-reverse items-start py-[24px] l:pb-[64px]",
12132
- images.length > 0 ? "grid grid-cols-2" : "flex"
12133
- ), children: [
12134
- /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
12135
- /* @__PURE__ */ jsx("h1", { className: "text-[48px] l:text-[32px] font-bold text-gray-900 leading-tight", children: title }),
12136
- /* @__PURE__ */ jsx("div", { className: "mt-[20px]", children: descriptions?.map((desc, index) => /* @__PURE__ */ jsx(
12137
- "p",
12138
- {
12139
- className: "text-base text-gray-600 leading-relaxed",
12140
- children: desc
12141
- },
12142
- index
12143
- )) }),
12144
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
12145
- /* @__PURE__ */ jsxs(
12146
- "svg",
12147
- {
12148
- width: "24",
12149
- height: "24",
12150
- viewBox: "0 0 24 24",
12151
- fill: "none",
12152
- xmlns: "http://www.w3.org/2000/svg",
12153
- className: "flex-shrink-0 mt-0.5",
12154
- children: [
12155
- /* @__PURE__ */ jsx(
12156
- "path",
12157
- {
12158
- 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",
12159
- stroke: "currentColor",
12160
- strokeWidth: "2",
12161
- strokeLinecap: "round",
12162
- strokeLinejoin: "round"
12163
- }
12164
- ),
12165
- /* @__PURE__ */ jsx(
12166
- "path",
12167
- {
12168
- 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",
12169
- stroke: "currentColor",
12170
- strokeWidth: "2",
12171
- strokeLinecap: "round",
12172
- strokeLinejoin: "round"
12173
- }
12174
- )
12175
- ]
12176
- }
12177
- ),
12178
- /* @__PURE__ */ jsx("span", { className: "text-base text-gray-900", children: devices })
12179
- ] }),
12180
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
12181
- /* @__PURE__ */ jsxs(
12182
- "svg",
12183
- {
12184
- width: "24",
12185
- height: "24",
12186
- viewBox: "0 0 24 24",
12187
- fill: "none",
12188
- xmlns: "http://www.w3.org/2000/svg",
12189
- className: "flex-shrink-0 mt-0.5",
12190
- children: [
12191
- /* @__PURE__ */ jsx(
12192
- "path",
12193
- {
12194
- 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",
12195
- stroke: "currentColor",
12196
- strokeWidth: "2",
12197
- strokeLinecap: "round",
12198
- strokeLinejoin: "round"
12199
- }
12200
- ),
12201
- /* @__PURE__ */ jsx(
12202
- "circle",
12203
- {
12204
- cx: "12",
12205
- cy: "9",
12206
- r: "2.5",
12207
- stroke: "currentColor",
12208
- strokeWidth: "2"
12209
- }
12210
- )
12211
- ]
12212
- }
12213
- ),
12214
- /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
12215
- /* @__PURE__ */ jsx("p", { className: "text-base text-gray-900", children: address }),
12216
- /* @__PURE__ */ jsxs(
12217
- "a",
12148
+ return /* @__PURE__ */ jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxs(
12149
+ "div",
12150
+ {
12151
+ className: cn(
12152
+ "gap-[80px] l:gap-[40px] l:flex l:flex-col-reverse items-start py-[24px] l:pb-[64px]",
12153
+ images.length > 0 ? "grid grid-cols-2" : "flex"
12154
+ ),
12155
+ children: [
12156
+ /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
12157
+ /* @__PURE__ */ jsx("h1", { className: "text-[48px] l:text-[32px] font-bold text-gray-900 leading-tight", children: title }),
12158
+ /* @__PURE__ */ jsx("div", { className: "mt-[20px]", children: descriptions?.map((desc, index) => /* @__PURE__ */ jsx(
12159
+ "p",
12218
12160
  {
12219
- href: googleMapsLink,
12220
- target: "_blank",
12221
- rel: "noopener noreferrer",
12222
- className: "inline-flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700 mt-1 underline",
12223
- children: [
12224
- pageData.openInGoogleMaps,
12225
- /* @__PURE__ */ jsx(
12226
- "svg",
12227
- {
12228
- width: "12",
12229
- height: "12",
12230
- viewBox: "0 0 12 12",
12231
- fill: "none",
12232
- xmlns: "http://www.w3.org/2000/svg",
12233
- children: /* @__PURE__ */ jsx(
12234
- "path",
12161
+ className: "text-base text-gray-600 leading-relaxed",
12162
+ children: desc
12163
+ },
12164
+ index
12165
+ )) }),
12166
+ !!devices && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
12167
+ /* @__PURE__ */ jsxs(
12168
+ "svg",
12169
+ {
12170
+ width: "24",
12171
+ height: "24",
12172
+ viewBox: "0 0 24 24",
12173
+ fill: "none",
12174
+ xmlns: "http://www.w3.org/2000/svg",
12175
+ className: "flex-shrink-0 mt-0.5",
12176
+ children: [
12177
+ /* @__PURE__ */ jsx(
12178
+ "path",
12179
+ {
12180
+ 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",
12181
+ stroke: "currentColor",
12182
+ strokeWidth: "2",
12183
+ strokeLinecap: "round",
12184
+ strokeLinejoin: "round"
12185
+ }
12186
+ ),
12187
+ /* @__PURE__ */ jsx(
12188
+ "path",
12189
+ {
12190
+ 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",
12191
+ stroke: "currentColor",
12192
+ strokeWidth: "2",
12193
+ strokeLinecap: "round",
12194
+ strokeLinejoin: "round"
12195
+ }
12196
+ )
12197
+ ]
12198
+ }
12199
+ ),
12200
+ /* @__PURE__ */ jsx("span", { className: "text-base text-gray-900", children: devices })
12201
+ ] }),
12202
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
12203
+ /* @__PURE__ */ jsxs(
12204
+ "svg",
12205
+ {
12206
+ width: "24",
12207
+ height: "24",
12208
+ viewBox: "0 0 24 24",
12209
+ fill: "none",
12210
+ xmlns: "http://www.w3.org/2000/svg",
12211
+ className: "flex-shrink-0 mt-0.5",
12212
+ children: [
12213
+ /* @__PURE__ */ jsx(
12214
+ "path",
12215
+ {
12216
+ 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",
12217
+ stroke: "currentColor",
12218
+ strokeWidth: "2",
12219
+ strokeLinecap: "round",
12220
+ strokeLinejoin: "round"
12221
+ }
12222
+ ),
12223
+ /* @__PURE__ */ jsx(
12224
+ "circle",
12225
+ {
12226
+ cx: "12",
12227
+ cy: "9",
12228
+ r: "2.5",
12229
+ stroke: "currentColor",
12230
+ strokeWidth: "2"
12231
+ }
12232
+ )
12233
+ ]
12234
+ }
12235
+ ),
12236
+ /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
12237
+ /* @__PURE__ */ jsx("p", { className: "text-base text-gray-900", children: address }),
12238
+ /* @__PURE__ */ jsxs(
12239
+ "a",
12240
+ {
12241
+ href: googleMapsLink,
12242
+ target: "_blank",
12243
+ rel: "noopener noreferrer",
12244
+ className: "inline-flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700 mt-1 underline",
12245
+ children: [
12246
+ pageData.openInGoogleMaps,
12247
+ /* @__PURE__ */ jsx(
12248
+ "svg",
12235
12249
  {
12236
- d: "M3 9L9 3M9 3H3M9 3V9",
12237
- stroke: "currentColor",
12238
- strokeWidth: "1.5",
12239
- strokeLinecap: "round",
12240
- strokeLinejoin: "round"
12250
+ width: "12",
12251
+ height: "12",
12252
+ viewBox: "0 0 12 12",
12253
+ fill: "none",
12254
+ xmlns: "http://www.w3.org/2000/svg",
12255
+ children: /* @__PURE__ */ jsx(
12256
+ "path",
12257
+ {
12258
+ d: "M3 9L9 3M9 3H3M9 3V9",
12259
+ stroke: "currentColor",
12260
+ strokeWidth: "1.5",
12261
+ strokeLinecap: "round",
12262
+ strokeLinejoin: "round"
12263
+ }
12264
+ )
12241
12265
  }
12242
12266
  )
12243
- }
12244
- )
12245
- ]
12246
- }
12247
- )
12248
- ] })
12249
- ] })
12250
- ] }),
12251
- images.length > 0 && /* @__PURE__ */ jsxs("div", { className: "relative l:w-full min-l:h-[400px] rounded-2xl overflow-hidden demo-room-swiper", children: [
12252
- /* @__PURE__ */ jsx("style", { children: `
12267
+ ]
12268
+ }
12269
+ )
12270
+ ] })
12271
+ ] })
12272
+ ] }),
12273
+ images.length > 0 && /* @__PURE__ */ jsxs("div", { className: "relative l:w-full min-l:h-[400px] rounded-2xl overflow-hidden demo-room-swiper", children: [
12274
+ /* @__PURE__ */ jsx("style", { children: `
12253
12275
  .demo-room-swiper .swiper-pagination-bullet {
12254
12276
  background-color: rgba(255, 255, 255, 0.5);
12255
12277
  }
@@ -12279,51 +12301,73 @@ var DemoRoomDetail2 = ({
12279
12301
  right: 16px !important;
12280
12302
  }
12281
12303
  ` }),
12282
- /* @__PURE__ */ jsx(
12283
- Swiper2,
12284
- {
12285
- modules: [Navigation, Pagination, Autoplay],
12286
- spaceBetween: 0,
12287
- slidesPerView: 1,
12288
- navigation: images.length > 1,
12289
- pagination: images.length > 1 ? { clickable: true } : false,
12290
- autoplay: images.length > 1 ? {
12291
- delay: 3e3,
12292
- disableOnInteraction: false
12293
- } : false,
12294
- loop: images.length > 1,
12295
- className: "h-full rounded-2xl",
12296
- children: images.map((img, index) => /* @__PURE__ */ jsx(SwiperSlide, { children: /* @__PURE__ */ jsx("div", { className: "relative w-full h-full bg-gray-100", children: /* @__PURE__ */ jsx(
12297
- "img",
12304
+ /* @__PURE__ */ jsx(
12305
+ Swiper2,
12298
12306
  {
12299
- src: img,
12300
- alt: `Demo room view ${index + 1}`,
12301
- className: "w-full h-full object-cover"
12307
+ modules: [Navigation, Pagination, Autoplay],
12308
+ spaceBetween: 0,
12309
+ slidesPerView: 1,
12310
+ navigation: images.length > 1,
12311
+ pagination: images.length > 1 ? { clickable: true } : false,
12312
+ autoplay: images.length > 1 ? {
12313
+ delay: 3e3,
12314
+ disableOnInteraction: false
12315
+ } : false,
12316
+ loop: images.length > 1,
12317
+ className: "h-full rounded-2xl",
12318
+ children: images.map((img, index) => /* @__PURE__ */ jsx(SwiperSlide, { children: /* @__PURE__ */ jsx("div", { className: "relative w-full h-full bg-gray-100", children: /* @__PURE__ */ jsx(
12319
+ "img",
12320
+ {
12321
+ src: img,
12322
+ alt: `Demo room view ${index + 1}`,
12323
+ className: "w-full h-full object-cover"
12324
+ }
12325
+ ) }) }, index))
12302
12326
  }
12303
- ) }) }, index))
12304
- }
12305
- )
12306
- ] })
12307
- ] }) });
12327
+ )
12328
+ ] })
12329
+ ]
12330
+ }
12331
+ ) });
12308
12332
  };
12309
12333
  DemoRoomDetail2.displayName = "DemoRoomDetail";
12310
12334
 
12311
12335
  // src/components/BookingFormO2O/utils/buildMirUrl.ts
12336
+ var REDIRECT_URL_ALLOWED_PARAMS = ["code", "business_type", "token"];
12337
+ function sanitizeRedirectSource(source) {
12338
+ if (!source) return source;
12339
+ try {
12340
+ const parsed = new URL(source);
12341
+ const keptParams = new URLSearchParams();
12342
+ REDIRECT_URL_ALLOWED_PARAMS.forEach((key) => {
12343
+ const value = parsed.searchParams.get(key);
12344
+ if (value) keptParams.set(key, value);
12345
+ });
12346
+ parsed.search = keptParams.toString();
12347
+ return parsed.toString();
12348
+ } catch {
12349
+ return source;
12350
+ }
12351
+ }
12312
12352
  function buildMirWelcomeUrl({
12313
12353
  baseUrl,
12314
12354
  language,
12315
12355
  managerId,
12316
12356
  credential,
12317
- currentUrl
12357
+ currentUrl,
12358
+ managerIdParam = "email",
12359
+ credentialParam = "credential"
12318
12360
  }) {
12319
12361
  const url = new URL(baseUrl);
12320
12362
  if (language) {
12321
12363
  url.searchParams.set("language", language);
12322
12364
  }
12323
12365
  url.searchParams.set("countrycode", "US");
12324
- url.searchParams.set("email", managerId);
12325
- url.searchParams.set("credential", credential);
12326
- const redirectSource = currentUrl ?? (typeof window !== "undefined" ? window.location.href : "");
12366
+ url.searchParams.set(managerIdParam, managerId);
12367
+ url.searchParams.set(credentialParam, credential);
12368
+ const redirectSource = sanitizeRedirectSource(
12369
+ currentUrl ?? (typeof window !== "undefined" ? window.location.href : "")
12370
+ );
12327
12371
  url.searchParams.set("redirect_url", encodeURIComponent(redirectSource));
12328
12372
  return url.toString();
12329
12373
  }
@@ -12400,7 +12444,7 @@ var getPurposeLabel = (pageData) => {
12400
12444
  return "What is your purpose of visit?";
12401
12445
  };
12402
12446
  var getPodContentDescription = (podContent) => podContent?.description || podContent?.subTitle;
12403
- var getPodContentImage = (podContent) => podContent?.image || podContent?.defaultImg;
12447
+ var getPodContentImage = (podContent) => podContent?.defaultImg;
12404
12448
  var getPodContentButtonText = (podContent) => podContent?.buttonText || podContent?.btnText;
12405
12449
  var BookingFormO2O = ({
12406
12450
  layoutClassName,
@@ -12417,9 +12461,10 @@ var BookingFormO2O = ({
12417
12461
  }) => {
12418
12462
  const apiClient = useMemo(
12419
12463
  () => createDemoRoomApi(apiConfig),
12420
- [apiConfig]
12464
+ // eslint-disable-next-line react-hooks/exhaustive-deps
12465
+ [apiConfig.baseUrl, apiConfig.apiKey, apiConfig.locale]
12421
12466
  );
12422
- const { data: demoRoom } = useDemoRoom(
12467
+ const { data: demoRoom, loading: demoRoomLoading } = useDemoRoom(
12423
12468
  apiClient,
12424
12469
  demoRoomCode || "",
12425
12470
  apiConfig.locale,
@@ -12460,17 +12505,47 @@ var BookingFormO2O = ({
12460
12505
  }, [purposeOptions, selectedPurposeType]);
12461
12506
  const selectedPodContent = selectedPurpose?.podContent;
12462
12507
  const selectedPodDescription = getPodContentDescription(selectedPodContent);
12463
- const selectedPodButtonText = getPodContentButtonText(selectedPodContent);
12508
+ const podDesignId = useMemo(() => getQueryParam("design_id"), []);
12509
+ const isPodDesignEditMode = !!podDesignId || !!booking?.design_project_id;
12510
+ const storeManagerIdFromUrl = useMemo(
12511
+ () => getQueryParam("store_manager_id"),
12512
+ []
12513
+ );
12514
+ const mirSessionId = useMemo(() => getQueryParam("session_id"), []);
12515
+ const effectiveStoreManagerId = storeManagerIdFromUrl || demoRoom?.contact?.manager_id;
12516
+ const effectiveMirSessionId = mirSessionId || booking?.design_project_id;
12517
+ const { data: bookingDesign } = useBookingDesign(
12518
+ apiClient,
12519
+ { demoroom_code: demoRoomCode, session_id: effectiveMirSessionId },
12520
+ { enabled: !!demoRoomCode && !!effectiveMirSessionId }
12521
+ );
12522
+ const selectedPodButtonText = isPodDesignEditMode ? selectedPodContent?.btnEditText : getPodContentButtonText(selectedPodContent);
12464
12523
  const selectedPodImage = getSafePageDataUrl(
12465
- getPodContentImage(selectedPodContent)
12524
+ isPodDesignEditMode && bookingDesign?.thumb_url || getPodContentImage(selectedPodContent)
12466
12525
  );
12467
- const selectedPodButtonIcon = getSafePageDataUrl(selectedPodContent?.btnIcon);
12468
- const podDesignId = useMemo(() => getQueryParam("design_id"), []);
12469
- const managerId = "57b98522a6a81087af435727aab98dfd0f8be7d3033338ba0db5517e0e08d0a7b13635faa5fc16c33f36fab1a6ceb29e";
12470
- const isPodButtonDisabled = !managerId;
12526
+ const selectedPodButtonIcon = getSafePageDataUrl(
12527
+ isPodDesignEditMode ? selectedPodContent?.btnEditIcon : selectedPodContent?.btnIcon
12528
+ );
12529
+ const managerId = demoRoom?.contact?.manager_hash;
12530
+ const isPodButtonDisabled = isPodDesignEditMode ? !effectiveStoreManagerId || !effectiveMirSessionId : !managerId;
12471
12531
  const mirCredential = useMemo(() => crypto.randomUUID(), [demoRoomCode]);
12472
- console.log(selectedPodContent);
12473
12532
  const selectedPodButtonLink = useMemo(() => {
12533
+ if (isPodButtonDisabled) return void 0;
12534
+ if (isPodDesignEditMode) {
12535
+ const editBaseUrl = getSafePageDataUrl(selectedPodContent?.buttonEditLink);
12536
+ if (!editBaseUrl || !effectiveStoreManagerId || !effectiveMirSessionId) {
12537
+ return void 0;
12538
+ }
12539
+ return buildMirWelcomeUrl({
12540
+ baseUrl: editBaseUrl,
12541
+ language: apiConfig.locale,
12542
+ managerId: effectiveStoreManagerId,
12543
+ credential: effectiveMirSessionId,
12544
+ managerIdParam: "store_manager_id",
12545
+ credentialParam: "sessionid"
12546
+ });
12547
+ }
12548
+ if (!managerId) return void 0;
12474
12549
  const baseUrl = getSafePageDataUrl(selectedPodContent?.buttonLink);
12475
12550
  if (!baseUrl) return void 0;
12476
12551
  return buildMirWelcomeUrl({
@@ -12484,7 +12559,10 @@ var BookingFormO2O = ({
12484
12559
  apiConfig.locale,
12485
12560
  managerId,
12486
12561
  isPodButtonDisabled,
12487
- mirCredential
12562
+ mirCredential,
12563
+ isPodDesignEditMode,
12564
+ effectiveStoreManagerId,
12565
+ effectiveMirSessionId
12488
12566
  ]);
12489
12567
  const dateTimePickerPageData = useMemo(
12490
12568
  () => ({
@@ -12501,6 +12579,7 @@ var BookingFormO2O = ({
12501
12579
  apiClient,
12502
12580
  demoRoomCode,
12503
12581
  demoRoom,
12582
+ demoRoomLoading,
12504
12583
  locale: apiConfig.locale,
12505
12584
  pageData: pageData?.demoRoomDetail
12506
12585
  }
@@ -12525,7 +12604,11 @@ var BookingFormO2O = ({
12525
12604
  onChange: (event2) => {
12526
12605
  setSelectedPurposeType(event2.target.value);
12527
12606
  },
12528
- 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]",
12607
+ disabled: !!token,
12608
+ className: cn(
12609
+ "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]",
12610
+ token && "pointer-events-none cursor-not-allowed opacity-50"
12611
+ ),
12529
12612
  children: purposeOptions.map((item, index) => /* @__PURE__ */ jsx(
12530
12613
  "option",
12531
12614
  {
@@ -12548,7 +12631,7 @@ var BookingFormO2O = ({
12548
12631
  {
12549
12632
  src: selectedPodImage,
12550
12633
  alt: selectedPodContent.imageAlt || selectedPodContent.title || "",
12551
- className: "mt-[12px] h-[156px] w-full rounded-[8px] object-cover l:h-auto"
12634
+ className: "mt-[12px] h-[220px] rounded-[8px] object-cover l:h-auto"
12552
12635
  }
12553
12636
  ),
12554
12637
  !!selectedPodButtonText && /* @__PURE__ */ jsxs(
@@ -12556,13 +12639,14 @@ var BookingFormO2O = ({
12556
12639
  {
12557
12640
  href: selectedPodButtonLink || "#",
12558
12641
  "aria-disabled": isPodButtonDisabled,
12559
- tabIndex: void 0,
12642
+ tabIndex: isPodButtonDisabled ? -1 : void 0,
12560
12643
  onClick: (event2) => {
12644
+ if (isPodButtonDisabled) event2.preventDefault();
12561
12645
  },
12562
12646
  rel: "noopener noreferrer",
12563
12647
  className: cn(
12564
12648
  "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]",
12565
- isPodButtonDisabled
12649
+ isPodButtonDisabled && "pointer-events-none cursor-not-allowed opacity-50"
12566
12650
  ),
12567
12651
  children: [
12568
12652
  selectedPodButtonIcon && /* @__PURE__ */ jsx(
@@ -12586,6 +12670,7 @@ var BookingFormO2O = ({
12586
12670
  apiClient,
12587
12671
  demoRoomCode,
12588
12672
  demoRoom,
12673
+ demoRoomLoading,
12589
12674
  token,
12590
12675
  booking,
12591
12676
  timezone: timezone5,
@@ -12594,7 +12679,7 @@ var BookingFormO2O = ({
12594
12679
  onQuestionnaireSubmit,
12595
12680
  pageData: dateTimePickerPageData,
12596
12681
  selectedPurposeType: selectedPurpose?.type,
12597
- podDesignId
12682
+ podDesignId: mirSessionId
12598
12683
  }
12599
12684
  ) })
12600
12685
  ] })
@@ -12604,6 +12689,7 @@ BookingFormO2O.displayName = "BookingFormO2O";
12604
12689
  var BookingSuccessO2O = ({
12605
12690
  bookingData: initialBookingData,
12606
12691
  token,
12692
+ isStoreUser,
12607
12693
  apiConfig,
12608
12694
  onScheduleAgain,
12609
12695
  onCancelSuccess,
@@ -12723,7 +12809,9 @@ var BookingSuccessO2O = ({
12723
12809
  const fetchBookingDesign = async () => {
12724
12810
  try {
12725
12811
  const apiClient = createDemoRoomApi(apiConfig);
12726
- const design = await apiClient.getBookingDesign(token);
12812
+ const design = await apiClient.getBookingDesign({
12813
+ booking_token: token
12814
+ });
12727
12815
  setBookingDesign(design);
12728
12816
  } catch (err) {
12729
12817
  console.error("Failed to fetch booking design:", err);
@@ -12785,9 +12873,7 @@ var BookingSuccessO2O = ({
12785
12873
  }
12786
12874
  const podDesignName = bookingDesign?.material;
12787
12875
  const podDesignImage = bookingDesign?.thumb_url;
12788
- const podOrderCode = bookingDesign?.order_code;
12789
- console.log(bookingDesign);
12790
- console.log(bookingData);
12876
+ bookingDesign?.order_code;
12791
12877
  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: [
12792
12878
  /* @__PURE__ */ jsx("h1", { className: "text-[48px] xxl:text-[32px] font-bold text-[#080A0F] mb-8 print:hidden", children: pageData.yourAppointment }),
12793
12879
  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: [
@@ -12903,15 +12989,14 @@ var BookingSuccessO2O = ({
12903
12989
  " ",
12904
12990
  podDesignName
12905
12991
  ] }),
12906
- bookingData?.status && pageData.podData?.status?.[bookingData.status] && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-[#4A4C56]", children: pageData.podData.status[bookingData.status] }),
12907
- podOrderCode && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-[#4A4C56]", children: podOrderCode })
12992
+ bookingData?.status && pageData.podData?.status?.[bookingData.status] && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-[#4A4C56]", children: pageData.podData.status[bookingData.status] })
12908
12993
  ] }),
12909
12994
  podDesignImage && /* @__PURE__ */ jsx(
12910
- "img",
12995
+ Image,
12911
12996
  {
12912
12997
  src: podDesignImage,
12913
12998
  alt: podDesignName,
12914
- className: "w-[88px] h-[88px] rounded-[8px] object-cover shrink-0"
12999
+ className: "!w-[88px] !h-[88px] rounded-[8px] !object-cover"
12915
13000
  }
12916
13001
  )
12917
13002
  ] })
@@ -12928,7 +13013,7 @@ var BookingSuccessO2O = ({
12928
13013
  children: /* @__PURE__ */ jsx(
12929
13014
  QRCode,
12930
13015
  {
12931
- value: "https://www.eufymake.com/?type=qrcode",
13016
+ value: `${pageData.podData?.QRCodeUrl}${token}&isStoreUser=true` || "",
12932
13017
  size: 200
12933
13018
  }
12934
13019
  )