@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/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 +24 -8
- package/dist/index.d.ts +24 -8
- package/dist/index.js +268 -183
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +269 -184
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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,
|
|
@@ -12121,11 +12136,14 @@ var DemoRoomDetail2 = ({
|
|
|
12121
12136
|
if (demoRoom?.latitude && demoRoom?.longitude) {
|
|
12122
12137
|
return `https://www.google.com/maps/search/?api=1&query=${demoRoom.latitude},${demoRoom.longitude}`;
|
|
12123
12138
|
} else if (address) {
|
|
12124
|
-
return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(
|
|
12139
|
+
return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(
|
|
12140
|
+
address
|
|
12141
|
+
)}`;
|
|
12125
12142
|
}
|
|
12126
12143
|
return "#";
|
|
12127
12144
|
})();
|
|
12128
|
-
|
|
12145
|
+
const isLoading = isManagedByParent ? !!demoRoomLoading : loading && shouldFetch;
|
|
12146
|
+
if (isLoading) {
|
|
12129
12147
|
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
12148
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
|
|
12131
12149
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-12 bg-gray-200 rounded animate-pulse" }),
|
|
@@ -12141,129 +12159,133 @@ var DemoRoomDetail2 = ({
|
|
|
12141
12159
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm mt-2", children: error.message })
|
|
12142
12160
|
] }) });
|
|
12143
12161
|
}
|
|
12144
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12145
|
-
"
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
{
|
|
12153
|
-
className: "text-
|
|
12154
|
-
children: desc
|
|
12155
|
-
|
|
12156
|
-
index
|
|
12157
|
-
)) }),
|
|
12158
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
12159
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12160
|
-
"svg",
|
|
12161
|
-
{
|
|
12162
|
-
width: "24",
|
|
12163
|
-
height: "24",
|
|
12164
|
-
viewBox: "0 0 24 24",
|
|
12165
|
-
fill: "none",
|
|
12166
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12167
|
-
className: "flex-shrink-0 mt-0.5",
|
|
12168
|
-
children: [
|
|
12169
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12170
|
-
"path",
|
|
12171
|
-
{
|
|
12172
|
-
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",
|
|
12173
|
-
stroke: "currentColor",
|
|
12174
|
-
strokeWidth: "2",
|
|
12175
|
-
strokeLinecap: "round",
|
|
12176
|
-
strokeLinejoin: "round"
|
|
12177
|
-
}
|
|
12178
|
-
),
|
|
12179
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12180
|
-
"path",
|
|
12181
|
-
{
|
|
12182
|
-
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",
|
|
12183
|
-
stroke: "currentColor",
|
|
12184
|
-
strokeWidth: "2",
|
|
12185
|
-
strokeLinecap: "round",
|
|
12186
|
-
strokeLinejoin: "round"
|
|
12187
|
-
}
|
|
12188
|
-
)
|
|
12189
|
-
]
|
|
12190
|
-
}
|
|
12191
|
-
),
|
|
12192
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-900", children: devices })
|
|
12193
|
-
] }),
|
|
12194
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
12195
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12196
|
-
"svg",
|
|
12197
|
-
{
|
|
12198
|
-
width: "24",
|
|
12199
|
-
height: "24",
|
|
12200
|
-
viewBox: "0 0 24 24",
|
|
12201
|
-
fill: "none",
|
|
12202
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12203
|
-
className: "flex-shrink-0 mt-0.5",
|
|
12204
|
-
children: [
|
|
12205
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12206
|
-
"path",
|
|
12207
|
-
{
|
|
12208
|
-
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",
|
|
12209
|
-
stroke: "currentColor",
|
|
12210
|
-
strokeWidth: "2",
|
|
12211
|
-
strokeLinecap: "round",
|
|
12212
|
-
strokeLinejoin: "round"
|
|
12213
|
-
}
|
|
12214
|
-
),
|
|
12215
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12216
|
-
"circle",
|
|
12217
|
-
{
|
|
12218
|
-
cx: "12",
|
|
12219
|
-
cy: "9",
|
|
12220
|
-
r: "2.5",
|
|
12221
|
-
stroke: "currentColor",
|
|
12222
|
-
strokeWidth: "2"
|
|
12223
|
-
}
|
|
12224
|
-
)
|
|
12225
|
-
]
|
|
12226
|
-
}
|
|
12227
|
-
),
|
|
12228
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
|
|
12229
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-900", children: address }),
|
|
12230
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12231
|
-
"a",
|
|
12162
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12163
|
+
"div",
|
|
12164
|
+
{
|
|
12165
|
+
className: cn(
|
|
12166
|
+
"gap-[80px] l:gap-[40px] l:flex l:flex-col-reverse items-start py-[24px] l:pb-[64px]",
|
|
12167
|
+
images.length > 0 ? "grid grid-cols-2" : "flex"
|
|
12168
|
+
),
|
|
12169
|
+
children: [
|
|
12170
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
|
|
12171
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-[48px] l:text-[32px] font-bold text-gray-900 leading-tight", children: title }),
|
|
12172
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-[20px]", children: descriptions?.map((desc, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
12173
|
+
"p",
|
|
12232
12174
|
{
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
|
|
12236
|
-
|
|
12237
|
-
|
|
12238
|
-
|
|
12239
|
-
|
|
12240
|
-
|
|
12241
|
-
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
12175
|
+
className: "text-base text-gray-600 leading-relaxed",
|
|
12176
|
+
children: desc
|
|
12177
|
+
},
|
|
12178
|
+
index
|
|
12179
|
+
)) }),
|
|
12180
|
+
!!devices && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
12181
|
+
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
|
|
12192
|
+
"path",
|
|
12193
|
+
{
|
|
12194
|
+
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",
|
|
12195
|
+
stroke: "currentColor",
|
|
12196
|
+
strokeWidth: "2",
|
|
12197
|
+
strokeLinecap: "round",
|
|
12198
|
+
strokeLinejoin: "round"
|
|
12199
|
+
}
|
|
12200
|
+
),
|
|
12201
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12202
|
+
"path",
|
|
12203
|
+
{
|
|
12204
|
+
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",
|
|
12205
|
+
stroke: "currentColor",
|
|
12206
|
+
strokeWidth: "2",
|
|
12207
|
+
strokeLinecap: "round",
|
|
12208
|
+
strokeLinejoin: "round"
|
|
12209
|
+
}
|
|
12210
|
+
)
|
|
12211
|
+
]
|
|
12212
|
+
}
|
|
12213
|
+
),
|
|
12214
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base text-gray-900", children: devices })
|
|
12215
|
+
] }),
|
|
12216
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
12217
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12218
|
+
"svg",
|
|
12219
|
+
{
|
|
12220
|
+
width: "24",
|
|
12221
|
+
height: "24",
|
|
12222
|
+
viewBox: "0 0 24 24",
|
|
12223
|
+
fill: "none",
|
|
12224
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12225
|
+
className: "flex-shrink-0 mt-0.5",
|
|
12226
|
+
children: [
|
|
12227
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12228
|
+
"path",
|
|
12229
|
+
{
|
|
12230
|
+
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",
|
|
12231
|
+
stroke: "currentColor",
|
|
12232
|
+
strokeWidth: "2",
|
|
12233
|
+
strokeLinecap: "round",
|
|
12234
|
+
strokeLinejoin: "round"
|
|
12235
|
+
}
|
|
12236
|
+
),
|
|
12237
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12238
|
+
"circle",
|
|
12239
|
+
{
|
|
12240
|
+
cx: "12",
|
|
12241
|
+
cy: "9",
|
|
12242
|
+
r: "2.5",
|
|
12243
|
+
stroke: "currentColor",
|
|
12244
|
+
strokeWidth: "2"
|
|
12245
|
+
}
|
|
12246
|
+
)
|
|
12247
|
+
]
|
|
12248
|
+
}
|
|
12249
|
+
),
|
|
12250
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
|
|
12251
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base text-gray-900", children: address }),
|
|
12252
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12253
|
+
"a",
|
|
12254
|
+
{
|
|
12255
|
+
href: googleMapsLink,
|
|
12256
|
+
target: "_blank",
|
|
12257
|
+
rel: "noopener noreferrer",
|
|
12258
|
+
className: "inline-flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700 mt-1 underline",
|
|
12259
|
+
children: [
|
|
12260
|
+
pageData.openInGoogleMaps,
|
|
12261
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12262
|
+
"svg",
|
|
12249
12263
|
{
|
|
12250
|
-
|
|
12251
|
-
|
|
12252
|
-
|
|
12253
|
-
|
|
12254
|
-
|
|
12264
|
+
width: "12",
|
|
12265
|
+
height: "12",
|
|
12266
|
+
viewBox: "0 0 12 12",
|
|
12267
|
+
fill: "none",
|
|
12268
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12269
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12270
|
+
"path",
|
|
12271
|
+
{
|
|
12272
|
+
d: "M3 9L9 3M9 3H3M9 3V9",
|
|
12273
|
+
stroke: "currentColor",
|
|
12274
|
+
strokeWidth: "1.5",
|
|
12275
|
+
strokeLinecap: "round",
|
|
12276
|
+
strokeLinejoin: "round"
|
|
12277
|
+
}
|
|
12278
|
+
)
|
|
12255
12279
|
}
|
|
12256
12280
|
)
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
12260
|
-
}
|
|
12261
|
-
)
|
|
12262
|
-
] })
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
images.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative l:w-full min-l:h-[400px] rounded-2xl overflow-hidden demo-room-swiper", children: [
|
|
12266
|
-
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `
|
|
12281
|
+
]
|
|
12282
|
+
}
|
|
12283
|
+
)
|
|
12284
|
+
] })
|
|
12285
|
+
] })
|
|
12286
|
+
] }),
|
|
12287
|
+
images.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative l:w-full min-l:h-[400px] rounded-2xl overflow-hidden demo-room-swiper", children: [
|
|
12288
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `
|
|
12267
12289
|
.demo-room-swiper .swiper-pagination-bullet {
|
|
12268
12290
|
background-color: rgba(255, 255, 255, 0.5);
|
|
12269
12291
|
}
|
|
@@ -12293,51 +12315,73 @@ var DemoRoomDetail2 = ({
|
|
|
12293
12315
|
right: 16px !important;
|
|
12294
12316
|
}
|
|
12295
12317
|
` }),
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
{
|
|
12299
|
-
modules: [Navigation, Pagination, Autoplay],
|
|
12300
|
-
spaceBetween: 0,
|
|
12301
|
-
slidesPerView: 1,
|
|
12302
|
-
navigation: images.length > 1,
|
|
12303
|
-
pagination: images.length > 1 ? { clickable: true } : false,
|
|
12304
|
-
autoplay: images.length > 1 ? {
|
|
12305
|
-
delay: 3e3,
|
|
12306
|
-
disableOnInteraction: false
|
|
12307
|
-
} : false,
|
|
12308
|
-
loop: images.length > 1,
|
|
12309
|
-
className: "h-full rounded-2xl",
|
|
12310
|
-
children: images.map((img, index) => /* @__PURE__ */ jsxRuntime.jsx(SwiperSlide, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full h-full bg-gray-100", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12311
|
-
"img",
|
|
12318
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12319
|
+
Swiper2,
|
|
12312
12320
|
{
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12321
|
+
modules: [Navigation, Pagination, Autoplay],
|
|
12322
|
+
spaceBetween: 0,
|
|
12323
|
+
slidesPerView: 1,
|
|
12324
|
+
navigation: images.length > 1,
|
|
12325
|
+
pagination: images.length > 1 ? { clickable: true } : false,
|
|
12326
|
+
autoplay: images.length > 1 ? {
|
|
12327
|
+
delay: 3e3,
|
|
12328
|
+
disableOnInteraction: false
|
|
12329
|
+
} : false,
|
|
12330
|
+
loop: images.length > 1,
|
|
12331
|
+
className: "h-full rounded-2xl",
|
|
12332
|
+
children: images.map((img, index) => /* @__PURE__ */ jsxRuntime.jsx(SwiperSlide, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full h-full bg-gray-100", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12333
|
+
"img",
|
|
12334
|
+
{
|
|
12335
|
+
src: img,
|
|
12336
|
+
alt: `Demo room view ${index + 1}`,
|
|
12337
|
+
className: "w-full h-full object-cover"
|
|
12338
|
+
}
|
|
12339
|
+
) }) }, index))
|
|
12316
12340
|
}
|
|
12317
|
-
)
|
|
12318
|
-
}
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
|
|
12341
|
+
)
|
|
12342
|
+
] })
|
|
12343
|
+
]
|
|
12344
|
+
}
|
|
12345
|
+
) });
|
|
12322
12346
|
};
|
|
12323
12347
|
DemoRoomDetail2.displayName = "DemoRoomDetail";
|
|
12324
12348
|
|
|
12325
12349
|
// src/components/BookingFormO2O/utils/buildMirUrl.ts
|
|
12350
|
+
var REDIRECT_URL_ALLOWED_PARAMS = ["code", "business_type", "token"];
|
|
12351
|
+
function sanitizeRedirectSource(source) {
|
|
12352
|
+
if (!source) return source;
|
|
12353
|
+
try {
|
|
12354
|
+
const parsed = new URL(source);
|
|
12355
|
+
const keptParams = new URLSearchParams();
|
|
12356
|
+
REDIRECT_URL_ALLOWED_PARAMS.forEach((key) => {
|
|
12357
|
+
const value = parsed.searchParams.get(key);
|
|
12358
|
+
if (value) keptParams.set(key, value);
|
|
12359
|
+
});
|
|
12360
|
+
parsed.search = keptParams.toString();
|
|
12361
|
+
return parsed.toString();
|
|
12362
|
+
} catch {
|
|
12363
|
+
return source;
|
|
12364
|
+
}
|
|
12365
|
+
}
|
|
12326
12366
|
function buildMirWelcomeUrl({
|
|
12327
12367
|
baseUrl,
|
|
12328
12368
|
language,
|
|
12329
12369
|
managerId,
|
|
12330
12370
|
credential,
|
|
12331
|
-
currentUrl
|
|
12371
|
+
currentUrl,
|
|
12372
|
+
managerIdParam = "email",
|
|
12373
|
+
credentialParam = "credential"
|
|
12332
12374
|
}) {
|
|
12333
12375
|
const url = new URL(baseUrl);
|
|
12334
12376
|
if (language) {
|
|
12335
12377
|
url.searchParams.set("language", language);
|
|
12336
12378
|
}
|
|
12337
12379
|
url.searchParams.set("countrycode", "US");
|
|
12338
|
-
url.searchParams.set(
|
|
12339
|
-
url.searchParams.set(
|
|
12340
|
-
const redirectSource =
|
|
12380
|
+
url.searchParams.set(managerIdParam, managerId);
|
|
12381
|
+
url.searchParams.set(credentialParam, credential);
|
|
12382
|
+
const redirectSource = sanitizeRedirectSource(
|
|
12383
|
+
currentUrl ?? (typeof window !== "undefined" ? window.location.href : "")
|
|
12384
|
+
);
|
|
12341
12385
|
url.searchParams.set("redirect_url", encodeURIComponent(redirectSource));
|
|
12342
12386
|
return url.toString();
|
|
12343
12387
|
}
|
|
@@ -12414,7 +12458,7 @@ var getPurposeLabel = (pageData) => {
|
|
|
12414
12458
|
return "What is your purpose of visit?";
|
|
12415
12459
|
};
|
|
12416
12460
|
var getPodContentDescription = (podContent) => podContent?.description || podContent?.subTitle;
|
|
12417
|
-
var getPodContentImage = (podContent) => podContent?.
|
|
12461
|
+
var getPodContentImage = (podContent) => podContent?.defaultImg;
|
|
12418
12462
|
var getPodContentButtonText = (podContent) => podContent?.buttonText || podContent?.btnText;
|
|
12419
12463
|
var BookingFormO2O = ({
|
|
12420
12464
|
layoutClassName,
|
|
@@ -12431,9 +12475,10 @@ var BookingFormO2O = ({
|
|
|
12431
12475
|
}) => {
|
|
12432
12476
|
const apiClient = React15.useMemo(
|
|
12433
12477
|
() => createDemoRoomApi(apiConfig),
|
|
12434
|
-
|
|
12478
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12479
|
+
[apiConfig.baseUrl, apiConfig.apiKey, apiConfig.locale]
|
|
12435
12480
|
);
|
|
12436
|
-
const { data: demoRoom } = useDemoRoom(
|
|
12481
|
+
const { data: demoRoom, loading: demoRoomLoading } = useDemoRoom(
|
|
12437
12482
|
apiClient,
|
|
12438
12483
|
demoRoomCode || "",
|
|
12439
12484
|
apiConfig.locale,
|
|
@@ -12474,17 +12519,47 @@ var BookingFormO2O = ({
|
|
|
12474
12519
|
}, [purposeOptions, selectedPurposeType]);
|
|
12475
12520
|
const selectedPodContent = selectedPurpose?.podContent;
|
|
12476
12521
|
const selectedPodDescription = getPodContentDescription(selectedPodContent);
|
|
12477
|
-
const
|
|
12522
|
+
const podDesignId = React15.useMemo(() => getQueryParam("design_id"), []);
|
|
12523
|
+
const isPodDesignEditMode = !!podDesignId || !!booking?.design_project_id;
|
|
12524
|
+
const storeManagerIdFromUrl = React15.useMemo(
|
|
12525
|
+
() => getQueryParam("store_manager_id"),
|
|
12526
|
+
[]
|
|
12527
|
+
);
|
|
12528
|
+
const mirSessionId = React15.useMemo(() => getQueryParam("session_id"), []);
|
|
12529
|
+
const effectiveStoreManagerId = storeManagerIdFromUrl || demoRoom?.contact?.manager_id;
|
|
12530
|
+
const effectiveMirSessionId = mirSessionId || booking?.design_project_id;
|
|
12531
|
+
const { data: bookingDesign } = useBookingDesign(
|
|
12532
|
+
apiClient,
|
|
12533
|
+
{ demoroom_code: demoRoomCode, session_id: effectiveMirSessionId },
|
|
12534
|
+
{ enabled: !!demoRoomCode && !!effectiveMirSessionId }
|
|
12535
|
+
);
|
|
12536
|
+
const selectedPodButtonText = isPodDesignEditMode ? selectedPodContent?.btnEditText : getPodContentButtonText(selectedPodContent);
|
|
12478
12537
|
const selectedPodImage = getSafePageDataUrl(
|
|
12479
|
-
getPodContentImage(selectedPodContent)
|
|
12538
|
+
isPodDesignEditMode && bookingDesign?.thumb_url || getPodContentImage(selectedPodContent)
|
|
12480
12539
|
);
|
|
12481
|
-
const selectedPodButtonIcon = getSafePageDataUrl(
|
|
12482
|
-
|
|
12483
|
-
|
|
12484
|
-
const
|
|
12540
|
+
const selectedPodButtonIcon = getSafePageDataUrl(
|
|
12541
|
+
isPodDesignEditMode ? selectedPodContent?.btnEditIcon : selectedPodContent?.btnIcon
|
|
12542
|
+
);
|
|
12543
|
+
const managerId = demoRoom?.contact?.manager_hash;
|
|
12544
|
+
const isPodButtonDisabled = isPodDesignEditMode ? !effectiveStoreManagerId || !effectiveMirSessionId : !managerId;
|
|
12485
12545
|
const mirCredential = React15.useMemo(() => crypto.randomUUID(), [demoRoomCode]);
|
|
12486
|
-
console.log(selectedPodContent);
|
|
12487
12546
|
const selectedPodButtonLink = React15.useMemo(() => {
|
|
12547
|
+
if (isPodButtonDisabled) return void 0;
|
|
12548
|
+
if (isPodDesignEditMode) {
|
|
12549
|
+
const editBaseUrl = getSafePageDataUrl(selectedPodContent?.buttonEditLink);
|
|
12550
|
+
if (!editBaseUrl || !effectiveStoreManagerId || !effectiveMirSessionId) {
|
|
12551
|
+
return void 0;
|
|
12552
|
+
}
|
|
12553
|
+
return buildMirWelcomeUrl({
|
|
12554
|
+
baseUrl: editBaseUrl,
|
|
12555
|
+
language: apiConfig.locale,
|
|
12556
|
+
managerId: effectiveStoreManagerId,
|
|
12557
|
+
credential: effectiveMirSessionId,
|
|
12558
|
+
managerIdParam: "store_manager_id",
|
|
12559
|
+
credentialParam: "sessionid"
|
|
12560
|
+
});
|
|
12561
|
+
}
|
|
12562
|
+
if (!managerId) return void 0;
|
|
12488
12563
|
const baseUrl = getSafePageDataUrl(selectedPodContent?.buttonLink);
|
|
12489
12564
|
if (!baseUrl) return void 0;
|
|
12490
12565
|
return buildMirWelcomeUrl({
|
|
@@ -12498,7 +12573,10 @@ var BookingFormO2O = ({
|
|
|
12498
12573
|
apiConfig.locale,
|
|
12499
12574
|
managerId,
|
|
12500
12575
|
isPodButtonDisabled,
|
|
12501
|
-
mirCredential
|
|
12576
|
+
mirCredential,
|
|
12577
|
+
isPodDesignEditMode,
|
|
12578
|
+
effectiveStoreManagerId,
|
|
12579
|
+
effectiveMirSessionId
|
|
12502
12580
|
]);
|
|
12503
12581
|
const dateTimePickerPageData = React15.useMemo(
|
|
12504
12582
|
() => ({
|
|
@@ -12515,6 +12593,7 @@ var BookingFormO2O = ({
|
|
|
12515
12593
|
apiClient,
|
|
12516
12594
|
demoRoomCode,
|
|
12517
12595
|
demoRoom,
|
|
12596
|
+
demoRoomLoading,
|
|
12518
12597
|
locale: apiConfig.locale,
|
|
12519
12598
|
pageData: pageData?.demoRoomDetail
|
|
12520
12599
|
}
|
|
@@ -12539,7 +12618,11 @@ var BookingFormO2O = ({
|
|
|
12539
12618
|
onChange: (event2) => {
|
|
12540
12619
|
setSelectedPurposeType(event2.target.value);
|
|
12541
12620
|
},
|
|
12542
|
-
|
|
12621
|
+
disabled: !!token,
|
|
12622
|
+
className: cn(
|
|
12623
|
+
"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]",
|
|
12624
|
+
token && "pointer-events-none cursor-not-allowed opacity-50"
|
|
12625
|
+
),
|
|
12543
12626
|
children: purposeOptions.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
12544
12627
|
"option",
|
|
12545
12628
|
{
|
|
@@ -12562,7 +12645,7 @@ var BookingFormO2O = ({
|
|
|
12562
12645
|
{
|
|
12563
12646
|
src: selectedPodImage,
|
|
12564
12647
|
alt: selectedPodContent.imageAlt || selectedPodContent.title || "",
|
|
12565
|
-
className: "mt-[12px] h-[
|
|
12648
|
+
className: "mt-[12px] h-[220px] rounded-[8px] object-cover l:h-auto"
|
|
12566
12649
|
}
|
|
12567
12650
|
),
|
|
12568
12651
|
!!selectedPodButtonText && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -12570,13 +12653,14 @@ var BookingFormO2O = ({
|
|
|
12570
12653
|
{
|
|
12571
12654
|
href: selectedPodButtonLink || "#",
|
|
12572
12655
|
"aria-disabled": isPodButtonDisabled,
|
|
12573
|
-
tabIndex: void 0,
|
|
12656
|
+
tabIndex: isPodButtonDisabled ? -1 : void 0,
|
|
12574
12657
|
onClick: (event2) => {
|
|
12658
|
+
if (isPodButtonDisabled) event2.preventDefault();
|
|
12575
12659
|
},
|
|
12576
12660
|
rel: "noopener noreferrer",
|
|
12577
12661
|
className: cn(
|
|
12578
12662
|
"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
|
|
12663
|
+
isPodButtonDisabled && "pointer-events-none cursor-not-allowed opacity-50"
|
|
12580
12664
|
),
|
|
12581
12665
|
children: [
|
|
12582
12666
|
selectedPodButtonIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -12600,6 +12684,7 @@ var BookingFormO2O = ({
|
|
|
12600
12684
|
apiClient,
|
|
12601
12685
|
demoRoomCode,
|
|
12602
12686
|
demoRoom,
|
|
12687
|
+
demoRoomLoading,
|
|
12603
12688
|
token,
|
|
12604
12689
|
booking,
|
|
12605
12690
|
timezone: timezone5,
|
|
@@ -12608,7 +12693,7 @@ var BookingFormO2O = ({
|
|
|
12608
12693
|
onQuestionnaireSubmit,
|
|
12609
12694
|
pageData: dateTimePickerPageData,
|
|
12610
12695
|
selectedPurposeType: selectedPurpose?.type,
|
|
12611
|
-
podDesignId
|
|
12696
|
+
podDesignId: mirSessionId
|
|
12612
12697
|
}
|
|
12613
12698
|
) })
|
|
12614
12699
|
] })
|
|
@@ -12618,6 +12703,7 @@ BookingFormO2O.displayName = "BookingFormO2O";
|
|
|
12618
12703
|
var BookingSuccessO2O = ({
|
|
12619
12704
|
bookingData: initialBookingData,
|
|
12620
12705
|
token,
|
|
12706
|
+
isStoreUser,
|
|
12621
12707
|
apiConfig,
|
|
12622
12708
|
onScheduleAgain,
|
|
12623
12709
|
onCancelSuccess,
|
|
@@ -12737,7 +12823,9 @@ var BookingSuccessO2O = ({
|
|
|
12737
12823
|
const fetchBookingDesign = async () => {
|
|
12738
12824
|
try {
|
|
12739
12825
|
const apiClient = createDemoRoomApi(apiConfig);
|
|
12740
|
-
const design = await apiClient.getBookingDesign(
|
|
12826
|
+
const design = await apiClient.getBookingDesign({
|
|
12827
|
+
booking_token: token
|
|
12828
|
+
});
|
|
12741
12829
|
setBookingDesign(design);
|
|
12742
12830
|
} catch (err) {
|
|
12743
12831
|
console.error("Failed to fetch booking design:", err);
|
|
@@ -12799,9 +12887,7 @@ var BookingSuccessO2O = ({
|
|
|
12799
12887
|
}
|
|
12800
12888
|
const podDesignName = bookingDesign?.material;
|
|
12801
12889
|
const podDesignImage = bookingDesign?.thumb_url;
|
|
12802
|
-
|
|
12803
|
-
console.log(bookingDesign);
|
|
12804
|
-
console.log(bookingData);
|
|
12890
|
+
bookingDesign?.order_code;
|
|
12805
12891
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `min-h-screen l:py-0 l:px-0 py-12 px-6 ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto", children: [
|
|
12806
12892
|
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-[48px] xxl:text-[32px] font-bold text-[#080A0F] mb-8 print:hidden", children: pageData.yourAppointment }),
|
|
12807
12893
|
isCancelled && /* @__PURE__ */ jsxRuntime.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: [
|
|
@@ -12917,15 +13003,14 @@ var BookingSuccessO2O = ({
|
|
|
12917
13003
|
" ",
|
|
12918
13004
|
podDesignName
|
|
12919
13005
|
] }),
|
|
12920
|
-
bookingData?.status && pageData.podData?.status?.[bookingData.status] && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-[#4A4C56]", children: pageData.podData.status[bookingData.status] })
|
|
12921
|
-
podOrderCode && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-[#4A4C56]", children: podOrderCode })
|
|
13006
|
+
bookingData?.status && pageData.podData?.status?.[bookingData.status] && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-[#4A4C56]", children: pageData.podData.status[bookingData.status] })
|
|
12922
13007
|
] }),
|
|
12923
13008
|
podDesignImage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12924
|
-
|
|
13009
|
+
antd.Image,
|
|
12925
13010
|
{
|
|
12926
13011
|
src: podDesignImage,
|
|
12927
13012
|
alt: podDesignName,
|
|
12928
|
-
className: "w-[88px] h-[88px] rounded-[8px] object-cover
|
|
13013
|
+
className: "!w-[88px] !h-[88px] rounded-[8px] !object-cover"
|
|
12929
13014
|
}
|
|
12930
13015
|
)
|
|
12931
13016
|
] })
|
|
@@ -12942,7 +13027,7 @@ var BookingSuccessO2O = ({
|
|
|
12942
13027
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12943
13028
|
antd.QRCode,
|
|
12944
13029
|
{
|
|
12945
|
-
value:
|
|
13030
|
+
value: `${pageData.podData?.QRCodeUrl}${token}&isStoreUser=true` || "",
|
|
12946
13031
|
size: 200
|
|
12947
13032
|
}
|
|
12948
13033
|
)
|