@anker-in/ui 0.3.0 → 0.3.1
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/demo-room.js +15 -4
- package/dist/demo-room.js.map +1 -1
- package/dist/demo-room.mjs +15 -4
- package/dist/demo-room.mjs.map +1 -1
- package/dist/index.d.mts +22 -8
- package/dist/index.d.ts +22 -8
- package/dist/index.js +104 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +104 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -254,6 +254,7 @@ interface DemoRoomContract {
|
|
|
254
254
|
manager_id?: string;
|
|
255
255
|
host_email?: string;
|
|
256
256
|
host_name?: string;
|
|
257
|
+
manager_hash?: string;
|
|
257
258
|
}
|
|
258
259
|
interface DemoRoomPodConfig {
|
|
259
260
|
questionnaire_id?: number;
|
|
@@ -397,6 +398,11 @@ interface CheckinBookingRequest {
|
|
|
397
398
|
interface CheckinBookingResponse {
|
|
398
399
|
booking: Booking;
|
|
399
400
|
}
|
|
401
|
+
interface GetBookingDesignRequest {
|
|
402
|
+
booking_token?: string;
|
|
403
|
+
demoroom_code?: string;
|
|
404
|
+
session_id?: string;
|
|
405
|
+
}
|
|
400
406
|
interface BookingDesign {
|
|
401
407
|
id: number;
|
|
402
408
|
project_id: string;
|
|
@@ -501,10 +507,12 @@ declare class DemoRoomApiClient {
|
|
|
501
507
|
*/
|
|
502
508
|
checkinBooking(data: CheckinBookingRequest): Promise<Booking>;
|
|
503
509
|
/**
|
|
504
|
-
* 查询 POD
|
|
505
|
-
*
|
|
510
|
+
* 查询 POD 作品信息
|
|
511
|
+
* 模式1(优先):通过 booking_token 精确查询
|
|
512
|
+
* 模式2:通过 demoroom_code + session_id 查询(MIR 跳回时预约尚未创建的场景)
|
|
513
|
+
* @param params 查询参数
|
|
506
514
|
*/
|
|
507
|
-
getBookingDesign(
|
|
515
|
+
getBookingDesign(params: GetBookingDesignRequest): Promise<BookingDesign>;
|
|
508
516
|
}
|
|
509
517
|
declare function createDemoRoomApi(config: DemoRoomApiConfig): DemoRoomApiClient;
|
|
510
518
|
|
|
@@ -533,6 +541,12 @@ interface BookingPurposePodContent {
|
|
|
533
541
|
btnText?: string;
|
|
534
542
|
buttonLink?: string;
|
|
535
543
|
btnIcon?: string;
|
|
544
|
+
/** 编辑设计按钮文案(URL 中存在 design_id 时使用,即访客已在 MIR 完成过设计) */
|
|
545
|
+
btnEditText?: string;
|
|
546
|
+
/** 编辑设计按钮图标(URL 中存在 design_id 时使用) */
|
|
547
|
+
btnEditIcon?: string;
|
|
548
|
+
/** 编辑设计跳转链接(URL 中存在 design_id 时使用) */
|
|
549
|
+
buttonEditLink?: string;
|
|
536
550
|
}
|
|
537
551
|
interface BookingPurposeDataItem {
|
|
538
552
|
type?: string;
|
|
@@ -831,14 +845,14 @@ declare function useCheckinBooking(client: DemoRoomApiClient): {
|
|
|
831
845
|
error: ApiError | null;
|
|
832
846
|
};
|
|
833
847
|
/**
|
|
834
|
-
* 查询 POD 作品信息 Hook
|
|
848
|
+
* 查询 POD 作品信息 Hook
|
|
849
|
+
* 模式1(优先):通过 booking_token 精确查询
|
|
850
|
+
* 模式2:通过 demoroom_code + session_id 查询(MIR 跳回时预约尚未创建的场景)
|
|
835
851
|
*/
|
|
836
|
-
declare function useBookingDesign(client: DemoRoomApiClient, params: {
|
|
837
|
-
booking_token: string;
|
|
838
|
-
}, options?: {
|
|
852
|
+
declare function useBookingDesign(client: DemoRoomApiClient, params: GetBookingDesignRequest, options?: {
|
|
839
853
|
enabled?: boolean;
|
|
840
854
|
}): UseApiState<BookingDesign>;
|
|
841
855
|
|
|
842
856
|
declare function cn(...inputs: ClassValue[]): string;
|
|
843
857
|
|
|
844
|
-
export { ApiError, ApiErrorCode, type ApiResponse, type Booking, type BookingDesign, BookingForm, BookingFormO2O, type BookingFormO2OProps, type BookingFormProps, type BookingStatus, BookingSuccess, BookingSuccessO2O, type BookingSuccessO2OProps, type BookingSuccessProps, type CancelBookingResponse, type CheckinBookingRequest, type CheckinBookingResponse, type CreateBookingRequest, type CreateBookingResponse, DemoRoomApiClient, type DemoRoomApiConfig, type DemoRoom as DemoRoomData, DemoRoomO2O, type DemoRoomO2OProps, type DemoRoomStatus, type DemoRoomType, type EditBookingRequest, type GetBookingResponse, type GetDemoRoomsResponse, type GetTimeslotsResponse, type Question, type QuestionOption, type QuestionType, type Questionnaire, type Timeslot, type TimeslotStatus, cn, createDemoRoomApi, useBooking, useBookingDesign, useCancelBooking, useCheckinBooking, useCreateBooking, useDemoRoom, useDemoRooms, useEditBooking, useQuestionnaire, useTimeslots };
|
|
858
|
+
export { ApiError, ApiErrorCode, type ApiResponse, type Booking, type BookingDesign, BookingForm, BookingFormO2O, type BookingFormO2OProps, type BookingFormProps, type BookingStatus, BookingSuccess, BookingSuccessO2O, type BookingSuccessO2OProps, type BookingSuccessProps, type CancelBookingResponse, type CheckinBookingRequest, type CheckinBookingResponse, type CreateBookingRequest, type CreateBookingResponse, DemoRoomApiClient, type DemoRoomApiConfig, type DemoRoom as DemoRoomData, DemoRoomO2O, type DemoRoomO2OProps, type DemoRoomStatus, type DemoRoomType, type EditBookingRequest, type GetBookingDesignRequest, type GetBookingResponse, type GetDemoRoomsResponse, type GetTimeslotsResponse, type Question, type QuestionOption, type QuestionType, type Questionnaire, type Timeslot, type TimeslotStatus, cn, createDemoRoomApi, useBooking, useBookingDesign, useCancelBooking, useCheckinBooking, useCreateBooking, useDemoRoom, useDemoRooms, useEditBooking, useQuestionnaire, useTimeslots };
|
package/dist/index.d.ts
CHANGED
|
@@ -254,6 +254,7 @@ interface DemoRoomContract {
|
|
|
254
254
|
manager_id?: string;
|
|
255
255
|
host_email?: string;
|
|
256
256
|
host_name?: string;
|
|
257
|
+
manager_hash?: string;
|
|
257
258
|
}
|
|
258
259
|
interface DemoRoomPodConfig {
|
|
259
260
|
questionnaire_id?: number;
|
|
@@ -397,6 +398,11 @@ interface CheckinBookingRequest {
|
|
|
397
398
|
interface CheckinBookingResponse {
|
|
398
399
|
booking: Booking;
|
|
399
400
|
}
|
|
401
|
+
interface GetBookingDesignRequest {
|
|
402
|
+
booking_token?: string;
|
|
403
|
+
demoroom_code?: string;
|
|
404
|
+
session_id?: string;
|
|
405
|
+
}
|
|
400
406
|
interface BookingDesign {
|
|
401
407
|
id: number;
|
|
402
408
|
project_id: string;
|
|
@@ -501,10 +507,12 @@ declare class DemoRoomApiClient {
|
|
|
501
507
|
*/
|
|
502
508
|
checkinBooking(data: CheckinBookingRequest): Promise<Booking>;
|
|
503
509
|
/**
|
|
504
|
-
* 查询 POD
|
|
505
|
-
*
|
|
510
|
+
* 查询 POD 作品信息
|
|
511
|
+
* 模式1(优先):通过 booking_token 精确查询
|
|
512
|
+
* 模式2:通过 demoroom_code + session_id 查询(MIR 跳回时预约尚未创建的场景)
|
|
513
|
+
* @param params 查询参数
|
|
506
514
|
*/
|
|
507
|
-
getBookingDesign(
|
|
515
|
+
getBookingDesign(params: GetBookingDesignRequest): Promise<BookingDesign>;
|
|
508
516
|
}
|
|
509
517
|
declare function createDemoRoomApi(config: DemoRoomApiConfig): DemoRoomApiClient;
|
|
510
518
|
|
|
@@ -533,6 +541,12 @@ interface BookingPurposePodContent {
|
|
|
533
541
|
btnText?: string;
|
|
534
542
|
buttonLink?: string;
|
|
535
543
|
btnIcon?: string;
|
|
544
|
+
/** 编辑设计按钮文案(URL 中存在 design_id 时使用,即访客已在 MIR 完成过设计) */
|
|
545
|
+
btnEditText?: string;
|
|
546
|
+
/** 编辑设计按钮图标(URL 中存在 design_id 时使用) */
|
|
547
|
+
btnEditIcon?: string;
|
|
548
|
+
/** 编辑设计跳转链接(URL 中存在 design_id 时使用) */
|
|
549
|
+
buttonEditLink?: string;
|
|
536
550
|
}
|
|
537
551
|
interface BookingPurposeDataItem {
|
|
538
552
|
type?: string;
|
|
@@ -831,14 +845,14 @@ declare function useCheckinBooking(client: DemoRoomApiClient): {
|
|
|
831
845
|
error: ApiError | null;
|
|
832
846
|
};
|
|
833
847
|
/**
|
|
834
|
-
* 查询 POD 作品信息 Hook
|
|
848
|
+
* 查询 POD 作品信息 Hook
|
|
849
|
+
* 模式1(优先):通过 booking_token 精确查询
|
|
850
|
+
* 模式2:通过 demoroom_code + session_id 查询(MIR 跳回时预约尚未创建的场景)
|
|
835
851
|
*/
|
|
836
|
-
declare function useBookingDesign(client: DemoRoomApiClient, params: {
|
|
837
|
-
booking_token: string;
|
|
838
|
-
}, options?: {
|
|
852
|
+
declare function useBookingDesign(client: DemoRoomApiClient, params: GetBookingDesignRequest, options?: {
|
|
839
853
|
enabled?: boolean;
|
|
840
854
|
}): UseApiState<BookingDesign>;
|
|
841
855
|
|
|
842
856
|
declare function cn(...inputs: ClassValue[]): string;
|
|
843
857
|
|
|
844
|
-
export { ApiError, ApiErrorCode, type ApiResponse, type Booking, type BookingDesign, BookingForm, BookingFormO2O, type BookingFormO2OProps, type BookingFormProps, type BookingStatus, BookingSuccess, BookingSuccessO2O, type BookingSuccessO2OProps, type BookingSuccessProps, type CancelBookingResponse, type CheckinBookingRequest, type CheckinBookingResponse, type CreateBookingRequest, type CreateBookingResponse, DemoRoomApiClient, type DemoRoomApiConfig, type DemoRoom as DemoRoomData, DemoRoomO2O, type DemoRoomO2OProps, type DemoRoomStatus, type DemoRoomType, type EditBookingRequest, type GetBookingResponse, type GetDemoRoomsResponse, type GetTimeslotsResponse, type Question, type QuestionOption, type QuestionType, type Questionnaire, type Timeslot, type TimeslotStatus, cn, createDemoRoomApi, useBooking, useBookingDesign, useCancelBooking, useCheckinBooking, useCreateBooking, useDemoRoom, useDemoRooms, useEditBooking, useQuestionnaire, useTimeslots };
|
|
858
|
+
export { ApiError, ApiErrorCode, type ApiResponse, type Booking, type BookingDesign, BookingForm, BookingFormO2O, type BookingFormO2OProps, type BookingFormProps, type BookingStatus, BookingSuccess, BookingSuccessO2O, type BookingSuccessO2OProps, type BookingSuccessProps, type CancelBookingResponse, type CheckinBookingRequest, type CheckinBookingResponse, type CreateBookingRequest, type CreateBookingResponse, DemoRoomApiClient, type DemoRoomApiConfig, type DemoRoom as DemoRoomData, DemoRoomO2O, type DemoRoomO2OProps, type DemoRoomStatus, type DemoRoomType, type EditBookingRequest, type GetBookingDesignRequest, type GetBookingResponse, type GetDemoRoomsResponse, type GetTimeslotsResponse, type Question, type QuestionOption, type QuestionType, type Questionnaire, type Timeslot, type TimeslotStatus, cn, createDemoRoomApi, useBooking, useBookingDesign, useCancelBooking, useCheckinBooking, useCreateBooking, useDemoRoom, useDemoRooms, useEditBooking, useQuestionnaire, useTimeslots };
|
package/dist/index.js
CHANGED
|
@@ -878,12 +878,12 @@ function useBookingDesign(client, params, options) {
|
|
|
878
878
|
});
|
|
879
879
|
const enabled = options?.enabled !== false;
|
|
880
880
|
React15.useEffect(() => {
|
|
881
|
-
if (!enabled || !params.booking_token) return;
|
|
881
|
+
if (!enabled || !params.booking_token && !(params.demoroom_code && params.session_id)) return;
|
|
882
882
|
let cancelled = false;
|
|
883
883
|
const fetchData = async () => {
|
|
884
884
|
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
885
885
|
try {
|
|
886
|
-
const data = await client.getBookingDesign(params
|
|
886
|
+
const data = await client.getBookingDesign(params);
|
|
887
887
|
if (!cancelled) {
|
|
888
888
|
setState({ data, loading: false, error: null });
|
|
889
889
|
}
|
|
@@ -901,7 +901,7 @@ function useBookingDesign(client, params, options) {
|
|
|
901
901
|
return () => {
|
|
902
902
|
cancelled = true;
|
|
903
903
|
};
|
|
904
|
-
}, [client, params.booking_token, enabled]);
|
|
904
|
+
}, [client, params.booking_token, params.demoroom_code, params.session_id, enabled]);
|
|
905
905
|
return state;
|
|
906
906
|
}
|
|
907
907
|
var AntdMobileIsolated = ({
|
|
@@ -1780,12 +1780,23 @@ var DemoRoomApiClient = class {
|
|
|
1780
1780
|
return response.booking;
|
|
1781
1781
|
}
|
|
1782
1782
|
/**
|
|
1783
|
-
* 查询 POD
|
|
1784
|
-
*
|
|
1783
|
+
* 查询 POD 作品信息
|
|
1784
|
+
* 模式1(优先):通过 booking_token 精确查询
|
|
1785
|
+
* 模式2:通过 demoroom_code + session_id 查询(MIR 跳回时预约尚未创建的场景)
|
|
1786
|
+
* @param params 查询参数
|
|
1785
1787
|
*/
|
|
1786
|
-
async getBookingDesign(
|
|
1788
|
+
async getBookingDesign(params) {
|
|
1787
1789
|
const searchParams = new URLSearchParams();
|
|
1788
|
-
|
|
1790
|
+
if (params.booking_token) {
|
|
1791
|
+
searchParams.append("booking_token", params.booking_token);
|
|
1792
|
+
} else {
|
|
1793
|
+
if (params.demoroom_code) {
|
|
1794
|
+
searchParams.append("demoroom_code", params.demoroom_code);
|
|
1795
|
+
}
|
|
1796
|
+
if (params.session_id) {
|
|
1797
|
+
searchParams.append("session_id", params.session_id);
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1789
1800
|
return this.request(
|
|
1790
1801
|
`/api/v1/store/bookings/design?${searchParams.toString()}`
|
|
1791
1802
|
);
|
|
@@ -11418,6 +11429,7 @@ var DateTimePicker2 = ({
|
|
|
11418
11429
|
apiClient,
|
|
11419
11430
|
demoRoomCode,
|
|
11420
11431
|
demoRoom: demoRoomProp,
|
|
11432
|
+
demoRoomLoading,
|
|
11421
11433
|
token,
|
|
11422
11434
|
booking,
|
|
11423
11435
|
timezone: timezone5,
|
|
@@ -11446,11 +11458,12 @@ var DateTimePicker2 = ({
|
|
|
11446
11458
|
loading: editLoading,
|
|
11447
11459
|
error: editError
|
|
11448
11460
|
} = useEditBooking(apiClient);
|
|
11461
|
+
const isManagedByParent = demoRoomLoading !== void 0;
|
|
11449
11462
|
const { data: fetchedDemoRoom } = useDemoRoom(
|
|
11450
11463
|
apiClient,
|
|
11451
11464
|
demoRoomCode || "",
|
|
11452
11465
|
locale,
|
|
11453
|
-
{ enabled: !demoRoomProp && !!demoRoomCode }
|
|
11466
|
+
{ enabled: !isManagedByParent && !demoRoomProp && !!demoRoomCode }
|
|
11454
11467
|
);
|
|
11455
11468
|
const demoRoom = demoRoomProp ?? fetchedDemoRoom;
|
|
11456
11469
|
const isPodPurpose = selectedPurposeType === "pod";
|
|
@@ -12088,6 +12101,7 @@ var DemoRoomDetail2 = ({
|
|
|
12088
12101
|
demoRoomCode,
|
|
12089
12102
|
locale,
|
|
12090
12103
|
demoRoom: demoRoomProp,
|
|
12104
|
+
demoRoomLoading,
|
|
12091
12105
|
title: titleProp,
|
|
12092
12106
|
descriptions: descriptionsProp,
|
|
12093
12107
|
devices: devicesProp,
|
|
@@ -12103,7 +12117,8 @@ var DemoRoomDetail2 = ({
|
|
|
12103
12117
|
className,
|
|
12104
12118
|
...props
|
|
12105
12119
|
}) => {
|
|
12106
|
-
const
|
|
12120
|
+
const isManagedByParent = demoRoomLoading !== void 0;
|
|
12121
|
+
const shouldFetch = !isManagedByParent && !demoRoomProp && !!apiClient && !!demoRoomCode;
|
|
12107
12122
|
const {
|
|
12108
12123
|
data: fetchedDemoRoom,
|
|
12109
12124
|
loading,
|
|
@@ -12125,7 +12140,8 @@ var DemoRoomDetail2 = ({
|
|
|
12125
12140
|
}
|
|
12126
12141
|
return "#";
|
|
12127
12142
|
})();
|
|
12128
|
-
|
|
12143
|
+
const isLoading = isManagedByParent ? !!demoRoomLoading : loading && shouldFetch;
|
|
12144
|
+
if (isLoading) {
|
|
12129
12145
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full pb-4", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-8 items-start", children: [
|
|
12130
12146
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
|
|
12131
12147
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-12 bg-gray-200 rounded animate-pulse" }),
|
|
@@ -12323,21 +12339,41 @@ var DemoRoomDetail2 = ({
|
|
|
12323
12339
|
DemoRoomDetail2.displayName = "DemoRoomDetail";
|
|
12324
12340
|
|
|
12325
12341
|
// src/components/BookingFormO2O/utils/buildMirUrl.ts
|
|
12342
|
+
var REDIRECT_URL_ALLOWED_PARAMS = ["code", "business_type", "token"];
|
|
12343
|
+
function sanitizeRedirectSource(source) {
|
|
12344
|
+
if (!source) return source;
|
|
12345
|
+
try {
|
|
12346
|
+
const parsed = new URL(source);
|
|
12347
|
+
const keptParams = new URLSearchParams();
|
|
12348
|
+
REDIRECT_URL_ALLOWED_PARAMS.forEach((key) => {
|
|
12349
|
+
const value = parsed.searchParams.get(key);
|
|
12350
|
+
if (value) keptParams.set(key, value);
|
|
12351
|
+
});
|
|
12352
|
+
parsed.search = keptParams.toString();
|
|
12353
|
+
return parsed.toString();
|
|
12354
|
+
} catch {
|
|
12355
|
+
return source;
|
|
12356
|
+
}
|
|
12357
|
+
}
|
|
12326
12358
|
function buildMirWelcomeUrl({
|
|
12327
12359
|
baseUrl,
|
|
12328
12360
|
language,
|
|
12329
12361
|
managerId,
|
|
12330
12362
|
credential,
|
|
12331
|
-
currentUrl
|
|
12363
|
+
currentUrl,
|
|
12364
|
+
managerIdParam = "email",
|
|
12365
|
+
credentialParam = "credential"
|
|
12332
12366
|
}) {
|
|
12333
12367
|
const url = new URL(baseUrl);
|
|
12334
12368
|
if (language) {
|
|
12335
12369
|
url.searchParams.set("language", language);
|
|
12336
12370
|
}
|
|
12337
12371
|
url.searchParams.set("countrycode", "US");
|
|
12338
|
-
url.searchParams.set(
|
|
12339
|
-
url.searchParams.set(
|
|
12340
|
-
const redirectSource =
|
|
12372
|
+
url.searchParams.set(managerIdParam, managerId);
|
|
12373
|
+
url.searchParams.set(credentialParam, credential);
|
|
12374
|
+
const redirectSource = sanitizeRedirectSource(
|
|
12375
|
+
currentUrl ?? (typeof window !== "undefined" ? window.location.href : "")
|
|
12376
|
+
);
|
|
12341
12377
|
url.searchParams.set("redirect_url", encodeURIComponent(redirectSource));
|
|
12342
12378
|
return url.toString();
|
|
12343
12379
|
}
|
|
@@ -12414,7 +12450,7 @@ var getPurposeLabel = (pageData) => {
|
|
|
12414
12450
|
return "What is your purpose of visit?";
|
|
12415
12451
|
};
|
|
12416
12452
|
var getPodContentDescription = (podContent) => podContent?.description || podContent?.subTitle;
|
|
12417
|
-
var getPodContentImage = (podContent) => podContent?.
|
|
12453
|
+
var getPodContentImage = (podContent) => podContent?.defaultImg;
|
|
12418
12454
|
var getPodContentButtonText = (podContent) => podContent?.buttonText || podContent?.btnText;
|
|
12419
12455
|
var BookingFormO2O = ({
|
|
12420
12456
|
layoutClassName,
|
|
@@ -12431,9 +12467,10 @@ var BookingFormO2O = ({
|
|
|
12431
12467
|
}) => {
|
|
12432
12468
|
const apiClient = React15.useMemo(
|
|
12433
12469
|
() => createDemoRoomApi(apiConfig),
|
|
12434
|
-
|
|
12470
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12471
|
+
[apiConfig.baseUrl, apiConfig.apiKey, apiConfig.locale]
|
|
12435
12472
|
);
|
|
12436
|
-
const { data: demoRoom } = useDemoRoom(
|
|
12473
|
+
const { data: demoRoom, loading: demoRoomLoading } = useDemoRoom(
|
|
12437
12474
|
apiClient,
|
|
12438
12475
|
demoRoomCode || "",
|
|
12439
12476
|
apiConfig.locale,
|
|
@@ -12474,17 +12511,49 @@ var BookingFormO2O = ({
|
|
|
12474
12511
|
}, [purposeOptions, selectedPurposeType]);
|
|
12475
12512
|
const selectedPodContent = selectedPurpose?.podContent;
|
|
12476
12513
|
const selectedPodDescription = getPodContentDescription(selectedPodContent);
|
|
12477
|
-
const
|
|
12514
|
+
const podDesignId = React15.useMemo(() => getQueryParam("design_id"), []);
|
|
12515
|
+
const isPodDesignEditMode = !!podDesignId || !!booking?.design_project_id;
|
|
12516
|
+
const storeManagerIdFromUrl = React15.useMemo(
|
|
12517
|
+
() => getQueryParam("store_manager_id"),
|
|
12518
|
+
[]
|
|
12519
|
+
);
|
|
12520
|
+
const mirSessionId = React15.useMemo(() => getQueryParam("session_id"), []);
|
|
12521
|
+
const effectiveStoreManagerId = storeManagerIdFromUrl || demoRoom?.contact?.manager_id;
|
|
12522
|
+
const effectiveMirSessionId = mirSessionId || booking?.design_project_id;
|
|
12523
|
+
const { data: bookingDesign } = useBookingDesign(
|
|
12524
|
+
apiClient,
|
|
12525
|
+
{ demoroom_code: demoRoomCode, session_id: effectiveMirSessionId },
|
|
12526
|
+
{ enabled: !!demoRoomCode && !!effectiveMirSessionId }
|
|
12527
|
+
);
|
|
12528
|
+
const selectedPodButtonText = isPodDesignEditMode ? selectedPodContent?.btnEditText : getPodContentButtonText(selectedPodContent);
|
|
12478
12529
|
const selectedPodImage = getSafePageDataUrl(
|
|
12479
|
-
getPodContentImage(selectedPodContent)
|
|
12530
|
+
isPodDesignEditMode && bookingDesign?.thumb_url || getPodContentImage(selectedPodContent)
|
|
12480
12531
|
);
|
|
12481
|
-
const selectedPodButtonIcon = getSafePageDataUrl(
|
|
12482
|
-
|
|
12483
|
-
|
|
12484
|
-
const
|
|
12532
|
+
const selectedPodButtonIcon = getSafePageDataUrl(
|
|
12533
|
+
isPodDesignEditMode ? selectedPodContent?.btnEditIcon : selectedPodContent?.btnIcon
|
|
12534
|
+
);
|
|
12535
|
+
const managerId = demoRoom?.contact?.manager_hash;
|
|
12536
|
+
const isPodButtonDisabled = isPodDesignEditMode ? !effectiveStoreManagerId || !effectiveMirSessionId : !managerId;
|
|
12485
12537
|
const mirCredential = React15.useMemo(() => crypto.randomUUID(), [demoRoomCode]);
|
|
12486
|
-
console.log(selectedPodContent);
|
|
12487
12538
|
const selectedPodButtonLink = React15.useMemo(() => {
|
|
12539
|
+
if (isPodButtonDisabled) return void 0;
|
|
12540
|
+
if (isPodDesignEditMode) {
|
|
12541
|
+
const editBaseUrl = getSafePageDataUrl(
|
|
12542
|
+
selectedPodContent?.buttonEditLink
|
|
12543
|
+
);
|
|
12544
|
+
if (!editBaseUrl || !effectiveStoreManagerId || !effectiveMirSessionId) {
|
|
12545
|
+
return void 0;
|
|
12546
|
+
}
|
|
12547
|
+
return buildMirWelcomeUrl({
|
|
12548
|
+
baseUrl: editBaseUrl,
|
|
12549
|
+
language: apiConfig.locale,
|
|
12550
|
+
managerId: effectiveStoreManagerId,
|
|
12551
|
+
credential: effectiveMirSessionId,
|
|
12552
|
+
managerIdParam: "store_manager_id",
|
|
12553
|
+
credentialParam: "sessionid"
|
|
12554
|
+
});
|
|
12555
|
+
}
|
|
12556
|
+
if (!managerId) return void 0;
|
|
12488
12557
|
const baseUrl = getSafePageDataUrl(selectedPodContent?.buttonLink);
|
|
12489
12558
|
if (!baseUrl) return void 0;
|
|
12490
12559
|
return buildMirWelcomeUrl({
|
|
@@ -12498,7 +12567,10 @@ var BookingFormO2O = ({
|
|
|
12498
12567
|
apiConfig.locale,
|
|
12499
12568
|
managerId,
|
|
12500
12569
|
isPodButtonDisabled,
|
|
12501
|
-
mirCredential
|
|
12570
|
+
mirCredential,
|
|
12571
|
+
isPodDesignEditMode,
|
|
12572
|
+
effectiveStoreManagerId,
|
|
12573
|
+
effectiveMirSessionId
|
|
12502
12574
|
]);
|
|
12503
12575
|
const dateTimePickerPageData = React15.useMemo(
|
|
12504
12576
|
() => ({
|
|
@@ -12515,6 +12587,7 @@ var BookingFormO2O = ({
|
|
|
12515
12587
|
apiClient,
|
|
12516
12588
|
demoRoomCode,
|
|
12517
12589
|
demoRoom,
|
|
12590
|
+
demoRoomLoading,
|
|
12518
12591
|
locale: apiConfig.locale,
|
|
12519
12592
|
pageData: pageData?.demoRoomDetail
|
|
12520
12593
|
}
|
|
@@ -12562,7 +12635,7 @@ var BookingFormO2O = ({
|
|
|
12562
12635
|
{
|
|
12563
12636
|
src: selectedPodImage,
|
|
12564
12637
|
alt: selectedPodContent.imageAlt || selectedPodContent.title || "",
|
|
12565
|
-
className: "mt-[12px] h-[
|
|
12638
|
+
className: "mt-[12px] h-[220px] rounded-[8px] object-cover l:h-auto"
|
|
12566
12639
|
}
|
|
12567
12640
|
),
|
|
12568
12641
|
!!selectedPodButtonText && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -12570,13 +12643,14 @@ var BookingFormO2O = ({
|
|
|
12570
12643
|
{
|
|
12571
12644
|
href: selectedPodButtonLink || "#",
|
|
12572
12645
|
"aria-disabled": isPodButtonDisabled,
|
|
12573
|
-
tabIndex: void 0,
|
|
12646
|
+
tabIndex: isPodButtonDisabled ? -1 : void 0,
|
|
12574
12647
|
onClick: (event2) => {
|
|
12648
|
+
if (isPodButtonDisabled) event2.preventDefault();
|
|
12575
12649
|
},
|
|
12576
12650
|
rel: "noopener noreferrer",
|
|
12577
12651
|
className: cn(
|
|
12578
12652
|
"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]",
|
|
12579
|
-
isPodButtonDisabled
|
|
12653
|
+
isPodButtonDisabled && "pointer-events-none cursor-not-allowed opacity-50"
|
|
12580
12654
|
),
|
|
12581
12655
|
children: [
|
|
12582
12656
|
selectedPodButtonIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -12600,6 +12674,7 @@ var BookingFormO2O = ({
|
|
|
12600
12674
|
apiClient,
|
|
12601
12675
|
demoRoomCode,
|
|
12602
12676
|
demoRoom,
|
|
12677
|
+
demoRoomLoading,
|
|
12603
12678
|
token,
|
|
12604
12679
|
booking,
|
|
12605
12680
|
timezone: timezone5,
|
|
@@ -12737,7 +12812,7 @@ var BookingSuccessO2O = ({
|
|
|
12737
12812
|
const fetchBookingDesign = async () => {
|
|
12738
12813
|
try {
|
|
12739
12814
|
const apiClient = createDemoRoomApi(apiConfig);
|
|
12740
|
-
const design = await apiClient.getBookingDesign(token);
|
|
12815
|
+
const design = await apiClient.getBookingDesign({ booking_token: token });
|
|
12741
12816
|
setBookingDesign(design);
|
|
12742
12817
|
} catch (err) {
|
|
12743
12818
|
console.error("Failed to fetch booking design:", err);
|