@anker-in/headless-ui 1.3.41 → 1.3.42
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/cjs/biz-components/Listing/BizProductProvider.d.ts +3 -1
- package/dist/cjs/biz-components/Listing/BizProductProvider.js +1 -1
- package/dist/cjs/biz-components/Listing/BizProductProvider.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/CartActionButtons/index.d.ts +9 -1
- package/dist/cjs/biz-components/Listing/components/CartActionButtons/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/CartActionButtons/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +3 -3
- package/dist/cjs/biz-components/NotifyMeDialog/NotifyMeDialog.d.ts +7 -0
- package/dist/cjs/biz-components/NotifyMeDialog/NotifyMeDialog.js +2 -0
- package/dist/cjs/biz-components/NotifyMeDialog/NotifyMeDialog.js.map +7 -0
- package/dist/cjs/biz-components/NotifyMeDialog/index.d.ts +2 -0
- package/dist/cjs/biz-components/NotifyMeDialog/index.js +2 -0
- package/dist/cjs/biz-components/NotifyMeDialog/index.js.map +7 -0
- package/dist/cjs/biz-components/NotifyMeDialog/types.d.ts +111 -0
- package/dist/cjs/biz-components/NotifyMeDialog/types.js +2 -0
- package/dist/cjs/biz-components/NotifyMeDialog/types.js.map +7 -0
- package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/cjs/biz-components/ProductNav/ProductNav.js.map +3 -3
- package/dist/cjs/biz-components/ProductNav/types.d.ts +3 -1
- package/dist/cjs/biz-components/ProductNav/types.js.map +1 -1
- package/dist/cjs/biz-components/index.d.ts +2 -0
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/biz-components/index.js.map +3 -3
- package/dist/cjs/components/tabs.js +1 -1
- package/dist/cjs/components/tabs.js.map +2 -2
- package/dist/esm/biz-components/Listing/BizProductProvider.d.ts +3 -1
- package/dist/esm/biz-components/Listing/BizProductProvider.js +1 -1
- package/dist/esm/biz-components/Listing/BizProductProvider.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/CartActionButtons/index.d.ts +9 -1
- package/dist/esm/biz-components/Listing/components/CartActionButtons/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/CartActionButtons/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +3 -3
- package/dist/esm/biz-components/NotifyMeDialog/NotifyMeDialog.d.ts +7 -0
- package/dist/esm/biz-components/NotifyMeDialog/NotifyMeDialog.js +2 -0
- package/dist/esm/biz-components/NotifyMeDialog/NotifyMeDialog.js.map +7 -0
- package/dist/esm/biz-components/NotifyMeDialog/index.d.ts +2 -0
- package/dist/esm/biz-components/NotifyMeDialog/index.js +2 -0
- package/dist/esm/biz-components/NotifyMeDialog/index.js.map +7 -0
- package/dist/esm/biz-components/NotifyMeDialog/types.d.ts +111 -0
- package/dist/esm/biz-components/NotifyMeDialog/types.js +1 -0
- package/dist/esm/biz-components/NotifyMeDialog/types.js.map +7 -0
- package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/esm/biz-components/ProductNav/ProductNav.js.map +3 -3
- package/dist/esm/biz-components/ProductNav/types.d.ts +3 -1
- package/dist/esm/biz-components/index.d.ts +2 -0
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +3 -3
- package/dist/esm/components/tabs.js +1 -1
- package/dist/esm/components/tabs.js.map +2 -2
- package/package.json +1 -1
- package/style.css +33 -0
|
@@ -132,8 +132,10 @@ export interface ProductContextType {
|
|
|
132
132
|
addToCartLoading?: boolean;
|
|
133
133
|
addOrder?: Array<'bundle' | 'gift' | 'exchange'>;
|
|
134
134
|
setAddOrder?: Dispatch<SetStateAction<Array<'bundle' | 'gift' | 'exchange'>>>;
|
|
135
|
+
notifyMeMode?: 'normal' | 'notify_me';
|
|
136
|
+
onNotifyMeClick?: (open: boolean) => void;
|
|
135
137
|
}
|
|
136
138
|
export declare const BizProductContext: React.Context<ProductContextType>;
|
|
137
139
|
export declare const useBizProductContext: () => ProductContextType;
|
|
138
|
-
declare const ProductProvider: ({ product, isLogin, profile, isMobile, isDesktop, children, renderRating, freeGift, exchangePurchase, bundle, checkedBundle, checkedGift, setCheckedBundle, setCheckedGift, checkedExchangePurchase, setCheckedExchangePurchase, variant, selectedOptions, setSelectedOptions, compareData, coupon, finalPrice, comparePrice, totalSavings, savingDetail, setSavingDetail, selectedVariants, onAddToCart, onBuyNow, creditsRedemption, memberFunctionResult, openModal, openSignInPopup, openAuthCodePopup, openSignUpPopup, renderInstallments, onUseCouponChange, onUseMemberDiscountChange, discount, buyNowLoading, addToCartLoading, }: PropsWithChildren<Omit<ProductContextType, "joinedRecommendBuyProducts" | "setJoinedRecommendBuyProducts" | "addOrder" | "setAddOrder" | "resolvedPayload">>) => import("react/jsx-runtime").JSX.Element;
|
|
140
|
+
declare const ProductProvider: ({ product, isLogin, profile, isMobile, isDesktop, children, renderRating, freeGift, exchangePurchase, bundle, checkedBundle, checkedGift, setCheckedBundle, setCheckedGift, checkedExchangePurchase, setCheckedExchangePurchase, variant, selectedOptions, setSelectedOptions, compareData, coupon, finalPrice, comparePrice, totalSavings, savingDetail, setSavingDetail, selectedVariants, onAddToCart, onBuyNow, creditsRedemption, memberFunctionResult, openModal, openSignInPopup, openAuthCodePopup, openSignUpPopup, renderInstallments, onUseCouponChange, onUseMemberDiscountChange, discount, buyNowLoading, addToCartLoading, notifyMeMode, onNotifyMeClick, }: PropsWithChildren<Omit<ProductContextType, "joinedRecommendBuyProducts" | "setJoinedRecommendBuyProducts" | "addOrder" | "setAddOrder" | "resolvedPayload">>) => import("react/jsx-runtime").JSX.Element;
|
|
139
141
|
export default ProductProvider;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var u=Object.defineProperty;var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var oe=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var ie=(e,n)=>{for(var r in n)u(e,r,{get:n[r],enumerable:!0})},de=(e,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of re(n))!ae.call(e,o)&&o!==r&&u(e,o,{get:()=>n[o],enumerable:!(i=oe(n,o))||i.enumerable});return e};var ce=e=>de(u({},"__esModule",{value:!0}),e);var pe={};ie(pe,{BizProductContext:()=>d,default:()=>le,useBizProductContext:()=>ue});module.exports=ce(pe);var P=require("react/jsx-runtime"),t=require("react"),m=require("./const.js");const d=(0,t.createContext)({}),ue=()=>{if(!(0,t.useContext)(d))throw new Error("useProductContext must be used in <ProductProvider>");return(0,t.useContext)(d)},se=({product:e,isLogin:n,profile:r,isMobile:i,isDesktop:o,children:b,renderRating:g,freeGift:y,exchangePurchase:h,bundle:f,checkedBundle:C,checkedGift:v,setCheckedBundle:x,setCheckedGift:S,checkedExchangePurchase:D,setCheckedExchangePurchase:R,variant:a,selectedOptions:B,setSelectedOptions:A,compareData:k,coupon:_,finalPrice:O,comparePrice:M,totalSavings:V,savingDetail:T,setSavingDetail:E,selectedVariants:L,onAddToCart:N,onBuyNow:w,creditsRedemption:F,memberFunctionResult:G,openModal:I,openSignInPopup:J,openAuthCodePopup:U,openSignUpPopup:W,renderInstallments:j,onUseCouponChange:z,onUseMemberDiscountChange:K,discount:Y,buyNowLoading:X,addToCartLoading:q,notifyMeMode:H,onNotifyMeClick:Q})=>{const[Z,s]=(0,t.useState)({}),[$,l]=(0,t.useState)([]),ee=(0,t.useMemo)(()=>{const te=a?.payload?.components??[],ne=m.VARIANT_PAYLOAD_EXCLUDED_KEYS;return te.filter(c=>{const p=c.componentKey??c.blockType??c.blockName;return p&&!ne.includes(p)}).length>0?a?.payload:e?.payload},[a?.payload,e?.payload]);return(0,t.useEffect)(()=>{a?.id&&(s({bundle:{value:void 0,canOperate:!0},gift:{value:void 0,canOperate:!0},exchange:{value:void 0,canOperate:!0}}),l([]))},[a?.id]),(0,P.jsx)(d.Provider,{value:{product:e,variant:a,isMobile:i,isDesktop:o,isLogin:n,profile:r,coupon:_,renderRating:g,finalPrice:O,comparePrice:M,savingDetail:T,setSavingDetail:E,totalSavings:V,selectedOptions:B,setSelectedOptions:A,freeGift:y,exchangePurchase:h,checkedGift:v,setCheckedGift:S,checkedBundle:C,setCheckedBundle:x,bundle:f,compareData:k,selectedVariants:L,onAddToCart:N,onBuyNow:w,joinedRecommendBuyProducts:Z,setJoinedRecommendBuyProducts:s,checkedExchangePurchase:D,setCheckedExchangePurchase:R,creditsRedemption:F,memberFunctionResult:G,openModal:I,openSignInPopup:J,openAuthCodePopup:U,openSignUpPopup:W,renderInstallments:j,onUseCouponChange:z,onUseMemberDiscountChange:K,discount:Y,buyNowLoading:X,addToCartLoading:q,notifyMeMode:H,onNotifyMeClick:Q,addOrder:$,setAddOrder:l,resolvedPayload:ee},children:b})};var le=se;
|
|
2
2
|
//# sourceMappingURL=BizProductProvider.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Listing/BizProductProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, {\n createContext,\n useCallback,\n useContext,\n type Dispatch,\n type SetStateAction,\n type PropsWithChildren,\n useState,\n useEffect,\n useMemo,\n} from 'react'\nimport type {\n Product,\n ProductPrice,\n ProductVariant,\n VariantCoupon,\n Options,\n FreeGift,\n BundleListItem,\n Bundle,\n} from './types/product'\nimport type { CompareData, DiscountData } from './types.js'\nimport { VARIANT_PAYLOAD_EXCLUDED_KEYS } from './const.js'\n\ntype Country = {\n id?: number\n name?: string\n code?: string\n}\n\nexport type UserProfile = {\n user_id: string\n email: string\n nick_name?: string\n full_name?: string\n first_name?: string\n last_name?: string\n dob?: string\n gender?: string\n phone_number?: string\n phone_account?: string\n country?: Country\n is_subscribe?: boolean\n avatar?: string\n can_change_password?: boolean\n invitation_code?: string\n phone_carrier?: string\n dob_programmed?: boolean\n activated?: boolean\n registed_at?: number\n activated_at?: number\n token?: string\n}\n\nexport type SavingDetail = {\n coupon: number\n bundle: number\n member: number\n freeGift: number\n compare: number\n exchangePurchase: number\n}\n\ntype variantWithFinalPrice = ProductVariant & { finalPrice?: ProductPrice }\n\nexport type FunctionMemberPriceResult = {\n hasMemberPrice: boolean\n originalPrice: number\n withCouponMemberTotalSave: number\n withoutCouponMaxMemberTotalSave?: number\n labels: {\n key: string\n value: string\n desc: string\n }[]\n}\n\nexport type ModalData = {\n needClickAway?: boolean\n className?: string\n title?: string\n content?: string\n domContent?: React.ReactNode\n}\n\nexport type JoinedRecommendBuyProducts = {\n bundle?: {\n value?: BundleListItem\n canOperate?: boolean\n }\n gift?: {\n value?: ProductVariant\n canOperate?: boolean\n }\n exchange?: {\n value?: ProductVariant\n canOperate?: boolean\n }\n}\n\nexport type CreditsRedemption = {\n amount: number\n availablePoints: number\n usedPoints: number\n skuDetails?: {\n sku: string\n is_eligible: boolean\n }[]\n}\n\nexport interface ProductContextType {\n isLogin?: boolean\n isMobile?: boolean\n isDesktop?: boolean\n product: Product\n profile?: UserProfile\n variant: ProductVariant\n resolvedPayload?: {\n components: any[]\n [key: string]: any\n }\n selectedVariants: Array<variantWithFinalPrice>\n renderRating?: React.ReactNode\n coupon?: VariantCoupon\n savingDetail: SavingDetail\n setSavingDetail: Dispatch<SetStateAction<SavingDetail>>\n finalPrice: number\n comparePrice: number\n totalSavings: number\n selectedOptions: Options\n setSelectedOptions: Dispatch<SetStateAction<Options>>\n freeGift?: FreeGift\n checkedGift?: ProductVariant\n setCheckedGift?: Dispatch<SetStateAction<ProductVariant | undefined>>\n exchangePurchase?: FreeGift\n checkedExchangePurchase?: ProductVariant\n setCheckedExchangePurchase?: Dispatch<SetStateAction<ProductVariant | undefined>>\n checkedBundle?: BundleListItem\n setCheckedBundle: Dispatch<SetStateAction<BundleListItem | undefined>>\n joinedRecommendBuyProducts: JoinedRecommendBuyProducts\n setJoinedRecommendBuyProducts?: Dispatch<SetStateAction<JoinedRecommendBuyProducts>>\n checkedCareBundle?: ProductVariant\n setCheckedCareBundle?: Dispatch<SetStateAction<ProductVariant | undefined>>\n bundle?: Bundle\n compareData?: CompareData['data']\n onAddToCart?: () => void\n onBuyNow?: () => void\n creditsRedemption?: CreditsRedemption\n memberFunctionResult?: FunctionMemberPriceResult\n openModal: ({ title, content, domContent }: ModalData) => void\n openSignInPopup?: () => void\n openAuthCodePopup?: () => void\n openSignUpPopup?: () => void\n renderInstallments?: React.ReactNode\n onUseCouponChange?: (couponSaving: number) => void\n onUseMemberDiscountChange?: (memberSaving: number) => void\n discount?: DiscountData\n buyNowLoading?: boolean\n addToCartLoading?: boolean\n addOrder?: Array<'bundle' | 'gift' | 'exchange'>\n setAddOrder?: Dispatch<SetStateAction<Array<'bundle' | 'gift' | 'exchange'>>>\n}\n\n// const initialState: ProductContextType = {\n// isLogin: false,\n// isMobile: false,\n// product: {} as Product,\n// variant: {} as ProductVariant,\n// savingDetail: { coupon: 0, bundle: 0, member: 0, freeGift: 0, compare: 0 },\n// finalPrice: 0,\n// comparePrice: 0,\n// totalSavings: 0,\n// renderRating: null,\n// selectedOptions: {} as Options,\n// setSelectedOptions: () => {},\n// checkedBundle: undefined,\n// checkedGift: undefined,\n// setCheckedBundle: () => {},\n// setCheckedGift: () => {},\n// checkedCareBundle: undefined,\n// setCheckedCareBundle: () => {},\n// }\n\nexport const BizProductContext = createContext<ProductContextType>({} as ProductContextType)\n\nexport const useBizProductContext = () => {\n const context = useContext(BizProductContext)\n if (!context) {\n throw new Error('useProductContext must be used in <ProductProvider>')\n }\n return useContext(BizProductContext)\n}\n\nconst ProductProvider = ({\n product,\n isLogin,\n profile,\n isMobile,\n isDesktop,\n children,\n renderRating,\n freeGift,\n exchangePurchase,\n bundle,\n checkedBundle,\n checkedGift,\n setCheckedBundle,\n setCheckedGift,\n checkedExchangePurchase,\n setCheckedExchangePurchase,\n variant,\n selectedOptions,\n setSelectedOptions,\n compareData,\n coupon,\n finalPrice,\n comparePrice,\n totalSavings,\n savingDetail,\n setSavingDetail,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n creditsRedemption,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n openSignUpPopup,\n renderInstallments,\n onUseCouponChange,\n onUseMemberDiscountChange,\n discount,\n buyNowLoading,\n addToCartLoading,\n}: PropsWithChildren<\n Omit<\n ProductContextType,\n 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts' | 'addOrder' | 'setAddOrder' | 'resolvedPayload'\n >\n>) => {\n const [joinedRecommendBuyProducts, setJoinedRecommendBuyProducts] = useState<JoinedRecommendBuyProducts>({})\n const [addOrder, setAddOrder] = useState<Array<'bundle' | 'gift' | 'exchange'>>([])\n\n const resolvedPayload = useMemo(() => {\n const variantComponents: any[] = variant?.payload?.components ?? []\n const excluded = VARIANT_PAYLOAD_EXCLUDED_KEYS as readonly string[]\n const nonExcluded = variantComponents.filter(item => {\n const identifier = item.componentKey ?? item.blockType ?? item.blockName\n return identifier && !excluded.includes(identifier)\n })\n return nonExcluded.length > 0 ? variant?.payload : product?.payload\n }, [variant?.payload, product?.payload])\n\n useEffect(() => {\n if (variant?.id) {\n setJoinedRecommendBuyProducts({\n bundle: {\n value: undefined,\n canOperate: true,\n },\n gift: {\n value: undefined,\n canOperate: true,\n },\n exchange: {\n value: undefined,\n canOperate: true,\n },\n })\n setAddOrder([])\n }\n }, [variant?.id])\n\n return (\n <BizProductContext.Provider\n value={{\n product,\n variant,\n isMobile,\n isDesktop,\n isLogin,\n profile,\n coupon,\n renderRating,\n finalPrice,\n comparePrice,\n savingDetail,\n setSavingDetail,\n totalSavings,\n selectedOptions,\n setSelectedOptions,\n freeGift,\n exchangePurchase,\n checkedGift,\n setCheckedGift,\n checkedBundle,\n setCheckedBundle,\n bundle,\n compareData,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n checkedExchangePurchase,\n setCheckedExchangePurchase,\n creditsRedemption,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n openSignUpPopup,\n renderInstallments,\n onUseCouponChange,\n onUseMemberDiscountChange,\n discount,\n buyNowLoading,\n addToCartLoading,\n addOrder,\n setAddOrder,\n resolvedPayload,\n }}\n >\n {children}\n </BizProductContext.Provider>\n )\n}\n\nexport default ProductProvider\n"],
|
|
5
|
-
"mappings": "mbAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,uBAAAE,EAAA,YAAAC,GAAA,yBAAAC,KAAA,eAAAC,GAAAL,
|
|
6
|
-
"names": ["BizProductProvider_exports", "__export", "BizProductContext", "BizProductProvider_default", "useBizProductContext", "__toCommonJS", "import_jsx_runtime", "import_react", "import_const", "ProductProvider", "product", "isLogin", "profile", "isMobile", "isDesktop", "children", "renderRating", "freeGift", "exchangePurchase", "bundle", "checkedBundle", "checkedGift", "setCheckedBundle", "setCheckedGift", "checkedExchangePurchase", "setCheckedExchangePurchase", "variant", "selectedOptions", "setSelectedOptions", "compareData", "coupon", "finalPrice", "comparePrice", "totalSavings", "savingDetail", "setSavingDetail", "selectedVariants", "onAddToCart", "onBuyNow", "creditsRedemption", "memberFunctionResult", "openModal", "openSignInPopup", "openAuthCodePopup", "openSignUpPopup", "renderInstallments", "onUseCouponChange", "onUseMemberDiscountChange", "discount", "buyNowLoading", "addToCartLoading", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "addOrder", "setAddOrder", "resolvedPayload", "variantComponents", "excluded", "item", "identifier"]
|
|
4
|
+
"sourcesContent": ["import React, {\n createContext,\n useCallback,\n useContext,\n type Dispatch,\n type SetStateAction,\n type PropsWithChildren,\n useState,\n useEffect,\n useMemo,\n} from 'react'\nimport type {\n Product,\n ProductPrice,\n ProductVariant,\n VariantCoupon,\n Options,\n FreeGift,\n BundleListItem,\n Bundle,\n} from './types/product'\nimport type { CompareData, DiscountData } from './types.js'\nimport { VARIANT_PAYLOAD_EXCLUDED_KEYS } from './const.js'\n\ntype Country = {\n id?: number\n name?: string\n code?: string\n}\n\nexport type UserProfile = {\n user_id: string\n email: string\n nick_name?: string\n full_name?: string\n first_name?: string\n last_name?: string\n dob?: string\n gender?: string\n phone_number?: string\n phone_account?: string\n country?: Country\n is_subscribe?: boolean\n avatar?: string\n can_change_password?: boolean\n invitation_code?: string\n phone_carrier?: string\n dob_programmed?: boolean\n activated?: boolean\n registed_at?: number\n activated_at?: number\n token?: string\n}\n\nexport type SavingDetail = {\n coupon: number\n bundle: number\n member: number\n freeGift: number\n compare: number\n exchangePurchase: number\n}\n\ntype variantWithFinalPrice = ProductVariant & { finalPrice?: ProductPrice }\n\nexport type FunctionMemberPriceResult = {\n hasMemberPrice: boolean\n originalPrice: number\n withCouponMemberTotalSave: number\n withoutCouponMaxMemberTotalSave?: number\n labels: {\n key: string\n value: string\n desc: string\n }[]\n}\n\nexport type ModalData = {\n needClickAway?: boolean\n className?: string\n title?: string\n content?: string\n domContent?: React.ReactNode\n}\n\nexport type JoinedRecommendBuyProducts = {\n bundle?: {\n value?: BundleListItem\n canOperate?: boolean\n }\n gift?: {\n value?: ProductVariant\n canOperate?: boolean\n }\n exchange?: {\n value?: ProductVariant\n canOperate?: boolean\n }\n}\n\nexport type CreditsRedemption = {\n amount: number\n availablePoints: number\n usedPoints: number\n skuDetails?: {\n sku: string\n is_eligible: boolean\n }[]\n}\n\nexport interface ProductContextType {\n isLogin?: boolean\n isMobile?: boolean\n isDesktop?: boolean\n product: Product\n profile?: UserProfile\n variant: ProductVariant\n resolvedPayload?: {\n components: any[]\n [key: string]: any\n }\n selectedVariants: Array<variantWithFinalPrice>\n renderRating?: React.ReactNode\n coupon?: VariantCoupon\n savingDetail: SavingDetail\n setSavingDetail: Dispatch<SetStateAction<SavingDetail>>\n finalPrice: number\n comparePrice: number\n totalSavings: number\n selectedOptions: Options\n setSelectedOptions: Dispatch<SetStateAction<Options>>\n freeGift?: FreeGift\n checkedGift?: ProductVariant\n setCheckedGift?: Dispatch<SetStateAction<ProductVariant | undefined>>\n exchangePurchase?: FreeGift\n checkedExchangePurchase?: ProductVariant\n setCheckedExchangePurchase?: Dispatch<SetStateAction<ProductVariant | undefined>>\n checkedBundle?: BundleListItem\n setCheckedBundle: Dispatch<SetStateAction<BundleListItem | undefined>>\n joinedRecommendBuyProducts: JoinedRecommendBuyProducts\n setJoinedRecommendBuyProducts?: Dispatch<SetStateAction<JoinedRecommendBuyProducts>>\n checkedCareBundle?: ProductVariant\n setCheckedCareBundle?: Dispatch<SetStateAction<ProductVariant | undefined>>\n bundle?: Bundle\n compareData?: CompareData['data']\n onAddToCart?: () => void\n onBuyNow?: () => void\n creditsRedemption?: CreditsRedemption\n memberFunctionResult?: FunctionMemberPriceResult\n openModal: ({ title, content, domContent }: ModalData) => void\n openSignInPopup?: () => void\n openAuthCodePopup?: () => void\n openSignUpPopup?: () => void\n renderInstallments?: React.ReactNode\n onUseCouponChange?: (couponSaving: number) => void\n onUseMemberDiscountChange?: (memberSaving: number) => void\n discount?: DiscountData\n buyNowLoading?: boolean\n addToCartLoading?: boolean\n addOrder?: Array<'bundle' | 'gift' | 'exchange'>\n setAddOrder?: Dispatch<SetStateAction<Array<'bundle' | 'gift' | 'exchange'>>>\n notifyMeMode?: 'normal' | 'notify_me'\n onNotifyMeClick?: (open: boolean) => void\n}\n\n// const initialState: ProductContextType = {\n// isLogin: false,\n// isMobile: false,\n// product: {} as Product,\n// variant: {} as ProductVariant,\n// savingDetail: { coupon: 0, bundle: 0, member: 0, freeGift: 0, compare: 0 },\n// finalPrice: 0,\n// comparePrice: 0,\n// totalSavings: 0,\n// renderRating: null,\n// selectedOptions: {} as Options,\n// setSelectedOptions: () => {},\n// checkedBundle: undefined,\n// checkedGift: undefined,\n// setCheckedBundle: () => {},\n// setCheckedGift: () => {},\n// checkedCareBundle: undefined,\n// setCheckedCareBundle: () => {},\n// }\n\nexport const BizProductContext = createContext<ProductContextType>({} as ProductContextType)\n\nexport const useBizProductContext = () => {\n const context = useContext(BizProductContext)\n if (!context) {\n throw new Error('useProductContext must be used in <ProductProvider>')\n }\n return useContext(BizProductContext)\n}\n\nconst ProductProvider = ({\n product,\n isLogin,\n profile,\n isMobile,\n isDesktop,\n children,\n renderRating,\n freeGift,\n exchangePurchase,\n bundle,\n checkedBundle,\n checkedGift,\n setCheckedBundle,\n setCheckedGift,\n checkedExchangePurchase,\n setCheckedExchangePurchase,\n variant,\n selectedOptions,\n setSelectedOptions,\n compareData,\n coupon,\n finalPrice,\n comparePrice,\n totalSavings,\n savingDetail,\n setSavingDetail,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n creditsRedemption,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n openSignUpPopup,\n renderInstallments,\n onUseCouponChange,\n onUseMemberDiscountChange,\n discount,\n buyNowLoading,\n addToCartLoading,\n notifyMeMode,\n onNotifyMeClick,\n}: PropsWithChildren<\n Omit<\n ProductContextType,\n 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts' | 'addOrder' | 'setAddOrder' | 'resolvedPayload'\n >\n>) => {\n const [joinedRecommendBuyProducts, setJoinedRecommendBuyProducts] = useState<JoinedRecommendBuyProducts>({})\n const [addOrder, setAddOrder] = useState<Array<'bundle' | 'gift' | 'exchange'>>([])\n\n const resolvedPayload = useMemo(() => {\n const variantComponents: any[] = variant?.payload?.components ?? []\n const excluded = VARIANT_PAYLOAD_EXCLUDED_KEYS as readonly string[]\n const nonExcluded = variantComponents.filter(item => {\n const identifier = item.componentKey ?? item.blockType ?? item.blockName\n return identifier && !excluded.includes(identifier)\n })\n return nonExcluded.length > 0 ? variant?.payload : product?.payload\n }, [variant?.payload, product?.payload])\n\n useEffect(() => {\n if (variant?.id) {\n setJoinedRecommendBuyProducts({\n bundle: {\n value: undefined,\n canOperate: true,\n },\n gift: {\n value: undefined,\n canOperate: true,\n },\n exchange: {\n value: undefined,\n canOperate: true,\n },\n })\n setAddOrder([])\n }\n }, [variant?.id])\n\n return (\n <BizProductContext.Provider\n value={{\n product,\n variant,\n isMobile,\n isDesktop,\n isLogin,\n profile,\n coupon,\n renderRating,\n finalPrice,\n comparePrice,\n savingDetail,\n setSavingDetail,\n totalSavings,\n selectedOptions,\n setSelectedOptions,\n freeGift,\n exchangePurchase,\n checkedGift,\n setCheckedGift,\n checkedBundle,\n setCheckedBundle,\n bundle,\n compareData,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n checkedExchangePurchase,\n setCheckedExchangePurchase,\n creditsRedemption,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n openSignUpPopup,\n renderInstallments,\n onUseCouponChange,\n onUseMemberDiscountChange,\n discount,\n buyNowLoading,\n addToCartLoading,\n notifyMeMode,\n onNotifyMeClick,\n addOrder,\n setAddOrder,\n resolvedPayload,\n }}\n >\n {children}\n </BizProductContext.Provider>\n )\n}\n\nexport default ProductProvider\n"],
|
|
5
|
+
"mappings": "mbAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,uBAAAE,EAAA,YAAAC,GAAA,yBAAAC,KAAA,eAAAC,GAAAL,IAuRI,IAAAM,EAAA,6BAvRJC,EAUO,iBAYPC,EAA8C,sBAmKvC,MAAMN,KAAoB,iBAAkC,CAAC,CAAuB,EAE9EE,GAAuB,IAAM,CAExC,GAAI,IADY,cAAWF,CAAiB,EAE1C,MAAM,IAAI,MAAM,qDAAqD,EAEvE,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,CAAC,EAElB,EAAG,CAAC9B,GAAS,EAAE,CAAC,KAGd,OAACxB,EAAkB,SAAlB,CACC,MAAO,CACL,QAAAQ,EACA,QAAAgB,EACA,SAAAb,EACA,UAAAC,EACA,QAAAH,EACA,QAAAC,EACA,OAAAkB,EACA,aAAAd,EACA,WAAAe,EACA,aAAAC,EACA,aAAAE,EACA,gBAAAC,EACA,aAAAF,EACA,gBAAAN,EACA,mBAAAC,EACA,SAAAX,EACA,iBAAAC,EACA,YAAAG,EACA,eAAAE,EACA,cAAAH,EACA,iBAAAE,EACA,OAAAH,EACA,YAAAU,EACA,iBAAAO,EACA,YAAAC,EACA,SAAAC,EACA,2BAAAe,EACA,8BAAAC,EACA,wBAAA9B,EACA,2BAAAC,EACA,kBAAAc,EACA,qBAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,kBAAAC,EACA,0BAAAC,EACA,SAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,SAAAG,EACA,YAAAC,EACA,gBAAAC,EACF,EAEC,SAAA1C,EACH,CAEJ,EAEA,IAAOZ,GAAQM",
|
|
6
|
+
"names": ["BizProductProvider_exports", "__export", "BizProductContext", "BizProductProvider_default", "useBizProductContext", "__toCommonJS", "import_jsx_runtime", "import_react", "import_const", "ProductProvider", "product", "isLogin", "profile", "isMobile", "isDesktop", "children", "renderRating", "freeGift", "exchangePurchase", "bundle", "checkedBundle", "checkedGift", "setCheckedBundle", "setCheckedGift", "checkedExchangePurchase", "setCheckedExchangePurchase", "variant", "selectedOptions", "setSelectedOptions", "compareData", "coupon", "finalPrice", "comparePrice", "totalSavings", "savingDetail", "setSavingDetail", "selectedVariants", "onAddToCart", "onBuyNow", "creditsRedemption", "memberFunctionResult", "openModal", "openSignInPopup", "openAuthCodePopup", "openSignUpPopup", "renderInstallments", "onUseCouponChange", "onUseMemberDiscountChange", "discount", "buyNowLoading", "addToCartLoading", "notifyMeMode", "onNotifyMeClick", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "addOrder", "setAddOrder", "resolvedPayload", "variantComponents", "excluded", "item", "identifier"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export interface CartActionButtonsProps {
|
|
2
|
+
/** 按钮模式:normal 展示两个购买按钮,notify_me 展示单个 Notify Me 按钮 */
|
|
3
|
+
mode?: 'normal' | 'notify_me';
|
|
2
4
|
availableForSale?: boolean;
|
|
3
5
|
addToCartText?: string;
|
|
4
6
|
buyNowText?: string;
|
|
@@ -8,6 +10,12 @@ export interface CartActionButtonsProps {
|
|
|
8
10
|
buyNowClassName?: string;
|
|
9
11
|
onAddToCart?: () => void;
|
|
10
12
|
onBuyNow?: () => void;
|
|
13
|
+
/** Notify Me 按钮文案,mode='notify_me' 时生效 */
|
|
14
|
+
notifyMeText?: string;
|
|
15
|
+
/** Notify Me 按钮自定义样式 */
|
|
16
|
+
notifyMeClassName?: string;
|
|
17
|
+
/** 点击 Notify Me 按钮的回调 */
|
|
18
|
+
onNotifyMeClick?: (open: boolean) => void;
|
|
11
19
|
}
|
|
12
|
-
declare const CartActionButtons: ({ availableForSale, addToCartText, buyNowText, addToCartLoading, buyNowLoading, addToCartClassName, buyNowClassName, onAddToCart, onBuyNow, }: CartActionButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare const CartActionButtons: ({ mode, availableForSale, addToCartText, buyNowText, addToCartLoading, buyNowLoading, addToCartClassName, buyNowClassName, onAddToCart, onBuyNow, notifyMeText, notifyMeClassName, onNotifyMeClick, }: CartActionButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
21
|
export default CartActionButtons;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var T=Object.create;var i=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var x=(t,o)=>{for(var a in o)i(t,a,{get:o[a],enumerable:!0})},c=(t,o,a,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of A(o))!k.call(t,n)&&n!==a&&i(t,n,{get:()=>o[n],enumerable:!(s=v(o,n))||s.enumerable});return t};var h=(t,o,a)=>(a=t!=null?T(M(t)):{},c(o||!t||!t.__esModule?i(a,"default",{value:t,enumerable:!0}):a,t)),z=t=>c(i({},"__esModule",{value:!0}),t);var E={};x(E,{default:()=>$});module.exports=z(E);var e=require("react/jsx-runtime"),r=require("../../../../components/index.js"),f=require("../../../../hooks/useExposure.js"),L=h(require("react"));const m="copy",p="CartActionButtons",R=({mode:t="normal",availableForSale:o=!0,addToCartText:a="Add to Cart",buyNowText:s="Buy Now",addToCartLoading:n=!1,buyNowLoading:y=!1,addToCartClassName:C="tablet:w-auto w-1/2",buyNowClassName:b="tablet:w-auto w-1/2",onAddToCart:N,onBuyNow:g,notifyMeText:l="Notify Me",notifyMeClassName:B="tablet:w-auto w-1/2",onNotifyMeClick:w})=>{if(t==="notify_me"){const u=L.useRef(null);return(0,f.useExposure)(u,{componentType:m,componentName:p,componentTitle:"",componentDescription:""}),(0,e.jsx)(r.Button,{ref:u,variant:"primary",size:"lg",className:B,onClick:()=>w?.(!0),"data-headless-type-name":`${m}#${p}`,"data-headless-title-desc-button":`''#''#${l}`,"data-headless-nav-position":"''#1",children:l})}const d=!o;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(r.Button,{variant:"secondary",disabled:d,size:"lg",className:C,onClick:N,loading:n,children:a}),(0,e.jsx)(r.Button,{variant:"primary",disabled:d,size:"lg",loading:y,className:b,onClick:g,children:s})]})};var $=R;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/biz-components/Listing/components/CartActionButtons/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Button } from '../../../../components/index.js'\n\nexport interface CartActionButtonsProps {\n availableForSale?: boolean\n addToCartText?: string\n buyNowText?: string\n addToCartLoading?: boolean\n buyNowLoading?: boolean\n addToCartClassName?: string\n buyNowClassName?: string\n onAddToCart?: () => void\n onBuyNow?: () => void\n}\n\nconst CartActionButtons = ({\n availableForSale = true,\n addToCartText = 'Add to Cart',\n buyNowText = 'Buy Now',\n addToCartLoading = false,\n buyNowLoading = false,\n addToCartClassName = 'tablet:w-auto w-1/2',\n buyNowClassName = 'tablet:w-auto w-1/2',\n onAddToCart,\n onBuyNow,\n}: CartActionButtonsProps) => {\n const disabled = !availableForSale\n\n return (\n <>\n <Button\n variant=\"secondary\"\n disabled={disabled}\n size=\"lg\"\n className={addToCartClassName}\n onClick={onAddToCart}\n loading={addToCartLoading}\n >\n {addToCartText}\n </Button>\n <Button\n variant=\"primary\"\n disabled={disabled}\n size=\"lg\"\n loading={buyNowLoading}\n className={buyNowClassName}\n onClick={onBuyNow}\n >\n {buyNowText}\n </Button>\n </>\n )\n}\n\nexport default CartActionButtons\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["CartActionButtons_exports", "__export", "CartActionButtons_default", "__toCommonJS", "import_jsx_runtime", "import_components", "CartActionButtons", "availableForSale", "addToCartText", "buyNowText", "addToCartLoading", "buyNowLoading", "addToCartClassName", "buyNowClassName", "onAddToCart", "onBuyNow", "disabled"]
|
|
4
|
+
"sourcesContent": ["import { Button } from '../../../../components/index.js'\nimport { useExposure } from '../../../../hooks/useExposure.js'\nimport * as React from 'react'\n\nconst componentType = 'copy'\nconst componentName = 'CartActionButtons'\n\nexport interface CartActionButtonsProps {\n /** \u6309\u94AE\u6A21\u5F0F\uFF1Anormal \u5C55\u793A\u4E24\u4E2A\u8D2D\u4E70\u6309\u94AE\uFF0Cnotify_me \u5C55\u793A\u5355\u4E2A Notify Me \u6309\u94AE */\n mode?: 'normal' | 'notify_me'\n availableForSale?: boolean\n addToCartText?: string\n buyNowText?: string\n addToCartLoading?: boolean\n buyNowLoading?: boolean\n addToCartClassName?: string\n buyNowClassName?: string\n onAddToCart?: () => void\n onBuyNow?: () => void\n /** Notify Me \u6309\u94AE\u6587\u6848\uFF0Cmode='notify_me' \u65F6\u751F\u6548 */\n notifyMeText?: string\n /** Notify Me \u6309\u94AE\u81EA\u5B9A\u4E49\u6837\u5F0F */\n notifyMeClassName?: string\n /** \u70B9\u51FB Notify Me \u6309\u94AE\u7684\u56DE\u8C03 */\n onNotifyMeClick?: (open: boolean) => void\n}\n\nconst CartActionButtons = ({\n mode = 'normal',\n availableForSale = true,\n addToCartText = 'Add to Cart',\n buyNowText = 'Buy Now',\n addToCartLoading = false,\n buyNowLoading = false,\n addToCartClassName = 'tablet:w-auto w-1/2',\n buyNowClassName = 'tablet:w-auto w-1/2',\n onAddToCart,\n onBuyNow,\n notifyMeText = 'Notify Me',\n notifyMeClassName = 'tablet:w-auto w-1/2',\n onNotifyMeClick,\n}: CartActionButtonsProps) => {\n if (mode === 'notify_me') {\n const notifyMeButtonRef = React.useRef<HTMLButtonElement>(null)\n useExposure(notifyMeButtonRef, {\n componentType,\n componentName,\n componentTitle: '',\n componentDescription: '',\n })\n return (\n <Button\n ref={notifyMeButtonRef}\n variant=\"primary\"\n size=\"lg\"\n className={notifyMeClassName}\n onClick={() => onNotifyMeClick?.(true)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`''#''#${notifyMeText}`}\n data-headless-nav-position={`''#1`}\n >\n {notifyMeText}\n </Button>\n )\n }\n\n const disabled = !availableForSale\n\n return (\n <>\n <Button\n variant=\"secondary\"\n disabled={disabled}\n size=\"lg\"\n className={addToCartClassName}\n onClick={onAddToCart}\n loading={addToCartLoading}\n >\n {addToCartText}\n </Button>\n <Button\n variant=\"primary\"\n disabled={disabled}\n size=\"lg\"\n loading={buyNowLoading}\n className={buyNowClassName}\n onClick={onBuyNow}\n >\n {buyNowText}\n </Button>\n </>\n )\n}\n\nexport default CartActionButtons\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmDM,IAAAI,EAAA,6BAnDNC,EAAuB,2CACvBC,EAA4B,4CAC5BC,EAAuB,oBAEvB,MAAMC,EAAgB,OAChBC,EAAgB,oBAsBhBC,EAAoB,CAAC,CACzB,KAAAC,EAAO,SACP,iBAAAC,EAAmB,GACnB,cAAAC,EAAgB,cAChB,WAAAC,EAAa,UACb,iBAAAC,EAAmB,GACnB,cAAAC,EAAgB,GAChB,mBAAAC,EAAqB,sBACrB,gBAAAC,EAAkB,sBAClB,YAAAC,EACA,SAAAC,EACA,aAAAC,EAAe,YACf,kBAAAC,EAAoB,sBACpB,gBAAAC,CACF,IAA8B,CAC5B,GAAIZ,IAAS,YAAa,CACxB,MAAMa,EAAoBjB,EAAM,OAA0B,IAAI,EAC9D,wBAAYiB,EAAmB,CAC7B,cAAAhB,EACA,cAAAC,EACA,eAAgB,GAChB,qBAAsB,EACxB,CAAC,KAEC,OAAC,UACC,IAAKe,EACL,QAAQ,UACR,KAAK,KACL,UAAWF,EACX,QAAS,IAAMC,IAAkB,EAAI,EACrC,0BAAyB,GAAGf,CAAa,IAAIC,CAAa,GAC1D,kCAAiC,SAASY,CAAY,GACtD,6BAA4B,OAE3B,SAAAA,EACH,CAEJ,CAEA,MAAMI,EAAW,CAACb,EAElB,SACE,oBACE,oBAAC,UACC,QAAQ,YACR,SAAUa,EACV,KAAK,KACL,UAAWR,EACX,QAASE,EACT,QAASJ,EAER,SAAAF,EACH,KACA,OAAC,UACC,QAAQ,UACR,SAAUY,EACV,KAAK,KACL,QAAST,EACT,UAAWE,EACX,QAASE,EAER,SAAAN,EACH,GACF,CAEJ,EAEA,IAAOZ,EAAQQ",
|
|
6
|
+
"names": ["CartActionButtons_exports", "__export", "CartActionButtons_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_useExposure", "React", "componentType", "componentName", "CartActionButtons", "mode", "availableForSale", "addToCartText", "buyNowText", "addToCartLoading", "buyNowLoading", "addToCartClassName", "buyNowClassName", "onAddToCart", "onBuyNow", "notifyMeText", "notifyMeClassName", "onNotifyMeClick", "notifyMeButtonRef", "disabled"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var le=Object.create;var T=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ce=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var de=(l,t)=>{for(var s in t)T(l,s,{get:t[s],enumerable:!0})},q=(l,t,s,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ie(t))!se.call(l,n)&&n!==s&&T(l,n,{get:()=>t[n],enumerable:!(u=re(t,n))||u.enumerable});return l};var J=(l,t,s)=>(s=l!=null?le(ce(l)):{},q(t||!l||!l.__esModule?T(s,"default",{value:l,enumerable:!0}):s,l)),pe=l=>q(T({},"__esModule",{value:!0}),l);var fe={};de(fe,{default:()=>xe});module.exports=pe(fe);var e=require("react/jsx-runtime"),a=require("../../../../../components/index.js"),B=require("../../../BizProductProvider.js"),M=require("../../../hooks/useComponentData.js"),v=require("react"),g=require("../../../utils/index.js"),S=require("../../../../AiuiProvider/index.js"),$=J(require("decimal.js")),U=require("../../../utils/textFormat.js"),X=require("../../../../../shared/Styles.js"),Y=require("../../../../../components/index.js"),Z=require("../../../../../shared/track.js"),ee=J(require("../../CartActionButtons/index.js"));const ue=()=>{const{locale:l="us",copyWriting:t,trackingData:s}=(0,S.useAiuiContext)(),{product:u,variant:n,finalPrice:x,comparePrice:b,coupon:k,selectedOptions:p,selectedVariants:i,totalSavings:F,onAddToCart:w,onBuyNow:E,savingDetail:f,checkedBundle:y,joinedRecommendBuyProducts:o,setJoinedRecommendBuyProducts:P,setSavingDetail:C,addToCartLoading:j,buyNowLoading:te,profile:_,addOrder:L,setAddOrder:D}=(0,B.useBizProductContext)(),G=s?.showComparePrice??!0,z=(0,M.useComponentData)("ProductSummary")??{},[A]=i,I=(0,v.useMemo)(()=>{const c=y?.variants.find(N=>N.variant.sku===A?.sku),r=new $.default(A?.price?.amount||0).minus(c?.price||A?.price?.amount).toNumber();let m=new $.default(A?.price?.amount||0);_?.email&&(m=m.minus(f?.member||0));const h=m.minus(f?.coupon).minus(r).toNumber();return parseFloat(h.toFixed(2))},[A,y,_,f?.member,f?.coupon]),{bundleVariant:V,giftVariant:R,exchangeVariant:W}=me()||{},[d,O]=(0,v.useState)();(0,v.useEffect)(()=>{O({bundle:o.bundle?.value?void 0:V,gift:o.gift?.value?void 0:R,exchange:o.exchange?.value?void 0:W})},[V,R,W,o]);const ae=(0,v.useMemo)(()=>{const c=[];return L&&L.forEach((r,m)=>{o[r]?.value&&c.push({type:r,key:`${r}-${m}`})}),c},[L,o]),oe=(0,v.useMemo)(()=>{const c=p?.quantity||"",r=p?.color||p?.colour||p?.couleur||"";return`${c&&r?`${c} | ${r}`:c||r}`},[p?.quantity,p?.color,p?.colour,p?.couleur]),ne=(0,v.useMemo)(()=>{const{image_1920:c,image_1440:r,image_1024:m,image_768:h,image_390:N}=z?.thumbnail||{};return(z?.thumbnail?`${c} 1920, ${r} 1440, ${m} 1024, ${h} 768, ${N} 390`:n.image?.url)||n.image?.url},[z?.thumbnail,n.image?.url]);return n.availableForSale?(0,e.jsx)("div",{className:"ipc-product-summary laptop:px-16 laptop-md:px-0 laptop-md:mt-[96px] lg-desktop:mt-[128px] mt-16",children:(0,e.jsx)("div",{className:"laptop:rounded-2xl bg-[#F5F5F7]",children:(0,e.jsxs)(a.Grid,{className:"tablet:p-8 tablet:!pb-0 px-4 pt-6",children:[(0,e.jsxs)(a.GridItem,{className:"laptop:col-start-1 laptop:col-span-5 col-span-12 flex flex-col justify-between gap-4",children:[(0,e.jsx)(a.Heading,{className:"lg-desktop:text-[48px] laptop:text-[32px] laptop-md:text-[40px] mb-4 text-[24px] font-bold leading-none [&>span]:text-[#D1D1D1]",html:z?.readyWant?.replace?.("{title}",u?.title)}),(0,e.jsx)("div",{className:"",children:(0,e.jsx)(a.Picture,{source:ne,className:"lg-desktop:aspect-[644/320] laptop-md:aspect-[503/270] laptop:aspect-[332/190] tablet:aspect-[704/380] aspect-[358/190]",imgClassName:"object-cover h-full"})})]}),(0,e.jsxs)(a.GridItem,{className:"tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 col-span-12 mt-8 flex flex-col justify-between gap-6 pb-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,e.jsx)(Y.ExposureDetector,{exposureKey:"listing_selector",onExposure:()=>{(0,Z.gaTrack)({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:`Product Detail Page${n.sku}`,component_type:"image",component_name:"listing_selector",position:1}})},children:(0,e.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(a.Picture,{source:n.image?.url||u?.images?.[0]?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,e.jsxs)("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:u.title}),(0,e.jsx)(a.Text,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]",html:oe})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:(0,g.formatPrice)({amount:I,currencyCode:n.price.currencyCode,locale:l})}),G&&I<n?.price?.amount&&(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl laptop:text-xl text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:n?.price?.amount,currencyCode:n.price.currencyCode,locale:l})})]})]})}),ae.map(({type:c,key:r})=>c==="gift"&&o?.gift?.value?(0,e.jsx)(H,{giftOperation:m=>{P?.({...o,gift:{value:void 0,canOperate:!0}}),O?.({...d,gift:m}),D?.(h=>h.filter(N=>N!=="gift"))},status:!!o?.gift,gift:o?.gift?.value,canOperate:o?.gift?.canOperate},r):c==="bundle"&&o?.bundle?.value?(0,e.jsx)(Q,{bundleOperation:m=>{P?.({...o,bundle:{value:void 0,canOperate:!0}}),O?.({...d,bundle:m}),D?.(h=>h.filter(N=>N!=="bundle"))},status:!!o?.bundle,bundleListItem:o?.bundle?.value,canOperate:o?.bundle?.canOperate},r):c==="exchange"&&o?.exchange?.value?(0,e.jsx)(K,{exchangeOperation:m=>{P?.({...o,exchange:{value:void 0,canOperate:!0}}),O?.({...d,exchange:m}),D?.(h=>h.filter(N=>N!=="exchange"))},status:!!o?.exchange,canOperate:o?.exchange?.canOperate,exchange:o?.exchange?.value},r):null)]}),(d?.bundle||d?.gift||d?.exchange)&&(0,e.jsxs)("div",{className:"laptop-md:mt-8 mt-6",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-[18px] text-sm font-bold",html:z?.recommendBuy}),(0,e.jsxs)("div",{className:"laptop-md:gap-4 mt-4 flex flex-col gap-6",children:[d?.exchange&&(0,e.jsx)(K,{exchangeOperation:c=>{P?.({...o,exchange:{value:c,canOperate:!0}}),O?.({...d,exchange:void 0}),D?.(r=>[...r,"exchange"])},canOperate:o?.exchange?.canOperate,status:!d?.exchange,exchange:d?.exchange}),d?.bundle&&(0,e.jsx)(Q,{bundleOperation:c=>{C?.({...f,exchangePurchase:0}),P?.({...o,bundle:{value:c,canOperate:!0}}),O?.({...d,bundle:void 0}),D?.(r=>[...r,"bundle"])},canOperate:o?.bundle?.canOperate,status:!d?.bundle,bundleListItem:d?.bundle}),d?.gift&&(0,e.jsx)(H,{giftOperation:c=>{P?.({...o,gift:{value:c,canOperate:!0}}),O?.({...d,gift:void 0}),D?.(r=>[...r,"gift"])},canOperate:o?.gift?.canOperate,status:!d?.gift,gift:d?.gift})]})]})]}),(0,e.jsxs)("div",{className:"text-right",children:[(0,e.jsx)(a.Text,{className:"laptop:text-xl laptop-md:text-2xl text-right font-bold",html:`${(0,U.replaceTemplate)(t?.totalPrice||"",{amount:(0,g.formatPrice)({amount:parseFloat(x.toFixed(2)),currencyCode:n.price.currencyCode,locale:l})})}`}),G&&F>0&&(0,e.jsx)(a.Text,{className:"laptop:text-xl laptop-md:text-2xl ml-1 text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:b,currencyCode:n.price.currencyCode,locale:l})}),(0,e.jsx)("div",{className:"mt-4 flex justify-end gap-3",children:(0,e.jsx)(ee.default,{availableForSale:n.availableForSale,addToCartText:t?.addToCart,buyNowText:t?.shopNow,addToCartLoading:j,buyNowLoading:te,addToCartClassName:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2",buyNowClassName:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2",onAddToCart:w,onBuyNow:E})})]})]})]})})}):null},me=()=>{const{bundle:l,variant:t,checkedBundle:s,freeGift:u,checkedGift:n,exchangePurchase:x,checkedExchangePurchase:b}=(0,B.useBizProductContext)();let k,p,i;const{bundleList:F}=l||{},{giftList:w=[]}=u||{},{giftList:E=[]}=x||{},f=F?.filter(C=>C.variants.slice(1,C.variants.length).every(j=>j.variant.availableForSale))||[],[y]=f;k=s||y;const[o]=w?.filter(C=>C.availableForSale)??[];p=n||o;const[P]=E?.filter(C=>C.availableForSale)??[];return i=b||P,{bundleVariant:k,giftVariant:p,exchangeVariant:i}},Q=({bundleOperation:l,bundleListItem:t,canOperate:s,status:u})=>{const{locale:n="us",copyWriting:x}=(0,S.useAiuiContext)(),{variant:b,setCheckedBundle:k}=(0,B.useBizProductContext)(),p=t?.variants.filter(i=>i.variant.sku!==b.sku);return(0,e.jsx)("div",{className:"",children:p?.map(i=>(0,e.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(a.Picture,{source:i?.variant?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,e.jsx)("div",{className:"tablet:max-w-none line-clamp-2 flex max-w-[178px] flex-col gap-[6px]",children:(0,e.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold",html:i.variant.product.title})})]}),(0,e.jsxs)("div",{className:"flex flex-col items-end justify-center gap-1",children:[!!t&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:(0,g.formatPrice)({amount:i?.price||0,locale:n,currencyCode:i.variant?.price?.currencyCode||""})}),i.price<i.variant.price.amount&&(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:i.variant.price.amount||0,locale:n,currencyCode:i.variant?.price?.currencyCode||""})})]}),s&&(0,e.jsx)(a.Button,{size:"icon",variant:"link",onClick:()=>{k?.(u?void 0:t),l?.(t)},className:"size-auto shrink-0 underline",children:u?x?.remove:x?.add})]})]},i.variant.id))})},H=({giftOperation:l,gift:t,status:s,canOperate:u})=>{const{locale:n="us",copyWriting:x}=(0,S.useAiuiContext)(),{freeGift:b,setCheckedGift:k}=(0,B.useBizProductContext)(),{freeLabel:p}=b||{},{options:i}=t||{},F=(0,v.useMemo)(()=>{const w=i?.find(o=>o.name==="color"||o.name==="colour"||o.name==="couleur")||{},E=i?.find(o=>o.name==="quantity")||{},f=w?w.values?.[0]?.label:"",y=E?E.values?.[0]?.label:"";return`${f&&y?y+" | "+f:y||f} | ${p}`},[p,i]);return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(a.Picture,{source:t?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,e.jsxs)("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:t?.product?.title}),(0,e.jsx)(a.Text,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]",html:F})]})]}),(0,e.jsxs)("div",{className:"flex flex-col items-end justify-center gap-2",children:[!!t&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:p}),(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:t.price.amount,locale:n,currencyCode:t.price.currencyCode})})]}),u&&(0,e.jsx)(a.Button,{size:"icon",variant:"link",onClick:()=>{k?.(s?void 0:t),l(t)},className:"size-auto shrink-0 underline",children:s?x?.remove:x?.add})]})]})},K=({exchangeOperation:l,exchange:t,canOperate:s,status:u})=>{const{locale:n="us",copyWriting:x}=(0,S.useAiuiContext)(),{setCheckedExchangePurchase:b}=(0,B.useBizProductContext)();return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(a.Picture,{source:t?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,e.jsxs)("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:t?.product?.title}),(0,e.jsx)(a.Text,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]"})]})]}),(0,e.jsxs)("div",{className:"flex flex-col items-end justify-center gap-2",children:[!!t&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:(0,g.formatPrice)({amount:t.finalPrice?.amount||0,locale:n,currencyCode:t.price.currencyCode})}),(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:t.price?.amount||0,locale:n,currencyCode:t.price.currencyCode})})]}),s&&(0,e.jsx)(a.Button,{size:"icon",variant:"link",onClick:()=>{b?.(u?void 0:t),l(t)},className:"size-auto shrink-0 underline",children:u?x?.remove:x?.add})]})]})};var xe=(0,X.withLayout)(ue);
|
|
1
|
+
"use strict";var re=Object.create;var T=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var ue=(l,t)=>{for(var s in t)T(l,s,{get:t[s],enumerable:!0})},W=(l,t,s,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of se(t))!pe.call(l,n)&&n!==s&&T(l,n,{get:()=>t[n],enumerable:!(u=ce(t,n))||u.enumerable});return l};var q=(l,t,s)=>(s=l!=null?re(de(l)):{},W(t||!l||!l.__esModule?T(s,"default",{value:l,enumerable:!0}):s,l)),me=l=>W(T({},"__esModule",{value:!0}),l);var ve={};ue(ve,{default:()=>ge});module.exports=me(ve);var e=require("react/jsx-runtime"),a=require("../../../../../components/index.js"),B=require("../../../BizProductProvider.js"),K=require("../../../hooks/useComponentData.js"),v=require("react"),g=require("../../../utils/index.js"),S=require("../../../../AiuiProvider/index.js"),$=q(require("decimal.js")),U=require("../../../utils/textFormat.js"),X=require("../../../../../shared/Styles.js"),Y=require("../../../../../components/index.js"),Z=require("../../../../../shared/track.js"),ee=q(require("../../CartActionButtons/index.js"));const xe=()=>{const{locale:l="us",copyWriting:t,trackingData:s}=(0,S.useAiuiContext)(),{product:u,variant:n,finalPrice:x,comparePrice:b,coupon:k,selectedOptions:p,selectedVariants:r,totalSavings:F,onAddToCart:w,onBuyNow:E,savingDetail:f,checkedBundle:N,joinedRecommendBuyProducts:o,setJoinedRecommendBuyProducts:C,setSavingDetail:P,addToCartLoading:j,buyNowLoading:te,notifyMeMode:ae,onNotifyMeClick:oe,profile:_,addOrder:L,setAddOrder:D}=(0,B.useBizProductContext)(),G=s?.showComparePrice??!0,z=(0,K.useComponentData)("ProductSummary")??{},[A]=r,I=(0,v.useMemo)(()=>{const c=N?.variants.find(y=>y.variant.sku===A?.sku),i=new $.default(A?.price?.amount||0).minus(c?.price||A?.price?.amount).toNumber();let m=new $.default(A?.price?.amount||0);_?.email&&(m=m.minus(f?.member||0));const h=m.minus(f?.coupon).minus(i).toNumber();return parseFloat(h.toFixed(2))},[A,N,_,f?.member,f?.coupon]),{bundleVariant:V,giftVariant:M,exchangeVariant:R}=fe()||{},[d,O]=(0,v.useState)();(0,v.useEffect)(()=>{O({bundle:o.bundle?.value?void 0:V,gift:o.gift?.value?void 0:M,exchange:o.exchange?.value?void 0:R})},[V,M,R,o]);const ne=(0,v.useMemo)(()=>{const c=[];return L&&L.forEach((i,m)=>{o[i]?.value&&c.push({type:i,key:`${i}-${m}`})}),c},[L,o]),le=(0,v.useMemo)(()=>{const c=p?.quantity||"",i=p?.color||p?.colour||p?.couleur||"";return`${c&&i?`${c} | ${i}`:c||i}`},[p?.quantity,p?.color,p?.colour,p?.couleur]),ie=(0,v.useMemo)(()=>{const{image_1920:c,image_1440:i,image_1024:m,image_768:h,image_390:y}=z?.thumbnail||{};return(z?.thumbnail?`${c} 1920, ${i} 1440, ${m} 1024, ${h} 768, ${y} 390`:n.image?.url)||n.image?.url},[z?.thumbnail,n.image?.url]);return n.availableForSale?(0,e.jsx)("div",{className:"ipc-product-summary laptop:px-16 laptop-md:px-0 laptop-md:mt-[96px] lg-desktop:mt-[128px] mt-16",children:(0,e.jsx)("div",{className:"laptop:rounded-2xl bg-[#F5F5F7]",children:(0,e.jsxs)(a.Grid,{className:"tablet:p-8 tablet:!pb-0 px-4 pt-6",children:[(0,e.jsxs)(a.GridItem,{className:"laptop:col-start-1 laptop:col-span-5 col-span-12 flex flex-col justify-between gap-4",children:[(0,e.jsx)(a.Heading,{className:"lg-desktop:text-[48px] laptop:text-[32px] laptop-md:text-[40px] mb-4 text-[24px] font-bold leading-none [&>span]:text-[#D1D1D1]",html:z?.readyWant?.replace?.("{title}",u?.title)}),(0,e.jsx)("div",{className:"",children:(0,e.jsx)(a.Picture,{source:ie,className:"lg-desktop:aspect-[644/320] laptop-md:aspect-[503/270] laptop:aspect-[332/190] tablet:aspect-[704/380] aspect-[358/190]",imgClassName:"object-cover h-full"})})]}),(0,e.jsxs)(a.GridItem,{className:"tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 col-span-12 mt-8 flex flex-col justify-between gap-6 pb-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,e.jsx)(Y.ExposureDetector,{exposureKey:"listing_selector",onExposure:()=>{(0,Z.gaTrack)({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:`Product Detail Page${n.sku}`,component_type:"image",component_name:"listing_selector",position:1}})},children:(0,e.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(a.Picture,{source:n.image?.url||u?.images?.[0]?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,e.jsxs)("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:u.title}),(0,e.jsx)(a.Text,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]",html:le})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:(0,g.formatPrice)({amount:I,currencyCode:n.price.currencyCode,locale:l})}),G&&I<n?.price?.amount&&(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl laptop:text-xl text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:n?.price?.amount,currencyCode:n.price.currencyCode,locale:l})})]})]})}),ne.map(({type:c,key:i})=>c==="gift"&&o?.gift?.value?(0,e.jsx)(Q,{giftOperation:m=>{C?.({...o,gift:{value:void 0,canOperate:!0}}),O?.({...d,gift:m}),D?.(h=>h.filter(y=>y!=="gift"))},status:!!o?.gift,gift:o?.gift?.value,canOperate:o?.gift?.canOperate},i):c==="bundle"&&o?.bundle?.value?(0,e.jsx)(J,{bundleOperation:m=>{C?.({...o,bundle:{value:void 0,canOperate:!0}}),O?.({...d,bundle:m}),D?.(h=>h.filter(y=>y!=="bundle"))},status:!!o?.bundle,bundleListItem:o?.bundle?.value,canOperate:o?.bundle?.canOperate},i):c==="exchange"&&o?.exchange?.value?(0,e.jsx)(H,{exchangeOperation:m=>{C?.({...o,exchange:{value:void 0,canOperate:!0}}),O?.({...d,exchange:m}),D?.(h=>h.filter(y=>y!=="exchange"))},status:!!o?.exchange,canOperate:o?.exchange?.canOperate,exchange:o?.exchange?.value},i):null)]}),(d?.bundle||d?.gift||d?.exchange)&&(0,e.jsxs)("div",{className:"laptop-md:mt-8 mt-6",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-[18px] text-sm font-bold",html:z?.recommendBuy}),(0,e.jsxs)("div",{className:"laptop-md:gap-4 mt-4 flex flex-col gap-6",children:[d?.exchange&&(0,e.jsx)(H,{exchangeOperation:c=>{C?.({...o,exchange:{value:c,canOperate:!0}}),O?.({...d,exchange:void 0}),D?.(i=>[...i,"exchange"])},canOperate:o?.exchange?.canOperate,status:!d?.exchange,exchange:d?.exchange}),d?.bundle&&(0,e.jsx)(J,{bundleOperation:c=>{P?.({...f,exchangePurchase:0}),C?.({...o,bundle:{value:c,canOperate:!0}}),O?.({...d,bundle:void 0}),D?.(i=>[...i,"bundle"])},canOperate:o?.bundle?.canOperate,status:!d?.bundle,bundleListItem:d?.bundle}),d?.gift&&(0,e.jsx)(Q,{giftOperation:c=>{C?.({...o,gift:{value:c,canOperate:!0}}),O?.({...d,gift:void 0}),D?.(i=>[...i,"gift"])},canOperate:o?.gift?.canOperate,status:!d?.gift,gift:d?.gift})]})]})]}),(0,e.jsxs)("div",{className:"text-right",children:[(0,e.jsx)(a.Text,{className:"laptop:text-xl laptop-md:text-2xl text-right font-bold",html:`${(0,U.replaceTemplate)(t?.totalPrice||"",{amount:(0,g.formatPrice)({amount:parseFloat(x.toFixed(2)),currencyCode:n.price.currencyCode,locale:l})})}`}),G&&F>0&&(0,e.jsx)(a.Text,{className:"laptop:text-xl laptop-md:text-2xl ml-1 text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:b,currencyCode:n.price.currencyCode,locale:l})}),(0,e.jsx)("div",{className:"mt-4 flex justify-end gap-3",children:(0,e.jsx)(ee.default,{mode:ae,availableForSale:n.availableForSale,addToCartText:t?.addToCart,buyNowText:t?.shopNow,addToCartLoading:j,buyNowLoading:te,addToCartClassName:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2",buyNowClassName:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2",onAddToCart:w,onBuyNow:E,onNotifyMeClick:oe,notifyMeText:t?.notifyMe,notifyMeClassName:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2"})})]})]})]})})}):null},fe=()=>{const{bundle:l,variant:t,checkedBundle:s,freeGift:u,checkedGift:n,exchangePurchase:x,checkedExchangePurchase:b}=(0,B.useBizProductContext)();let k,p,r;const{bundleList:F}=l||{},{giftList:w=[]}=u||{},{giftList:E=[]}=x||{},f=F?.filter(P=>P.variants.slice(1,P.variants.length).every(j=>j.variant.availableForSale))||[],[N]=f;k=s||N;const[o]=w?.filter(P=>P.availableForSale)??[];p=n||o;const[C]=E?.filter(P=>P.availableForSale)??[];return r=b||C,{bundleVariant:k,giftVariant:p,exchangeVariant:r}},J=({bundleOperation:l,bundleListItem:t,canOperate:s,status:u})=>{const{locale:n="us",copyWriting:x}=(0,S.useAiuiContext)(),{variant:b,setCheckedBundle:k}=(0,B.useBizProductContext)(),p=t?.variants.filter(r=>r.variant.sku!==b.sku);return(0,e.jsx)("div",{className:"",children:p?.map(r=>(0,e.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(a.Picture,{source:r?.variant?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,e.jsx)("div",{className:"tablet:max-w-none line-clamp-2 flex max-w-[178px] flex-col gap-[6px]",children:(0,e.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold",html:r.variant.product.title})})]}),(0,e.jsxs)("div",{className:"flex flex-col items-end justify-center gap-1",children:[!!t&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:(0,g.formatPrice)({amount:r?.price||0,locale:n,currencyCode:r.variant?.price?.currencyCode||""})}),r.price<r.variant.price.amount&&(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:r.variant.price.amount||0,locale:n,currencyCode:r.variant?.price?.currencyCode||""})})]}),s&&(0,e.jsx)(a.Button,{size:"icon",variant:"link",onClick:()=>{k?.(u?void 0:t),l?.(t)},className:"size-auto shrink-0 underline",children:u?x?.remove:x?.add})]})]},r.variant.id))})},Q=({giftOperation:l,gift:t,status:s,canOperate:u})=>{const{locale:n="us",copyWriting:x}=(0,S.useAiuiContext)(),{freeGift:b,setCheckedGift:k}=(0,B.useBizProductContext)(),{freeLabel:p}=b||{},{options:r}=t||{},F=(0,v.useMemo)(()=>{const w=r?.find(o=>o.name==="color"||o.name==="colour"||o.name==="couleur")||{},E=r?.find(o=>o.name==="quantity")||{},f=w?w.values?.[0]?.label:"",N=E?E.values?.[0]?.label:"";return`${f&&N?N+" | "+f:N||f} | ${p}`},[p,r]);return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(a.Picture,{source:t?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,e.jsxs)("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:t?.product?.title}),(0,e.jsx)(a.Text,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]",html:F})]})]}),(0,e.jsxs)("div",{className:"flex flex-col items-end justify-center gap-2",children:[!!t&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:p}),(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:t.price.amount,locale:n,currencyCode:t.price.currencyCode})})]}),u&&(0,e.jsx)(a.Button,{size:"icon",variant:"link",onClick:()=>{k?.(s?void 0:t),l(t)},className:"size-auto shrink-0 underline",children:s?x?.remove:x?.add})]})]})},H=({exchangeOperation:l,exchange:t,canOperate:s,status:u})=>{const{locale:n="us",copyWriting:x}=(0,S.useAiuiContext)(),{setCheckedExchangePurchase:b}=(0,B.useBizProductContext)();return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(a.Picture,{source:t?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,e.jsxs)("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:t?.product?.title}),(0,e.jsx)(a.Text,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]"})]})]}),(0,e.jsxs)("div",{className:"flex flex-col items-end justify-center gap-2",children:[!!t&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:(0,g.formatPrice)({amount:t.finalPrice?.amount||0,locale:n,currencyCode:t.price.currencyCode})}),(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:t.price?.amount||0,locale:n,currencyCode:t.price.currencyCode})})]}),s&&(0,e.jsx)(a.Button,{size:"icon",variant:"link",onClick:()=>{b?.(u?void 0:t),l(t)},className:"size-auto shrink-0 underline",children:u?x?.remove:x?.add})]})]})};var ge=(0,X.withLayout)(xe);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/biz-components/Listing/components/ProductCard/ProductSummary/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Text, Button, Grid, GridItem, Picture, Heading } from '../../../../../components/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useComponentData } from '../../../hooks/useComponentData.js'\nimport { useEffect, useMemo, useState } from 'react'\nimport { formatPrice } from '../../../utils/index.js'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport type { BundleListItem, ProductVariant, ProductPrice, ProductOption } from '../../../types/product'\nimport Decimal from 'decimal.js'\nimport { replaceTemplate } from '../../../utils/textFormat.js'\nimport { withLayout } from '../../../../../shared/Styles.js'\nimport { ExposureDetector } from '../../../../../components/index.js'\nimport { gaTrack } from '../../../../../shared/track.js'\nimport CartActionButtons from '../../CartActionButtons/index.js'\n\nconst ProductSummary = () => {\n const { locale = 'us', copyWriting, trackingData } = useAiuiContext()\n const {\n product,\n variant,\n finalPrice,\n comparePrice,\n coupon,\n selectedOptions,\n selectedVariants,\n totalSavings,\n onAddToCart,\n onBuyNow,\n savingDetail,\n checkedBundle,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n setSavingDetail,\n addToCartLoading,\n buyNowLoading,\n profile,\n addOrder,\n setAddOrder,\n } = useBizProductContext()\n\n /** \u662F\u5426\u663E\u793A\u539F\u4EF7\uFF08\u5212\u7EBF\u4EF7\uFF09\uFF0C\u9ED8\u8BA4\u663E\u793A */\n const showComparePrice = trackingData?.showComparePrice ?? true\n\n const productSummaryData = useComponentData('ProductSummary') ?? {}\n\n const [currentProductVariant] = selectedVariants\n\n const summaryFinalPrice = useMemo(() => {\n const currentBundleVariant = checkedBundle?.variants.find(v => v.variant.sku === currentProductVariant?.sku)\n const currentBundlePrice = new Decimal(currentProductVariant?.price?.amount || 0)\n .minus(currentBundleVariant?.price || currentProductVariant?.price?.amount)\n .toNumber()\n let currentProductPrice = new Decimal(currentProductVariant?.price?.amount || 0)\n if (profile?.email) {\n currentProductPrice = currentProductPrice.minus(savingDetail?.member || 0)\n }\n const finalPrice = currentProductPrice.minus(savingDetail?.coupon).minus(currentBundlePrice).toNumber()\n return parseFloat(finalPrice.toFixed(2))\n }, [currentProductVariant, checkedBundle, profile, savingDetail?.member, savingDetail?.coupon])\n\n const { bundleVariant, giftVariant, exchangeVariant } = useRecommendBuyProducts() || {}\n\n const [initialRecommendBuyProducts, setInitialRecommendBuyProducts] = useState<{\n bundle?: BundleListItem\n gift?: ProductVariant\n exchange?: ProductVariant\n }>()\n\n useEffect(() => {\n setInitialRecommendBuyProducts({\n bundle: joinedRecommendBuyProducts.bundle?.value ? undefined : bundleVariant,\n gift: joinedRecommendBuyProducts.gift?.value ? undefined : giftVariant,\n exchange: joinedRecommendBuyProducts.exchange?.value ? undefined : exchangeVariant,\n })\n }, [bundleVariant, giftVariant, exchangeVariant, joinedRecommendBuyProducts])\n\n // \u6839\u636E\u6DFB\u52A0\u987A\u5E8F\u751F\u6210\u5DF2\u6DFB\u52A0\u4EA7\u54C1\u7684\u5217\u8868\n const orderedJoinedProducts = useMemo(() => {\n const result: Array<{ type: 'bundle' | 'gift' | 'exchange'; key: string }> = []\n\n // \u6309\u7167\u6DFB\u52A0\u987A\u5E8F\u6DFB\u52A0\n if (addOrder) {\n addOrder.forEach((type, index) => {\n if (joinedRecommendBuyProducts[type]?.value) {\n result.push({ type, key: `${type}-${index}` })\n }\n })\n }\n\n return result\n }, [addOrder, joinedRecommendBuyProducts])\n\n const productOptionsText = useMemo(() => {\n const quantity = selectedOptions?.quantity || ''\n const color = selectedOptions?.color || selectedOptions?.colour || selectedOptions?.couleur || ''\n return `${quantity && color ? `${quantity} | ${color}` : quantity || color}`\n }, [selectedOptions?.quantity, selectedOptions?.color, selectedOptions?.colour, selectedOptions?.couleur])\n\n const variantImage = useMemo(() => {\n const { image_1920, image_1440, image_1024, image_768, image_390 } = productSummaryData?.thumbnail || {}\n const responsiveSource = productSummaryData?.thumbnail\n ? `${image_1920} 1920, ${image_1440} 1440, ${image_1024} 1024, ${image_768} 768, ${image_390} 390`\n : variant.image?.url\n return responsiveSource || variant.image?.url\n }, [productSummaryData?.thumbnail, variant.image?.url])\n\n const isAvailable = variant.availableForSale\n if (!isAvailable) return null\n\n return (\n <div className=\"ipc-product-summary laptop:px-16 laptop-md:px-0 laptop-md:mt-[96px] lg-desktop:mt-[128px] mt-16\">\n <div className=\"laptop:rounded-2xl bg-[#F5F5F7]\">\n <Grid className=\"tablet:p-8 tablet:!pb-0 px-4 pt-6\">\n <GridItem className=\"laptop:col-start-1 laptop:col-span-5 col-span-12 flex flex-col justify-between gap-4\">\n <Heading\n className=\"lg-desktop:text-[48px] laptop:text-[32px] laptop-md:text-[40px] mb-4 text-[24px] font-bold leading-none [&>span]:text-[#D1D1D1]\"\n html={productSummaryData?.readyWant?.replace?.('{title}', product?.title)}\n />\n <div className=\"\">\n <Picture\n source={variantImage}\n className=\"lg-desktop:aspect-[644/320] laptop-md:aspect-[503/270] laptop:aspect-[332/190] tablet:aspect-[704/380] aspect-[358/190]\"\n imgClassName=\"object-cover h-full\"\n />\n </div>\n </GridItem>\n <GridItem className=\"tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 col-span-12 mt-8 flex flex-col justify-between gap-6 pb-6\">\n <div>\n <div className=\"flex flex-col gap-4\">\n <ExposureDetector\n exposureKey=\"listing_selector\"\n onExposure={() => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_impression',\n event_parameters: {\n page_group: `Product Detail Page${variant.sku}`,\n component_type: 'image',\n component_name: 'listing_selector',\n position: 1,\n },\n })\n }}\n >\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={variant.image?.url || product?.images?.[0]?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={product.title}\n />\n <Text\n className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\"\n html={productOptionsText}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: summaryFinalPrice,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n {showComparePrice && summaryFinalPrice < variant?.price?.amount && (\n <Text\n className=\"laptop-md:text-2xl laptop:text-xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: variant?.price?.amount,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n </div>\n </div>\n </ExposureDetector>\n {/* \u6309\u7167\u6DFB\u52A0\u987A\u5E8F\u6E32\u67D3\u5DF2\u6DFB\u52A0\u7684\u4EA7\u54C1 */}\n {orderedJoinedProducts.map(({ type, key }) => {\n if (type === 'gift' && joinedRecommendBuyProducts?.gift?.value) {\n return (\n <ProductGiftSummary\n key={key}\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'gift'))\n }}\n status={!!joinedRecommendBuyProducts?.gift}\n gift={joinedRecommendBuyProducts?.gift?.value}\n canOperate={joinedRecommendBuyProducts?.gift?.canOperate}\n />\n )\n }\n if (type === 'bundle' && joinedRecommendBuyProducts?.bundle?.value) {\n return (\n <ProductBundleSummary\n key={key}\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'bundle'))\n }}\n status={!!joinedRecommendBuyProducts?.bundle}\n bundleListItem={joinedRecommendBuyProducts?.bundle?.value}\n canOperate={joinedRecommendBuyProducts?.bundle?.canOperate}\n />\n )\n }\n if (type === 'exchange' && joinedRecommendBuyProducts?.exchange?.value) {\n return (\n <ProductExchangeSummary\n key={key}\n exchangeOperation={exchange => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, exchange })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'exchange'))\n }}\n status={!!joinedRecommendBuyProducts?.exchange}\n canOperate={joinedRecommendBuyProducts?.exchange?.canOperate}\n exchange={joinedRecommendBuyProducts?.exchange?.value}\n />\n )\n }\n return null\n })}\n </div>\n {(initialRecommendBuyProducts?.bundle ||\n initialRecommendBuyProducts?.gift ||\n initialRecommendBuyProducts?.exchange) && (\n <div className=\"laptop-md:mt-8 mt-6\">\n <Text className=\"laptop-md:text-[18px] text-sm font-bold\" html={productSummaryData?.recommendBuy} />\n <div className=\"laptop-md:gap-4 mt-4 flex flex-col gap-6\">\n {initialRecommendBuyProducts?.exchange && (\n <ProductExchangeSummary\n exchangeOperation={exchange => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: exchange,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, exchange: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'exchange'])\n }}\n canOperate={joinedRecommendBuyProducts?.exchange?.canOperate}\n status={!initialRecommendBuyProducts?.exchange}\n exchange={initialRecommendBuyProducts?.exchange}\n />\n )}\n {initialRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setSavingDetail?.({ ...savingDetail, exchangePurchase: 0 })\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: bundle,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'bundle'])\n }}\n canOperate={joinedRecommendBuyProducts?.bundle?.canOperate}\n status={!initialRecommendBuyProducts?.bundle}\n bundleListItem={initialRecommendBuyProducts?.bundle}\n />\n )}\n {initialRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: gift,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'gift'])\n }}\n canOperate={joinedRecommendBuyProducts?.gift?.canOperate}\n status={!initialRecommendBuyProducts?.gift}\n gift={initialRecommendBuyProducts?.gift}\n />\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"text-right\">\n <Text\n className=\"laptop:text-xl laptop-md:text-2xl text-right font-bold\"\n html={`${replaceTemplate(copyWriting?.totalPrice || '', { amount: formatPrice({ amount: parseFloat(finalPrice.toFixed(2)), currencyCode: variant.price.currencyCode, locale }) })}`}\n />\n\n {showComparePrice && totalSavings > 0 && (\n <Text\n className=\"laptop:text-xl laptop-md:text-2xl ml-1 text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: comparePrice,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n <div className=\"mt-4 flex justify-end gap-3\">\n <CartActionButtons\n availableForSale={variant.availableForSale}\n addToCartText={copyWriting?.addToCart}\n buyNowText={copyWriting?.shopNow}\n addToCartLoading={addToCartLoading}\n buyNowLoading={buyNowLoading}\n addToCartClassName=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n buyNowClassName=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n onAddToCart={onAddToCart}\n onBuyNow={onBuyNow}\n />\n </div>\n </div>\n </GridItem>\n </Grid>\n </div>\n </div>\n )\n}\n\nconst useRecommendBuyProducts = () => {\n const { bundle, variant, checkedBundle, freeGift, checkedGift, exchangePurchase, checkedExchangePurchase } =\n useBizProductContext()\n let bundleVariant = undefined\n let giftVariant = undefined\n let exchangeVariant = undefined\n const { bundleList } = bundle || {}\n\n const { giftList = [] } = freeGift || {}\n const { giftList: exchangeList = [] } = exchangePurchase || {}\n\n const availableBundleList =\n bundleList?.filter(bundle =>\n bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n ) || []\n\n const [firstAvailableBundle] = availableBundleList\n bundleVariant = checkedBundle || firstAvailableBundle\n\n const [firstAvailableGift] = giftList?.filter(gift => gift.availableForSale) ?? []\n giftVariant = checkedGift || firstAvailableGift\n\n const [firstAvailableExchange] = exchangeList?.filter(exchange => exchange.availableForSale) ?? []\n exchangeVariant = checkedExchangePurchase || firstAvailableExchange\n\n return { bundleVariant, giftVariant, exchangeVariant }\n}\n\nconst ProductBundleSummary = ({\n bundleOperation,\n bundleListItem,\n canOperate,\n status,\n}: {\n bundleOperation: (bundle?: BundleListItem) => void\n bundleListItem?: BundleListItem\n canOperate?: boolean\n status?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { variant, setCheckedBundle } = useBizProductContext()\n const bundleVariants = bundleListItem?.variants.filter(v => v.variant.sku !== variant.sku)\n\n return (\n <div className=\"\">\n {bundleVariants?.map(bundleVariant => {\n return (\n <div className=\"flex items-center justify-between gap-4\" key={bundleVariant.variant.id}>\n <div className=\"flex items-center gap-4\">\n <Picture\n source={bundleVariant?.variant?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none line-clamp-2 flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold\"\n html={bundleVariant.variant.product.title}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-1\">\n {!!bundleListItem && (\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: bundleVariant?.price || 0,\n locale,\n currencyCode: bundleVariant.variant?.price?.currencyCode || '',\n })}\n />\n {bundleVariant.price < bundleVariant.variant.price.amount && (\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: bundleVariant.variant.price.amount || 0,\n locale,\n currencyCode: bundleVariant.variant?.price?.currencyCode || '',\n })}\n />\n )}\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedBundle?.(status ? undefined : bundleListItem)\n bundleOperation?.(bundleListItem)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n })}\n </div>\n )\n}\n\nconst ProductGiftSummary = ({\n giftOperation,\n gift,\n status,\n canOperate,\n}: {\n giftOperation: (gift?: ProductVariant) => void\n gift?: ProductVariant\n status?: boolean\n canOperate?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { freeGift, setCheckedGift } = useBizProductContext()\n const { freeLabel } = freeGift || {}\n const { options } = gift || {}\n\n const giftOptionsText = useMemo(() => {\n const giftColorOption = (options?.find(\n option => option.name === 'color' || option.name === 'colour' || option.name === 'couleur'\n ) || {}) as ProductOption\n const giftQuantityOption = options?.find(option => option.name === 'quantity') || ({} as ProductOption)\n const giftColorOptionText = giftColorOption ? giftColorOption.values?.[0]?.label : ''\n const giftQuantityOptionText = giftQuantityOption ? giftQuantityOption.values?.[0]?.label : ''\n return `${giftColorOptionText && giftQuantityOptionText ? giftQuantityOptionText + ' | ' + giftColorOptionText : giftQuantityOptionText || giftColorOptionText} | ${freeLabel}`\n }, [freeLabel, options])\n\n return (\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={gift?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={gift?.product?.title}\n />\n <Text\n className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\"\n html={giftOptionsText}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-2\">\n {!!gift && (\n <div className=\"flex items-center gap-1\">\n <Text className=\"laptop-md:text-2xl text-base font-bold\" html={freeLabel} />\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: gift.price.amount,\n locale,\n currencyCode: gift.price.currencyCode,\n })}\n />\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedGift?.(status ? undefined : gift)\n giftOperation(gift)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nconst ProductExchangeSummary = ({\n exchangeOperation,\n exchange,\n canOperate,\n status,\n}: {\n exchangeOperation: (exchange?: ProductVariant) => void\n exchange?: ProductVariant & { finalPrice?: ProductPrice }\n canOperate?: boolean\n status?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { setCheckedExchangePurchase } = useBizProductContext()\n\n return (\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={exchange?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={exchange?.product?.title}\n />\n <Text className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\" />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-2\">\n {!!exchange && (\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: exchange.finalPrice?.amount || 0,\n locale,\n currencyCode: exchange.price.currencyCode,\n })}\n />\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: exchange.price?.amount || 0,\n locale,\n currencyCode: exchange.price.currencyCode,\n })}\n />\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedExchangePurchase?.(status ? undefined : exchange)\n exchangeOperation(exchange)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nexport default withLayout(ProductSummary)\n"],
|
|
5
|
-
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,
|
|
6
|
-
"names": ["ProductSummary_exports", "__export", "ProductSummary_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_BizProductProvider", "import_useComponentData", "import_react", "import_utils", "import_AiuiProvider", "import_decimal", "import_textFormat", "import_Styles", "import_track", "import_CartActionButtons", "ProductSummary", "locale", "copyWriting", "trackingData", "product", "variant", "finalPrice", "comparePrice", "coupon", "selectedOptions", "selectedVariants", "totalSavings", "onAddToCart", "onBuyNow", "savingDetail", "checkedBundle", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "setSavingDetail", "addToCartLoading", "buyNowLoading", "profile", "addOrder", "setAddOrder", "showComparePrice", "productSummaryData", "currentProductVariant", "summaryFinalPrice", "currentBundleVariant", "v", "currentBundlePrice", "Decimal", "currentProductPrice", "bundleVariant", "giftVariant", "exchangeVariant", "useRecommendBuyProducts", "initialRecommendBuyProducts", "setInitialRecommendBuyProducts", "orderedJoinedProducts", "result", "type", "index", "productOptionsText", "quantity", "color", "variantImage", "image_1920", "image_1440", "image_1024", "image_768", "image_390", "key", "ProductGiftSummary", "gift", "prev", "t", "ProductBundleSummary", "bundle", "ProductExchangeSummary", "exchange", "CartActionButtons", "freeGift", "checkedGift", "exchangePurchase", "checkedExchangePurchase", "bundleList", "giftList", "exchangeList", "availableBundleList", "firstAvailableBundle", "firstAvailableGift", "firstAvailableExchange", "bundleOperation", "bundleListItem", "canOperate", "status", "setCheckedBundle", "bundleVariants", "giftOperation", "setCheckedGift", "freeLabel", "options", "giftOptionsText", "giftColorOption", "option", "giftQuantityOption", "giftColorOptionText", "giftQuantityOptionText", "exchangeOperation", "setCheckedExchangePurchase"]
|
|
4
|
+
"sourcesContent": ["import { Text, Button, Grid, GridItem, Picture, Heading } from '../../../../../components/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useComponentData } from '../../../hooks/useComponentData.js'\nimport { useEffect, useMemo, useState } from 'react'\nimport { formatPrice } from '../../../utils/index.js'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport type { BundleListItem, ProductVariant, ProductPrice, ProductOption } from '../../../types/product'\nimport Decimal from 'decimal.js'\nimport { replaceTemplate } from '../../../utils/textFormat.js'\nimport { withLayout } from '../../../../../shared/Styles.js'\nimport { ExposureDetector } from '../../../../../components/index.js'\nimport { gaTrack } from '../../../../../shared/track.js'\nimport CartActionButtons from '../../CartActionButtons/index.js'\n\nconst ProductSummary = () => {\n const { locale = 'us', copyWriting, trackingData } = useAiuiContext()\n const {\n product,\n variant,\n finalPrice,\n comparePrice,\n coupon,\n selectedOptions,\n selectedVariants,\n totalSavings,\n onAddToCart,\n onBuyNow,\n savingDetail,\n checkedBundle,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n setSavingDetail,\n addToCartLoading,\n buyNowLoading,\n notifyMeMode,\n onNotifyMeClick,\n profile,\n addOrder,\n setAddOrder,\n } = useBizProductContext()\n\n /** \u662F\u5426\u663E\u793A\u539F\u4EF7\uFF08\u5212\u7EBF\u4EF7\uFF09\uFF0C\u9ED8\u8BA4\u663E\u793A */\n const showComparePrice = trackingData?.showComparePrice ?? true\n\n const productSummaryData = useComponentData('ProductSummary') ?? {}\n\n const [currentProductVariant] = selectedVariants\n\n const summaryFinalPrice = useMemo(() => {\n const currentBundleVariant = checkedBundle?.variants.find(v => v.variant.sku === currentProductVariant?.sku)\n const currentBundlePrice = new Decimal(currentProductVariant?.price?.amount || 0)\n .minus(currentBundleVariant?.price || currentProductVariant?.price?.amount)\n .toNumber()\n let currentProductPrice = new Decimal(currentProductVariant?.price?.amount || 0)\n if (profile?.email) {\n currentProductPrice = currentProductPrice.minus(savingDetail?.member || 0)\n }\n const finalPrice = currentProductPrice.minus(savingDetail?.coupon).minus(currentBundlePrice).toNumber()\n return parseFloat(finalPrice.toFixed(2))\n }, [currentProductVariant, checkedBundle, profile, savingDetail?.member, savingDetail?.coupon])\n\n const { bundleVariant, giftVariant, exchangeVariant } = useRecommendBuyProducts() || {}\n\n const [initialRecommendBuyProducts, setInitialRecommendBuyProducts] = useState<{\n bundle?: BundleListItem\n gift?: ProductVariant\n exchange?: ProductVariant\n }>()\n\n useEffect(() => {\n setInitialRecommendBuyProducts({\n bundle: joinedRecommendBuyProducts.bundle?.value ? undefined : bundleVariant,\n gift: joinedRecommendBuyProducts.gift?.value ? undefined : giftVariant,\n exchange: joinedRecommendBuyProducts.exchange?.value ? undefined : exchangeVariant,\n })\n }, [bundleVariant, giftVariant, exchangeVariant, joinedRecommendBuyProducts])\n\n // \u6839\u636E\u6DFB\u52A0\u987A\u5E8F\u751F\u6210\u5DF2\u6DFB\u52A0\u4EA7\u54C1\u7684\u5217\u8868\n const orderedJoinedProducts = useMemo(() => {\n const result: Array<{ type: 'bundle' | 'gift' | 'exchange'; key: string }> = []\n\n // \u6309\u7167\u6DFB\u52A0\u987A\u5E8F\u6DFB\u52A0\n if (addOrder) {\n addOrder.forEach((type, index) => {\n if (joinedRecommendBuyProducts[type]?.value) {\n result.push({ type, key: `${type}-${index}` })\n }\n })\n }\n\n return result\n }, [addOrder, joinedRecommendBuyProducts])\n\n const productOptionsText = useMemo(() => {\n const quantity = selectedOptions?.quantity || ''\n const color = selectedOptions?.color || selectedOptions?.colour || selectedOptions?.couleur || ''\n return `${quantity && color ? `${quantity} | ${color}` : quantity || color}`\n }, [selectedOptions?.quantity, selectedOptions?.color, selectedOptions?.colour, selectedOptions?.couleur])\n\n const variantImage = useMemo(() => {\n const { image_1920, image_1440, image_1024, image_768, image_390 } = productSummaryData?.thumbnail || {}\n const responsiveSource = productSummaryData?.thumbnail\n ? `${image_1920} 1920, ${image_1440} 1440, ${image_1024} 1024, ${image_768} 768, ${image_390} 390`\n : variant.image?.url\n return responsiveSource || variant.image?.url\n }, [productSummaryData?.thumbnail, variant.image?.url])\n\n const isAvailable = variant.availableForSale\n if (!isAvailable) return null\n\n return (\n <div className=\"ipc-product-summary laptop:px-16 laptop-md:px-0 laptop-md:mt-[96px] lg-desktop:mt-[128px] mt-16\">\n <div className=\"laptop:rounded-2xl bg-[#F5F5F7]\">\n <Grid className=\"tablet:p-8 tablet:!pb-0 px-4 pt-6\">\n <GridItem className=\"laptop:col-start-1 laptop:col-span-5 col-span-12 flex flex-col justify-between gap-4\">\n <Heading\n className=\"lg-desktop:text-[48px] laptop:text-[32px] laptop-md:text-[40px] mb-4 text-[24px] font-bold leading-none [&>span]:text-[#D1D1D1]\"\n html={productSummaryData?.readyWant?.replace?.('{title}', product?.title)}\n />\n <div className=\"\">\n <Picture\n source={variantImage}\n className=\"lg-desktop:aspect-[644/320] laptop-md:aspect-[503/270] laptop:aspect-[332/190] tablet:aspect-[704/380] aspect-[358/190]\"\n imgClassName=\"object-cover h-full\"\n />\n </div>\n </GridItem>\n <GridItem className=\"tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 col-span-12 mt-8 flex flex-col justify-between gap-6 pb-6\">\n <div>\n <div className=\"flex flex-col gap-4\">\n <ExposureDetector\n exposureKey=\"listing_selector\"\n onExposure={() => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_impression',\n event_parameters: {\n page_group: `Product Detail Page${variant.sku}`,\n component_type: 'image',\n component_name: 'listing_selector',\n position: 1,\n },\n })\n }}\n >\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={variant.image?.url || product?.images?.[0]?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={product.title}\n />\n <Text\n className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\"\n html={productOptionsText}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: summaryFinalPrice,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n {showComparePrice && summaryFinalPrice < variant?.price?.amount && (\n <Text\n className=\"laptop-md:text-2xl laptop:text-xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: variant?.price?.amount,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n </div>\n </div>\n </ExposureDetector>\n {/* \u6309\u7167\u6DFB\u52A0\u987A\u5E8F\u6E32\u67D3\u5DF2\u6DFB\u52A0\u7684\u4EA7\u54C1 */}\n {orderedJoinedProducts.map(({ type, key }) => {\n if (type === 'gift' && joinedRecommendBuyProducts?.gift?.value) {\n return (\n <ProductGiftSummary\n key={key}\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'gift'))\n }}\n status={!!joinedRecommendBuyProducts?.gift}\n gift={joinedRecommendBuyProducts?.gift?.value}\n canOperate={joinedRecommendBuyProducts?.gift?.canOperate}\n />\n )\n }\n if (type === 'bundle' && joinedRecommendBuyProducts?.bundle?.value) {\n return (\n <ProductBundleSummary\n key={key}\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'bundle'))\n }}\n status={!!joinedRecommendBuyProducts?.bundle}\n bundleListItem={joinedRecommendBuyProducts?.bundle?.value}\n canOperate={joinedRecommendBuyProducts?.bundle?.canOperate}\n />\n )\n }\n if (type === 'exchange' && joinedRecommendBuyProducts?.exchange?.value) {\n return (\n <ProductExchangeSummary\n key={key}\n exchangeOperation={exchange => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, exchange })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'exchange'))\n }}\n status={!!joinedRecommendBuyProducts?.exchange}\n canOperate={joinedRecommendBuyProducts?.exchange?.canOperate}\n exchange={joinedRecommendBuyProducts?.exchange?.value}\n />\n )\n }\n return null\n })}\n </div>\n {(initialRecommendBuyProducts?.bundle ||\n initialRecommendBuyProducts?.gift ||\n initialRecommendBuyProducts?.exchange) && (\n <div className=\"laptop-md:mt-8 mt-6\">\n <Text className=\"laptop-md:text-[18px] text-sm font-bold\" html={productSummaryData?.recommendBuy} />\n <div className=\"laptop-md:gap-4 mt-4 flex flex-col gap-6\">\n {initialRecommendBuyProducts?.exchange && (\n <ProductExchangeSummary\n exchangeOperation={exchange => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: exchange,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, exchange: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'exchange'])\n }}\n canOperate={joinedRecommendBuyProducts?.exchange?.canOperate}\n status={!initialRecommendBuyProducts?.exchange}\n exchange={initialRecommendBuyProducts?.exchange}\n />\n )}\n {initialRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setSavingDetail?.({ ...savingDetail, exchangePurchase: 0 })\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: bundle,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'bundle'])\n }}\n canOperate={joinedRecommendBuyProducts?.bundle?.canOperate}\n status={!initialRecommendBuyProducts?.bundle}\n bundleListItem={initialRecommendBuyProducts?.bundle}\n />\n )}\n {initialRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: gift,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'gift'])\n }}\n canOperate={joinedRecommendBuyProducts?.gift?.canOperate}\n status={!initialRecommendBuyProducts?.gift}\n gift={initialRecommendBuyProducts?.gift}\n />\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"text-right\">\n <Text\n className=\"laptop:text-xl laptop-md:text-2xl text-right font-bold\"\n html={`${replaceTemplate(copyWriting?.totalPrice || '', { amount: formatPrice({ amount: parseFloat(finalPrice.toFixed(2)), currencyCode: variant.price.currencyCode, locale }) })}`}\n />\n\n {showComparePrice && totalSavings > 0 && (\n <Text\n className=\"laptop:text-xl laptop-md:text-2xl ml-1 text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: comparePrice,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n <div className=\"mt-4 flex justify-end gap-3\">\n <CartActionButtons\n mode={notifyMeMode}\n availableForSale={variant.availableForSale}\n addToCartText={copyWriting?.addToCart}\n buyNowText={copyWriting?.shopNow}\n addToCartLoading={addToCartLoading}\n buyNowLoading={buyNowLoading}\n addToCartClassName=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n buyNowClassName=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n onAddToCart={onAddToCart}\n onBuyNow={onBuyNow}\n onNotifyMeClick={onNotifyMeClick}\n notifyMeText={copyWriting?.notifyMe}\n notifyMeClassName=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n />\n </div>\n </div>\n </GridItem>\n </Grid>\n </div>\n </div>\n )\n}\n\nconst useRecommendBuyProducts = () => {\n const { bundle, variant, checkedBundle, freeGift, checkedGift, exchangePurchase, checkedExchangePurchase } =\n useBizProductContext()\n let bundleVariant = undefined\n let giftVariant = undefined\n let exchangeVariant = undefined\n const { bundleList } = bundle || {}\n\n const { giftList = [] } = freeGift || {}\n const { giftList: exchangeList = [] } = exchangePurchase || {}\n\n const availableBundleList =\n bundleList?.filter(bundle =>\n bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n ) || []\n\n const [firstAvailableBundle] = availableBundleList\n bundleVariant = checkedBundle || firstAvailableBundle\n\n const [firstAvailableGift] = giftList?.filter(gift => gift.availableForSale) ?? []\n giftVariant = checkedGift || firstAvailableGift\n\n const [firstAvailableExchange] = exchangeList?.filter(exchange => exchange.availableForSale) ?? []\n exchangeVariant = checkedExchangePurchase || firstAvailableExchange\n\n return { bundleVariant, giftVariant, exchangeVariant }\n}\n\nconst ProductBundleSummary = ({\n bundleOperation,\n bundleListItem,\n canOperate,\n status,\n}: {\n bundleOperation: (bundle?: BundleListItem) => void\n bundleListItem?: BundleListItem\n canOperate?: boolean\n status?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { variant, setCheckedBundle } = useBizProductContext()\n const bundleVariants = bundleListItem?.variants.filter(v => v.variant.sku !== variant.sku)\n\n return (\n <div className=\"\">\n {bundleVariants?.map(bundleVariant => {\n return (\n <div className=\"flex items-center justify-between gap-4\" key={bundleVariant.variant.id}>\n <div className=\"flex items-center gap-4\">\n <Picture\n source={bundleVariant?.variant?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none line-clamp-2 flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold\"\n html={bundleVariant.variant.product.title}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-1\">\n {!!bundleListItem && (\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: bundleVariant?.price || 0,\n locale,\n currencyCode: bundleVariant.variant?.price?.currencyCode || '',\n })}\n />\n {bundleVariant.price < bundleVariant.variant.price.amount && (\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: bundleVariant.variant.price.amount || 0,\n locale,\n currencyCode: bundleVariant.variant?.price?.currencyCode || '',\n })}\n />\n )}\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedBundle?.(status ? undefined : bundleListItem)\n bundleOperation?.(bundleListItem)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n })}\n </div>\n )\n}\n\nconst ProductGiftSummary = ({\n giftOperation,\n gift,\n status,\n canOperate,\n}: {\n giftOperation: (gift?: ProductVariant) => void\n gift?: ProductVariant\n status?: boolean\n canOperate?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { freeGift, setCheckedGift } = useBizProductContext()\n const { freeLabel } = freeGift || {}\n const { options } = gift || {}\n\n const giftOptionsText = useMemo(() => {\n const giftColorOption = (options?.find(\n option => option.name === 'color' || option.name === 'colour' || option.name === 'couleur'\n ) || {}) as ProductOption\n const giftQuantityOption = options?.find(option => option.name === 'quantity') || ({} as ProductOption)\n const giftColorOptionText = giftColorOption ? giftColorOption.values?.[0]?.label : ''\n const giftQuantityOptionText = giftQuantityOption ? giftQuantityOption.values?.[0]?.label : ''\n return `${giftColorOptionText && giftQuantityOptionText ? giftQuantityOptionText + ' | ' + giftColorOptionText : giftQuantityOptionText || giftColorOptionText} | ${freeLabel}`\n }, [freeLabel, options])\n\n return (\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={gift?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={gift?.product?.title}\n />\n <Text\n className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\"\n html={giftOptionsText}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-2\">\n {!!gift && (\n <div className=\"flex items-center gap-1\">\n <Text className=\"laptop-md:text-2xl text-base font-bold\" html={freeLabel} />\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: gift.price.amount,\n locale,\n currencyCode: gift.price.currencyCode,\n })}\n />\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedGift?.(status ? undefined : gift)\n giftOperation(gift)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nconst ProductExchangeSummary = ({\n exchangeOperation,\n exchange,\n canOperate,\n status,\n}: {\n exchangeOperation: (exchange?: ProductVariant) => void\n exchange?: ProductVariant & { finalPrice?: ProductPrice }\n canOperate?: boolean\n status?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { setCheckedExchangePurchase } = useBizProductContext()\n\n return (\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={exchange?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={exchange?.product?.title}\n />\n <Text className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\" />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-2\">\n {!!exchange && (\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: exchange.finalPrice?.amount || 0,\n locale,\n currencyCode: exchange.price.currencyCode,\n })}\n />\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: exchange.price?.amount || 0,\n locale,\n currencyCode: exchange.price.currencyCode,\n })}\n />\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedExchangePurchase?.(status ? undefined : exchange)\n exchangeOperation(exchange)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nexport default withLayout(ProductSummary)\n"],
|
|
5
|
+
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAkHU,IAAAI,EAAA,6BAlHVC,EAA+D,8CAC/DC,EAAqC,0CACrCC,EAAiC,8CACjCC,EAA6C,iBAC7CC,EAA4B,mCAC5BC,EAA+B,6CAE/BC,EAAoB,yBACpBC,EAAgC,wCAChCC,EAA2B,2CAC3BR,EAAiC,8CACjCS,EAAwB,0CACxBC,GAA8B,+CAE9B,MAAMC,GAAiB,IAAM,CAC3B,KAAM,CAAE,OAAAC,EAAS,KAAM,YAAAC,EAAa,aAAAC,CAAa,KAAI,kBAAe,EAC9D,CACJ,QAAAC,EACA,QAAAC,EACA,WAAAC,EACA,aAAAC,EACA,OAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,aAAAC,EACA,YAAAC,EACA,SAAAC,EACA,aAAAC,EACA,cAAAC,EACA,2BAAAC,EACA,8BAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,cAAAC,GACA,aAAAC,GACA,gBAAAC,GACA,QAA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OAAA7E,EAAS,KAAM,YAAAC,CAAY,KAAI,kBAAe,EAChD,CAAE,2BAAA0F,CAA2B,KAAI,wBAAqB,EAE5D,SACE,QAAC,OAAI,UAAU,0CACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,WACC,OAAQ9B,GAAU,OAAO,IACzB,UAAU,wHACZ,KACA,QAAC,OAAI,UAAU,0DACb,oBAAC,QACC,UAAU,kFACV,KAAMA,GAAU,SAAS,MAC3B,KACA,OAAC,QAAK,UAAU,gFAAgF,GAClG,GACF,KACA,QAAC,OAAI,UAAU,+CACZ,WAAC,CAACA,MACD,QAAC,OAAI,UAAU,0BACb,oBAAC,QACC,UAAU,yCACV,QAAM,eAAY,CAChB,OAAQA,EAAS,YAAY,QAAU,EACvC,OAAA7D,EACA,aAAc6D,EAAS,MAAM,YAC/B,CAAC,EACH,KACA,OAAC,QACC,UAAU,qEACV,QAAM,eAAY,CAChB,OAAQA,EAAS,OAAO,QAAU,EAClC,OAAA7D,EACA,aAAc6D,EAAS,MAAM,YAC/B,CAAC,EACH,GACF,EAEDe,MACC,OAAC,UACC,KAAK,OACL,QAAQ,OACR,QAAS,IAAM,CACbe,IAA6Bd,EAAS,OAAYhB,CAAQ,EAC1D6B,EAAkB7B,CAAQ,CAC5B,EACA,UAAU,+BAET,SAAAgB,EAAS5E,GAAa,OAASA,GAAa,IAC/C,GAEJ,GACF,CAEJ,EAEA,IAAOhB,MAAQ,cAAWc,EAAc",
|
|
6
|
+
"names": ["ProductSummary_exports", "__export", "ProductSummary_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_BizProductProvider", "import_useComponentData", "import_react", "import_utils", "import_AiuiProvider", "import_decimal", "import_textFormat", "import_Styles", "import_track", "import_CartActionButtons", "ProductSummary", "locale", "copyWriting", "trackingData", "product", "variant", "finalPrice", "comparePrice", "coupon", "selectedOptions", "selectedVariants", "totalSavings", "onAddToCart", "onBuyNow", "savingDetail", "checkedBundle", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "setSavingDetail", "addToCartLoading", "buyNowLoading", "notifyMeMode", "onNotifyMeClick", "profile", "addOrder", "setAddOrder", "showComparePrice", "productSummaryData", "currentProductVariant", "summaryFinalPrice", "currentBundleVariant", "v", "currentBundlePrice", "Decimal", "currentProductPrice", "bundleVariant", "giftVariant", "exchangeVariant", "useRecommendBuyProducts", "initialRecommendBuyProducts", "setInitialRecommendBuyProducts", "orderedJoinedProducts", "result", "type", "index", "productOptionsText", "quantity", "color", "variantImage", "image_1920", "image_1440", "image_1024", "image_768", "image_390", "key", "ProductGiftSummary", "gift", "prev", "t", "ProductBundleSummary", "bundle", "ProductExchangeSummary", "exchange", "CartActionButtons", "freeGift", "checkedGift", "exchangePurchase", "checkedExchangePurchase", "bundleList", "giftList", "exchangeList", "availableBundleList", "firstAvailableBundle", "firstAvailableGift", "firstAvailableExchange", "bundleOperation", "bundleListItem", "canOperate", "status", "setCheckedBundle", "bundleVariants", "giftOperation", "setCheckedGift", "freeLabel", "options", "giftOptionsText", "giftColorOption", "option", "giftQuantityOption", "giftColorOptionText", "giftQuantityOptionText", "exchangeOperation", "setCheckedExchangePurchase"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var j=Object.create;var u=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var $=(t,e)=>{for(var o in e)u(t,o,{get:e[o],enumerable:!0})},h=(t,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of z(e))!W.call(t,n)&&n!==o&&u(t,n,{get:()=>e[n],enumerable:!(c=q(e,n))||c.enumerable});return t};var G=(t,e,o)=>(o=t!=null?j(U(t)):{},h(e||!t||!t.__esModule?u(o,"default",{value:t,enumerable:!0}):o,t)),H=t=>h(u({},"__esModule",{value:!0}),t);var K={};$(K,{default:()=>J});module.exports=H(K);var a=require("react/jsx-runtime"),r=require("../../../../../components/index.js"),w=require("../../../../AiuiProvider/index.js"),S=require("../../../BizProductProvider.js"),b=require("react"),i=require("../../../utils/index.js"),f=require("../../../utils/textFormat.js"),T=require("../../../hooks/useBenefits.js"),k=G(require("../../CartActionButtons/index.js"));const I=({totalSavingsSlot:t}={})=>{const{copyWriting:e,locale:o="us",trackingData:c,currencyCode:n}=(0,w.useAiuiContext)(),{variant:l,finalPrice:A,totalSavings:d,isLogin:p,comparePrice:M,onAddToCart:P,onBuyNow:D,savingDetail:x,addToCartLoading:B,buyNowLoading:F,notifyMeMode:L,onNotifyMeClick:E,discount:Q,memberFunctionResult:g}=(0,S.useBizProductContext)(),R=(0,T.useBenefits)({variant:l}),{commonCoupon:m,memberDiscount:s}=R,O=c?.showComparePrice??!0,_=(0,b.useMemo)(()=>(0,f.replaceTemplate)(e?.totalSavings||"",{amount:(0,i.formatPrice)({amount:d,currencyCode:l.price.currencyCode,locale:n==="CAD"?"us":o||"us"})}),[e?.totalSavings,d,l.price.currencyCode,o]),C=(0,b.useMemo)(()=>{if(!e?.unlockedSaving)return;const y=m?.enable?Number(m?.config?.fixed_value||0):0,v=s?.enable?s.config?.amount??0:0,N=Math.round((g?.withoutCouponMaxMemberTotalSave?Math.max(v,y):v+y)*100)/100;if(!(N<=0))return(0,f.replaceTemplate)(e.unlockedSaving,{amount:(0,i.formatPrice)({amount:N,currencyCode:l.price.currencyCode,locale:n==="CAD"?"us":o||"us"})})},[e?.unlockedSaving,m?.enable,m?.config?.fixed_value,s?.enable,s?.config?.amount,g,l.price.currencyCode,o]);return(0,a.jsxs)(r.Container,{childClassName:"tablet:flex tablet:justify-end tablet:gap-8 laptop-md:px-0 desktop:px-0 tablet:items-center tablet:gap-4",className:"laptop-md:border-none laptop-md:py-0 border-t border-[#E4E5E6] bg-white py-3",children:[l.availableForSale?(0,a.jsxs)("div",{className:"laptop-md:items-end flex flex-col justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(r.Text,{className:"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2]",html:(0,i.formatPrice)({amount:parseFloat(A.toFixed(2)),currencyCode:l.price.currencyCode,locale:n==="CAD"?"us":o||"us"})}),O&&(d>0||x?.member>0&&p)&&(0,a.jsx)(r.Text,{className:"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2] text-[#4A4C56] line-through",html:(0,i.formatPrice)({amount:M,currencyCode:l.price.currencyCode,locale:n==="CAD"?"us":o||"us"})}),x?.member>0&&p&&(0,a.jsx)(r.Text,{className:"bg-brand-0 rounded px-1 py-[2px] text-sm font-bold text-white",html:e?.memberPrice||"Member Price"})]}),t||(d>0||x?.member>0&&p?(0,a.jsx)(r.Text,{className:"text-brand-0 tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]",html:`${_}`}):C?(0,a.jsx)(r.Text,{className:"text-info-quaternary tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]",html:C}):null)]}):(0,a.jsx)(r.Text,{className:"text-[20px] font-bold text-[#999999]",html:e?.soldOut??"Sold Out"}),(0,a.jsx)("div",{className:"tablet:mt-0 mt-2 flex items-center gap-2",children:(0,a.jsx)(k.default,{mode:L,availableForSale:l.availableForSale,addToCartText:e?.addToCart??"Add to Cart",buyNowText:e?.buyNow??"Buy Now",addToCartLoading:B,buyNowLoading:F,onAddToCart:P,onBuyNow:D,onNotifyMeClick:E,notifyMeText:e?.notifyMe,notifyMeClassName:"w-full"})})]})};var J=I;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/biz-components/Listing/components/PurchaseBar/ProductActions/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Text, Container } from '../../../../../components/index.js'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useMemo, type ReactNode } from 'react'\nimport { formatPrice } from '../../../utils/index.js'\nimport { replaceTemplate } from '../../../utils/textFormat.js'\nimport { useBenefits } from '../../../hooks/useBenefits.js'\nimport CartActionButtons from '../../CartActionButtons/index.js'\n\nexport interface ProductActionsProps {\n /** \u81EA\u5B9A\u4E49\u603B\u8282\u7701\u7EC4\u4EF6\uFF0C\u4F20\u5165\u65F6\u4F1A\u66FF\u4EE3\u9ED8\u8BA4\u7684 totalSavings \u663E\u793A */\n totalSavingsSlot?: ReactNode\n}\n\nconst ProductActions = ({ totalSavingsSlot }: ProductActionsProps = {}) => {\n const { copyWriting, locale = 'us', trackingData, currencyCode } = useAiuiContext()\n const {\n variant,\n finalPrice,\n totalSavings,\n isLogin,\n comparePrice,\n onAddToCart,\n onBuyNow,\n savingDetail,\n addToCartLoading,\n buyNowLoading,\n discount,\n memberFunctionResult,\n } = useBizProductContext()\n const benefits = useBenefits({ variant })\n const { commonCoupon, memberDiscount } = benefits\n\n /** \u662F\u5426\u663E\u793A\u539F\u4EF7\uFF08\u5212\u7EBF\u4EF7\uFF09\uFF0C\u9ED8\u8BA4\u663E\u793A */\n const showComparePrice = trackingData?.showComparePrice ?? true\n\n const totalSavingsText = useMemo(() => {\n return replaceTemplate(copyWriting?.totalSavings || '', {\n amount: formatPrice({\n amount: totalSavings,\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n }),\n })\n }, [copyWriting?.totalSavings, totalSavings, variant.price.currencyCode, locale])\n\n const unlockedSavingText = useMemo(() => {\n if (!copyWriting?.unlockedSaving) return undefined\n\n const couponSaving = commonCoupon?.enable ? Number(commonCoupon?.config?.fixed_value || 0) : 0\n const memberSaving = memberDiscount?.enable ? (memberDiscount.config?.amount ?? 0) : 0\n\n // \u4E0D\u53EF\u53E0\u52A0\u65F6\u53D6\u4F1A\u5458\u4EF7\u4E0E code \u6298\u6263\u7684\u6700\u5927\u503C\uFF0C\u53EF\u53E0\u52A0\u65F6\u53D6\u4E8C\u8005\u4E4B\u548C\n const totalUnlocked = Math.round((\n memberFunctionResult?.withoutCouponMaxMemberTotalSave\n ? Math.max(memberSaving, couponSaving)\n : memberSaving + couponSaving\n ) * 100) / 100\n\n if (totalUnlocked <= 0) return undefined\n\n return replaceTemplate(copyWriting.unlockedSaving, {\n amount: formatPrice({\n amount: totalUnlocked,\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n }),\n })\n }, [\n copyWriting?.unlockedSaving,\n commonCoupon?.enable,\n commonCoupon?.config?.fixed_value,\n memberDiscount?.enable,\n memberDiscount?.config?.amount,\n memberFunctionResult,\n variant.price.currencyCode,\n locale,\n ])\n\n return (\n <Container\n childClassName=\"tablet:flex tablet:justify-end tablet:gap-8 laptop-md:px-0 desktop:px-0 tablet:items-center tablet:gap-4\"\n className=\"laptop-md:border-none laptop-md:py-0 border-t border-[#E4E5E6] bg-white py-3\"\n >\n {variant.availableForSale ? (\n <div className=\"laptop-md:items-end flex flex-col justify-between\">\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2]\"\n html={formatPrice({\n amount: parseFloat(finalPrice.toFixed(2)),\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n })}\n />\n {showComparePrice && (totalSavings > 0 || (savingDetail?.member > 0 && isLogin)) && (\n <Text\n className=\"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2] text-[#4A4C56] line-through\"\n html={formatPrice({\n amount: comparePrice,\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n })}\n />\n )}\n {savingDetail?.member > 0 && isLogin && (\n <Text\n className=\"bg-brand-0 rounded px-1 py-[2px] text-sm font-bold text-white\"\n html={copyWriting?.memberPrice || 'Member Price'}\n />\n )}\n </div>\n {totalSavingsSlot ||\n (totalSavings > 0 || (savingDetail?.member > 0 && isLogin) ? (\n <Text\n className=\"text-brand-0 tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]\"\n html={`${totalSavingsText}`}\n />\n ) : unlockedSavingText ? (\n <Text\n className=\"text-info-quaternary tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]\"\n html={unlockedSavingText}\n />\n ) : null)}\n </div>\n ) : (\n <Text className=\"text-[20px] font-bold text-[#999999]\" html={copyWriting?.soldOut ?? 'Sold Out'} />\n )}\n <div className=\"tablet:mt-0 mt-2 flex items-center gap-2\">\n <CartActionButtons\n availableForSale={variant.availableForSale}\n addToCartText={copyWriting?.addToCart ?? 'Add to Cart'}\n buyNowText={copyWriting?.buyNow ?? 'Buy Now'}\n addToCartLoading={addToCartLoading}\n buyNowLoading={buyNowLoading}\n onAddToCart={onAddToCart}\n onBuyNow={onBuyNow}\n />\n </div>\n </Container>\n )\n}\n\nexport default ProductActions\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["ProductActions_exports", "__export", "ProductActions_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_AiuiProvider", "import_BizProductProvider", "import_react", "import_utils", "import_textFormat", "import_useBenefits", "import_CartActionButtons", "ProductActions", "totalSavingsSlot", "copyWriting", "locale", "trackingData", "currencyCode", "variant", "finalPrice", "totalSavings", "isLogin", "comparePrice", "onAddToCart", "onBuyNow", "savingDetail", "addToCartLoading", "buyNowLoading", "discount", "memberFunctionResult", "benefits", "commonCoupon", "memberDiscount", "showComparePrice", "totalSavingsText", "unlockedSavingText", "couponSaving", "memberSaving", "totalUnlocked", "CartActionButtons"]
|
|
4
|
+
"sourcesContent": ["import { Text, Container } from '../../../../../components/index.js'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useMemo, type ReactNode } from 'react'\nimport { formatPrice } from '../../../utils/index.js'\nimport { replaceTemplate } from '../../../utils/textFormat.js'\nimport { useBenefits } from '../../../hooks/useBenefits.js'\nimport CartActionButtons from '../../CartActionButtons/index.js'\n\nexport interface ProductActionsProps {\n /** \u81EA\u5B9A\u4E49\u603B\u8282\u7701\u7EC4\u4EF6\uFF0C\u4F20\u5165\u65F6\u4F1A\u66FF\u4EE3\u9ED8\u8BA4\u7684 totalSavings \u663E\u793A */\n totalSavingsSlot?: ReactNode\n}\n\nconst ProductActions = ({ totalSavingsSlot }: ProductActionsProps = {}) => {\n const { copyWriting, locale = 'us', trackingData, currencyCode } = useAiuiContext()\n const {\n variant,\n finalPrice,\n totalSavings,\n isLogin,\n comparePrice,\n onAddToCart,\n onBuyNow,\n savingDetail,\n addToCartLoading,\n buyNowLoading,\n notifyMeMode,\n onNotifyMeClick,\n discount,\n memberFunctionResult,\n } = useBizProductContext()\n const benefits = useBenefits({ variant })\n const { commonCoupon, memberDiscount } = benefits\n\n /** \u662F\u5426\u663E\u793A\u539F\u4EF7\uFF08\u5212\u7EBF\u4EF7\uFF09\uFF0C\u9ED8\u8BA4\u663E\u793A */\n const showComparePrice = trackingData?.showComparePrice ?? true\n\n const totalSavingsText = useMemo(() => {\n return replaceTemplate(copyWriting?.totalSavings || '', {\n amount: formatPrice({\n amount: totalSavings,\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n }),\n })\n }, [copyWriting?.totalSavings, totalSavings, variant.price.currencyCode, locale])\n\n const unlockedSavingText = useMemo(() => {\n if (!copyWriting?.unlockedSaving) return undefined\n\n const couponSaving = commonCoupon?.enable ? Number(commonCoupon?.config?.fixed_value || 0) : 0\n const memberSaving = memberDiscount?.enable ? (memberDiscount.config?.amount ?? 0) : 0\n\n // \u4E0D\u53EF\u53E0\u52A0\u65F6\u53D6\u4F1A\u5458\u4EF7\u4E0E code \u6298\u6263\u7684\u6700\u5927\u503C\uFF0C\u53EF\u53E0\u52A0\u65F6\u53D6\u4E8C\u8005\u4E4B\u548C\n const totalUnlocked = Math.round((\n memberFunctionResult?.withoutCouponMaxMemberTotalSave\n ? Math.max(memberSaving, couponSaving)\n : memberSaving + couponSaving\n ) * 100) / 100\n\n if (totalUnlocked <= 0) return undefined\n\n return replaceTemplate(copyWriting.unlockedSaving, {\n amount: formatPrice({\n amount: totalUnlocked,\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n }),\n })\n }, [\n copyWriting?.unlockedSaving,\n commonCoupon?.enable,\n commonCoupon?.config?.fixed_value,\n memberDiscount?.enable,\n memberDiscount?.config?.amount,\n memberFunctionResult,\n variant.price.currencyCode,\n locale,\n ])\n\n return (\n <Container\n childClassName=\"tablet:flex tablet:justify-end tablet:gap-8 laptop-md:px-0 desktop:px-0 tablet:items-center tablet:gap-4\"\n className=\"laptop-md:border-none laptop-md:py-0 border-t border-[#E4E5E6] bg-white py-3\"\n >\n {variant.availableForSale ? (\n <div className=\"laptop-md:items-end flex flex-col justify-between\">\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2]\"\n html={formatPrice({\n amount: parseFloat(finalPrice.toFixed(2)),\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n })}\n />\n {showComparePrice && (totalSavings > 0 || (savingDetail?.member > 0 && isLogin)) && (\n <Text\n className=\"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2] text-[#4A4C56] line-through\"\n html={formatPrice({\n amount: comparePrice,\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n })}\n />\n )}\n {savingDetail?.member > 0 && isLogin && (\n <Text\n className=\"bg-brand-0 rounded px-1 py-[2px] text-sm font-bold text-white\"\n html={copyWriting?.memberPrice || 'Member Price'}\n />\n )}\n </div>\n {totalSavingsSlot ||\n (totalSavings > 0 || (savingDetail?.member > 0 && isLogin) ? (\n <Text\n className=\"text-brand-0 tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]\"\n html={`${totalSavingsText}`}\n />\n ) : unlockedSavingText ? (\n <Text\n className=\"text-info-quaternary tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]\"\n html={unlockedSavingText}\n />\n ) : null)}\n </div>\n ) : (\n <Text className=\"text-[20px] font-bold text-[#999999]\" html={copyWriting?.soldOut ?? 'Sold Out'} />\n )}\n <div className=\"tablet:mt-0 mt-2 flex items-center gap-2\">\n <CartActionButtons\n mode={notifyMeMode}\n availableForSale={variant.availableForSale}\n addToCartText={copyWriting?.addToCart ?? 'Add to Cart'}\n buyNowText={copyWriting?.buyNow ?? 'Buy Now'}\n addToCartLoading={addToCartLoading}\n buyNowLoading={buyNowLoading}\n onAddToCart={onAddToCart}\n onBuyNow={onBuyNow}\n onNotifyMeClick={onNotifyMeClick}\n notifyMeText={copyWriting?.notifyMe}\n notifyMeClassName=\"w-full\"\n />\n </div>\n </Container>\n )\n}\n\nexport default ProductActions\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAwFU,IAAAI,EAAA,6BAxFVC,EAAgC,8CAChCC,EAA+B,6CAC/BC,EAAqC,0CACrCC,EAAwC,iBACxCC,EAA4B,mCAC5BC,EAAgC,wCAChCC,EAA4B,yCAC5BC,EAA8B,+CAO9B,MAAMC,EAAiB,CAAC,CAAE,iBAAAC,CAAiB,EAAyB,CAAC,IAAM,CACzE,KAAM,CAAE,YAAAC,EAAa,OA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,CAAC,EAED,SACE,QAAC,aACC,eAAe,2GACf,UAAU,+EAET,UAAAG,EAAQ,oBACP,QAAC,OAAI,UAAU,oDACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,QACC,UAAU,yFACV,QAAM,eAAY,CAChB,OAAQ,WAAWC,EAAW,QAAQ,CAAC,CAAC,EACxC,aAAcD,EAAQ,MAAM,aAC5B,OAAQD,IAAiB,MAAQ,KAAOF,GAAU,IACpD,CAAC,EACH,EACCoB,IAAqBf,EAAe,GAAMK,GAAc,OAAS,GAAKJ,OACrE,OAAC,QACC,UAAU,qHACV,QAAM,eAAY,CAChB,OAAQC,EACR,aAAcJ,EAAQ,MAAM,aAC5B,OAAQD,IAAiB,MAAQ,KAAOF,GAAU,IACpD,CAAC,EACH,EAEDU,GAAc,OAAS,GAAKJ,MAC3B,OAAC,QACC,UAAU,gEACV,KAAMP,GAAa,aAAe,eACpC,GAEJ,EACCD,IACEO,EAAe,GAAMK,GAAc,OAAS,GAAKJ,KAChD,OAAC,QACC,UAAU,4HACV,KAAM,GAAGe,CAAgB,GAC3B,EACEC,KACF,OAAC,QACC,UAAU,oIACV,KAAMA,EACR,EACE,OACR,KAEA,OAAC,QAAK,UAAU,uCAAuC,KAAMvB,GAAa,SAAW,WAAY,KAEnG,OAAC,OAAI,UAAU,2CACb,mBAAC,EAAA2B,QAAA,CACC,KAAMb,EACN,iBAAkBV,EAAQ,iBAC1B,cAAeJ,GAAa,WAAa,cACzC,WAAYA,GAAa,QAAU,UACnC,iBAAkBY,EAClB,cAAeC,EACf,YAAaJ,EACb,SAAUC,EACV,gBAAiBK,EACjB,aAAcf,GAAa,SAC3B,kBAAkB,SACpB,EACF,GACF,CAEJ,EAEA,IAAOb,EAAQW",
|
|
6
|
+
"names": ["ProductActions_exports", "__export", "ProductActions_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_AiuiProvider", "import_BizProductProvider", "import_react", "import_utils", "import_textFormat", "import_useBenefits", "import_CartActionButtons", "ProductActions", "totalSavingsSlot", "copyWriting", "locale", "trackingData", "currencyCode", "variant", "finalPrice", "totalSavings", "isLogin", "comparePrice", "onAddToCart", "onBuyNow", "savingDetail", "addToCartLoading", "buyNowLoading", "notifyMeMode", "onNotifyMeClick", "discount", "memberFunctionResult", "benefits", "commonCoupon", "memberDiscount", "showComparePrice", "totalSavingsText", "unlockedSavingText", "couponSaving", "memberSaving", "totalUnlocked", "CartActionButtons"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NotifyMeDialogProps } from './types.js';
|
|
2
|
+
declare const NotifyMeDialog: {
|
|
3
|
+
({ open, onOpenChange, copy, classNames, checkboxes, subscriptionMeta, onSubmit, }: NotifyMeDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default NotifyMeDialog;
|
|
7
|
+
export type { NotifyMeDialogProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";var re=Object.create;var T=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var me=(r,l)=>{for(var u in l)T(r,u,{get:l[u],enumerable:!0})},$=(r,l,u,m)=>{if(l&&typeof l=="object"||typeof l=="function")for(let o of ie(l))!se.call(r,o)&&o!==u&&T(r,o,{get:()=>l[o],enumerable:!(m=le(l,o))||m.enumerable});return r};var ce=(r,l,u)=>(u=r!=null?re(ne(r)):{},$(l||!r||!r.__esModule?T(u,"default",{value:r,enumerable:!0}):u,r)),pe=r=>$(T({},"__esModule",{value:!0}),r);var ge={};me(ge,{default:()=>fe});module.exports=pe(ge);var e=require("react/jsx-runtime"),s=require("react"),t=require("../../components/index.js"),d=require("../../helpers/index.js"),de=ce(require("react")),G=require("../../hooks/useExposure.js"),q=require("../AiuiProvider/index.js"),w=require("../../shared/track.js");const v="copy",k="NotifyMeDialog",ue=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,j=({open:r,onOpenChange:l,copy:u,classNames:m,checkboxes:o=[],subscriptionMeta:C,onSubmit:S})=>{const{title:_,subTitle:b,emailLabel:A="Email address",emailPlaceholder:F="your@email.com",submitBtnText:N="Notify Me",errorEmpty:W,errorInvalidEmail:X,errorCheckboxRequired:J,errorSubmit:M="Something went wrong. Please try again.",errorSubmitDetail:K,successTitle:Q,successDesc:H,successBtnText:B}=u,L=de.useRef(null),{trackingData:z}=(0,q.useAiuiContext)();(0,G.useExposure)(L,{componentType:v,componentName:k,componentTitle:_,componentDescription:b});const[h,I]=(0,s.useState)(""),[D,P]=(0,s.useState)(()=>o.map(()=>!1)),[f,x]=(0,s.useState)("idle"),[U,E]=(0,s.useState)(()=>o.map(()=>!1)),[n,g]=(0,s.useState)("idle"),[R,y]=(0,s.useState)(null),V=R?K?.find(a=>a.code===R)?.message??M:M,Y=n!=="loading"&&n!=="success",Z=(0,s.useCallback)(a=>{const c=o[a];c&&(0,w.gaTrack)({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:z.pageGroup||"Home Page",component_type:v,component_name:k,button_name:c.label,component_title:_,component_description:b||""}}),P(p=>{const i=[...p];return i[a]=!i[a],i}),E(p=>{const i=[...p];return i[a]=!1,i}),f!=="idle"&&x("idle"),n==="error-submit"&&(g("idle"),y(null))},[f,n]),O=(0,s.useCallback)(a=>{I(a.target.value),f!=="idle"&&x("idle"),E(c=>c.some(Boolean)?c.map(()=>!1):c),n==="error-submit"&&(g("idle"),y(null))},[f,n]),ee=(0,s.useCallback)(async()=>{(0,w.gaTrack)({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:z.pageGroup||"Home Page",component_type:v,component_name:k,button_name:N,component_title:_,component_description:b||""}});let a=!1;h.trim()?ue.test(h.trim())?x("idle"):(x("error-format"),a=!0):(x("error-empty"),a=!0);const c=o.map((p,i)=>p.label&&p.required&&!D[i]?(a=!0,!0):!1);if(E(c),!a){g("loading");try{const p=o.map((i,oe)=>i.checkbox_id!==void 0?{checkbox_id:i.checkbox_id,checked:D[oe]}:null).filter(i=>i!==null);await S({email:h.trim(),checkedItems:p,meta:C}),g("success")}catch(p){const i=p&&typeof p=="object"&&"code"in p?String(p.code):null;y(i),g("error-submit")}}},[h,o,D,C,S]);(0,s.useEffect)(()=>{if(n!=="error-submit")return;const a=setTimeout(()=>{g("idle"),y(null)},3e3);return()=>clearTimeout(a)},[n]);const te=(0,s.useCallback)(a=>{a||(I(""),P(o.map(()=>!1)),x("idle"),E(o.map(()=>!1)),g("idle"),y(null)),l(a)},[o,l]),ae=o.some(a=>a.label);return(0,e.jsx)(t.Dialog,{open:r,onOpenChange:te,children:(0,e.jsxs)(t.DialogContent,{ref:L,"aria-describedby":"notify-me-content",className:(0,d.cn)("laptop:max-w-[480px] laptop:[&_.dialog-close-icon]:size-6 laptop:gap-8 rounded-box laptop:p-8 max-h-[90vh] w-[calc(100%-32px)] gap-6 overflow-y-auto bg-white p-6 [&_.dialog-close-icon]:size-5",m?.root),children:[n!=="success"&&(0,e.jsxs)(t.DialogHeader,{className:(0,d.cn)(m?.header),children:[(0,e.jsx)(t.DialogTitle,{children:(0,e.jsx)(t.Heading,{as:"h2",size:2,className:(0,d.cn)("text-info-primary text-center font-bold",m?.title),children:_})}),b&&(0,e.jsx)(t.DialogDescription,{asChild:!0,children:(0,e.jsx)(t.Text,{as:"p",className:(0,d.cn)("text-info-primary laptop:text-base mt-1 text-center text-sm",m?.subTitle),children:b})})]}),n==="success"?(0,e.jsxs)("div",{className:(0,d.cn)("flex flex-col items-center text-center",m?.successText),children:[(0,e.jsx)("div",{className:"flex size-20 items-center justify-center",children:(0,e.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"80",height:"80",viewBox:"0 0 80 80",fill:"none",children:[(0,e.jsx)("circle",{cx:"40",cy:"40",r:"35",fill:"#30D158"}),(0,e.jsx)("path",{d:"M23.3333 38.3333L36.6666 50L56.6666 30",stroke:"white",strokeWidth:"6.66667",strokeLinecap:"round",strokeLinejoin:"round"})]})}),(0,e.jsxs)("div",{className:"mt-4",children:[(0,e.jsx)(t.Heading,{as:"h3",size:2,className:"text-info-primary font-bold",children:Q}),H&&(0,e.jsx)(t.Text,{as:"p",className:"text-info-primary laptop:text-base mt-1 text-sm",children:H})]}),B&&(0,e.jsx)(t.Button,{variant:"primary",size:"lg",onClick:()=>l(!1),className:"laptop:mt-8 mt-6 w-full",children:B})]}):(0,e.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,e.jsxs)("div",{className:m?.emailInput,children:[(0,e.jsx)(t.Text,{as:"label",htmlFor:"notify-me-email",className:"text-info-primary laptop:text-base mb-2 block text-sm",children:A}),(0,e.jsx)(t.Input,{id:"notify-me-email",type:"email",placeholder:F,value:h,onChange:O,disabled:n==="loading",className:(0,d.cn)("placeholder:text-info-tertiary text-info-primary laptop:h-[54px] laptop:text-base laptop:p-4 border-lines-1 h-[44px] w-full bg-white p-3 text-sm font-bold placeholder:font-bold focus-visible:!outline-none",f!=="idle"&&"border-error-0")}),f==="error-empty"&&(0,e.jsx)(t.Text,{as:"p",className:"text-error-0 laptop:text-base mt-2 text-sm",children:W}),f==="error-format"&&(0,e.jsx)(t.Text,{as:"p",className:"text-error-0 laptop:text-base mt-2 text-sm",children:X})]}),ae&&(0,e.jsx)("div",{className:(0,d.cn)("laptop:gap-4 flex flex-col gap-2",m?.checkboxes),children:o.map((a,c)=>a.label?(0,e.jsxs)("div",{children:[(0,e.jsxs)("label",{className:(0,d.cn)("text-info-tertiary flex cursor-pointer items-start gap-2",m?.checkboxItem),children:[(0,e.jsx)(t.Checkbox,{checked:D[c],onCheckedChange:()=>Z(c),"data-headless-type-name":`${v}#${k}`,"data-headless-title-desc-button":`''#''#${a.label}`,"data-headless-nav-position":"''#1",disabled:n==="loading",className:"border-info-secondary data-[state=checked]:bg-info-secondary mt-0.5 shrink-0"}),(0,e.jsx)(t.Text,{as:"span",className:"text-info-tertiary laptop:text-base [&_a]:text-brand-0 text-sm leading-snug [&_a]:underline",html:a.label})]}),U[c]&&(0,e.jsx)(t.Text,{as:"p",className:"text-error-0 laptop:text-base mt-2 text-sm",children:J})]},c):null)}),(0,e.jsx)(t.Button,{variant:"primary",size:"lg",loading:n==="loading",disabled:!Y,onClick:ee,className:(0,d.cn)("w-full",m?.submitBtn),"data-headless-type-name":`${v}#${k}`,"data-headless-title-desc-button":`''#''#${N}`,"data-headless-nav-position":"''#1",children:N}),n==="error-submit"&&(0,e.jsx)(t.Text,{as:"p",className:(0,d.cn)("text-error-0 laptop:text-base text-sm",m?.errorText),children:V})]})]})})};j.displayName="NotifyMeDialog";var fe=j;
|
|
2
|
+
//# sourceMappingURL=NotifyMeDialog.js.map
|