|
|
@@ -420,6 +420,29 @@ export const LumiShopPage = () => {
|
|
|
} catch {
|
|
|
/* ignore cart refresh */
|
|
|
}
|
|
|
+
|
|
|
+ // 单独购买成功后:自动装配到当前幕布(购物车购买不自动装配)
|
|
|
+ try {
|
|
|
+ const isBackdrop = itemToPurchase.item_type === 'backdrop' || itemToPurchase.biz_type === 'wallpaper';
|
|
|
+ if (isBackdrop) {
|
|
|
+ await updateChatbotBackdrop(userId, itemToPurchase.item_id);
|
|
|
+ } else {
|
|
|
+ await equipChatbotFurniture(userId, itemToPurchase.item_id);
|
|
|
+ }
|
|
|
+ await refreshChatbotLayout();
|
|
|
+ await refreshFurnitureCatalog();
|
|
|
+ } catch (equipError: unknown) {
|
|
|
+ if (equipError instanceof ApiError) {
|
|
|
+ if (equipError.code === 'SLOT_DEPENDENCY_NOT_SATISFIED') {
|
|
|
+ showFurnitureNotice(equipError.backendMessage || tProfile('lumiFurnitureDependencyNotMetNotice'));
|
|
|
+ } else {
|
|
|
+ showFurnitureNotice(equipError.backendMessage || tError(equipError.code));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showFurnitureNotice(tError('SERVER_ERROR'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
setActivePurchaseItem(null);
|
|
|
setPurchaseSuccessItem(itemToPurchase);
|
|
|
} catch (error: unknown) {
|
|
|
@@ -431,7 +454,15 @@ export const LumiShopPage = () => {
|
|
|
} finally {
|
|
|
setPurchaseSubmitting(false);
|
|
|
}
|
|
|
- }, [activePurchaseItem, purchaseSubmitting, refreshFurnitureCatalog, showFurnitureNotice, tError]);
|
|
|
+ }, [
|
|
|
+ activePurchaseItem,
|
|
|
+ purchaseSubmitting,
|
|
|
+ refreshChatbotLayout,
|
|
|
+ refreshFurnitureCatalog,
|
|
|
+ showFurnitureNotice,
|
|
|
+ tError,
|
|
|
+ tProfile,
|
|
|
+ ]);
|
|
|
|
|
|
const onPurchaseBuyClick = useMemo(
|
|
|
() => wrapTrackedClick('lumi_shop', 'purchase_buy', handlePurchaseBuy),
|
|
|
@@ -1286,7 +1317,12 @@ export const LumiShopPage = () => {
|
|
|
<button
|
|
|
key={filter.key}
|
|
|
type="button"
|
|
|
- onClick={() => setFurnitureFilter(filter.key)}
|
|
|
+ onClick={wrapTrackedClick(
|
|
|
+ 'lumi_shop',
|
|
|
+ 'furniture_filter',
|
|
|
+ () => setFurnitureFilter(filter.key),
|
|
|
+ { properties: { filter_key: filter.key } },
|
|
|
+ )}
|
|
|
aria-label={filter.ariaLabel}
|
|
|
style={{
|
|
|
width: px2vmin(44),
|
|
|
@@ -1341,7 +1377,19 @@ export const LumiShopPage = () => {
|
|
|
<button
|
|
|
key={item.item_id}
|
|
|
type="button"
|
|
|
- onClick={() => handleFurnitureCardClick(item)}
|
|
|
+ onClick={wrapTrackedClick(
|
|
|
+ 'lumi_shop',
|
|
|
+ 'catalog_item_click',
|
|
|
+ () => handleFurnitureCardClick(item),
|
|
|
+ {
|
|
|
+ properties: {
|
|
|
+ item_id: item.item_id,
|
|
|
+ biz_type: item.biz_type,
|
|
|
+ item_type: item.item_type,
|
|
|
+ is_owned: item.is_owned,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )}
|
|
|
style={{
|
|
|
width: px2vmin(90),
|
|
|
height: px2vmin(102),
|
|
|
@@ -1453,7 +1501,7 @@ export const LumiShopPage = () => {
|
|
|
backgroundColor: 'transparent',
|
|
|
zIndex: 10029,
|
|
|
}}
|
|
|
- onClick={closeShopCartModal}
|
|
|
+ onClick={wrapTrackedClick('lumi_shop', 'shop_cart_close', closeShopCartModal)}
|
|
|
>
|
|
|
<div
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
@@ -1540,10 +1588,20 @@ export const LumiShopPage = () => {
|
|
|
>
|
|
|
<button
|
|
|
type="button"
|
|
|
- onClick={(e) => {
|
|
|
- e.stopPropagation();
|
|
|
- void handleRemoveShopCartItem(line.catalogItem.item_id);
|
|
|
- }}
|
|
|
+ onClick={wrapTrackedClick(
|
|
|
+ 'lumi_shop',
|
|
|
+ 'shop_cart_remove_item',
|
|
|
+ (e) => {
|
|
|
+ e?.stopPropagation();
|
|
|
+ void handleRemoveShopCartItem(line.catalogItem.item_id);
|
|
|
+ },
|
|
|
+ {
|
|
|
+ properties: {
|
|
|
+ item_id: line.catalogItem.item_id,
|
|
|
+ quantity: line.quantity,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )}
|
|
|
disabled={shopCartRemovingItemIds[line.catalogItem.item_id]}
|
|
|
style={{
|
|
|
position: 'absolute',
|
|
|
@@ -1643,7 +1701,7 @@ export const LumiShopPage = () => {
|
|
|
>
|
|
|
<button
|
|
|
type="button"
|
|
|
- onClick={closeShopCartModal}
|
|
|
+ onClick={wrapTrackedClick('lumi_shop', 'shop_cart_close', closeShopCartModal)}
|
|
|
style={{
|
|
|
width: px2vmin(146),
|
|
|
height: px2vmin(56),
|
|
|
@@ -1671,9 +1729,14 @@ export const LumiShopPage = () => {
|
|
|
|
|
|
<button
|
|
|
type="button"
|
|
|
- onClick={() => {
|
|
|
- void handleShopCartPurchaseAll();
|
|
|
- }}
|
|
|
+ onClick={wrapTrackedClick(
|
|
|
+ 'lumi_shop',
|
|
|
+ 'shop_cart_purchase_all',
|
|
|
+ () => {
|
|
|
+ void handleShopCartPurchaseAll();
|
|
|
+ },
|
|
|
+ { properties: { cart_total_quantity: shopCartTotalQty } },
|
|
|
+ )}
|
|
|
disabled={shopCartPurchasing || shopCartItems.length <= 0}
|
|
|
style={{
|
|
|
width: px2vmin(146),
|
|
|
@@ -1735,7 +1798,7 @@ export const LumiShopPage = () => {
|
|
|
backgroundColor: 'transparent',
|
|
|
zIndex: 10031,
|
|
|
}}
|
|
|
- onClick={() => setActivePurchaseItem(null)}
|
|
|
+ onClick={wrapTrackedClick('lumi_shop', 'purchase_modal_close', () => setActivePurchaseItem(null))}
|
|
|
>
|
|
|
<div
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
@@ -2002,7 +2065,7 @@ export const LumiShopPage = () => {
|
|
|
backgroundColor: 'rgba(0, 0, 0, 0.4)',
|
|
|
zIndex: 10032,
|
|
|
}}
|
|
|
- onClick={() => setPurchaseSuccessItem(null)}
|
|
|
+ onClick={wrapTrackedClick('lumi_shop', 'purchase_success_close', () => setPurchaseSuccessItem(null))}
|
|
|
>
|
|
|
{/* 庆祝 GIF:位于底部弹窗上方 5px */}
|
|
|
<div
|
|
|
@@ -2215,7 +2278,12 @@ export const LumiShopPage = () => {
|
|
|
backgroundColor: 'transparent',
|
|
|
zIndex: 10030,
|
|
|
}}
|
|
|
- onClick={() => setActiveFurnitureModalItem(null)}
|
|
|
+ onClick={wrapTrackedClick('lumi_shop', 'furniture_modal_close', () => setActiveFurnitureModalItem(null), {
|
|
|
+ properties: {
|
|
|
+ item_id: activeFurnitureModalItem.item_id,
|
|
|
+ modal_mode: furnitureModalMode,
|
|
|
+ },
|
|
|
+ })}
|
|
|
>
|
|
|
<div
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
@@ -2332,9 +2400,12 @@ export const LumiShopPage = () => {
|
|
|
>
|
|
|
<button
|
|
|
type="button"
|
|
|
- onClick={() => {
|
|
|
- handleFurnitureModalConfirm();
|
|
|
- }}
|
|
|
+ onClick={wrapTrackedClick('lumi_shop', 'furniture_modal_confirm', () => handleFurnitureModalConfirm(), {
|
|
|
+ properties: {
|
|
|
+ item_id: activeFurnitureModalItem.item_id,
|
|
|
+ modal_mode: furnitureModalMode,
|
|
|
+ },
|
|
|
+ })}
|
|
|
disabled={furnitureSubmitting}
|
|
|
style={{
|
|
|
width: px2vmin(146),
|
|
|
@@ -2360,7 +2431,12 @@ export const LumiShopPage = () => {
|
|
|
</button>
|
|
|
<button
|
|
|
type="button"
|
|
|
- onClick={() => setActiveFurnitureModalItem(null)}
|
|
|
+ onClick={wrapTrackedClick('lumi_shop', 'furniture_modal_cancel', () => setActiveFurnitureModalItem(null), {
|
|
|
+ properties: {
|
|
|
+ item_id: activeFurnitureModalItem.item_id,
|
|
|
+ modal_mode: furnitureModalMode,
|
|
|
+ },
|
|
|
+ })}
|
|
|
disabled={furnitureSubmitting}
|
|
|
style={{
|
|
|
width: px2vmin(146),
|