@anker-in/headless-ui 1.0.26-alpha.1763367560339 → 1.0.26-alpha.1763429992784
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/HeroBanner/HeroBanner.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js.map +3 -3
- package/dist/cjs/biz-components/HeroBanner/types.d.ts +2 -0
- package/dist/cjs/biz-components/HeroBanner/types.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/types.js.map +1 -1
- 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/PaidShipping/LearnMore.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PaidShipping/LearnMore.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/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 +2 -2
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js.map +3 -3
- package/dist/esm/biz-components/HeroBanner/types.d.ts +2 -0
- 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/PaidShipping/LearnMore.js +1 -1
- package/dist/esm/biz-components/Listing/components/PaidShipping/LearnMore.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.js +1 -1
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/PaidShipping/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/PaidShipping/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/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 +2 -2
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var ne=Object.create;var N=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ce=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty;var de=(t,a)=>{for(var o in a)N(t,o,{get:a[o],enumerable:!0})},A=(t,a,o,k)=>{if(a&&typeof a=="object"||typeof a=="function")for(let u of pe(a))!ue.call(t,u)&&u!==o&&N(t,u,{get:()=>a[u],enumerable:!(k=ie(a,u))||k.enumerable});return t};var T=(t,a,o)=>(o=t!=null?ne(ce(t)):{},A(a||!t||!t.__esModule?N(o,"default",{value:t,enumerable:!0}):o,t)),me=t=>A(N({},"__esModule",{value:!0}),t);var fe={};de(fe,{default:()=>be});module.exports=me(fe);var e=require("react/jsx-runtime"),r=T(require("react")),y=T(require("gsap")),w=require("gsap/dist/ScrollTrigger"),C=require("react-responsive"),Z=require("react-intersection-observer"),G=T(require("../../helpers/ScrollLoadVideo.js")),l=require("../../components/index.js"),J=T(require("./Countdown.js")),m=require("../../helpers/index.js"),K=require("../../shared/Styles.js"),O=require("../../hooks/useExposure.js"),z=require("../../shared/trackUrlRef.js"),W=require("../../components/button.js"),X=require("../VideoModal/index.js");const p="image",c="hero_banner",ge=({size:t="base"})=>{const{width:a,height:o}=W.sizeMap[t];return(0,e.jsx)("svg",{width:a,height:o,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:(0,e.jsx)("path",{d:"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z",fill:"currentcolor"})})},Q=r.default.forwardRef(({data:t,className:a,onSecondaryButtonClick:o,onPrimaryButtonClick:k},u)=>{const{title:s,subtitle:n,endDate:M,endDate_tz:Y,dateFormat:ee,pcImage:B,padImage:L,mobileImage:$,pcVideo:te,padVideo:ae,mobileVideo:D,isShowVideo:re,primaryButton:f,secondaryButton:i,theme:oe="light",size:H="default",caption:V=[],blockLink:S,iconArray:le}=t,E=(0,C.useMediaQuery)({query:"(max-width: 768px)"}),U=(0,C.useMediaQuery)({query:"(max-width: 1024px)"}),[_,j]=(0,r.useState)(!1),{ref:se,inView:F}=(0,Z.useInView)(),I=(0,r.useRef)(null),R=(0,r.useRef)(null),P=(0,r.useRef)(null),h=(0,r.useRef)(null),d=(0,r.useRef)(null);return(0,O.useExposure)(d,{componentType:p,componentName:c,componentTitle:s,componentDescription:n}),(0,r.useImperativeHandle)(u,()=>d.current),(0,r.useEffect)(()=>{y.default.registerPlugin(w.ScrollTrigger);function g(){if(!h.current)return;const b=d.current?.clientHeight||100;window.innerHeight<=b?I.current=w.ScrollTrigger.create({trigger:d.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:x=>{const v=x.progress*40-20;y.default.set(h.current,{yPercent:v})}}):(P.current=w.ScrollTrigger.create({trigger:d.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:x=>{const v=x.progress*20-20;y.default.set(h.current,{yPercent:v})}}),R.current=w.ScrollTrigger.create({trigger:d.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:x=>{const v=x.progress*20;y.default.set(h.current,{yPercent:v})}}))}return F&&g(),()=>{I.current&&I.current.kill(),P.current&&P.current.kill(),R.current&&R.current.kill()}},[F]),(0,e.jsx)("div",{ref:se,"data-ui-component-id":"HeroBanner",children:(0,e.jsxs)("div",{ref:d,className:(0,m.cn)(oe==="dark"?"aiui-dark":""," tablet:aspect-[768/660] text-info-primary relative aspect-[390/660] w-full overflow-hidden",{"lg-desktop:aspect-[1920/930] desktop:aspect-[1440/700] laptop:aspect-[1024/520]":H==="default","lg-desktop:aspect-[1920/720] desktop:aspect-[1440/576] laptop:aspect-[1024/432]":H==="sm"},a),children:[S&&(0,e.jsx)("a",{className:"absolute inset-0 z-10",href:(0,z.trackUrlRef)(S,`${p}_${c}`),"data-headless-type-name":`${p}#${c}`,"data-headless-title-desc-button":`${s}#${n}`,tabIndex:-1,"aria-hidden":"true","aria-label":s}),(0,e.jsx)("div",{ref:h,className:(0,m.cn)("absolute left-0 top-0 size-full"),children:re?(0,e.jsx)(G.default,{poster:E?$?.url:U?L?.url||$?.url:B?.url,src:E?D?.url:U?ae?.url||D?.url:te?.url,className:"laptop:w-full h-full",videoClassName:"h-full object-cover",muted:!0,loop:!0,playsInline:!0}):(0,e.jsx)(l.Picture,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:B?.alt||"",source:`${B?.url||""} , ${L?.url??($?.url||"")} 1024, ${$?.url||""} 767`})}),(0,e.jsxs)("div",{className:"hero-banner-content laptop:top-1/2 laptop:-translate-y-1/2 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] lg-desktop:gap-[32px] absolute top-24 z-10 flex flex-col gap-[24px] px-[16px]",children:[(0,e.jsxs)("div",{className:"laptop:text-left max-w-[686px]",children:[s&&(0,e.jsx)(l.Heading,{as:"h2",size:H==="sm"?4:5,className:(0,m.cn)("hero-banner-title"),html:s}),n&&(0,e.jsx)(l.Heading,{as:"h3",className:(0,m.cn)("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm"),html:n}),M&&(0,e.jsx)("div",{className:"mt-3",children:(0,e.jsx)(J.default,{endDate:M,endDate_tz:Y,dateFormat:ee})})]}),(0,e.jsxs)("div",{className:"hero-banner-button-group laptop:justify-start lg-desktop:gap-3 flex items-center gap-2",children:[i?.isShowPlayVideoButton&&i?.playVideoButtonText?(0,e.jsxs)(l.Button,{onClick:()=>{j(!0),o?.()},size:"lg",variant:"secondary",className:"hero-banner-play-video-button","data-headless-type-name":`${p}#${c}`,"data-headless-title-desc-button":`${s}#${n}#${i?.playVideoButtonText}`,children:[i?.playVideoButtonText," ",(0,e.jsx)(ge,{size:"lg"})]}):i?.text?(0,e.jsxs)(l.Button,{"aria-label":s??n,size:"lg",variant:"secondary",className:"hero-banner-secondary-button",as:"a",onClick:()=>{o?.()},href:(0,z.trackUrlRef)(i?.link,`${p}_${c}`),"data-headless-type-name":`${p}#${c}`,"data-headless-title-desc-button":`${s}#${n}#${i?.text}`,children:[i?.text,(0,e.jsx)("span",{className:"sr-only",children:s??n})]}):null,f&&f.text&&(0,e.jsx)(l.Button,{"aria-label":s??n,size:"lg",variant:"primary",className:"hero-banner-primary-button",as:"a",onClick:()=>{k?.()},href:(0,z.trackUrlRef)(f.link,`${p}_${c}`),"data-headless-type-name":`${p}#${c}`,"data-headless-title-desc-button":`${s}#${n}#${f?.text}`,children:f.text})]}),(0,e.jsx)("div",{className:"hero-banner-icon-group flex items-center gap-2",children:le?.map((g,b)=>(0,e.jsx)("div",{className:"h-12",children:(0,e.jsx)(l.Picture,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",alt:g?.pcImage?.alt||"",source:g?.pcImage?.url})},b))})]}),V.length>0&&(0,e.jsx)("div",{className:"hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]",children:V.map((g,b)=>(0,e.jsxs)(r.default.Fragment,{children:[(0,e.jsx)(l.Text,{size:2,className:(0,m.cn)("hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]"),html:g.title}),b<V.length-1&&(0,e.jsx)("div",{className:(0,m.cn)("bg-info-primary w-px")})]},b))}),_&&(0,e.jsx)(X.VideoModal,{visible:_,videoUrl:i?.videoUrl?.url,youTubeId:i?.youtubeId,onCloseModal:()=>j(!1)})]})})});Q.displayName="HeroBanner";var be=(0,K.withLayout)(Q);
|
|
2
2
|
//# sourceMappingURL=HeroBanner.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/HeroBanner/HeroBanner.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef, useState, useEffect } from 'react'\nimport gsap from 'gsap'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport type { HeroBannerProps } from './types.js'\nimport { useMediaQuery } from 'react-responsive'\nimport { useInView } from 'react-intersection-observer'\nimport ScrollLoadVideo from '../../helpers/ScrollLoadVideo.js'\nimport { Button, Heading, Picture, Text } from '../../components/index.js'\nimport Countdown from './Countdown.js'\nimport { cn } from '../../helpers/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { sizeMap } from '../../components/button.js'\nimport { VideoModal } from '../VideoModal/index.js'\n\nconst componentType = 'image'\nconst componentName = 'hero_banner'\n\nconst PlayButtonAppendIcon = ({ size = 'base' }: { size: 'base' | 'lg' | 'sm' }) => {\n const { width, height } = sizeMap[size]\n return (\n <svg width={width} height={height} viewBox=\"0 0 20 20\" fill=\"currentcolor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z\"\n fill=\"currentcolor\"\n />\n </svg>\n )\n}\n\nconst HeroBanner = React.forwardRef<HTMLDivElement, HeroBannerProps>(({ data, className }, ref) => {\n const {\n title,\n subtitle,\n endDate,\n endDate_tz,\n dateFormat,\n pcImage,\n padImage,\n mobileImage,\n pcVideo,\n padVideo,\n mobileVideo,\n isShowVideo,\n primaryButton,\n secondaryButton,\n theme = 'light',\n size = 'default',\n caption = [],\n blockLink,\n iconArray,\n } = data\n\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const isPad = useMediaQuery({ query: '(max-width: 1024px)' })\n const [visible, setVisible] = useState<boolean>(false)\n const { ref: inViewRef, inView } = useInView()\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n const bgTriggerRef = useRef<ScrollTrigger | null>(null)\n const boxTriggerRef = useRef<ScrollTrigger | null>(null)\n\n const bgRef = useRef<HTMLImageElement>(null)\n const boxRef = useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: subtitle,\n })\n\n useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n useEffect(() => {\n gsap.registerPlugin(ScrollTrigger)\n function gsapResize() {\n if (!bgRef.current) return\n const clientHeight = boxRef.current?.clientHeight || 100\n const screenHeight = window.innerHeight\n\n if (screenHeight <= clientHeight) {\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top bottom',\n end: 'bottom top',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 40\n const value = self.progress * base - base / 2\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n } else {\n boxTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top bottom',\n end: 'bottom bottom',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 20\n const value = self.progress * base - base\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n bgTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top top',\n end: 'bottom top',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 20\n const value = self.progress * base\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n }\n }\n if (inView) gsapResize()\n return () => {\n // ScrollTrigger.getAll().forEach((t: any) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n boxTriggerRef.current && boxTriggerRef.current.kill()\n bgTriggerRef.current && bgTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n <div ref={inViewRef} data-ui-component-id=\"HeroBanner\">\n <div\n ref={boxRef}\n className={cn(\n theme === 'dark' ? 'aiui-dark' : '',\n ' tablet:aspect-[768/660] text-info-primary relative aspect-[390/660] w-full overflow-hidden',\n {\n 'lg-desktop:aspect-[1920/930] desktop:aspect-[1440/700] laptop:aspect-[1024/520]': size === 'default',\n 'lg-desktop:aspect-[1920/720] desktop:aspect-[1440/576] laptop:aspect-[1024/432]': size === 'sm',\n },\n className\n )}\n >\n {blockLink && (\n <a\n className=\"absolute inset-0 z-10\"\n href={trackUrlRef(blockLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}`}\n tabIndex={-1}\n aria-hidden=\"true\"\n aria-label={title}\n ></a>\n )}\n <div ref={bgRef} className={cn('absolute left-0 top-0 size-full')}>\n {isShowVideo ? (\n <ScrollLoadVideo\n poster={isMobile ? mobileImage?.url : isPad ? padImage?.url || mobileImage?.url : pcImage?.url}\n src={\n isMobile\n ? (mobileVideo?.url as string)\n : isPad\n ? (padVideo?.url as string) || (mobileVideo?.url as string)\n : (pcVideo?.url as string)\n }\n className=\"laptop:w-full h-full\"\n videoClassName=\"h-full object-cover\"\n muted\n loop\n playsInline\n />\n ) : (\n <Picture\n className=\"laptop:w-full h-full\"\n imgClassName=\"h-full object-cover\"\n loading=\"eager\"\n fetchPriority=\"high\"\n alt={pcImage?.alt || ''}\n source={`${pcImage?.url || ''} , ${padImage?.url ?? (mobileImage?.url || '')} 1024, ${mobileImage?.url || ''} 767`}\n />\n )}\n </div>\n\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"hero-banner-content laptop:top-1/2 laptop:-translate-y-1/2 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] lg-desktop:gap-[32px] absolute top-24 z-10 flex flex-col gap-[24px] px-[16px]\">\n <div className=\"laptop:text-left max-w-[686px]\">\n {title && <Heading as=\"h2\" size={size === 'sm' ? 4 : 5} className={cn('hero-banner-title')} html={title} />}\n {subtitle && (\n <Heading\n as=\"h3\"\n className={cn(\n 'hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm'\n )}\n html={subtitle}\n />\n )}\n {endDate && (\n <div className=\"mt-3\">\n <Countdown endDate={endDate} endDate_tz={endDate_tz} dateFormat={dateFormat} />\n </div>\n )}\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div className=\"hero-banner-button-group laptop:justify-start lg-desktop:gap-3 flex items-center gap-2\">\n {secondaryButton?.isShowPlayVideoButton && secondaryButton?.playVideoButtonText ? (\n <Button\n onClick={() => setVisible(true)}\n size=\"lg\"\n variant=\"secondary\"\n className=\"hero-banner-play-video-button\"\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${secondaryButton?.playVideoButtonText}`}\n >\n {secondaryButton?.playVideoButtonText} <PlayButtonAppendIcon size=\"lg\" />\n </Button>\n ) : secondaryButton?.text ? (\n <Button\n aria-label={title ?? subtitle}\n size=\"lg\"\n variant=\"secondary\"\n className=\"hero-banner-secondary-button\"\n as=\"a\"\n href={trackUrlRef(secondaryButton?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${secondaryButton?.text}`}\n >\n {secondaryButton?.text}\n <span className=\"sr-only\">{title ?? subtitle}</span>\n </Button>\n ) : null}\n {primaryButton && primaryButton.text && (\n <Button\n aria-label={title ?? subtitle}\n size=\"lg\"\n variant=\"primary\"\n className=\"hero-banner-primary-button\"\n as=\"a\"\n href={trackUrlRef(primaryButton.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${primaryButton?.text}`}\n >\n {primaryButton.text}\n </Button>\n )}\n </div>\n <div className=\"hero-banner-icon-group flex items-center gap-2\">\n {iconArray?.map((icon, index) => (\n <div key={index} className=\"h-12\">\n <Picture\n className=\"laptop:w-full h-full\"\n imgClassName=\"h-full object-cover\"\n loading=\"eager\"\n alt={icon?.pcImage?.alt || ''}\n source={icon?.pcImage?.url}\n />\n </div>\n ))}\n </div>\n </div>\n\n {/* \u5E95\u90E8\u4EA7\u54C1\u5217\u8868 */}\n {caption.length > 0 && (\n <div className=\"hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]\">\n {caption.map((c, index) => (\n <React.Fragment key={index}>\n <Text\n size={2}\n className={cn(\n 'hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]'\n )}\n html={c.title}\n />\n {index < caption.length - 1 && <div className={cn('bg-info-primary w-px')} />}\n </React.Fragment>\n ))}\n </div>\n )}\n\n {/* \u89C6\u9891\u5F39\u7A97 */}\n {visible && (\n <VideoModal\n visible={visible}\n videoUrl={secondaryButton?.videoUrl?.url}\n youTubeId={secondaryButton?.youtubeId}\n onCloseModal={() => setVisible(false)}\n />\n )}\n </div>\n </div>\n )\n})\n\nHeroBanner.displayName = 'HeroBanner'\n\nexport default withLayout(HeroBanner)\n"],
|
|
5
|
-
"mappings": "mlBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAwBM,IAAAI,EAAA,6BAvBNC,EAAwE,oBACxEC,EAAiB,mBACjBC,EAA8B,mCAE9BC,EAA8B,4BAC9BC,EAA0B,uCAC1BC,EAA4B,+CAC5BC,EAA+C,qCAC/CC,EAAsB,6BACtBC,EAAmB,kCACnBC,EAA2B,kCAC3BC,EAA4B,sCAC5BC,EAA4B,uCAC5BC,EAAwB,sCACxBC,EAA2B,kCAE3B,MAAMC,EAAgB,QAChBC,EAAgB,cAEhBC,GAAuB,CAAC,CAAE,KAAAC,EAAO,MAAO,IAAsC,CAClF,KAAM,CAAE,MAAAC,EAAO,OAAAC,CAAO,EAAI,UAAQF,CAAI,EACtC,SACE,OAAC,OAAI,MAAOC,EAAO,OAAQC,EAAQ,QAAQ,YAAY,KAAK,eAAe,MAAM,6BAC/E,mBAAC,QACC,EAAE,0LACF,KAAK,eACP,EACF,CAEJ,EAEMC,EAAa,EAAAC,QAAM,
|
|
6
|
-
"names": ["HeroBanner_exports", "__export", "HeroBanner_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_gsap", "import_ScrollTrigger", "import_react_responsive", "import_react_intersection_observer", "import_ScrollLoadVideo", "import_components", "import_Countdown", "import_helpers", "import_Styles", "import_useExposure", "import_trackUrlRef", "import_button", "import_VideoModal", "componentType", "componentName", "PlayButtonAppendIcon", "size", "width", "height", "HeroBanner", "React", "data", "className", "ref", "title", "subtitle", "endDate", "endDate_tz", "dateFormat", "pcImage", "padImage", "mobileImage", "pcVideo", "padVideo", "mobileVideo", "isShowVideo", "primaryButton", "secondaryButton", "theme", "caption", "blockLink", "iconArray", "isMobile", "isPad", "visible", "setVisible", "inViewRef", "inView", "scrollTriggerRef", "bgTriggerRef", "boxTriggerRef", "bgRef", "boxRef", "gsap", "gsapResize", "clientHeight", "self", "value", "ScrollLoadVideo", "Countdown", "icon", "index", "c"]
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef, useState, useEffect } from 'react'\nimport gsap from 'gsap'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport type { HeroBannerProps } from './types.js'\nimport { useMediaQuery } from 'react-responsive'\nimport { useInView } from 'react-intersection-observer'\nimport ScrollLoadVideo from '../../helpers/ScrollLoadVideo.js'\nimport { Button, Heading, Picture, Text } from '../../components/index.js'\nimport Countdown from './Countdown.js'\nimport { cn } from '../../helpers/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { sizeMap } from '../../components/button.js'\nimport { VideoModal } from '../VideoModal/index.js'\n\nconst componentType = 'image'\nconst componentName = 'hero_banner'\n\nconst PlayButtonAppendIcon = ({ size = 'base' }: { size: 'base' | 'lg' | 'sm' }) => {\n const { width, height } = sizeMap[size]\n return (\n <svg width={width} height={height} viewBox=\"0 0 20 20\" fill=\"currentcolor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z\"\n fill=\"currentcolor\"\n />\n </svg>\n )\n}\n\nconst HeroBanner = React.forwardRef<HTMLDivElement, HeroBannerProps>(\n ({ data, className, onSecondaryButtonClick, onPrimaryButtonClick }, ref) => {\n const {\n title,\n subtitle,\n endDate,\n endDate_tz,\n dateFormat,\n pcImage,\n padImage,\n mobileImage,\n pcVideo,\n padVideo,\n mobileVideo,\n isShowVideo,\n primaryButton,\n secondaryButton,\n theme = 'light',\n size = 'default',\n caption = [],\n blockLink,\n iconArray,\n } = data\n\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const isPad = useMediaQuery({ query: '(max-width: 1024px)' })\n const [visible, setVisible] = useState<boolean>(false)\n const { ref: inViewRef, inView } = useInView()\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n const bgTriggerRef = useRef<ScrollTrigger | null>(null)\n const boxTriggerRef = useRef<ScrollTrigger | null>(null)\n\n const bgRef = useRef<HTMLImageElement>(null)\n const boxRef = useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: subtitle,\n })\n\n useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n useEffect(() => {\n gsap.registerPlugin(ScrollTrigger)\n function gsapResize() {\n if (!bgRef.current) return\n const clientHeight = boxRef.current?.clientHeight || 100\n const screenHeight = window.innerHeight\n\n if (screenHeight <= clientHeight) {\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top bottom',\n end: 'bottom top',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 40\n const value = self.progress * base - base / 2\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n } else {\n boxTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top bottom',\n end: 'bottom bottom',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 20\n const value = self.progress * base - base\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n bgTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top top',\n end: 'bottom top',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 20\n const value = self.progress * base\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n }\n }\n if (inView) gsapResize()\n return () => {\n // ScrollTrigger.getAll().forEach((t: any) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n boxTriggerRef.current && boxTriggerRef.current.kill()\n bgTriggerRef.current && bgTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n <div ref={inViewRef} data-ui-component-id=\"HeroBanner\">\n <div\n ref={boxRef}\n className={cn(\n theme === 'dark' ? 'aiui-dark' : '',\n ' tablet:aspect-[768/660] text-info-primary relative aspect-[390/660] w-full overflow-hidden',\n {\n 'lg-desktop:aspect-[1920/930] desktop:aspect-[1440/700] laptop:aspect-[1024/520]': size === 'default',\n 'lg-desktop:aspect-[1920/720] desktop:aspect-[1440/576] laptop:aspect-[1024/432]': size === 'sm',\n },\n className\n )}\n >\n {blockLink && (\n <a\n className=\"absolute inset-0 z-10\"\n href={trackUrlRef(blockLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}`}\n tabIndex={-1}\n aria-hidden=\"true\"\n aria-label={title}\n ></a>\n )}\n <div ref={bgRef} className={cn('absolute left-0 top-0 size-full')}>\n {isShowVideo ? (\n <ScrollLoadVideo\n poster={isMobile ? mobileImage?.url : isPad ? padImage?.url || mobileImage?.url : pcImage?.url}\n src={\n isMobile\n ? (mobileVideo?.url as string)\n : isPad\n ? (padVideo?.url as string) || (mobileVideo?.url as string)\n : (pcVideo?.url as string)\n }\n className=\"laptop:w-full h-full\"\n videoClassName=\"h-full object-cover\"\n muted\n loop\n playsInline\n />\n ) : (\n <Picture\n className=\"laptop:w-full h-full\"\n imgClassName=\"h-full object-cover\"\n loading=\"eager\"\n fetchPriority=\"high\"\n alt={pcImage?.alt || ''}\n source={`${pcImage?.url || ''} , ${padImage?.url ?? (mobileImage?.url || '')} 1024, ${mobileImage?.url || ''} 767`}\n />\n )}\n </div>\n\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"hero-banner-content laptop:top-1/2 laptop:-translate-y-1/2 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] lg-desktop:gap-[32px] absolute top-24 z-10 flex flex-col gap-[24px] px-[16px]\">\n <div className=\"laptop:text-left max-w-[686px]\">\n {title && (\n <Heading as=\"h2\" size={size === 'sm' ? 4 : 5} className={cn('hero-banner-title')} html={title} />\n )}\n {subtitle && (\n <Heading\n as=\"h3\"\n className={cn(\n 'hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm'\n )}\n html={subtitle}\n />\n )}\n {endDate && (\n <div className=\"mt-3\">\n <Countdown endDate={endDate} endDate_tz={endDate_tz} dateFormat={dateFormat} />\n </div>\n )}\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div className=\"hero-banner-button-group laptop:justify-start lg-desktop:gap-3 flex items-center gap-2\">\n {secondaryButton?.isShowPlayVideoButton && secondaryButton?.playVideoButtonText ? (\n <Button\n onClick={() => {\n setVisible(true)\n onSecondaryButtonClick?.()\n }}\n size=\"lg\"\n variant=\"secondary\"\n className=\"hero-banner-play-video-button\"\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${secondaryButton?.playVideoButtonText}`}\n >\n {secondaryButton?.playVideoButtonText} <PlayButtonAppendIcon size=\"lg\" />\n </Button>\n ) : secondaryButton?.text ? (\n <Button\n aria-label={title ?? subtitle}\n size=\"lg\"\n variant=\"secondary\"\n className=\"hero-banner-secondary-button\"\n as=\"a\"\n onClick={() => {\n onSecondaryButtonClick?.()\n }}\n href={trackUrlRef(secondaryButton?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${secondaryButton?.text}`}\n >\n {secondaryButton?.text}\n <span className=\"sr-only\">{title ?? subtitle}</span>\n </Button>\n ) : null}\n {primaryButton && primaryButton.text && (\n <Button\n aria-label={title ?? subtitle}\n size=\"lg\"\n variant=\"primary\"\n className=\"hero-banner-primary-button\"\n as=\"a\"\n onClick={() => {\n onPrimaryButtonClick?.()\n }}\n href={trackUrlRef(primaryButton.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${primaryButton?.text}`}\n >\n {primaryButton.text}\n </Button>\n )}\n </div>\n <div className=\"hero-banner-icon-group flex items-center gap-2\">\n {iconArray?.map((icon, index) => (\n <div key={index} className=\"h-12\">\n <Picture\n className=\"laptop:w-full h-full\"\n imgClassName=\"h-full object-cover\"\n loading=\"eager\"\n alt={icon?.pcImage?.alt || ''}\n source={icon?.pcImage?.url}\n />\n </div>\n ))}\n </div>\n </div>\n\n {/* \u5E95\u90E8\u4EA7\u54C1\u5217\u8868 */}\n {caption.length > 0 && (\n <div className=\"hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]\">\n {caption.map((c, index) => (\n <React.Fragment key={index}>\n <Text\n size={2}\n className={cn(\n 'hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]'\n )}\n html={c.title}\n />\n {index < caption.length - 1 && <div className={cn('bg-info-primary w-px')} />}\n </React.Fragment>\n ))}\n </div>\n )}\n\n {/* \u89C6\u9891\u5F39\u7A97 */}\n {visible && (\n <VideoModal\n visible={visible}\n videoUrl={secondaryButton?.videoUrl?.url}\n youTubeId={secondaryButton?.youtubeId}\n onCloseModal={() => setVisible(false)}\n />\n )}\n </div>\n </div>\n )\n }\n)\n\nHeroBanner.displayName = 'HeroBanner'\n\nexport default withLayout(HeroBanner)\n"],
|
|
5
|
+
"mappings": "mlBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAwBM,IAAAI,EAAA,6BAvBNC,EAAwE,oBACxEC,EAAiB,mBACjBC,EAA8B,mCAE9BC,EAA8B,4BAC9BC,EAA0B,uCAC1BC,EAA4B,+CAC5BC,EAA+C,qCAC/CC,EAAsB,6BACtBC,EAAmB,kCACnBC,EAA2B,kCAC3BC,EAA4B,sCAC5BC,EAA4B,uCAC5BC,EAAwB,sCACxBC,EAA2B,kCAE3B,MAAMC,EAAgB,QAChBC,EAAgB,cAEhBC,GAAuB,CAAC,CAAE,KAAAC,EAAO,MAAO,IAAsC,CAClF,KAAM,CAAE,MAAAC,EAAO,OAAAC,CAAO,EAAI,UAAQF,CAAI,EACtC,SACE,OAAC,OAAI,MAAOC,EAAO,OAAQC,EAAQ,QAAQ,YAAY,KAAK,eAAe,MAAM,6BAC/E,mBAAC,QACC,EAAE,0LACF,KAAK,eACP,EACF,CAEJ,EAEMC,EAAa,EAAAC,QAAM,WACvB,CAAC,CAAE,KAAAC,EAAM,UAAAC,EAAW,uBAAAC,EAAwB,qBAAAC,CAAqB,EAAGC,IAAQ,CAC1E,KAAM,CACJ,MAAAC,EACA,SAAAC,EACA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AAS,GAC/C,EACE,KACHW,GAAiBA,EAAc,SAC9B,OAAC,UACC,aAAYZ,GAASC,EACrB,KAAK,KACL,QAAQ,UACR,UAAU,6BACV,GAAG,IACH,QAAS,IAAM,CACbH,IAAuB,CACzB,EACA,QAAM,eAAYc,EAAc,KAAM,GAAGzB,CAAa,IAAIC,CAAa,EAAE,EACzE,0BAAyB,GAAGD,CAAa,IAAIC,CAAa,GAC1D,kCAAiC,GAAGY,CAAK,IAAIC,CAAQ,IAAIW,GAAe,IAAI,GAE3E,SAAAA,EAAc,KACjB,GAEJ,KACA,OAAC,OAAI,UAAU,iDACZ,SAAAK,IAAW,IAAI,CAACmB,EAAMC,OACrB,OAAC,OAAgB,UAAU,OACzB,mBAAC,WACC,UAAU,uBACV,aAAa,sBACb,QAAQ,QACR,IAAKD,GAAM,SAAS,KAAO,GAC3B,OAAQA,GAAM,SAAS,IACzB,GAPQC,CAQV,CACD,EACH,GACF,EAGCtB,EAAQ,OAAS,MAChB,OAAC,OAAI,UAAU,iMACZ,SAAAA,EAAQ,IAAI,CAACuB,EAAGD,OACf,QAAC,EAAA3C,QAAM,SAAN,CACC,oBAAC,QACC,KAAM,EACN,aAAW,MACT,yIACF,EACA,KAAM4C,EAAE,MACV,EACCD,EAAQtB,EAAQ,OAAS,MAAK,OAAC,OAAI,aAAW,MAAG,sBAAsB,EAAG,IARxDsB,CASrB,CACD,EACH,EAIDjB,MACC,OAAC,cACC,QAASA,EACT,SAAUP,GAAiB,UAAU,IACrC,UAAWA,GAAiB,UAC5B,aAAc,IAAMQ,EAAW,EAAK,EACtC,GAEJ,EACF,CAEJ,CACF,EAEA5B,EAAW,YAAc,aAEzB,IAAOvB,MAAQ,cAAWuB,CAAU",
|
|
6
|
+
"names": ["HeroBanner_exports", "__export", "HeroBanner_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_gsap", "import_ScrollTrigger", "import_react_responsive", "import_react_intersection_observer", "import_ScrollLoadVideo", "import_components", "import_Countdown", "import_helpers", "import_Styles", "import_useExposure", "import_trackUrlRef", "import_button", "import_VideoModal", "componentType", "componentName", "PlayButtonAppendIcon", "size", "width", "height", "HeroBanner", "React", "data", "className", "onSecondaryButtonClick", "onPrimaryButtonClick", "ref", "title", "subtitle", "endDate", "endDate_tz", "dateFormat", "pcImage", "padImage", "mobileImage", "pcVideo", "padVideo", "mobileVideo", "isShowVideo", "primaryButton", "secondaryButton", "theme", "caption", "blockLink", "iconArray", "isMobile", "isPad", "visible", "setVisible", "inViewRef", "inView", "scrollTriggerRef", "bgTriggerRef", "boxTriggerRef", "bgRef", "boxRef", "gsap", "gsapResize", "clientHeight", "self", "value", "ScrollLoadVideo", "Countdown", "icon", "index", "c"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ButtonProps } from '../../components/button.js';
|
|
2
2
|
import type { Media, Theme } from '../../types/props.js';
|
|
3
3
|
export interface HeroBannerProps {
|
|
4
|
+
onSecondaryButtonClick?: () => void;
|
|
5
|
+
onPrimaryButtonClick?: () => void;
|
|
4
6
|
data: {
|
|
5
7
|
/** 主标题 */
|
|
6
8
|
title: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var
|
|
1
|
+
"use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of s(t))!d.call(e,i)&&i!==r&&n(e,i,{get:()=>t[i],enumerable:!(o=a(t,i))||o.enumerable});return e};var p=e=>l(n({},"__esModule",{value:!0}),e);var m={};module.exports=p(m);
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/HeroBanner/types.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ButtonProps } from '../../components/button.js'\nimport type { Media, Theme } from '../../types/props.js'\n\nexport interface HeroBannerProps {\n data: {\n /** \u4E3B\u6807\u9898 */\n title: string\n /** \u526F\u6807\u9898/\u63CF\u8FF0\u6587\u672C */\n subtitle: string\n /** \u7ED3\u675F\u65F6\u95F4\uFF08ISO \u5B57\u7B26\u4E32\uFF09 */\n endDate?: string\n /** \u7ED3\u675F\u65F6\u95F4\u65F6\u533A\uFF08\u5982: America/Los_Angeles\uFF09 */\n endDate_tz?: string\n dateFormat?: string\n /** \u56FE\u6807\u5217\u8868 */\n iconArray?: Array<any>\n pcImage: Media\n padImage?: Media\n mobileImage: Media\n pcVideo?: Media\n padVideo?: Media\n mobileVideo?: Media\n isShowVideo?: boolean\n blockLink?: string\n /** \u4E3B\u6309\u94AE\u6587\u672C\u548C\u914D\u7F6E */\n primaryButton?: {\n text: string\n link?: string\n } & Omit<ButtonProps, 'children'>\n /** \u6B21\u8981\u6309\u94AE\u6587\u672C\u548C\u914D\u7F6E */\n secondaryButton?: {\n text: string\n link?: string\n isShowPlayVideoButton?: boolean\n playVideoButtonText?: string\n playIcon?: boolean\n videoUrl?: Media\n youtubeId?: string\n } & Omit<ButtonProps, 'children'>\n /** \u4E3B\u9898 */\n theme?: Theme\n /** \u5927\u5C0F, \u9ED8\u8BA4default,\u5355banner, \u53EF\u9009sm, \u7528\u4E8E\u591Abanner\u573A\u666F */\n size?: 'default' | 'sm'\n /** \u5E95\u90E8\u4EA7\u54C1\u5217\u8868 */\n caption?: Array<{\n title: string\n }>\n }\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n}\n"],
|
|
4
|
+
"sourcesContent": ["import type { ButtonProps } from '../../components/button.js'\nimport type { Media, Theme } from '../../types/props.js'\n\nexport interface HeroBannerProps {\n onSecondaryButtonClick?: () => void\n onPrimaryButtonClick?: () => void\n data: {\n /** \u4E3B\u6807\u9898 */\n title: string\n /** \u526F\u6807\u9898/\u63CF\u8FF0\u6587\u672C */\n subtitle: string\n /** \u7ED3\u675F\u65F6\u95F4\uFF08ISO \u5B57\u7B26\u4E32\uFF09 */\n endDate?: string\n /** \u7ED3\u675F\u65F6\u95F4\u65F6\u533A\uFF08\u5982: America/Los_Angeles\uFF09 */\n endDate_tz?: string\n dateFormat?: string\n /** \u56FE\u6807\u5217\u8868 */\n iconArray?: Array<any>\n pcImage: Media\n padImage?: Media\n mobileImage: Media\n pcVideo?: Media\n padVideo?: Media\n mobileVideo?: Media\n isShowVideo?: boolean\n blockLink?: string\n /** \u4E3B\u6309\u94AE\u6587\u672C\u548C\u914D\u7F6E */\n primaryButton?: {\n text: string\n link?: string\n } & Omit<ButtonProps, 'children'>\n /** \u6B21\u8981\u6309\u94AE\u6587\u672C\u548C\u914D\u7F6E */\n secondaryButton?: {\n text: string\n link?: string\n isShowPlayVideoButton?: boolean\n playVideoButtonText?: string\n playIcon?: boolean\n videoUrl?: Media\n youtubeId?: string\n } & Omit<ButtonProps, 'children'>\n /** \u4E3B\u9898 */\n theme?: Theme\n /** \u5927\u5C0F, \u9ED8\u8BA4default,\u5355banner, \u53EF\u9009sm, \u7528\u4E8E\u591Abanner\u573A\u666F */\n size?: 'default' | 'sm'\n /** \u5E95\u90E8\u4EA7\u54C1\u5217\u8868 */\n caption?: Array<{\n title: string\n }>\n }\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n}\n"],
|
|
5
5
|
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
6
|
"names": ["types_exports", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -117,8 +117,10 @@ export interface ProductContextType {
|
|
|
117
117
|
discount?: DiscountData;
|
|
118
118
|
buyNowLoading?: boolean;
|
|
119
119
|
addToCartLoading?: boolean;
|
|
120
|
+
addOrder?: Array<'bundle' | 'gift' | 'exchange'>;
|
|
121
|
+
setAddOrder?: Dispatch<SetStateAction<Array<'bundle' | 'gift' | 'exchange'>>>;
|
|
120
122
|
}
|
|
121
123
|
export declare const BizProductContext: React.Context<ProductContextType>;
|
|
122
124
|
export declare const useBizProductContext: () => ProductContextType;
|
|
123
|
-
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, creditsRedemptionAmount, memberFunctionResult, openModal, openSignInPopup, openAuthCodePopup, openSignUpPopup, renderInstallments, onUseCouponChange, onUseMemberDiscountChange, discount, buyNowLoading, addToCartLoading, }: PropsWithChildren<Omit<ProductContextType, 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts'>>) => import("react/jsx-runtime").JSX.Element;
|
|
125
|
+
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, creditsRedemptionAmount, memberFunctionResult, openModal, openSignInPopup, openAuthCodePopup, openSignUpPopup, renderInstallments, onUseCouponChange, onUseMemberDiscountChange, discount, buyNowLoading, addToCartLoading, }: PropsWithChildren<Omit<ProductContextType, 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts' | 'addOrder' | 'setAddOrder'>>) => import("react/jsx-runtime").JSX.Element;
|
|
124
126
|
export default ProductProvider;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var Z=(t,e)=>{for(var r in e)c(t,r,{get:e[r],enumerable:!0})},$=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of X(e))!Y.call(t,o)&&o!==r&&c(t,o,{get:()=>e[o],enumerable:!(a=Q(e,o))||a.enumerable});return t};var ee=t=>$(c({},"__esModule",{value:!0}),t);var re={};Z(re,{BizProductContext:()=>i,default:()=>oe,useBizProductContext:()=>te});module.exports=ee(re);var p=require("react/jsx-runtime"),n=require("react");const i=(0,n.createContext)({}),te=()=>{if(!(0,n.useContext)(i))throw new Error("useProductContext must be used in <ProductProvider>");return(0,n.useContext)(i)},ne=({product:t,isLogin:e,profile:r,isMobile:a,isDesktop:o,children:l,renderRating:m,freeGift:P,exchangePurchase:b,bundle:g,checkedBundle:h,checkedGift:y,setCheckedBundle:f,setCheckedGift:C,checkedExchangePurchase:v,setCheckedExchangePurchase:S,variant:d,selectedOptions:x,setSelectedOptions:D,compareData:B,coupon:R,finalPrice:A,comparePrice:O,totalSavings:_,savingDetail:k,setSavingDetail:V,selectedVariants:M,onAddToCart:w,onBuyNow:F,creditsRedemptionAmount:T,memberFunctionResult:G,openModal:J,openSignInPopup:L,openAuthCodePopup:I,openSignUpPopup:N,renderInstallments:U,onUseCouponChange:E,onUseMemberDiscountChange:W,discount:j,buyNowLoading:z,addToCartLoading:q})=>{const[H,u]=(0,n.useState)({}),[K,s]=(0,n.useState)([]);return(0,n.useEffect)(()=>{d?.id&&(u({bundle:{value:void 0,canOperate:!0},gift:{value:void 0,canOperate:!0},exchange:{value:void 0,canOperate:!0}}),s([]))},[d?.id]),(0,p.jsx)(i.Provider,{value:{product:t,variant:d,isMobile:a,isDesktop:o,isLogin:e,profile:r,coupon:R,renderRating:m,finalPrice:A,comparePrice:O,savingDetail:k,setSavingDetail:V,totalSavings:_,selectedOptions:x,setSelectedOptions:D,freeGift:P,exchangePurchase:b,checkedGift:y,setCheckedGift:C,checkedBundle:h,setCheckedBundle:f,bundle:g,compareData:B,selectedVariants:M,onAddToCart:w,onBuyNow:F,joinedRecommendBuyProducts:H,setJoinedRecommendBuyProducts:u,checkedExchangePurchase:v,setCheckedExchangePurchase:S,creditsRedemptionAmount:T,memberFunctionResult:G,openModal:J,openSignInPopup:L,openAuthCodePopup:I,openSignUpPopup:N,renderInstallments:U,onUseCouponChange:E,onUseMemberDiscountChange:W,discount:j,buyNowLoading:z,addToCartLoading:q,addOrder:K,setAddOrder:s},children:l})};var oe=ne;
|
|
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} 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'\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}\nexport interface ProductContextType {\n isLogin?: boolean\n isMobile?: boolean\n isDesktop?: boolean\n product: Product\n profile?: UserProfile\n variant: ProductVariant\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 creditsRedemptionAmount?: number\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}\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 creditsRedemptionAmount,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n openSignUpPopup,\n renderInstallments,\n onUseCouponChange,\n onUseMemberDiscountChange,\n discount,\n buyNowLoading,\n addToCartLoading,\n}: PropsWithChildren<Omit<ProductContextType, 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts'>>) => {\n const [joinedRecommendBuyProducts, setJoinedRecommendBuyProducts] = useState<JoinedRecommendBuyProducts>({})\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 }\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 creditsRedemptionAmount,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n openSignUpPopup,\n renderInstallments,\n onUseCouponChange,\n onUseMemberDiscountChange,\n discount,\n buyNowLoading,\n addToCartLoading,\n }}\n >\n {children}\n </BizProductContext.Provider>\n )\n}\n\nexport default ProductProvider\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["BizProductProvider_exports", "__export", "BizProductContext", "BizProductProvider_default", "useBizProductContext", "__toCommonJS", "import_jsx_runtime", "import_react", "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", "creditsRedemptionAmount", "memberFunctionResult", "openModal", "openSignInPopup", "openAuthCodePopup", "openSignUpPopup", "renderInstallments", "onUseCouponChange", "onUseMemberDiscountChange", "discount", "buyNowLoading", "addToCartLoading", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts"]
|
|
4
|
+
"sourcesContent": ["import React, {\n createContext,\n useCallback,\n useContext,\n type Dispatch,\n type SetStateAction,\n type PropsWithChildren,\n useState,\n useEffect,\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'\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}\nexport interface ProductContextType {\n isLogin?: boolean\n isMobile?: boolean\n isDesktop?: boolean\n product: Product\n profile?: UserProfile\n variant: ProductVariant\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 creditsRedemptionAmount?: number\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 creditsRedemptionAmount,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n openSignUpPopup,\n renderInstallments,\n onUseCouponChange,\n onUseMemberDiscountChange,\n discount,\n buyNowLoading,\n addToCartLoading,\n}: PropsWithChildren<Omit<ProductContextType, 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts' | 'addOrder' | 'setAddOrder'>>) => {\n const [joinedRecommendBuyProducts, setJoinedRecommendBuyProducts] = useState<JoinedRecommendBuyProducts>({})\n const [addOrder, setAddOrder] = useState<Array<'bundle' | 'gift' | 'exchange'>>([])\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 creditsRedemptionAmount,\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 }}\n >\n {children}\n </BizProductContext.Provider>\n )\n}\n\nexport default ProductProvider\n"],
|
|
5
|
+
"mappings": "0aAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,uBAAAE,EAAA,YAAAC,GAAA,yBAAAC,KAAA,eAAAC,GAAAL,IAmPI,IAAAM,EAAA,6BAnPJC,EASO,iBA6JA,MAAML,KAAoB,iBAAkC,CAAC,CAAuB,EAE9EE,GAAuB,IAAM,CAExC,GAAI,IADY,cAAWF,CAAiB,EAE1C,MAAM,IAAI,MAAM,qDAAqD,EAEvE,SAAO,cAAWA,CAAiB,CACrC,EAEMM,GAAkB,CAAC,CACvB,QAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,SAAAC,EACA,aAAAC,EACA,SAAAC,EACA,iBAAAC,EACA,OAAAC,EACA,cAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,wBAAAC,EACA,2BAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,YAAAC,EACA,OAAAC,EACA,WAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,YAAAC,EACA,SAAAC,EACA,wBAAAC,EACA,qBAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,kBAAAC,EACA,0BAAAC,EACA,SAAAC,EACA,cAAAC,EACA,iBAAAC,CACF,IAAgJ,CAC9I,KAAM,CAACC,EAA4BC,CAA6B,KAAI,YAAqC,CAAC,CAAC,EACrG,CAACC,EAAUC,CAAW,KAAI,YAAgD,CAAC,CAAC,EAElF,sBAAU,IAAM,CACV5B,GAAS,KACX0B,EAA8B,CAC5B,OAAQ,CACN,MAAO,OACP,WAAY,EACd,EACA,KAAM,CACJ,MAAO,OACP,WAAY,EACd,EACA,SAAU,CACR,MAAO,OACP,WAAY,EACd,CACF,CAAC,EACDE,EAAY,CAAC,CAAC,EAElB,EAAG,CAAC5B,GAAS,EAAE,CAAC,KAGd,OAACvB,EAAkB,SAAlB,CACC,MAAO,CACL,QAAAO,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,2BAAAa,EACA,8BAAAC,EACA,wBAAA5B,EACA,2BAAAC,EACA,wBAAAc,EACA,qBAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,kBAAAC,EACA,0BAAAC,EACA,SAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,SAAAG,EACA,YAAAC,CACF,EAEC,SAAAvC,EACH,CAEJ,EAEA,IAAOX,GAAQK",
|
|
6
|
+
"names": ["BizProductProvider_exports", "__export", "BizProductContext", "BizProductProvider_default", "useBizProductContext", "__toCommonJS", "import_jsx_runtime", "import_react", "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", "creditsRedemptionAmount", "memberFunctionResult", "openModal", "openSignInPopup", "openAuthCodePopup", "openSignUpPopup", "renderInstallments", "onUseCouponChange", "onUseMemberDiscountChange", "discount", "buyNowLoading", "addToCartLoading", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "addOrder", "setAddOrder"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var
|
|
1
|
+
"use strict";var n=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var f=(o,t)=>{for(var l in t)n(o,l,{get:t[l],enumerable:!0})},g=(o,t,l,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of m(t))!d.call(o,i)&&i!==l&&n(o,i,{get:()=>t[i],enumerable:!(p=c(t,i))||p.enumerable});return o};var u=o=>g(n({},"__esModule",{value:!0}),o);var N={};f(N,{default:()=>v});module.exports=u(N);var e=require("react/jsx-runtime"),a=require("../../../../components/index.js"),r=require("../../../AiuiProvider/index.js"),x=require("../../../../helpers/index.js");const h=o=>{const{className:t,setOpenShippingPolicyModal:l,metafields:p}=o,{trackingData:i}=(0,r.useAiuiContext)(),s=i?.common?.copywriting;return(0,e.jsxs)("div",{tabIndex:-1,className:(0,x.cn)("from-4.29% to-101.05% relative items-start gap-[16px] overflow-hidden rounded-xl laptop:rounded-2xl bg-gradient-to-r from-[rgba(215,245,254,0.24)] to-[rgba(215,245,254,0.80)] p-4 laptop:py-5 text-[#1F2021] md:py-[16px]","flex flex-col",t),children:[(0,e.jsx)(a.Picture,{source:p?.shippingPolicyIcon,className:"size-[150px] -bottom-10 absolute z-[1] -right-10"}),(0,e.jsxs)("div",{className:"flex w-full items-start justify-between",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3 laptop:gap-2 lg-desktop:gap-4",children:[(0,e.jsx)(a.Text,{size:2,className:"text-[14px] laptop:text-[16px] lg-desktop:text-[18px]",children:p?.shippingPolicyTitle}),(0,e.jsx)(a.Text,{size:1,as:"p",className:"text-[12px] text-[#6D6D6F] laptop:text-[14px]",children:p?.loginBeforeCheckoutNote})]}),(0,e.jsx)(a.Button,{variant:"link",className:"hidden !p-0 whitespace-nowrap laptop:inline-flex",onClick:()=>{l(!0)},children:s?.learnMore})]}),(0,e.jsx)(a.Button,{variant:"link",className:"inline-flex p-0 laptop:hidden",onClick:()=>{l(!0)},children:s?.learnMore})]})};var v=h;
|
|
2
2
|
//# sourceMappingURL=LearnMore.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/biz-components/Listing/components/PaidShipping/LearnMore.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Button, Text } from '../../../../components/index.js'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { cn } from '../../../../helpers/index.js'\n\nconst LearnMore = (props: any) => {\n const { className, setOpenShippingPolicyModal, metafields } = props\n const { trackingData } = useAiuiContext()\n const shopCommon = trackingData?.common?.copywriting\n\n return (\n <div\n tabIndex={-1}\n className={cn(\n 'from-4.29% to-101.05% relative items-start gap-[16px] overflow-hidden rounded-xl laptop:rounded-2xl bg-gradient-to-r from-[rgba(215,245,254,0.24)] to-[rgba(215,245,254,0.80)] p-4 laptop:py-
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
4
|
+
"sourcesContent": ["import { Button, Picture, Text } from '../../../../components/index.js'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { cn } from '../../../../helpers/index.js'\n\nconst LearnMore = (props: any) => {\n const { className, setOpenShippingPolicyModal, metafields } = props\n const { trackingData } = useAiuiContext()\n const shopCommon = trackingData?.common?.copywriting\n\n return (\n <div\n tabIndex={-1}\n className={cn(\n 'from-4.29% to-101.05% relative items-start gap-[16px] overflow-hidden rounded-xl laptop:rounded-2xl bg-gradient-to-r from-[rgba(215,245,254,0.24)] to-[rgba(215,245,254,0.80)] p-4 laptop:py-5 text-[#1F2021] md:py-[16px]',\n 'flex flex-col',\n className\n )}\n >\n <Picture source={metafields?.shippingPolicyIcon} className=\"size-[150px] -bottom-10 absolute z-[1] -right-10\" />\n <div className=\"flex w-full items-start justify-between\">\n <div className=\"flex flex-col gap-3 laptop:gap-2 lg-desktop:gap-4\">\n <Text size={2} className=\"text-[14px] laptop:text-[16px] lg-desktop:text-[18px]\">\n {metafields?.shippingPolicyTitle}\n </Text>\n <Text size={1} as=\"p\" className=\"text-[12px] text-[#6D6D6F] laptop:text-[14px]\">\n {metafields?.loginBeforeCheckoutNote}\n </Text>\n </div>\n <Button\n variant=\"link\"\n className=\"hidden !p-0 whitespace-nowrap laptop:inline-flex\"\n onClick={() => {\n setOpenShippingPolicyModal(true)\n }}\n >\n {shopCommon?.learnMore}\n </Button>\n </div>\n\n <Button\n variant=\"link\"\n className=\"inline-flex p-0 laptop:hidden\"\n onClick={() => {\n setOpenShippingPolicyModal(true)\n }}\n >\n {shopCommon?.learnMore}\n </Button>\n </div>\n )\n}\n\nexport default LearnMore\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAkBM,IAAAI,EAAA,6BAlBNC,EAAsC,2CACtCC,EAA+B,0CAC/BC,EAAmB,wCAEnB,MAAMC,EAAaC,GAAe,CAChC,KAAM,CAAE,UAAAC,EAAW,2BAAAC,EAA4B,WAAAC,CAAW,EAAIH,EACxD,CAAE,aAAAI,CAAa,KAAI,kBAAe,EAClCC,EAAaD,GAAc,QAAQ,YAEzC,SACE,QAAC,OACC,SAAU,GACV,aAAW,MACT,6NACA,gBACAH,CACF,EAEA,oBAAC,WAAQ,OAAQE,GAAY,mBAAoB,UAAU,mDAAmD,KAC9G,QAAC,OAAI,UAAU,0CACb,qBAAC,OAAI,UAAU,oDACb,oBAAC,QAAK,KAAM,EAAG,UAAU,wDACtB,SAAAA,GAAY,oBACf,KACA,OAAC,QAAK,KAAM,EAAG,GAAG,IAAI,UAAU,gDAC7B,SAAAA,GAAY,wBACf,GACF,KACA,OAAC,UACC,QAAQ,OACR,UAAU,mDACV,QAAS,IAAM,CACbD,EAA2B,EAAI,CACjC,EAEC,SAAAG,GAAY,UACf,GACF,KAEA,OAAC,UACC,QAAQ,OACR,UAAU,gCACV,QAAS,IAAM,CACbH,EAA2B,EAAI,CACjC,EAEC,SAAAG,GAAY,UACf,GACF,CAEJ,EAEA,IAAOZ,EAAQM",
|
|
6
6
|
"names": ["LearnMore_exports", "__export", "LearnMore_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_AiuiProvider", "import_helpers", "LearnMore", "props", "className", "setOpenShippingPolicyModal", "metafields", "trackingData", "shopCommon"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var N=(e,t)=>{for(var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var N=(e,t)=>{for(var a in t)d(e,a,{get:t[a],enumerable:!0})},E=(e,t,a,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of y(t))!h.call(e,r)&&r!==a&&d(e,r,{get:()=>t[r],enumerable:!(l=v(t,r))||l.enumerable});return e};var k=e=>E(d({},"__esModule",{value:!0}),e);var D={};N(D,{default:()=>C});module.exports=k(D);var o=require("react/jsx-runtime"),x=require("../../utils/index.js"),s=require("../../../AiuiProvider/index.js"),n=require("../../../../components/index.js"),p=require("../../../../helpers/index.js"),m=require("./type.js");const w=({item:e,index:t,active:a,toggleShipping:l,currencyCode:r,metafields:c,className:b=""})=>{const{trackingData:u,locale:f="us"}=(0,s.useAiuiContext)(),g=u?.common?.copywriting;return(0,o.jsxs)("div",{role:"button",tabIndex:0,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&l(e,t)},className:(0,p.cn)("relative flex cursor-pointer gap-[16px] overflow-hidden rounded-xl laptop:rounded-2xl border-[2px] border-[#E8E8E8] p-4 laptop:py-5 text-[#1F2021]",{"cursor-not-allowed opacity-60":e.disabled,"border-brand":a},b),onClick:()=>l(e,t),children:[(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsx)(n.Text,{className:(0,p.cn)("text-[14px] font-bold leading-[1.4] laptop:text-[16px] lg-desktop:text-[18px]",{}),as:"p",html:e.title}),(0,o.jsx)(n.Text,{className:(0,p.cn)("mt-[8px] text-[12px] font-bold leading-[1.4] text-[#6D6D6F] laptop:text-[14px]",{}),as:"p",html:e.subtitle})]}),(0,o.jsx)(n.Text,{className:(0,p.cn)("relative text-xl font-bold h-fit my-auto",{}),as:"p",html:e.price?(0,x.formatPrice)({amount:e.price,currencyCode:r,locale:f,removeTrailingZeros:!0}):g?.free}),e.mode!==m.ShippingMethodMode.FREE&&(0,o.jsx)("div",{className:(0,p.cn)("absolute -right-[1px] -top-[1px] rounded-bl-[8px] rounded-tr-[8px] bg-brand px-[8px] py-[3px] text-[12px] font-bold leading-[1.4] text-white"),children:c?.memberOnly})]})};var C=w;
|
|
2
2
|
//# sourceMappingURL=ShippingMethod.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/biz-components/Listing/components/PaidShipping/ShippingMethod.tsx"],
|
|
4
|
-
"sourcesContent": ["import { formatPrice } from '../../utils/index.js'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { Text } from '../../../../components/index.js'\nimport { cn } from '../../../../helpers/index.js'\nimport { ShippingMethodMode } from './type.js'\n\nconst ShippingMethod = ({\n item,\n index,\n active,\n toggleShipping,\n currencyCode,\n metafields,\n className = '',\n}: {\n item: any\n index: number\n active: boolean\n toggleShipping: (item: any, index: number) => void\n currencyCode: string\n metafields: any\n className?: string\n}) => {\n const { trackingData, locale = 'us' } = useAiuiContext()\n const shopCommon = trackingData?.common?.copywriting\n\n return (\n <div\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n toggleShipping(item, index)\n }\n }}\n className={cn(\n 'relative flex cursor-pointer
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA6CM,IAAAI,EAAA,6BA7CNC,EAA4B,gCAC5BC,EAA+B,0CAC/BC,EAAqB,2CACrBC,EAAmB,wCACnBC,EAAmC,qBAEnC,MAAMC,EAAiB,CAAC,CACtB,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,eAAAC,EACA,aAAAC,EACA,WAAAC,EACA,UAAAC,EAAY,EACd,IAQM,CACJ,KAAM,CAAE,aAAAC,EAAc,OAAAC,EAAS,IAAK,KAAI,kBAAe,EACjDC,EAAaF,GAAc,QAAQ,YAEzC,SACE,QAAC,OACC,KAAK,SACL,SAAU,EACV,UAAWG,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCP,EAAeH,EAAMC,CAAK,CAE9B,EACA,aAAW,MACT,
|
|
4
|
+
"sourcesContent": ["import { formatPrice } from '../../utils/index.js'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { Text } from '../../../../components/index.js'\nimport { cn } from '../../../../helpers/index.js'\nimport { ShippingMethodMode } from './type.js'\n\nconst ShippingMethod = ({\n item,\n index,\n active,\n toggleShipping,\n currencyCode,\n metafields,\n className = '',\n}: {\n item: any\n index: number\n active: boolean\n toggleShipping: (item: any, index: number) => void\n currencyCode: string\n metafields: any\n className?: string\n}) => {\n const { trackingData, locale = 'us' } = useAiuiContext()\n const shopCommon = trackingData?.common?.copywriting\n\n return (\n <div\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n toggleShipping(item, index)\n }\n }}\n className={cn(\n 'relative flex cursor-pointer gap-[16px] overflow-hidden rounded-xl laptop:rounded-2xl border-[2px] border-[#E8E8E8] p-4 laptop:py-5 text-[#1F2021]',\n {\n 'cursor-not-allowed opacity-60': item.disabled,\n 'border-brand': active,\n },\n className\n )}\n onClick={() => toggleShipping(item, index)}\n >\n <div className=\"relative\">\n <Text\n className={cn('text-[14px] font-bold leading-[1.4] laptop:text-[16px] lg-desktop:text-[18px]', {})}\n as=\"p\"\n html={item.title}\n />\n <Text\n className={cn('mt-[8px] text-[12px] font-bold leading-[1.4] text-[#6D6D6F] laptop:text-[14px]', {})}\n as=\"p\"\n html={item.subtitle}\n />\n </div>\n\n <Text\n className={cn('relative text-xl font-bold h-fit my-auto', {})}\n as=\"p\"\n html={\n item.price\n ? formatPrice({\n amount: item.price,\n currencyCode,\n locale,\n removeTrailingZeros: true,\n })\n : shopCommon?.free\n }\n />\n {item.mode !== ShippingMethodMode.FREE && (\n <div\n className={cn(\n 'absolute -right-[1px] -top-[1px] rounded-bl-[8px] rounded-tr-[8px] bg-brand px-[8px] py-[3px] text-[12px] font-bold leading-[1.4] text-white'\n )}\n >\n {metafields?.memberOnly}\n </div>\n )}\n </div>\n )\n}\n\nexport default ShippingMethod"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA6CM,IAAAI,EAAA,6BA7CNC,EAA4B,gCAC5BC,EAA+B,0CAC/BC,EAAqB,2CACrBC,EAAmB,wCACnBC,EAAmC,qBAEnC,MAAMC,EAAiB,CAAC,CACtB,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,eAAAC,EACA,aAAAC,EACA,WAAAC,EACA,UAAAC,EAAY,EACd,IAQM,CACJ,KAAM,CAAE,aAAAC,EAAc,OAAAC,EAAS,IAAK,KAAI,kBAAe,EACjDC,EAAaF,GAAc,QAAQ,YAEzC,SACE,QAAC,OACC,KAAK,SACL,SAAU,EACV,UAAWG,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCP,EAAeH,EAAMC,CAAK,CAE9B,EACA,aAAW,MACT,qJACA,CACE,gCAAiCD,EAAK,SACtC,eAAgBE,CAClB,EACAI,CACF,EACA,QAAS,IAAMH,EAAeH,EAAMC,CAAK,EAEzC,qBAAC,OAAI,UAAU,WACb,oBAAC,QACC,aAAW,MAAG,gFAAiF,CAAC,CAAC,EACjG,GAAG,IACH,KAAMD,EAAK,MACb,KACA,OAAC,QACC,aAAW,MAAG,iFAAkF,CAAC,CAAC,EAClG,GAAG,IACH,KAAMA,EAAK,SACb,GACF,KAEA,OAAC,QACC,aAAW,MAAG,2CAA4C,CAAC,CAAC,EAC5D,GAAG,IACH,KACEA,EAAK,SACD,eAAY,CACV,OAAQA,EAAK,MACb,aAAAI,EACA,OAAAI,EACA,oBAAqB,EACvB,CAAC,EACDC,GAAY,KAEpB,EACCT,EAAK,OAAS,qBAAmB,SAChC,OAAC,OACC,aAAW,MACT,8IACF,EAEC,SAAAK,GAAY,WACf,GAEJ,CAEJ,EAEA,IAAOd,EAAQQ",
|
|
6
6
|
"names": ["ShippingMethod_exports", "__export", "ShippingMethod_default", "__toCommonJS", "import_jsx_runtime", "import_utils", "import_AiuiProvider", "import_components", "import_helpers", "import_type", "ShippingMethod", "item", "index", "active", "toggleShipping", "currencyCode", "metafields", "className", "trackingData", "locale", "shopCommon", "e"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var V=Object.create;var y=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var j=(i,p)=>{for(var n in p)y(i,n,{get:p[n],enumerable:!0})},T=(i,p,n,d)=>{if(p&&typeof p=="object"||typeof p=="function")for(let l of F(p))!B.call(i,l)&&l!==n&&y(i,l,{get:()=>p[l],enumerable:!(d=W(p,l))||d.enumerable});return i};var P=(i,p,n)=>(n=i!=null?V($(i)):{},T(p||!i||!i.__esModule?y(n,"default",{value:i,enumerable:!0}):n,i)),q=i=>T(y({},"__esModule",{value:!0}),i);var J={};j(J,{default:()=>H});module.exports=q(J);var r=require("react/jsx-runtime"),x=require("../../../../components/index.js"),o=require("react"),w=require("../../../../helpers"),_=P(require("./ShippingMethod")),k=require("./ShippingPolicyModal"),M=require("./utils"),C=P(require("./LearnMore")),N=require("../../BizProductProvider.js"),A=require("../../../../shared/Styles.js");const G=({metafields:i,productList:p,onShippingInfoChange:n,variant:d,className:l})=>{const{isLogin:D,openSignInPopup:L}=(0,N.useBizProductContext)(),[O,f]=(0,o.useState)(!1),[S,z]=(0,o.useState)(!1),[E,b]=(0,o.useState)(null),v=(0,o.useMemo)(()=>p.reduce((e,t)=>e+(t?.variant?.weight||0),0),[p]),c=(0,o.useCallback)((e,t,s)=>({id:`${e.__code}__${e.price}`,code:e.__code,mode:e.__mode,title:e.title,disabled:!(0,M.isWeightAvailable)(t,e),price:e.price,subtitle:e.subtitle,tag:s!==0?i?.memberOnly:"",error:(0,M.isWeightAvailable)(t,e)?"":i.overWeightError}),[i?.memberOnly,i.overWeightError]),h=(0,o.useMemo)(()=>{const e=i?.list?.map((t,s)=>c(t,v,s));return e?.reduce((t,s)=>{const
|
|
1
|
+
"use strict";var V=Object.create;var y=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var j=(i,p)=>{for(var n in p)y(i,n,{get:p[n],enumerable:!0})},T=(i,p,n,d)=>{if(p&&typeof p=="object"||typeof p=="function")for(let l of F(p))!B.call(i,l)&&l!==n&&y(i,l,{get:()=>p[l],enumerable:!(d=W(p,l))||d.enumerable});return i};var P=(i,p,n)=>(n=i!=null?V($(i)):{},T(p||!i||!i.__esModule?y(n,"default",{value:i,enumerable:!0}):n,i)),q=i=>T(y({},"__esModule",{value:!0}),i);var J={};j(J,{default:()=>H});module.exports=q(J);var r=require("react/jsx-runtime"),x=require("../../../../components/index.js"),o=require("react"),w=require("../../../../helpers"),_=P(require("./ShippingMethod")),k=require("./ShippingPolicyModal"),M=require("./utils"),C=P(require("./LearnMore")),N=require("../../BizProductProvider.js"),A=require("../../../../shared/Styles.js");const G=({metafields:i,productList:p,onShippingInfoChange:n,variant:d,className:l})=>{const{isLogin:D,openSignInPopup:L}=(0,N.useBizProductContext)(),[O,f]=(0,o.useState)(!1),[S,z]=(0,o.useState)(!1),[E,b]=(0,o.useState)(null),v=(0,o.useMemo)(()=>p.reduce((e,t)=>e+(t?.variant?.weight||0),0),[p]),c=(0,o.useCallback)((e,t,s)=>({id:`${e.__code}__${e.price}`,code:e.__code,mode:e.__mode,title:e.title,disabled:!(0,M.isWeightAvailable)(t,e),price:e.price,subtitle:e.subtitle,tag:s!==0?i?.memberOnly:"",error:(0,M.isWeightAvailable)(t,e)?"":i.overWeightError}),[i?.memberOnly,i.overWeightError]),h=(0,o.useMemo)(()=>{const e=i?.list?.map((t,s)=>c(t,v,s));return e?.reduce((t,s)=>{const u=e.filter(a=>a.code==s.code);let m;return u.every(a=>a.disabled)?m=u[u.length-1]:m=u.find(a=>!a.disabled),t.find(a=>m.id===a.id)?t:[...t,m]},[])},[c,i?.list,v]),g=(0,o.useCallback)(e=>{n({selected_delivery_code:e.code,selected_delivery_mode:e.mode})},[n]);(0,o.useEffect)(()=>{if(i?.list?.length>0&&!S){const e=c(i?.list[0],0,0);b(e),g(e),z(!0)}},[c,i?.list,g,S]);const I=(0,o.useCallback)(e=>{e.disabled||(b(e),g(e))},[D,h,d.sku,g,L]);return(0,r.jsxs)("div",{id:"ipc-product-paid-shipping",className:(0,w.cn)(" mt-16 desktop:mt-[96px] lg-desktop:mt-[128px] px-4 tablet:px-0 tablet:px-8 laptop:px-16 desktop:px-0",l),children:[(0,r.jsx)("div",{className:"flex flex-wrap justify-between space-x-2 md:space-x-1",children:(0,r.jsx)(x.Text,{className:"font-bold leading-[1.2] text-[#1F2021] text-[16px]",html:i?.title})}),(0,r.jsxs)("div",{className:"lg-desktop:mt-[16px] flex flex-wrap gap-[12px] overflow-hidden mt-[12px] desktop:flex-nowrap",children:[h.map((e,t)=>(0,r.jsx)(_.default,{index:t,item:e,active:E?.code===e.code,toggleShipping:()=>I(e),currencyCode:d.price.currencyCode,metafields:i,className:"w-full laptop:w-[calc(50%-6px)] desktop:flex-1"},t)),(0,r.jsx)(C.default,{setOpenShippingPolicyModal:f,metafields:i,className:"w-full laptop:w-[calc(50%-6px)] desktop:w-[calc(33.33%-16px)] lg-desktop:w-[calc(33.33%-24px)]"})]}),h.find(e=>e?.error)&&(0,r.jsx)(x.Text,{className:"desktop:mt-[16px] font-bold leading-[1.4] text-[#D41435] mt-[12px]",html:h.find(e=>e.error)?.error,as:"p"}),i?.seeAvailableArea&&(0,r.jsx)(x.Text,{as:"div",className:"mt-[16px] font-bold leading-[1.4] text-[#1D1D1F] [&_a]:underline",html:i?.seeAvailableArea}),i?.shippingPolicy&&(0,r.jsx)(k.ShippingPolicyModal,{data:i?.shippingPolicy,onClose:()=>f(!1),open:O})]})};var H=(0,A.withLayout)(G);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/biz-components/Listing/components/PaidShipping/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Container, Text } from '../../../../components/index.js'\nimport type { Product, ProductVariant } from '../../types/product'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport { cn } from '../../../../helpers'\n\nimport ShippingMethod from './ShippingMethod'\nimport { ShippingPolicyModal } from './ShippingPolicyModal'\nimport type { DeliveryCustom, shippingMetafields, ShippingMethodType } from './type'\nimport { isWeightAvailable } from './utils'\nimport LearnMore from './LearnMore'\nimport { useBizProductContext } from '../../BizProductProvider.js'\nimport { withLayout } from '../../../../shared/Styles.js'\n\nconst PaidShipping = ({\n metafields,\n productList,\n onShippingInfoChange,\n variant,\n className,\n}: {\n metafields: any\n productList: Array<Product & { variant: ProductVariant }>\n variant: ProductVariant\n onShippingInfoChange: (deliveryCustom: DeliveryCustom) => void\n className?: string\n}) => {\n const { isLogin, openSignInPopup } = useBizProductContext()\n const [openShippingPolicyModal, setOpenShippingPolicyModal] = useState(false)\n const [init, setInit] = useState(false)\n\n const [selectedMethod, setSelectedMethod] = useState<ShippingMethodType | null>(null)\n\n const weight = useMemo(() => {\n return productList.reduce((acc, product) => acc + (product?.variant?.weight || 0), 0)\n }, [productList])\n\n const normalizedMethod = useCallback(\n (method: shippingMetafields, weight: number, index: number) => {\n return {\n id: `${method.__code}__${method.price}`,\n code: method.__code,\n mode: method.__mode,\n title: method.title,\n disabled: !isWeightAvailable(weight, method),\n price: method.price,\n subtitle: method.subtitle,\n tag: index !== 0 ? metafields?.memberOnly : '',\n error: !isWeightAvailable(weight, method) ? metafields.overWeightError : '',\n }\n },\n [metafields?.memberOnly, metafields.overWeightError]\n )\n\n const list = useMemo(() => {\n const normalizedList: ShippingMethodType[] = metafields?.list?.map((method: shippingMetafields, index: number) =>\n normalizedMethod(method, weight, index)\n )\n\n return normalizedList?.reduce((prev: ShippingMethodType[], method: ShippingMethodType) => {\n // \u5982\u679C\u8D85\u91CD\uFF0C\u540C\u4E00\u4E2A\u7269\u6D41\u9009\u9879\u7C7B\u578B\u4E0B\uFF0C\u5C55\u793A\u5176\u4E2D\u4E00\u4E2A\u4E14\u4E0D\u53EF\u9009\n const sameTypeMethod = normalizedList.filter((m: ShippingMethodType) => m.code == method.code)\n let availableMethod: ShippingMethodType\n // \u6240\u6709\u7269\u6D41\u9009\u9879\u90FD\u4E0D\u53EF\u9009\n if (sameTypeMethod.every((m: ShippingMethodType) => m.disabled)) {\n availableMethod = sameTypeMethod[sameTypeMethod.length - 1]\n } else {\n // \u53EF\u9009\u7269\u6D41\u9009\u9879\n availableMethod = sameTypeMethod.find((m: ShippingMethodType) => !m.disabled)!\n }\n // \u5F53\u524D\u7269\u6D41\u9009\u9879\u5DF2\u5B58\u5728\n const hasSameMethod = prev.find((m: ShippingMethodType) => availableMethod.id === m.id)\n if (!hasSameMethod) {\n return [...prev, availableMethod]\n } else {\n return prev\n }\n }, [] as ShippingMethodType[])\n }, [normalizedMethod, metafields?.list, weight])\n\n const handleChangeShippingInfo = useCallback(\n (selectedMethod: ShippingMethodType) => {\n onShippingInfoChange({\n selected_delivery_code: selectedMethod.code,\n selected_delivery_mode: selectedMethod.mode,\n })\n },\n [onShippingInfoChange]\n )\n\n useEffect(() => {\n // \u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\u7269\u6D41\u9009\u9879\n if (metafields?.list?.length > 0 && !init) {\n const standardShippingMethod = normalizedMethod(metafields?.list[0], 0, 0)\n setSelectedMethod(standardShippingMethod)\n handleChangeShippingInfo(standardShippingMethod)\n setInit(true)\n }\n }, [normalizedMethod, metafields?.list, handleChangeShippingInfo, init])\n\n const toggleShipping = useCallback(\n (method: ShippingMethodType) => {\n if (method.disabled) {\n return\n }\n setSelectedMethod(method)\n handleChangeShippingInfo(method)\n // gaTrack({\n // event: 'ga4Event',\n // event_name: 'lp_button',\n // member_active_status: isLogin ? 'active' : 'not active', //\u7528\u4E8E\u8F93\u5165code\u6FC0\u6D3B\u4F1A\u5458\u5F39'\u7A97\u7684\u6309\u94AE\uFF0C\u533A\u5206\u4F1A\u5458\u6FC0\u6D3B\u72B6\u6001\uFF0C\u4F20active\u6216not active\n // event_parameters: {\n // page_group: 'Product Detail Page' + variant.sku, //\u5982\u679C\u662F\u9996\u9875\uFF0C\u5219\u4F20\"Home Page\";\u5982\u679C\u662Flisting\u7684\u9996\u5C4F\u6309\u94AE\uFF0C\u4F20Product Detail Page+$SKU\n // position: 'masterbanner1', //\u4F4D\u7F6E\u6807\u8BB0\u3002\u9996\u9875\u9996\u5C4F\u8F6E\u64AD\u4F4D\u7F6E\u4F20masterbanner1\u3001masterbanner2\u3001masterbanner3\uFF0C\u7B2C\u4E8C\u5C4F\u4F202nd_banner\uFF0C\u7B2C\u4E09\u5C4F\u4F203rd_banner\uFF0C\u6216\u8005\u53D6\u8BE5\u6A21\u5757\u5C0F\u6807\u9898\uFF0C\u6216\u80FD\u8BC6\u522B\u51FA\u662F\u54EA\u4E2A\u6A21\u5757\u4F4D\u7F6E\u7684\u6587\u6848\uFF0C\u5F39\u7A97\u4F20pop;\u5982\u679C\u662F\u8D2D\u7269\u8F66\u4FA7\u8FB9\u680F\uFF0C\u5219\u4F20\"Cart Pop Up\"\n // button_name: method.title, //\u53D6\u6309\u94AE\u6587\u6848\uFF0C\u6216\u80FD\u8BC6\u522B\u51FA\u662F\u54EA\u4E2A\u6309\u94AE\u7684\u6587\u6848,\u6BD4\u5982\u53F3\u4E0A\u89D2\u5173\u95ED\u4F20close,\u793E\u5A92\u5206\u4EAB\u56FE\u6807\u4F20\u5BF9\u5E94\u5E73\u53F0\u540D\u5B57\u5982Facebook,\u56FE\u7247\u5207\u6362\u5219\u4F20\u5BF9\u5E94\u5C55\u793A\u56FE\u7247\u7684\u540D\u5B57\n // info: '', //\u9ED8\u8BA4\u7A7A\u503C\uFF0C\u4E00\u822C\u4F20\u590D\u9009\u6846\u7684\u6587\u6848\u5185\u5BB9\uFF0C\u7279\u6B8A\u60C5\u51B5\u53EF\u6307\u5B9Ainfo\u503C\n // },\n // })\n },\n\n [isLogin, list, variant.sku, handleChangeShippingInfo, openSignInPopup]\n )\n\n return (\n <div\n id=\"ipc-product-paid-shipping\"\n className={cn(\n ' mt-16 desktop:mt-[96px] lg-desktop:mt-[128px] px-4 tablet:px-0 tablet:px-8 laptop:px-16 desktop:px-0',\n className\n )}\n >\n <div className=\"flex flex-wrap justify-between space-x-2 md:space-x-1\">\n <Text
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmIQ,IAAAI,EAAA,6BAnIRC,EAAgC,2CAEhCC,EAA0D,iBAC1D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AAkBF,EAAeA,EAAe,OAAS,CAAC,EAG1DE,EAAkBF,EAAe,KAAMC,GAA0B,CAACA,EAAE,QAAQ,EAGxDF,EAAK,KAAME,GAA0BC,EAAgB,KAAOD,EAAE,EAAE,EAI7EF,EAFA,CAAC,GAAGA,EAAMG,CAAe,CAIpC,EAAG,CAAC,CAAyB,CAC/B,EAAG,CAACR,EAAkBhB,GAAY,KAAMa,CAAM,CAAC,EAEzCY,KAA2B,eAC9Bd,GAAuC,CACtCT,EAAqB,CACnB,uBAAwBS,EAAe,KACvC,uBAAwBA,EAAe,IACzC,CAAC,CACH,EACA,CAACT,CAAoB,CACvB,KAEA,aAAU,IAAM,CAEd,GAAIF,GAAY,MAAM,OAAS,GAAK,CAACS,EAAM,CACzC,MAAMiB,EAAyBV,EAAiBhB,GAAY,KAAK,CAAC,EAAG,EAAG,CAAC,EACzEY,EAAkBc,CAAsB,EACxCD,EAAyBC,CAAsB,EAC/ChB,EAAQ,EAAI,CACd,CACF,EAAG,CAACM,EAAkBhB,GAAY,KAAMyB,EAA0BhB,CAAI,CAAC,EAEvE,MAAMkB,KAAiB,eACpBV,GAA+B,CAC1BA,EAAO,WAGXL,EAAkBK,CAAM,EACxBQ,EAAyBR,CAAM,EAYjC,EAEA,CAACZ,EAASc,EAAMhB,EAAQ,IAAKsB,EAA0BnB,CAAe,CACxE,EAEA,SACE,QAAC,OACC,GAAG,4BACH,aAAW,MACT,wGACAF,CACF,EAEA,oBAAC,OAAI,UAAU,wDACb,mBAAC,
|
|
4
|
+
"sourcesContent": ["import { Container, Text } from '../../../../components/index.js'\nimport type { Product, ProductVariant } from '../../types/product'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport { cn } from '../../../../helpers'\n\nimport ShippingMethod from './ShippingMethod'\nimport { ShippingPolicyModal } from './ShippingPolicyModal'\nimport type { DeliveryCustom, shippingMetafields, ShippingMethodType } from './type'\nimport { isWeightAvailable } from './utils'\nimport LearnMore from './LearnMore'\nimport { useBizProductContext } from '../../BizProductProvider.js'\nimport { withLayout } from '../../../../shared/Styles.js'\n\nconst PaidShipping = ({\n metafields,\n productList,\n onShippingInfoChange,\n variant,\n className,\n}: {\n metafields: any\n productList: Array<Product & { variant: ProductVariant }>\n variant: ProductVariant\n onShippingInfoChange: (deliveryCustom: DeliveryCustom) => void\n className?: string\n}) => {\n const { isLogin, openSignInPopup } = useBizProductContext()\n const [openShippingPolicyModal, setOpenShippingPolicyModal] = useState(false)\n const [init, setInit] = useState(false)\n\n const [selectedMethod, setSelectedMethod] = useState<ShippingMethodType | null>(null)\n\n const weight = useMemo(() => {\n return productList.reduce((acc, product) => acc + (product?.variant?.weight || 0), 0)\n }, [productList])\n\n const normalizedMethod = useCallback(\n (method: shippingMetafields, weight: number, index: number) => {\n return {\n id: `${method.__code}__${method.price}`,\n code: method.__code,\n mode: method.__mode,\n title: method.title,\n disabled: !isWeightAvailable(weight, method),\n price: method.price,\n subtitle: method.subtitle,\n tag: index !== 0 ? metafields?.memberOnly : '',\n error: !isWeightAvailable(weight, method) ? metafields.overWeightError : '',\n }\n },\n [metafields?.memberOnly, metafields.overWeightError]\n )\n\n const list = useMemo(() => {\n const normalizedList: ShippingMethodType[] = metafields?.list?.map((method: shippingMetafields, index: number) =>\n normalizedMethod(method, weight, index)\n )\n\n return normalizedList?.reduce((prev: ShippingMethodType[], method: ShippingMethodType) => {\n // \u5982\u679C\u8D85\u91CD\uFF0C\u540C\u4E00\u4E2A\u7269\u6D41\u9009\u9879\u7C7B\u578B\u4E0B\uFF0C\u5C55\u793A\u5176\u4E2D\u4E00\u4E2A\u4E14\u4E0D\u53EF\u9009\n const sameTypeMethod = normalizedList.filter((m: ShippingMethodType) => m.code == method.code)\n let availableMethod: ShippingMethodType\n // \u6240\u6709\u7269\u6D41\u9009\u9879\u90FD\u4E0D\u53EF\u9009\n if (sameTypeMethod.every((m: ShippingMethodType) => m.disabled)) {\n availableMethod = sameTypeMethod[sameTypeMethod.length - 1]\n } else {\n // \u53EF\u9009\u7269\u6D41\u9009\u9879\n availableMethod = sameTypeMethod.find((m: ShippingMethodType) => !m.disabled)!\n }\n // \u5F53\u524D\u7269\u6D41\u9009\u9879\u5DF2\u5B58\u5728\n const hasSameMethod = prev.find((m: ShippingMethodType) => availableMethod.id === m.id)\n if (!hasSameMethod) {\n return [...prev, availableMethod]\n } else {\n return prev\n }\n }, [] as ShippingMethodType[])\n }, [normalizedMethod, metafields?.list, weight])\n\n const handleChangeShippingInfo = useCallback(\n (selectedMethod: ShippingMethodType) => {\n onShippingInfoChange({\n selected_delivery_code: selectedMethod.code,\n selected_delivery_mode: selectedMethod.mode,\n })\n },\n [onShippingInfoChange]\n )\n\n useEffect(() => {\n // \u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\u7269\u6D41\u9009\u9879\n if (metafields?.list?.length > 0 && !init) {\n const standardShippingMethod = normalizedMethod(metafields?.list[0], 0, 0)\n setSelectedMethod(standardShippingMethod)\n handleChangeShippingInfo(standardShippingMethod)\n setInit(true)\n }\n }, [normalizedMethod, metafields?.list, handleChangeShippingInfo, init])\n\n const toggleShipping = useCallback(\n (method: ShippingMethodType) => {\n if (method.disabled) {\n return\n }\n setSelectedMethod(method)\n handleChangeShippingInfo(method)\n // gaTrack({\n // event: 'ga4Event',\n // event_name: 'lp_button',\n // member_active_status: isLogin ? 'active' : 'not active', //\u7528\u4E8E\u8F93\u5165code\u6FC0\u6D3B\u4F1A\u5458\u5F39'\u7A97\u7684\u6309\u94AE\uFF0C\u533A\u5206\u4F1A\u5458\u6FC0\u6D3B\u72B6\u6001\uFF0C\u4F20active\u6216not active\n // event_parameters: {\n // page_group: 'Product Detail Page' + variant.sku, //\u5982\u679C\u662F\u9996\u9875\uFF0C\u5219\u4F20\"Home Page\";\u5982\u679C\u662Flisting\u7684\u9996\u5C4F\u6309\u94AE\uFF0C\u4F20Product Detail Page+$SKU\n // position: 'masterbanner1', //\u4F4D\u7F6E\u6807\u8BB0\u3002\u9996\u9875\u9996\u5C4F\u8F6E\u64AD\u4F4D\u7F6E\u4F20masterbanner1\u3001masterbanner2\u3001masterbanner3\uFF0C\u7B2C\u4E8C\u5C4F\u4F202nd_banner\uFF0C\u7B2C\u4E09\u5C4F\u4F203rd_banner\uFF0C\u6216\u8005\u53D6\u8BE5\u6A21\u5757\u5C0F\u6807\u9898\uFF0C\u6216\u80FD\u8BC6\u522B\u51FA\u662F\u54EA\u4E2A\u6A21\u5757\u4F4D\u7F6E\u7684\u6587\u6848\uFF0C\u5F39\u7A97\u4F20pop;\u5982\u679C\u662F\u8D2D\u7269\u8F66\u4FA7\u8FB9\u680F\uFF0C\u5219\u4F20\"Cart Pop Up\"\n // button_name: method.title, //\u53D6\u6309\u94AE\u6587\u6848\uFF0C\u6216\u80FD\u8BC6\u522B\u51FA\u662F\u54EA\u4E2A\u6309\u94AE\u7684\u6587\u6848,\u6BD4\u5982\u53F3\u4E0A\u89D2\u5173\u95ED\u4F20close,\u793E\u5A92\u5206\u4EAB\u56FE\u6807\u4F20\u5BF9\u5E94\u5E73\u53F0\u540D\u5B57\u5982Facebook,\u56FE\u7247\u5207\u6362\u5219\u4F20\u5BF9\u5E94\u5C55\u793A\u56FE\u7247\u7684\u540D\u5B57\n // info: '', //\u9ED8\u8BA4\u7A7A\u503C\uFF0C\u4E00\u822C\u4F20\u590D\u9009\u6846\u7684\u6587\u6848\u5185\u5BB9\uFF0C\u7279\u6B8A\u60C5\u51B5\u53EF\u6307\u5B9Ainfo\u503C\n // },\n // })\n },\n\n [isLogin, list, variant.sku, handleChangeShippingInfo, openSignInPopup]\n )\n\n return (\n <div\n id=\"ipc-product-paid-shipping\"\n className={cn(\n ' mt-16 desktop:mt-[96px] lg-desktop:mt-[128px] px-4 tablet:px-0 tablet:px-8 laptop:px-16 desktop:px-0',\n className\n )}\n >\n <div className=\"flex flex-wrap justify-between space-x-2 md:space-x-1\">\n <Text className=\"font-bold leading-[1.2] text-[#1F2021] text-[16px]\" html={metafields?.title}></Text>\n {/* <button\n onClick={() => {\n setOpenShippingPolicyModal(true)\n }}\n className='text-brand-color text-[16px] font-semibold text-[#595959] underline md:text-[14px]'\n >\n {metafields?.policy}\n </button> */}\n </div>\n <div className=\"lg-desktop:mt-[16px] flex flex-wrap gap-[12px] overflow-hidden mt-[12px] desktop:flex-nowrap\">\n {list.map((method: ShippingMethodType, index: number) => (\n <ShippingMethod\n key={index}\n index={index}\n item={method}\n active={selectedMethod?.code === method.code}\n toggleShipping={() => toggleShipping(method)}\n currencyCode={variant.price.currencyCode}\n metafields={metafields}\n className=\"w-full laptop:w-[calc(50%-6px)] desktop:flex-1\"\n />\n ))}\n {/* learn more \u5361\u7247 */}\n <LearnMore\n setOpenShippingPolicyModal={setOpenShippingPolicyModal}\n metafields={metafields}\n className=\"w-full laptop:w-[calc(50%-6px)] desktop:w-[calc(33.33%-16px)] lg-desktop:w-[calc(33.33%-24px)]\"\n />\n </div>\n {list.find((method: ShippingMethodType) => method?.error) && (\n <Text\n className=\"desktop:mt-[16px] font-bold leading-[1.4] text-[#D41435] mt-[12px]\"\n html={list.find((method: ShippingMethodType) => method.error)?.error as string}\n as=\"p\"\n />\n )}\n\n {metafields?.seeAvailableArea && (\n <Text\n as=\"div\"\n className=\"mt-[16px] font-bold leading-[1.4] text-[#1D1D1F] [&_a]:underline\"\n html={metafields?.seeAvailableArea}\n />\n )}\n {metafields?.shippingPolicy && (\n <ShippingPolicyModal\n data={metafields?.shippingPolicy}\n onClose={() => setOpenShippingPolicyModal(false)}\n open={openShippingPolicyModal}\n />\n )}\n </div>\n )\n}\n\nexport default withLayout(PaidShipping)\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmIQ,IAAAI,EAAA,6BAnIRC,EAAgC,2CAEhCC,EAA0D,iBAC1DC,EAAmB,+BAEnBC,EAA2B,+BAC3BC,EAAoC,iCAEpCC,EAAkC,mBAClCC,EAAsB,0BACtBC,EAAqC,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K,KAAMF,GAA+BA,GAAQ,KAAK,MACtD,OAAC,QACC,UAAU,qEACV,KAAME,EAAK,KAAMF,GAA+BA,EAAO,KAAK,GAAG,MAC/D,GAAG,IACL,EAGDjB,GAAY,qBACX,OAAC,QACC,GAAG,MACH,UAAU,mEACV,KAAMA,GAAY,iBACpB,EAEDA,GAAY,mBACX,OAAC,uBACC,KAAMA,GAAY,eAClB,QAAS,IAAMQ,EAA2B,EAAK,EAC/C,KAAMD,EACR,GAEJ,CAEJ,EAEA,IAAOpB,KAAQ,cAAWY,CAAY",
|
|
6
6
|
"names": ["PaidShipping_exports", "__export", "PaidShipping_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_react", "import_helpers", "import_ShippingMethod", "import_ShippingPolicyModal", "import_utils", "import_LearnMore", "import_BizProductProvider", "import_Styles", "PaidShipping", "metafields", "productList", "onShippingInfoChange", "variant", "className", "isLogin", "openSignInPopup", "openShippingPolicyModal", "setOpenShippingPolicyModal", "init", "setInit", "selectedMethod", "setSelectedMethod", "weight", "acc", "product", "normalizedMethod", "method", "index", "list", "normalizedList", "prev", "sameTypeMethod", "m", "availableMethod", "handleChangeShippingInfo", "standardShippingMethod", "toggleShipping", "ShippingMethod", "LearnMore"]
|
|
7
7
|
}
|